{ "cells": [ { "cell_type": "markdown", "source": [ "# Tutorial 11: Fluid-Structure Interaction" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "In this tutorial, we will learn\n", "\n", " - How to solve a surface-coupled multi-physics problem.\n", " - Construct FE spaces defined in different domains.\n", " - Define interface triangulations and integrate on them.\n", "\n", "1. [Problem Statement](#probStat)\n", " - [Strong form](#strongForm)\n", " - [Geometry and Discrete model](#geometry)\n", " - [Boundary conditions and properties](#conditions)\n", "2. [Numerical scheme](#numericalScheme)\n", " - [FE spaces](#feSpace)\n", " - [Weak form](#weakForm)\n", " - [Numerical integration](#integration)\n", " - [Algebraic system of equations](#algebraic)\n", "3. [Post-processing](#postprocess)\n", " - [Visualization](#visualization)\n", " - [Quantities of interest](#QOIs)" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "## Problem statement\n", "```@raw HTML\n", "\n", "```\n", "### Strong form\n", " Let $\\Gamma_{\\rm FS}$ be the interface between a fluid domain $\\Omega_{\\rm F}$ and a solid domain $\\Omega_{\\rm S}$. We denote by $\\Gamma_{\\rm F,D}$ and $\\Gamma_{\\rm F,N}$ the fluid boundaries with Dirichlet and Neumann conditions, respectively.\n", "The Fluid-Structure Interaction (FSI) problem reads:\n", "\n", "find $u_{\\rm F}$, $p_{\\rm F}$ and $u_{\\rm S}$ such that\n", "$$\n", "\\left\\lbrace\n", "\\begin{aligned}\n", "-\\nabla\\cdot\\boldsymbol{\\sigma}_{\\rm F} = f &\\text{ in }\\Omega_{\\rm F},\\\\\n", "\\nabla\\cdot u_{\\rm F} = 0 &\\text{ in } \\Omega_{\\rm F},\\\\\n", "-\\nabla\\cdot\\boldsymbol{\\sigma}_{\\rm S} = s &\\text{ in }\\Omega_{\\rm S},\\\\\n", "\\end{aligned}\n", "\\right.\n", "$$\n", "\n", "satisfying the Dirichlet and Neumann boundary conditions\n", "$$\n", "\\left\\lbrace\n", "\\begin{aligned}\n", "u_{\\rm F} = g_{\\rm F} &\\text{ on } \\Gamma_{\\rm F,D},\\\\\n", "n_{\\rm F} \\cdot \\boldsymbol{\\sigma}_{\\rm F} = 0 &\\text{ on } \\Gamma_{\\rm F,N},\\\\\n", "u_{\\rm S} = g_{\\rm S} &\\text{ on } \\Gamma_{\\rm S,D},\\\\\n", "\\end{aligned}\n", "\\right.\n", "$$\n", "\n", "and the kinematic and dynamic conditions at the fluid-solid interface\n", "$$\n", "\\left\\lbrace\n", "\\begin{aligned}\n", "u_{\\rm F} = u_{\\rm S} &\\text{ on } \\Gamma_{\\rm FS},\\\\\n", "n_{\\rm F} \\cdot \\boldsymbol{\\sigma}_{\\rm F} + n_{\\rm S} \\cdot \\boldsymbol{\\sigma}_{\\rm S} = 0 &\\text{ on } \\Gamma_{\\rm FS}.\\\\\n", "\\end{aligned}\n", "\\right.\n", "$$\n", "\n", "Where $\\boldsymbol{\\sigma}_{\\rm F}(u_{\\rm F},p_{\\rm F})=2\\mu_{\\rm F}\\boldsymbol{\\varepsilon}(u_{\\rm F}) - p_{\\rm F}\\mathbf{I}$ and $\\boldsymbol{\\sigma}_{\\rm S}(u_{\\rm S})=2\\mu_{\\rm S}\\boldsymbol{\\varepsilon}(u_{\\rm S}) +\\lambda_{\\rm S}tr(\\boldsymbol{\\varepsilon}(u_{\\rm S}))\\mathbf{I}$." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### Geometry and Discrete model\n", "In this tutorial we solve the benchmark descrived in [1], consisting on a flow over an elastic flag after a cylinder.\n", "The computational domain is defined by a channel of size $\\Omega \\doteq (0,4.5)\\times(0,0.41)$, with an embedded cylinder of radius $R=0.05$ and center at $C=(0.2,0.2)$. The associated FE triangulation is denoted by $\\mathcal{T}$, the fluid and solid domain and their associated triangulations will be denoted by $\\Omega_{\\rm F}$, $\\Omega_{\\rm S}$, $\\mathcal{T}_{\\rm F}$ and $\\mathcal{T}_{\\rm S}$, respectively.\n", "\n", "In order to load the discrete model we first setup Gridap" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using Gridap" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The discrete model for the elastic flag problem is generated by loading the `\"../models/elasticFlag.json\"` file." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "model = DiscreteModelFromFile(\"../models/elasticFlag.json\")" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "We can inspect the loaded geometry and associated parts by printing to a `vtk` file:" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "writevtk(model,\"model\")" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "This will produce an output in which we can identify the different parts of the domain, with the associated labels and tags.\n", "\n", "| Part | Notation | Label | Tag |\n", "| :---: | :---:| :---: | :---: |\n", "| Solid-cylinder wall | $\\Gamma_{\\rm S,D_{cyl}}$ | \"fixed\" | 1 |\n", "| Fluid-solid interface | $\\Gamma_{\\rm FS}$ | \"interface\" | 2 |\n", "| Channel inlet | $\\Gamma_{\\rm F,D_{in}}$ | \"inlet\" | 3 |\n", "| Channel outlet | $\\Gamma_{\\rm F,N_{out}}$ | \"outlet\" | 4 |\n", "| Channel walls | $\\Gamma_{\\rm F,D_{wall}}$ | \"noSlip\" | 5 |\n", "| Fluid-cylinder wall | $\\Gamma_{\\rm F,D_{cyl}}$ | \"cylinder\" | 6 |\n", "| Fluid domain | $\\Omega_{\\rm F}$ | \"fluid\" | 7 |\n", "| Solid domain | $\\Omega_{\\rm S}$ | \"solid\" | 8 |\n", "\n", "![](../assets/fsi/tags.png)" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### External conditions and properties\n", "#### Boundary conditions\n", "We apply Dirichlet boundary conditions at the channel inlet, upper and lower boundaries and on the cylinder. A parabolic profile is enforced at the channel inlet, while a no-slip condition is imposed on the remaining Dirichlet boundaries.\n", "$$\n", "\\left\\lbrace\n", "\\begin{aligned}\n", "u_{\\rm F,in}(x,y) = 1.5U\\frac{y(H −y)}{\\left(\\frac{H}{2}\\right)^2}\\quad&\\textrm{on }\\Gamma_{\\rm F,D_{in}},\\\\\n", "u_{\\rm F,0}(x,y) = [0, 0]\\quad&\\textrm{on }\\Gamma_{\\rm F,D_{wall}}\\cup\\Gamma_{\\rm F,D_{cyl}},\\\\\n", "u_{\\rm S,0}(x,y) = [0, 0]\\quad&\\textrm{on }\\Gamma_{\\rm S,D_{cyl}}.\\\\\n", "\\end{aligned}\n", "\\right.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "const U = 1.0\n", "const H = 0.41\n", "uf_in(x) = VectorValue( 1.5 * U * x[2] * ( H - x[2] ) / ( (H/2)^2 ), 0.0 )\n", "uf_0(x) = VectorValue( 0.0, 0.0 )\n", "us_0(x) = VectorValue( 0.0, 0.0 )" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "We consider a free traction condition at the channel outlet\n", "$$\n", "n_{\\rm F} \\cdot \\boldsymbol{\\sigma}_{\\rm F} = \\mathbf{0}\\quad\\textrm{on }\\Gamma_{\\rm F,N}\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "hN(x) = VectorValue( 0.0, 0.0 )\n", "p_jump(x) = 0.0" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "#### External forces\n", "In this test, the body forces acting on the fluid an solid are zero." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "f(x) = VectorValue( 0.0, 0.0 )\n", "s(x) = VectorValue( 0.0, 0.0 )\n", "g(x) = 0.0" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "#### Material properties\n", "We use a linear elastic constitutive law for the elastic flag. Given the Young's modulus $E$ and the Poisson ratio $\\nu$, we can compute the Lamé constants, $\\lambda$ and $\\mu$, using the following function:" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "function lame_parameters(E,ν)\n", " λ = (E*ν)/((1+ν)*(1-2*ν))\n", " μ = E/(2*(1+ν))\n", " (λ, μ)\n", "end" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Then, we get the Lamé parameters for a solid with $E=1.0$ MPa and $\\nu=0.33$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "const E_s = 1.0\n", "const ν_s = 0.33\n", "const (λ_s,μ_s) = lame_parameters(E_s,ν_s)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The Cauchy stress tensor for the solid part is defined by $\\sigma_s = 2\\mu\\varepsilon + \\lambda tr(\\varepsilon)\\mathbf{I}$. Note that we use the trace operator from the `LinearAlgebra` package. Note that this function will be used as a composition (`∘`), using as argument a function whose arguments depend on the coordinates, without the need of passing such coordinates as an argument. That is `σ_s(ε(u)) = σ_s ∘ ε(u)`." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using LinearAlgebra: tr\n", "σₛ(ε) = λ_s*tr(ε)*one(ε) + 2*μ_s*ε" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "For the fluid part, we only need to define the viscosity $\\mu_f$, which we set to $0.01$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "const μ_f = 0.01" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The Cauchy stress tensor for the fluid part is given by $\\sigma_f = \\sigma^{dev}_f - p\\mathbf{I}$, with $\\sigma^{dev}_f=2\\mu_f$ the deviatoric part of the stress. Since we use a mixed form with the pressure $p$ as an unknown, the stress law will only involve the deviatoric part." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "σ_dev_f(ε) = 2*μ_f*ε" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "## Numerical scheme\n", "```@raw HTML\n", "\n", "```\n", "### FE Spaces\n", "In this tutorial we use an *inf-sup* stable velocity-pressure pair, $P_k/P_{k-1}$ elements, with continuous velocities and pressures. We select the same velocity interpolation space for the fluid and the solid parts, defined as follows\n", "$$\n", "V_{\\rm X} \\doteq \\{ v \\in [H^1(\\Omega_{\\rm X})]^d:\\ v|_T\\in [P_k(T)]^d \\text{ for all } T\\in\\mathcal{T}_{\\rm X} \\},\n", "$$\n", "where $T$ denotes an arbitrary cell of the FE mesh $\\mathcal{T}_{\\rm X}$, and $P_k(T)$ is the usual Lagrangian FE space of order $k$ defined on a mesh of triangles or tetrahedra. Note that the sub-index $(\\cdot)_{\\rm X}$ stands for the fluid or solid parts, $(\\cdot)_{\\rm F}$ or $(\\cdot)_{\\rm S}$, respectively.\n", "On the other hand, the space for the pressure is only defined in the fluid domain, $\\Omega_{\\rm F}$, and is given by\n", "$$\n", "Q \\doteq \\{ q \\in C^0(\\Omega):\\ q|_T\\in P_{k-1}(T) \\text{ for all } T\\in\\mathcal{T}_{\\rm F}\\}.\n", "$$" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "Before creating the FE spaces, we first need to define the triangulation of each of the sub-domains, which are constructed restricting the global triangulation to the corresponding part. This is done by calling the `Triangulation` (or equivalently `Interior`) function with the desired geometrical part label, i.e. `\"solid\"` and `\"fluid\"`, respectively. Here we create the triangulation of the global domain, $\\mathcal{T}$, and the solid and fluid triangulations, $\\mathcal{T}_{\\rm F}$ and $\\mathcal{T}_{\\rm S}$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Ω = Interior(model)\n", "Ω_s = Interior(model,tags=\"solid\")\n", "Ω_f = Interior(model,tags=\"fluid\")" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "We also generate the triangulation and associated outer normal field for the outlet boundary, $\\Gamma_{\\rm F,N_{out}}$, which will be used to impose a Neumann condition." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Γ_out = BoundaryTriangulation(model,tags=\"outlet\")\n", "n_Γout = get_normal_vector(Γ_out)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Finally, to impose the interface condition between solid and fluid, we will need the triangulation and normal field of such interface, $\\Gamma_{\\rm FS}$. The interface triangulation is generated by calling the `InterfaceTriangulation` function specifying the two interfacing domain triangulations. Note that the normal field will point outwards with respect to the first entry." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Γ_fs = InterfaceTriangulation(Ω_f,Ω_s)\n", "n_Γfs = get_normal_vector(Γ_fs)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "In what follows we will assume a second-order velocity interpolation, i.e. $k=2$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "k = 2" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Now we define the reference FE for the velocity and pressure fields. The velocity field reference FE, both for fluid and solid domains, will be defined by a 2-dimensional `VectorValue` type `:Lagrangian` reference FE element of order `k`. The reference FE for the pressure will be given by a scalar value type `:Lagrangian` reference FE element of order `k-1`." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "reffeᵤ = ReferenceFE(lagrangian,VectorValue{2,Float64},k)\n", "reffeₚ = ReferenceFE(lagrangian,Float64,k-1)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Having set up all the ingredients, we can create the different FE spaces for the test functions. For the velocity FE spaces we call the `TestFESpace` function with the corresponding discrete model, using the velocity reference FE `reffeᵤ` and conformity `:H1`. Note that we assign different Dirichlet boundary labels for the two different parts, generating the variational spaces with homogeneous Dirichlet boundary conditions, $V_{\\rm F,0}$ and $V_{\\rm S,0}$ ." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Vf = TestFESpace(\n", " Ω_f,\n", " reffeᵤ,\n", " conformity=:H1,\n", " dirichlet_tags=[\"inlet\", \"noSlip\", \"cylinder\"])\n", "\n", "Vs = TestFESpace(\n", " Ω_s,\n", " reffeᵤ,\n", " conformity=:H1,\n", " dirichlet_tags=[\"fixed\"])" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "For the pressure test FE space, we use the fluid discrete model, the pressure reference FE `reffeₚ` and `:C0` conformity." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Qf = TestFESpace(\n", " Ω_f,\n", " reffeₚ,\n", " conformity=:C0)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The trial FE spaces are generated from the test FE spaces, adding the corresponding function for the various Dirichlet boundaries, leading to $U_{\\rm F,g_{\\rm F}}$, $U_{\\rm S,g_{\\rm S}}$ and $P_{\\rm F}$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Uf = TrialFESpace(Vf,[uf_in, uf_0, uf_0])\n", "Us = TrialFESpace(Vs,[us_0])\n", "Pf = TrialFESpace(Qf)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Finally, we glue the test and trial FE spaces together, defining a unique test and trial space for all the fields using the `MultiFieldFESpace` function. That is $Y=[V_{\\rm S,0}, V_{\\rm F,0}, Q_{\\rm F}]^T$ and $X=[U_{\\rm S,g_{\\rm S}}, U_{\\rm F,g_{\\rm F}}, P_{\\rm F}]^T$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Y = MultiFieldFESpace([Vs,Vf,Qf])\n", "X = MultiFieldFESpace([Us,Uf,Pf])" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### Numerical integration\n", "Once we have all the triangulations, we can generate the quadrature rules to be applied each domain. This will be generated by calling the `Measure` function, that given a triangulation and an integration degree, it returns the Lebesgue integral measure $d\\Omega$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "degree = 2*k\n", "dΩₛ = Measure(Ω_s,degree)\n", "dΩ_f = Measure(Ω_f,degree)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Idem for the boundary part." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "bdegree = 2*k\n", "dΓ_out = Measure(Γ_out,bdegree)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Idem for the interface part." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "idegree = 2*k\n", "dΓ_fs = Measure(Γ_fs,idegree)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### Weak form\n", "We now introduce the solution and test function vectors as $[\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm s}, p^h_{\\rm f}]^T$ and $[\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}]^T$. The weak form of the coupled FSI problem using the Nitche's method, see for instance [2], reads:\n", "\n", "find $[\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm s}, p^h_{\\rm f}]^T \\in X$ such that\n", "$$\n", "a([\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm s}, p^h_{\\rm f}],[\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}])=l([\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}])\\qquad\\forall[\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}]^T\\in Y,\n", "$$\n", "where\n", "$$\n", "\\begin{aligned}\n", "&a([\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm s}, p^h_{\\rm f}],[\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}])\\doteq a_s(\\mathbf{u}^h_{\\rm s},\\mathbf{v}^h_{\\rm s}) + a_f((\\mathbf{u}^h_{\\rm f},p^h_{\\rm f}),(\\mathbf{v}^h_{\\rm f},q^h_{\\rm f})) + a_{fs}((\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm f}, p^h_{\\rm f}),(\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}))\\\\\n", "&l([\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}])\\doteq l_s(\\mathbf{v}^h_{\\rm s}) + l_f(\\mathbf{v}^h_{\\rm f}) + l_{f,\\Gamma_N}(\\mathbf{v}^h_{\\rm f}).\n", "\\end{aligned}\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "a((us,uf,p),(vs,vf,q)) = a_s(us,vs) + a_f((uf,p),(vf,q)) + a_fs((us,uf,p),(vs,vf,q))\n", "l((vs,vf,q)) = l_s(vs) + l_f((vf,q)) + l_f_Γn(vf)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "with the following definitions:\n", "\n", "- The bilinear form associated with the solid counterpart, $a_s(\\mathbf{u}^h_{\\rm s},\\mathbf{v}^h_{\\rm s})$, defined as\n", "$$\n", "a_s(\\mathbf{u},\\mathbf{v})=\\int\\varepsilon(\\mathbf{v}):\\boldsymbol{\\sigma}_s(\\epsilon(\\mathbf{u}))\\ d\\Omega_{\\rm S}.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "a_s(u,v) = ∫( ε(v) ⊙ (σₛ ∘ ε(u)) )dΩₛ" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "- The bilinear form associated with the fluid counterpart, $a_f((\\mathbf{u}^h_{\\rm f},p^h_{\\rm f}),(\\mathbf{v}^h_{\\rm f},q^h_{\\rm f}))$, is defined as\n", "$$\n", "a_f((\\mathbf{u},p),(\\mathbf{v},q))=\\int\\left(\\varepsilon(\\mathbf{v}):\\boldsymbol{\\sigma}^{dev}_f(\\mathbf{u}) - (\\nabla\\cdot\\mathbf{v})\\ p + q\\ (\\nabla\\cdot\\mathbf{u})\\right) d\\Omega_{\\rm F}.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "a_f((u,p),(v,q)) = ∫( ε(v) ⊙ (σ_dev_f ∘ ε(u)) - (∇⋅v)*p + q*(∇⋅u) )dΩ_f" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "- The bilinear form associated with the coupling between fluid and solid counterparts, $a_{fs}((\\mathbf{u}^h_{\\rm s},\\mathbf{u}^h_{\\rm f}, p^h_{\\rm f}),(\\mathbf{v}^h_{\\rm s},\\mathbf{v}^h_{\\rm f}, q^h_{\\rm f}))$, is given by:\n", "$$\n", "\\begin{aligned}\n", "a_{fs}((\\mathbf{u}_{\\rm s},\\mathbf{u}_{\\rm f}, p),((\\mathbf{v}_{\\rm s},\\mathbf{v}_{\\rm f}, q))=&\\int\\left(\\gamma\\frac{\\mu_f}{h}(\\mathbf{v}_{\\rm f}-\\mathbf{v}_{\\rm s})\\cdot(\\mathbf{u}_{\\rm f}-\\mathbf{u}_{\\rm s})\\right.\\\\\n", "&- (\\mathbf{v}_{\\rm f}-\\mathbf{v}_{\\rm s})\\cdot(\\mathbf{n}_{\\rm fs}\\cdot\\boldsymbol{\\sigma}^{dev}_f(\\mathbf{u}_{\\rm f}))\n", "+ (\\mathbf{v}_{\\rm f}-\\mathbf{v}_{\\rm S})\\cdot(p_{\\rm f}\\mathbf{n}_{\\rm fs})\\\\\n", "&- \\chi(\\mathbf{n}_{\\rm fs}\\cdot\\boldsymbol{\\sigma}^{dev}_f(\\mathbf{v}_{\\rm f})\\cdot(\\mathbf{u}^{\\rm f}-\\mathbf{u}_{\\rm s})\n", "+ \\left.(q_{\\rm f}\\mathbf{n}_{\\rm fs})\\cdot(\\mathbf{u}_{\\rm f}-\\mathbf{u}_{\\rm s})\\ \\right) d\\Gamma_{\\rm FS}\n", "\\end{aligned}\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "a_fs((us,uf,p),(vs,vf,q)) = ∫( α*(jump_Γ(vf,vs)⋅jump_Γ(uf,us)) +\n", " jump_Γ(vf,vs)⋅t_Γfs(1,p,uf,n_Γfs) +\n", " t_Γfs(χ,q,vf,n_Γfs)⋅jump_Γ(uf,us) )dΓ_fs" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Where $\\chi$ is a parameter that can take values $1.0$ or $-1.0$ and it is used to define the symmetric or antisymmetric version of the method, respectively. To define this form we used the well known Nitsche's method, which enforces the continuity of fluid and solid velocities as well as the continuity of the normal stresses, see for instance [2]." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "const γ = 1.0\n", "const χ = -1.0\n", "jump_Γ(wf,ws) = wf.⁺-ws.⁻\n", "t_Γfs(χ,q,w,n) = q.⁺*n.⁺ - χ*n.⁺⋅(σ_dev_f∘ε(w.⁺))" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "From the interface triangulation we can obtain the interface elements length, $h$, and the penalty parameter, $\\alpha=\\gamma\\frac{\\mu_f}{h}$, used in the Nitsche's terms." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using Gridap.CellData\n", "dim = num_cell_dims(Γ_fs)\n", "h_Γfs = get_array(∫(1)dΓ_fs)\n", "α = CellField( lazy_map(h->γ*μ_f/(h.^dim),h_Γfs), Γ_fs)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "- The linear form associated with the solid counterpart, $l_s(\\mathbf{v}^h_{\\rm s})$, is defined as\n", "$$\n", "l_s(\\mathbf{v})=\\int\\mathbf{v}\\cdot s\\ d\\Omega_{\\rm S}.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "l_s(v) = ∫( v⋅s )dΩₛ" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "- The linear form associated with the fluid counterpart, $l_f(\\mathbf{v}^h_{\\rm f})$ is defined as\n", "$$\n", "l_f(\\mathbf{v},q)=\\int\\mathbf{v}\\cdot f + qg\\ d\\Omega_{\\rm F}.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "l_f((v,q)) = ∫( v⋅f + q*g )dΩ_f" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "- The linear form associated with the fluid Neumann boundary condition, $l_{f,\\Gamma_N}(\\mathbf{v}^h_{\\rm f})$, is defined as\n", "$$\n", "l_{f,\\Gamma_N}(\\mathbf{v})=\\int\\mathbf{v}\\cdot h\\ d\\Gamma_{\\rm N_{out}}.\n", "$$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "l_f_Γn(v) = ∫( v⋅hN )dΓ_out" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "The final bilinear and linear forms will be given by" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### Algebraic System of Equations\n", "After defining the weak form of the problem and the integration quadrature rules to perform the numerical integration, we are ready to assemble the linear system of equations. In this case, the system will have the following structure:\n", "$$\n", "\\begin{bmatrix}\n", "\\mathbf{A}_{u,\\rm S}&\\mathbf{A}_{u,\\rm SF}&0\\\\\n", "\\mathbf{A}_{u,\\rm FS}&\\mathbf{A}_{u,\\rm F}&\\mathbf{A}_{up,\\rm F}\\\\\n", "0&\\mathbf{A}_{up,\\rm F}&\\mathbf{A}_{p,\\rm F}\\\\\n", "\\end{bmatrix}\\begin{bmatrix}\n", "\\mathbf{U}^h_{\\rm S}\\\\\n", "\\mathbf{U}^h_{\\rm F}\\\\\n", "\\mathbf{P}^h_{\\rm F}\\\\\n", "\\end{bmatrix} = \\begin{bmatrix}\n", "\\mathbf{F}^h_{u,\\rm S}\\\\\n", "\\mathbf{F}^h_{u,\\rm F}\\\\\n", "\\mathbf{F}^h_{p,\\rm F}\\\\\n", "\\end{bmatrix}\n", "$$\n", "In order to construct the system we define the final FE operator, constructed using the function `AffineFEOperator` passing as arguments the bilinear and linear forms, $a$ and $l$, together with the trial and test FE spaces, $X$ and $Y$." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "op = AffineFEOperator(a,l,X,Y)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "Finally, we call `solve` to obtain the solution vector of nodal values $[\\mathbf{U}^h_{\\rm S},\\mathbf{U}^h_{\\rm F},\\mathbf{P}^h_{\\rm F}]^T$" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "uhs, uhf, ph = solve(op)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "## Post-processing\n", "```@raw HTML\n", "\n", "```\n", "### Visualization\n", "The solution fields $[\\mathbf{U}^h_{\\rm S},\\mathbf{U}^h_{\\rm F},\\mathbf{P}^h_{\\rm F}]^T$ are defined over all the domain, extended with zeros on the inactive part. Calling the function `writevtk` passing the global triangulation, we will output the global fields." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "writevtk(Ω,\"trian\", cellfields=[\"uhs\" => uhs, \"uhf\" => uhf, \"ph\" => ph])" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "![](../assets/fsi/Global_solution.png)" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "However, we can also restrict the fields to the active part by calling the function `restrict` with the field along with the respective active triangulation." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "writevtk(Ω_s,\"trian_solid\",cellfields=[\"uhs\"=>uhs])\n", "writevtk(Ω_f,\"trian_fluid\",cellfields=[\"ph\"=>ph,\"uhf\"=>uhf])" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "![](../assets/fsi/Local_solution.png)" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "```@raw HTML\n", "\n", "```\n", "### Quantities of Interest" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "Γ_S = BoundaryTriangulation(model,tags=[\"cylinder\",\"interface\"])\n", "dΓₛ = Measure(Γ_S,bdegree)\n", "n_ΓS = get_normal_vector(Γ_S)\n", "FD, FL = sum( ∫( (n_ΓS⋅σ_dev_f(ε(uhf))) - ph*n_ΓS )*dΓₛ )\n", "println(\"Drag force: \", FD)\n", "println(\"Lift force: \", FL)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "## References\n", "[1] Turek, S., Hron, J., Madlik, M., Razzaq, M., Wobker, H., & Acker, J. F. (2011).* Numerical simulation and benchmarking of a monolithic multigrid solver for fluid-structure interaction problems with application to hemodynamics*. In Fluid Structure Interaction II (pp. 193-220). Springer, Berlin, Heidelberg.*\n", "\n", "[2] Burman, E., and Fernández, M. A. *Stabilized explicit coupling for fluid–structure interaction using Nitsche's method.* Comptes Rendus Mathematique 345.8 (2007): 467-472." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "---\n", "\n", "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" ], "metadata": {} } ], "nbformat_minor": 3, "metadata": { "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.7" }, "kernelspec": { "name": "julia-1.6", "display_name": "Julia 1.6.7", "language": "julia" } }, "nbformat": 4 }