From cb34cea9463706033c4297c8867d989ec5f5413d Mon Sep 17 00:00:00 2001 From: Thomas Saigre <60920471+thomas-saigre@users.noreply.github.com> Date: Sun, 16 Jul 2023 16:31:49 +0200 Subject: [PATCH 1/4] Update introduction.adoc Add json specifications for boundaries conditions also minor typo fixes @prudhomm @vincentchabannes can you please review that this additions are corrects ? I'm not sure in particular of `expr1` and `expr2` for Robin conditions --- .../modules/cfpdes/partials/introduction.adoc | 92 ++++++++++++++++--- 1 file changed, 77 insertions(+), 15 deletions(-) diff --git a/toolboxes/modules/cfpdes/partials/introduction.adoc b/toolboxes/modules/cfpdes/partials/introduction.adoc index c0159431..79a61bf5 100644 --- a/toolboxes/modules/cfpdes/partials/introduction.adoc +++ b/toolboxes/modules/cfpdes/partials/introduction.adoc @@ -35,7 +35,7 @@ By utilizing coefficient forms in PDE toolboxes, researchers and engineers can c A lot of PDE(s) can be writen in a generic form, and depends mainly on the definition of coefficients. -The generic form that we use is describe by the next equation, find stem:[u: \Omega \subset \mathbb{R}^d \longrightarrow \mathbb{R}^n] with stem:[d=2,3] and stem:[n=1] (stem:[u] is a scalar field) or stem:[n=d](stem:[u] is a vector field) such that +The generic form that we use is describe by the next equation, find stem:[u: \Omega \subset \mathbb{R}^d \longrightarrow \mathbb{R}^n] with stem:[d=2,3] and stem:[n=1] (stem:[u] is a scalar field) or stem:[n=d](stem:[u] is a vector field) such that [stem] ++++ @@ -64,7 +64,7 @@ Many problems are multiphysics (i.e. several unknowns) and the generic form can The system of stem:[N] equations reads then: -For stem:[i=1\dots N], find stem:[u_i: \Omega \subset \mathbb{R}^d \longrightarrow \mathbb{R}^{n_i}] with stem:[d=2,3] and stem:[n_i=1] (stem:[u_i] is a scalar field) or stem:[n_i=d](stem:[u_i] is a vector field) such that +For stem:[i=1\dots N], find stem:[u_i: \Omega \subset \mathbb{R}^d \longrightarrow \mathbb{R}^{n_i}] with stem:[d=2,3] and stem:[n_i=1] (stem:[u_i] is a scalar field) or stem:[n_i=d](stem:[u_i] is a vector field) such that [stem] ++++ \begin{eqnarray*} @@ -85,7 +85,7 @@ We need also to respect some constraint on the coefficient shape as described in | stem:[d] | scalar | scalar -| stem:[c] | scalar or matrix | scalar or matrix +| stem:[c] | scalar or matrix | scalar or matrix | stem:[\alpha] | vectorial | scalar or matrix | stem:[\gamma] | vectorial | matrix | stem:[\beta] | vectorial | vectorial @@ -213,7 +213,7 @@ Dirichlet boundary condition is a type of boundary condition commonly used in pa It specifies the value of the solution at the boundary of the domain. In other words, it prescribes the behavior of the solution at the boundary. -The condition may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and other unknowns stem:[u_1, \dots, u_N] than the current one. +The condition may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and other unknowns stem:[u_1, \dots, u_N] than the current one. For example, in a heat transfer problem, a Dirichlet boundary condition may specify the temperature at the boundary of the domain. In a fluid flow problem, a Dirichlet boundary condition may specify the velocity or pressure at the boundary. @@ -233,7 +233,29 @@ u_i = g_i(x,t,\mu), \quad i=1,\dots,N ++++ **** -The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` file only if Dirichlet conditions are used. +The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` file only if Dirichlet conditions are used. + +.Examples of Dirichlet boundary condition +[.examp#ex:boudaryconditions:dirichlet] +**** +[source, json] +---- +"Dirichlet": <1> +{ + "Gamma0": <2> + { + "markers": ["Bottom","Right","Bottom-Left","Top-Right"], <3> + "expr": "0" <4> + } +} +---- +**** + +<1> Keyword for Dirichlet conditions. +<2> The physical entity (associated to the mesh) to which the condition is applied. +<3> The markers of the boundary where the Dirichlet condition is applied. +<4> The expression for the Dirichlet stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. + === Neumann @@ -247,7 +269,7 @@ In a fluid flow problem, a Neumann boundary condition may specify the normal str The Neumann boundary condition is also essential in determining a unique solution to a PDE problem. It provides additional information about the behavior of the solution at the boundary, which complements the Dirichlet boundary condition. Together, the Dirichlet and Neumann boundary conditions form a complete set of boundary conditions that fully specify the PDE problem. -The Neumann conditions may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and the unknowns stem:[u_1, \dots, u_N]. +The Neumann conditions may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and the unknowns stem:[u_1, \dots, u_N]. The shape of the Neumann condition is the same as the unknown shape. @@ -264,6 +286,25 @@ The shape of the Neumann condition is the same as the unknown shape. The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` file only if Neumann conditions are used. +.Examples of Neumann boundary condition +[.examp#ex:boudaryconditions:neumann] +**** +[source, json] +---- +"Neumann": <1> +{ + "top": <2> + { + "expr":"-h_top*(heat_T-T0_top):h_top:heat_T:T0_top" <3> + } +} +---- +**** + +<1> Keyword for Robin conditions. +<2> The physical entity (associated to the mesh) to which the condition is applied. +<3> Expression of stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. + === Robin Robin boundary condition is a type of boundary condition that combines both Dirichlet and Neumann boundary conditions. @@ -275,7 +316,7 @@ In a fluid flow problem, a Robin boundary condition may specify a slip coefficie The Robin boundary condition is useful in modeling situations where the boundary is in contact with a medium that has a different thermal or mechanical behavior than the domain. It provides a more realistic and accurate description of the physical problem than using only Dirichlet or Neumann boundary conditions. -The Robin conditions may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu]. +The Robin conditions may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu]. The shape of the Robin condition is the same as the unknown shape. @@ -292,6 +333,27 @@ The shape of the Robin condition is the same as the unknown shape. The user provides the expression for stem:[(\eta_i)_{i=1\dots N}] and stem:[(\zeta_i)_{i=1\dots N}] in the `.json` file only if Robin conditions are used. +.Examples of Robin boundary condition +[.examp#ex:boudaryconditions:robin] +**** +[source, json] +---- +"Robin": <1> +{ + "top": <2> + { + "expr1": "h_top:h_top", <3> + "expr2": "h_top*T0_top:h_top:T0_top" <4> + } +} +---- +**** + +<1> Keyword for Robin conditions. +<2> The physical entity (associated to the mesh) to which the condition is applied. +<3> Expression of stem:[\eta_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. +<4> Expression of stem:[\zeta_i]. + == Finite Element Approximation @@ -301,11 +363,11 @@ Here's an example of an asciidoc table with a list of finite elements supported |=== | Finite Element | polynomial order | Description -| Pch | 0,1,2 | Piecewise continuous scalar functions of arbitrary degree stem:[k] -| Pchv| 0,1,2 | Piecewise continuous vectorial functions of arbitrary degree stem:[k] +| `Pch` | 0,1,2 | Piecewise continuous scalar functions of arbitrary degree stem:[k] +| `Pchv`| 0,1,2 | Piecewise continuous vectorial functions of arbitrary degree stem:[k] -| RT | k=0 | Raviart-Thomas element of degree stem:[k] -| NED | Nedelec's first family of curl-conforming elements +| `RT` | k=0 | Raviart-Thomas element of degree stem:[k] +| `NED` | | Nedelec's first family of curl-conforming elements |=== @@ -370,7 +432,7 @@ They have also been used in the development of advanced simulation tools for eng === GaLS The Galerkin least squares formulation is a stabilized finite element method used to solve partial differential equations. The variational formulation of the Galerkin least squares method is given by: -Find $u \in V$ such that +Find stem:[u \in V] such that [stem] ++++ @@ -416,11 +478,11 @@ The Streamline Upwind Petrov Galerkin (SUPG) method is a stabilized finite eleme a_{\text{SUPG}}(u,v) = a(u,v) + \tau \left( \mathbf{\beta} \cdot \nabla u - \frac{1}{2} \Delta u \right) \left( \mathbf{b} \cdot \nabla v - \frac{1}{2} \Delta v \right) ++++ -where stem:[\tau] is a positive constant that controls the strength of the stabilization term, stem:[\beta] is a vector field that represents the direction and magnitude of the convection term in the PDE, and $\Delta$ is the Laplace operator. The SUPG method introduces an additional term that penalizes the gradient of the solution in the direction of the convection term, which improves the accuracy and stability of the numerical solution for convection-dominated problems. The SUPG method has been shown to be effective in solving a wide range of PDE problems, including fluid dynamics and heat transfer. +where stem:[\tau] is a positive constant that controls the strength of the stabilization term, stem:[\beta] is a vector field that represents the direction and magnitude of the convection term in the PDE, and stem:[\Delta] is the Laplace operator. The SUPG method introduces an additional term that penalizes the gradient of the solution in the direction of the convection term, which improves the accuracy and stability of the numerical solution for convection-dominated problems. The SUPG method has been shown to be effective in solving a wide range of PDE problems, including fluid dynamics and heat transfer. === {cfpdes} toolbox -Given a `cfpdes` equation named `myeq`, SUPG and GaLS can be used as stabilisation methods. +Given a `cfpdes` equation named `myeq`, SUPG and GaLS can be used as stabilisation methods. To enable them use, in the command-line or `.cfg` file, the option `cfpdes.eq.stabilitsation=1` and define the stabilisation type `cfpdes.eq.stabilitsation.type=gls #supg#unusual-gls #gls` .Stabilisation methods @@ -440,4 +502,4 @@ Examples are available https://github.com/feelpp/feelpp/tree/develop/toolboxes/c == Next steps * [x] xref:user:python:pyfeelpptoolboxes/cfpdes.poisson.adoc[The Poisson equation] -//* [x] The advection-diffusion-reaction equation \ No newline at end of file +//* [x] The advection-diffusion-reaction equation From c6df538df2ccf52fdc470f6dcb74c3c178b767d8 Mon Sep 17 00:00:00 2001 From: Thomas Saigre Date: Tue, 15 Aug 2023 10:54:59 +0200 Subject: [PATCH 2/4] replace item with <.> /cc @prudhomm --- .../modules/cfpdes/partials/introduction.adoc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/toolboxes/modules/cfpdes/partials/introduction.adoc b/toolboxes/modules/cfpdes/partials/introduction.adoc index 79a61bf5..6894f6d9 100644 --- a/toolboxes/modules/cfpdes/partials/introduction.adoc +++ b/toolboxes/modules/cfpdes/partials/introduction.adoc @@ -251,10 +251,10 @@ The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` fi ---- **** -<1> Keyword for Dirichlet conditions. -<2> The physical entity (associated to the mesh) to which the condition is applied. -<3> The markers of the boundary where the Dirichlet condition is applied. -<4> The expression for the Dirichlet stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. +<.> Keyword for Dirichlet conditions. +<.> The physical entity (associated to the mesh) to which the condition is applied. +<.> The markers of the boundary where the Dirichlet condition is applied. +<.> The expression for the Dirichlet stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. === Neumann @@ -301,9 +301,9 @@ The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` fi ---- **** -<1> Keyword for Robin conditions. -<2> The physical entity (associated to the mesh) to which the condition is applied. -<3> Expression of stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. +<.> Keyword for Robin conditions. +<.> The physical entity (associated to the mesh) to which the condition is applied. +<.> Expression of stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. === Robin @@ -349,10 +349,10 @@ The user provides the expression for stem:[(\eta_i)_{i=1\dots N}] and stem:[(\ze ---- **** -<1> Keyword for Robin conditions. -<2> The physical entity (associated to the mesh) to which the condition is applied. -<3> Expression of stem:[\eta_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. -<4> Expression of stem:[\zeta_i]. +<.> Keyword for Robin conditions. +<.> The physical entity (associated to the mesh) to which the condition is applied. +<.> Expression of stem:[\eta_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. +<.> Expression of stem:[\zeta_i]. == Finite Element Approximation From d90c78eb070806ae3ce0a00ac54dee5bcddce378 Mon Sep 17 00:00:00 2001 From: Thomas Saigre Date: Thu, 21 Sep 2023 14:35:25 +0200 Subject: [PATCH 3/4] remove trailing spaces --- .../modules/cfpdes/partials/introduction.adoc | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/toolboxes/modules/cfpdes/partials/introduction.adoc b/toolboxes/modules/cfpdes/partials/introduction.adoc index 6894f6d9..c6ab5b5f 100644 --- a/toolboxes/modules/cfpdes/partials/introduction.adoc +++ b/toolboxes/modules/cfpdes/partials/introduction.adoc @@ -6,7 +6,7 @@ Coefficient forms in PDE (Partial Differential Equation) toolboxes refer to the representation of the PDE problem in terms of its coefficient functions. In the context of PDEs, the coefficients represent the properties and characteristics of the equation, such as the diffusion coefficient, convection coefficient, reaction coefficient, and others. -Different types of PDEs, such as elliptic, parabolic, or hyperbolic equations, have specific coefficient forms associated with them. +Different types of PDEs, such as elliptic, parabolic, or hyperbolic equations, have specific coefficient forms associated with them. These coefficient forms capture the behavior and physical properties of the underlying phenomena being modeled. For example, in the context of the Poisson equation, a commonly encountered elliptic equation, the coefficient form is often written as: @@ -16,16 +16,16 @@ For example, in the context of the Poisson equation, a commonly encountered elli -\nabla \cdot (c \nabla u) + a u = f ++++ -Here, +Here, -* stem:[c] represents the diffusion coefficient, -* stem:[a] represents the reaction coefficient, -* stem:[u] is the unknown function, and -* stem:[f] is the source term. +* stem:[c] represents the diffusion coefficient, +* stem:[a] represents the reaction coefficient, +* stem:[u] is the unknown function, and +* stem:[f] is the source term. The coefficient form provides a structured way to express the PDE problem and allows for efficient numerical solution techniques. -PDE toolboxes, such as those available in {feelpp}, provide functionality to handle coefficient forms of various PDEs. +PDE toolboxes, such as those available in {feelpp}, provide functionality to handle coefficient forms of various PDEs. They offer tools for defining the coefficient functions, setting boundary conditions, discretizing the problem, and solving it numerically using appropriate algorithms and methods. By utilizing coefficient forms in PDE toolboxes, researchers and engineers can conveniently formulate and solve complex PDE problems with the necessary coefficients and boundary conditions, enabling the analysis and simulation of a wide range of physical phenomena. @@ -86,10 +86,10 @@ We need also to respect some constraint on the coefficient shape as described in | stem:[d] | scalar | scalar | stem:[c] | scalar or matrix | scalar or matrix -| stem:[\alpha] | vectorial | scalar or matrix -| stem:[\gamma] | vectorial | matrix -| stem:[\beta] | vectorial | vectorial -| stem:[a] | scalar | scalar +| stem:[\alpha] | vectorial | scalar or matrix +| stem:[\gamma] | vectorial | matrix +| stem:[\beta] | vectorial | vectorial +| stem:[a] | scalar | scalar | stem:[f] | scalar | vectorial |=== @@ -161,7 +161,7 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec "alpha": "x*y*mu:x:y:mu", // scalar "alpha": "{x,y,y,x*mu}:x:y:mu", // 2D matrix "gamma": "{x,y,y,x}:x:y", // 2D matrix - "beta": "{t+x,y}:x:y:t", + "beta": "{t+x,y}:x:y:t", "a": "x+y:x:y", "f": "{x,x+y*t}:x:y:t" } @@ -207,16 +207,16 @@ NOTE: the shape of the initial condition must be the same as the unknown shape. Here are supported boundary conditions -=== Dirichlet +=== Dirichlet -Dirichlet boundary condition is a type of boundary condition commonly used in partial differential equations. -It specifies the value of the solution at the boundary of the domain. -In other words, it prescribes the behavior of the solution at the boundary. +Dirichlet boundary condition is a type of boundary condition commonly used in partial differential equations. +It specifies the value of the solution at the boundary of the domain. +In other words, it prescribes the behavior of the solution at the boundary. The condition may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and other unknowns stem:[u_1, \dots, u_N] than the current one. -For example, in a heat transfer problem, a Dirichlet boundary condition may specify the temperature at the boundary of the domain. -In a fluid flow problem, a Dirichlet boundary condition may specify the velocity or pressure at the boundary. +For example, in a heat transfer problem, a Dirichlet boundary condition may specify the temperature at the boundary of the domain. +In a fluid flow problem, a Dirichlet boundary condition may specify the velocity or pressure at the boundary. The Dirichlet boundary condition is essential in determining a unique solution to a PDE problem. Without it, the solution would be underdetermined, and there would be an infinite number of solutions that satisfy the PDE. @@ -228,7 +228,7 @@ The shape of the Dirichlet condition is the same as the unknown shape. [stem] ++++ \begin{eqnarray*} -u_i = g_i(x,t,\mu), \quad i=1,\dots,N +u_i = g_i(x,t,\mu), \quad i=1,\dots,N \end{eqnarray*} ++++ **** @@ -259,14 +259,14 @@ The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` fi === Neumann -Neumann boundary condition is another type of boundary condition commonly used in partial differential equations. -It specifies the normal derivative of the solution at the boundary of the domain. +Neumann boundary condition is another type of boundary condition commonly used in partial differential equations. +It specifies the normal derivative of the solution at the boundary of the domain. In other words, it prescribes the flux of the solution across the boundary. -For example, in a heat transfer problem, a Neumann boundary condition may specify the heat flux at the boundary of the domain. -In a fluid flow problem, a Neumann boundary condition may specify the normal stress or shear stress at the boundary. +For example, in a heat transfer problem, a Neumann boundary condition may specify the heat flux at the boundary of the domain. +In a fluid flow problem, a Neumann boundary condition may specify the normal stress or shear stress at the boundary. -The Neumann boundary condition is also essential in determining a unique solution to a PDE problem. +The Neumann boundary condition is also essential in determining a unique solution to a PDE problem. It provides additional information about the behavior of the solution at the boundary, which complements the Dirichlet boundary condition. Together, the Dirichlet and Neumann boundary conditions form a complete set of boundary conditions that fully specify the PDE problem. The Neumann conditions may depend on the space variable stem:[x], time stem:[t], parameters stem:[\mu] and the unknowns stem:[u_1, \dots, u_N]. @@ -307,12 +307,12 @@ The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` fi === Robin -Robin boundary condition is a type of boundary condition that combines both Dirichlet and Neumann boundary conditions. -It specifies a linear combination of the solution and its normal derivative at the boundary of the domain. -In other words, it prescribes both the value and the flux of the solution at the boundary. +Robin boundary condition is a type of boundary condition that combines both Dirichlet and Neumann boundary conditions. +It specifies a linear combination of the solution and its normal derivative at the boundary of the domain. +In other words, it prescribes both the value and the flux of the solution at the boundary. -For example, in a heat transfer problem, a Robin boundary condition may specify a heat transfer coefficient that relates the temperature difference between the boundary and the surrounding medium to the heat flux at the boundary. -In a fluid flow problem, a Robin boundary condition may specify a slip coefficient that relates the velocity difference between the boundary and the surrounding medium to the shear stress at the boundary. +For example, in a heat transfer problem, a Robin boundary condition may specify a heat transfer coefficient that relates the temperature difference between the boundary and the surrounding medium to the heat flux at the boundary. +In a fluid flow problem, a Robin boundary condition may specify a slip coefficient that relates the velocity difference between the boundary and the surrounding medium to the shear stress at the boundary. The Robin boundary condition is useful in modeling situations where the boundary is in contact with a medium that has a different thermal or mechanical behavior than the domain. It provides a more realistic and accurate description of the physical problem than using only Dirichlet or Neumann boundary conditions. @@ -371,7 +371,7 @@ Here's an example of an asciidoc table with a list of finite elements supported |=== -This table lists various finite elements supported by {cfpdes}, along with a brief description of each element. +This table lists various finite elements supported by {cfpdes}, along with a brief description of each element. NOTE: {feelpp} supports a wider range of finite elements, including piecewise arbitrary order polynomials, as well as mixed finite elements such as Raviart-Thomas and Brezzi-Douglas-Marini elements or Nedelec's first families. @@ -384,7 +384,7 @@ The backward difference formula scheme is a numerical method for approximating t stem:[f'(x_n) ≈ \frac{1}{\Delta t} \left(\alpha f(x_n) + \beta f(x_{n-1}) + \gamma f(x_{n-2}) + \dots\right)] -where stem:[\Delta t] is the time step size, stem:[x_n] is the point at which the derivative is approximated, and stem:[\alpha], stem:[\beta], stem:[\gamma], etc. are coefficients that depend on the order of the scheme. +where stem:[\Delta t] is the time step size, stem:[x_n] is the point at which the derivative is approximated, and stem:[\alpha], stem:[\beta], stem:[\gamma], etc. are coefficients that depend on the order of the scheme. For example, the first-order backward difference formula scheme is: @@ -406,25 +406,25 @@ The theta scheme is a numerical method for solving partial differential equation \frac{u_i^{n+1} - u_i^n}{\Delta t} = \theta f(u_{i}^{n+1}) + (1-\theta)f(u_{i}^{n}) ++++ -where stem:[u_i^n] is the numerical solution at the stem:[i]-th spatial point and stem:[n]-th time step, stem:[\Delta t] and stem:[\Delta x] are the time and spatial step sizes, and stem:[\theta] is a parameter that determines the weighting between the current and previous time steps. +where stem:[u_i^n] is the numerical solution at the stem:[i]-th spatial point and stem:[n]-th time step, stem:[\Delta t] and stem:[\Delta x] are the time and spatial step sizes, and stem:[\theta] is a parameter that determines the weighting between the current and previous time steps. -When stem:[\theta=0], the scheme reduces to the backward difference formula, whereas when stem:[\theta=1], it reduces to the forward difference formula. +When stem:[\theta=0], the scheme reduces to the backward difference formula, whereas when stem:[\theta=1], it reduces to the forward difference formula. For stem:[\theta=0.5], the scheme is known as the **Crank-Nicolson scheme**, which is a popular choice due to its stability and accuracy. The theta scheme is widely used in numerical simulations of heat transfer, fluid flow, and other physical phenomena. == Stabilized finite element methods -:adr: advection diffusion reaction +:adr: advection diffusion reaction -Stabilized finite element methods are a class of numerical methods used to solve partial differential equations (PDEs). +Stabilized finite element methods are a class of numerical methods used to solve partial differential equations (PDEs). These methods are designed to overcome the limitations of traditional finite element methods, which can suffer from numerical instabilities and inaccuracies when applied to certain types of PDEs, such as those with convection-dominated or highly oscillatory solutions. -Stabilized finite element methods introduce additional terms to the weak form of the PDE, which act as stabilizers to improve the accuracy and stability of the numerical solution. +Stabilized finite element methods introduce additional terms to the weak form of the PDE, which act as stabilizers to improve the accuracy and stability of the numerical solution. These terms are typically chosen to balance the effects of convection, diffusion, and reaction in the PDE, and to ensure that the numerical solution satisfies certain physical and mathematical constraints. -There are several types of stabilized finite element methods, including **streamline diffusion**, **Petrov-Galerkin**, and **least-squares** methods. +There are several types of stabilized finite element methods, including **streamline diffusion**, **Petrov-Galerkin**, and **least-squares** methods. Each method has its own strengths and weaknesses, and the choice of method depends on the specific problem being solved. -Stabilized finite element methods have been successfully applied to a wide range of PDE problems, including fluid dynamics, heat transfer, and structural mechanics. +Stabilized finite element methods have been successfully applied to a wide range of PDE problems, including fluid dynamics, heat transfer, and structural mechanics. They have also been used in the development of advanced simulation tools for engineering and scientific applications. {cfpdes} toolbox provides the possibility to use stabilized finite element methods (GaLS and SUPG) for equations such as the {adr} equation. @@ -454,9 +454,9 @@ l(v) = \int_{\Omega} f v dx ++++ -Here, stem:[\epsilon], stem:[\beta], and stem:[\gamma] are positive constants that control the balance between diffusion, convection, and reaction in the PDE, and stem:[\alpha] is a positive constant that controls the strength of the stabilization term on the boundary. -The Galerkin least squares method introduces additional terms to the bilinear form that act as stabilizers to improve the accuracy and stability of the numerical solution. -These terms are chosen to minimize the residual of the PDE in a least squares sense, and are typically expressed in terms of the gradient of the solution and its higher-order derivatives. +Here, stem:[\epsilon], stem:[\beta], and stem:[\gamma] are positive constants that control the balance between diffusion, convection, and reaction in the PDE, and stem:[\alpha] is a positive constant that controls the strength of the stabilization term on the boundary. +The Galerkin least squares method introduces additional terms to the bilinear form that act as stabilizers to improve the accuracy and stability of the numerical solution. +These terms are chosen to minimize the residual of the PDE in a least squares sense, and are typically expressed in terms of the gradient of the solution and its higher-order derivatives. The Galerkin least squares method has been shown to be effective in solving a wide range of PDE problems, including convection-dominated and highly oscillatory problems. [stem] @@ -465,8 +465,8 @@ a_{\text{GLS}}(u,v) = a(u,v) + \tau \int_{\Omega} \left( \epsilon \nabla u - \be ++++ where stem:[\tau] is a positive constant that controls the strength of the stabilization term. -The first term in the additional terms is a diffusion term that penalizes the gradient of the solution, while the second term is a convection term that penalizes the solution itself. -The third term is a reaction term that ensures that the numerical solution satisfies certain physical and mathematical constraints. +The first term in the additional terms is a diffusion term that penalizes the gradient of the solution, while the second term is a convection term that penalizes the solution itself. +The third term is a reaction term that ensures that the numerical solution satisfies certain physical and mathematical constraints. The Galerkin least squares method with these additional terms has been shown to be effective in improving the accuracy and stability of the numerical solution for a wide range of PDE problems. === SUPG @@ -482,21 +482,21 @@ where stem:[\tau] is a positive constant that controls the strength of the stabi === {cfpdes} toolbox -Given a `cfpdes` equation named `myeq`, SUPG and GaLS can be used as stabilisation methods. +Given a `cfpdes` equation named `myeq`, SUPG and GaLS can be used as stabilisation methods. To enable them use, in the command-line or `.cfg` file, the option `cfpdes.eq.stabilitsation=1` and define the stabilisation type `cfpdes.eq.stabilitsation.type=gls #supg#unusual-gls #gls` .Stabilisation methods |=== -| type | +| type | | `gls` | default option -| `supg` | -| `unusual-gls` | +| `supg` | +| `unusual-gls` | |=== -Examples are available https://github.com/feelpp/feelpp/tree/develop/toolboxes/coefficientformpdes/cases/adr[here] +Examples are available https://github.com/feelpp/feelpp/tree/develop/toolboxes/coefficientformpdes/cases/adr[here] == Next steps From 1b2c287b1eaae7ee28deb8a8d0b1f729db928298 Mon Sep 17 00:00:00 2001 From: Thomas Saigre Date: Thu, 21 Sep 2023 14:36:08 +0200 Subject: [PATCH 4/4] add more details in code #180 /cc @prudhomm @vincentchabannes can you please review that what I added is correct ? --- .../modules/cfpdes/partials/introduction.adoc | 88 +++++++++++++------ 1 file changed, 61 insertions(+), 27 deletions(-) diff --git a/toolboxes/modules/cfpdes/partials/introduction.adoc b/toolboxes/modules/cfpdes/partials/introduction.adoc index c6ab5b5f..27bfdf9d 100644 --- a/toolboxes/modules/cfpdes/partials/introduction.adoc +++ b/toolboxes/modules/cfpdes/partials/introduction.adoc @@ -104,17 +104,22 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec { "Models": { - "cfpdes":{ - "equations":["myscalarpde"] + "cfpdes": + { + "equations":["myscalarpde"] <1> }, - "mypde":{ - "setup":{ - "unknown":{ - "basis":"Pch1", // the unknown is a scalar field - "name":"u", - "symbol":"u" + "myscalarpde": <2> + { + "setup": + { + "unknown": + { + "basis":"Pch1", // the unknown is a scalar field <3> + "name":"u", <4> + "symbol":"u" <4> }, - "coefficients":{ + "coefficients": <5> + { "d": "1", "c": "x+y:x:y", "c": "{x+y,x,y,x-y}:t:x:y", // 2D matrix @@ -128,7 +133,8 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec } } }, - "Parameters":{ + "Parameters": <6> + { "mu": 0.5 } } @@ -143,17 +149,22 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec { "Models": { - "cfpdes":{ - "equations":["myvectorialpde"] + "cfpdes": + { + "equations":["myvectorialpde"] <1> }, - "mypde":{ - "setup":{ - "unknown":{ - "basis":"Pch1v", // the unknown is a vector field - "name":"u", - "symbol":"u" + "myvectorialpde": <2> + { + "setup": + { + "unknown": + { + "basis":"Pch1v", // the unknown is a vector field <3> + "name":"u", <4> + "symbol":"u" <4> }, - "coefficients":{ + "coefficients": <5> + { "d": "1", "c": "x+y:x:y", "c": "{x+y,x,y,x-y}:t:x:y", // 2D matrix @@ -168,7 +179,8 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec } } }, - "Parameters":{ + "Parameters": <6> + { "mu": 0.5 } } @@ -176,6 +188,13 @@ NOTE: In the following, `mu` is a parameter defined e.g. in the `Parameters` sec ---- **** +<.> The name of the equation to be considered, if many equations are defined, they must be listed here. +<.> The name of the equation for definition. +<.> Functional space used in the discretization of the equation. +<.> The name, and symbol of the unknown. +<.> Definition of the coefficients involved in the equation. +<.> Definition of parameters involved in the equation. + == Initial Conditions @@ -188,13 +207,18 @@ NOTE: the shape of the initial condition must be the same as the unknown shape. **** [source,json] ---- -"InitialConditions":{ - "mypde": { - "u": { - "Expression": { - "myic": { - "markers": "Omega", - "expr": "2*cos(t)*sin(x)*cos(y):t:x:y" +"InitialConditions": <1> +{ + "mypde": <2> + { + "u": <3> + { + "Expression": + { + "myic": <4> + { + "markers": "Omega", <5> + "expr": "2*cos(t)*sin(x)*cos(y):t:x:y" <6> } } } @@ -203,6 +227,14 @@ NOTE: the shape of the initial condition must be the same as the unknown shape. ---- **** +<.> Keyword for initial conditions +<.> The name of the equation +<.> The name of the unknown +<.> The name of the initial condition +<.> The physical entity (associated to the mesh) to which the condition is applied. +<.> The expression of the initial condition. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_initialconditions[the json specifications]. + + == Boundary Conditions Here are supported boundary conditions @@ -305,6 +337,8 @@ The user provides the expression for stem:[(g_i)_{i=1\dots N}] in the `.json` fi <.> The physical entity (associated to the mesh) to which the condition is applied. <.> Expression of stem:[g_i]. See more details in xref:toolboxes:ROOT:modeling-analysis-using-json-files.adoc#_boundaryconditions[the json specifications]. +NOTE: Because of the presence of `heat_T` in the expression, this will be considered as a non-linear condition. + === Robin Robin boundary condition is a type of boundary condition that combines both Dirichlet and Neumann boundary conditions.