Salome HOME
initial project version
[tools/solverlab.git] / CoreFlows / Documentation / functionalities.ipynb
1 {
2  "cells": [
3   {
4    "cell_type": "code",
5    "execution_count": 3,
6    "metadata": {},
7    "outputs": [
8     {
9      "data": {
10       "text/markdown": [
11        "Available functionalities  \n",
12        "===========================\n",
13        "\n",
14        "Meshes\n",
15        "------\n",
16        "\n",
17        "The simulation requires a mesh $M$ that can be defined either\n",
18        "\n",
19        "- using the [CDMATH-Toolbox](https://github.com/ndjinga/CDMATH) structured mesh constructor Mesh $M(xmin,xmax,nx)$\n",
20        "- loading a [MED](https://www.salome-platform.org/user-section/about/med) file generated by [SALOME](https://www.salome-platform.org/) platform Mesh $M$ (''  filename '')\n",
21        "\n",
22        "All the boundary faces of the mesh sould be gathered into groups of FACES that will be used to set boundary conditions. These groups of faces can be set\n",
23        "- using the [CDMATH-Toolbox](https://github.com/ndjinga/CDMATH) face group generator \\a M.setGroupAtPlan(value,direction,tolerance,groupName), where direction is an integer with value $0$ for the plane $x=value$, $1$ for the plane $y=value$ and $2$ for the plane $z=value$\n",
24        "- using [SALOME](https://www.salome-platform.org/) platform when generating the [MED](https://www.salome-platform.org/user-section/about/med) file\n",
25        "\n",
26        "\n",
27        "Initial data and power fields\n",
28        "-----------------------------\n",
29        "\n",
30        "The initial data and power fields can be defined on the simulation mesh using the Field class of [CDMATH-Toolbox](https://github.com/ndjinga/CDMATH) either\n",
31        "- starting from a null field using the command Field(fieldname,ON\\_CELLS,numberOfComponents), then setting the values on cell $i$ for each component  $j$ with the command $F(i,j)=fij$\n",
32        "- loading a field stored in a [MED](https://www.salome-platform.org/user-section/about/med) file using the command Field(filename,ON\\_CELLS, filename)\n",
33        "\n",
34        "The initial data should in general be a vector field containing parameters that are specific to each model\n",
35        "- [SinglePhase](../Models/inc/SinglePhase.hxx) : $(p, \\vec{v}, T)$, ie pressure, velocity, temperature\n",
36        "- [DriftModel](../Models/inc/DriftModel.hxx) : $(c_g, p, \\vec{v}, T)$, ie phase 1 concentration, pressure, velocity, temperature\n",
37        "- [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx) : $(\\alpha_g, p,\\vec{v}_g,\\vec{v}_l)$, ie phase 1 void fraction, pressure, phase 1 velocity, phase 2 velocity\n",
38        "- [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx) : $(\\alpha_g, p,\\vec{v}_g,\\vec{v}_l,T)$, ie phase 1 void fraction, pressure, phase 1 velocity, phase 2 velocity, common temperature\n",
39        "- [TransportEquation](../Models/inc/TransportEquation.hxx) : $h$ the fluid enthalpy \n",
40        "- [DiffusionEquation](../Models/inc/DiffusionEquation.hxx) : $T$ the solid temperature\n",
41        "\n",
42        "Whatever the model chosen, the initial data is set with the function ProblemCoreFlows::setInitialField (initialField), and the heat power field is set with the function ProblemCoreFlows::setHeatSource(heatPower) for a constant uniform value or the function ProblemCoreFlows::setHeatSourceField(heatPowerField) for a variable power field.\n",
43        "\n",
44        "Models\n",
45        "------\n",
46        "\n",
47        "The model can be set as\n",
48        "\n",
49        "- [SinglePhase](../Models/inc/SinglePhase.hxx)::SinglePhase ( \\ref fluidType, \\ref pressureEstimate,spaceDimension) where \\ref fluidType is either  \\ref Liquid or \\ref Steam, and \\ref pressureEstimate is \\ref around1bar300K or \\ref around155bars600K\n",
50        "- [DriftModel](../Models/inc/DriftModel.hxx)::DriftModel (\\ref pressureEstimate,spaceDimension) where  pressureEstimate is \\ref around1bar300K or \\ref around155bars600K\n",
51        "- [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx)::IsothermalTwoFluid (\\ref pressureEstimate,spaceDimension) where  pressureEstimate is \\ref around1bar300K or \\ref around155bars600K\n",
52        "- [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)::FiveEqsTwoFluid (\\ref pressureEstimate,spaceDimension) where  pressureEstimate is \\ref around1bar300K or \\ref around155bars600K\n",
53        "- [TransportEquation](../Models/inc/TransportEquation.hxx)::TransportEquation (\\ref fluidType, \\ref pressureEstimate ,$\\vec v$) where \\ref fluidType is either  \\ref Liquid or \\ref Steam, \\ref pressureEstimate is \\ref around1bar300K or \\ref around155bars600K and$\\vec v$ is the velocity vector assumed constant and of type vector<double>\n",
54        "- [DiffusionEquation](../Models/inc/DiffusionEquation.hxx)::DiffusionEquation (spaceDim,$ \\rho, c_p,\\lambda$) where $\\rho$ is the solid density, $c_p$ its specific heat and $\\lambda$ its conductivity with default values set for Uranirum\n",
55        "\n",
56        "Physical options\n",
57        "----------------\n",
58        "\n",
59        "The following physical parameters have default value zero but can be set by the user:\n",
60        "\n",
61        "- In order to set a constant heat source : ProblemCoreFlows::setHeatSource($ heatSource $) where heat source is a double\n",
62        "- In order to set the viscosities : ProblemFluid::setViscosity($ viscosite $ ) where viscosite is a $vector<double>$ of size nbPhases\n",
63        "- In order to set the conductivities : ProblemFluid::setConductivity ($ conductivite$ ) where conductivite is a $vector<double>$ of size nbPhases\n",
64        "- In order to set the gravity : ProblemFluid::setGravity($ gravite$ ) where gravite is a $vector<double>$ of size spaceDim\n",
65        "- In order to set the friction coefficients : ProblemFluid::setDragCoeffs($ dragCoeffs$ ) where dragCoeffs is a $vector<double>$ containing the friction coefficients between fluid and solid in a porous approach for [SinglePhase](../Models/inc/SinglePhase.hxx) (one coefficient) and [DriftModel](../Models/inc/DriftModel.hxx) (two coefficients), or interfacial friction between the two phases for [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx) (one coefficient) and [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx) (one coefficient)\n",
66        "- In order to set the heat transfert coefficient between fluid and solid in a porous flow ProblemCoreFlows::setHeatTransfertCoeff (heatCoeff)\n",
67        "\n",
68        "Numerical options\n",
69        "-----------------\n",
70        "\n",
71        "- The nonlinear formulation can be \\ref Roe, \\ref VFRoe or \\ref VFFC and is set by the method ProblemFluid::setNonLinearFormulation(\\ref NonLinearFormulation)\n",
72        "- The time discretisation can be \\ref Explicit or \\ref Implicit, and the space discretisation can be \\ref upwind, \\ref lowMach, \\ref pressureCorrection, \\ref staggered or \\ref centered. The space and time discretisations can be set using the command ProblemCoreFlows::setNumericalScheme( \\ref upwind ,  \\ref Explicit ); or ProblemCoreFlows::setNumericalScheme( \\ref centered ,  \\ref Implicit); for instance. \n",
73        "- Advanced options can be set to enforce a well balanced scheme with ProblemFluid::setWellBalancedCorrection or an entropic scheme  with ProblemFluid::setEntropicCorrection.\n",
74        "- In order to set the cfl number: ProblemCoreFlows::setCFL($ cfl $ );\n",
75        "- In order to set the tolerance number  : ProblemCoreFlows::setPrecision($ precision $ );\n",
76        "- In order to set the maximum number of time steps : ProblemCoreFlows::setMaxNbOfTimeStep($ MaxNbOfTimeStep$ );\n",
77        "- In order to set the maximum time of the computation : ProblemCoreFlows::setTimeMax($ maxTime$);\n",
78        "- In order to set the linear solver and preconditioner : ProblemCoreFlows::setLinearSolver(\\ref GMRES, \\ref ILU ).\n",
79        "The usual linear solvers are [GMRES](https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPGMRES.html) and [BICGSTAB](https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPBCGS.html), and the usual \"preconditionners\" are [ILU](https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCILU.html) and [LU](https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCLU.html).\n",
80        "\n",
81        "\n",
82        "Boundary conditions\n",
83        "-------------------\n",
84        "\n",
85        "For the numerical treatment of the boundaries, it is important that each boundary (Group in Salome vocabulary) be assigned a \\ref BoundaryType.\n",
86        "\n",
87        "Boundary types can be \n",
88        "\n",
89        "- \\ref Wall\n",
90        "      + simply set with the function [SinglePhase](../Models/inc/SinglePhase.hxx)::setWallBoundaryCondition, [DriftModel](../Models/inc/DriftModel.hxx)::setWallBoundaryCondition, [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx)::setWallBoundaryCondition, [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)::setWallBoundaryCondition\n",
91        "      + possible for all fluid models : [SinglePhase](../Models/inc/SinglePhase.hxx), [DriftModel](../Models/inc/DriftModel.hxx), [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx), [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)\n",
92        "- \\ref Neumann\n",
93        "      + simply set with the function ProblemCoreFlows::setNeumannBoundaryCondition\n",
94        "      + possible for all models\n",
95        "- \\ref Inlet\n",
96        "      + simply set with the functions [SinglePhase](../Models/inc/SinglePhase.hxx)::setInletBoundaryCondition, [SinglePhase](../Models/inc/SinglePhase.hxx)::setInletBoundaryCondition, [DriftModel](../Models/inc/DriftModel.hxx)::setInletBoundaryCondition, [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx)::setInletBoundaryCondition, [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)::setInletBoundaryCondition or [TransportEquation](../Models/inc/TransportEquation.hxx)::setInletBoundaryCondition\n",
97        "      + possible for [TransportEquation](../Models/inc/TransportEquation.hxx), [SinglePhase](../Models/inc/SinglePhase.hxx), [DriftModel](../Models/inc/DriftModel.hxx), [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx), [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)\n",
98        "- \\ref Outlet\n",
99        "      + simply set with the command ProblemFluid::setOutletBoundaryCondition\n",
100        "      + possible for all fluid models : [SinglePhase](../Models/inc/SinglePhase.hxx), [DriftModel](../Models/inc/DriftModel.hxx), [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx), [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx)\n",
101        "- \\ref Dirichlet\n",
102        "      + simply set with the command [DiffusionEquation](../Models/inc/DiffusionEquation.hxx)::setDirichletBoundaryCondition\n",
103        "      + possible for [DiffusionEquation](../Models/inc/DiffusionEquation.hxx)\n",
104        "\n",
105        "The former way to set the boundary conditions was to create a C++ map $map<string, LimitField> boundaryFields$ that associates the boundary name to a field. Once the map is filled with the appropriate content, the boundary conditions are set with the command ProblemCoreFlows::setBoundaryFields(boundaryFields).\n",
106        "The LimitField structure is specific to each model and each type of boundary condition.\n",
107        "- for a Neumann boundary condition :  LimitField limitNeumann; limitNeumann.bcType=Neumann;\n",
108        "\n",
109        "- for an Inlet boundary condition (not possible for [DiffusionEquation](../Models/inc/DiffusionEquation.hxx)): LimitField limitInlet; limitInlet.bcType=Inlet; then\n",
110        "      + For [TransportEquation](../Models/inc/TransportEquation.hxx): \n",
111        "\t\t- limitInlet.h=1.3e6\n",
112        "      + For [SinglePhase](../Models/inc/SinglePhase.hxx) (3D case):\n",
113        "\t  - limitInlet.T = 600;\t\n",
114        "\t  - limitInlet.v\\_x = $vector<double>(1,0)$;\n",
115        "\t  - limitInlet.v\\_y = $vector<double>(1,0)$;\n",
116        "\t  - limitInlet.v\\_z = $vector<double>(1,0)$; \n",
117        "\n",
118        "     + For [DriftModel](../Models/inc/DriftModel.hxx) (3D case):\n",
119        "\t  - limitInlet.c=0;\t\n",
120        "\t  - limitInlet.T = 600;\t\n",
121        "\t  - limitInlet.v\\_x = $vector<double>(1,0)$;\n",
122        "\t  - limitInlet.v\\_y = $vector<double>(1,0)$;\n",
123        "\t  - limitInlet.v\\_z = $vector<double>(1,0)$;\n",
124        "\n",
125        "     + For [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx) Model (3D case):\t\n",
126        "\t  - limitInlet.alpha=0;\t\n",
127        "\t  - limitInlet.v\\_x = $vector<double>(2,0)$;\n",
128        "\t  - limitInlet.v\\_y = $vector<double>(2,0)$;\t\n",
129        "\t  - limitInlet.v\\_z = $vector<double>(2,0)$;\n",
130        "\n",
131        "     + For [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx) (3D case): \t\t\n",
132        "\t  - limitInlet.alpha=0;\t\n",
133        "\t  - limitInlet.T = 600;\t\n",
134        "\t  - limitInlet.v\\_x = $vector<double>(2,0)$;\t\n",
135        "\t  - limitInlet.v\\_y = $vector<double>(2,0)$;\t\n",
136        "\t  - limitInlet.v\\_z = $vector<double>(2,0)$; \n",
137        "\n",
138        "     + then boundaryFields['' \\a Inlet'']= limitInlet;\t\n",
139        "\n",
140        "- for an Outlet boundary condition (for fluid models): LimitField limitOutlet; limitOutlet.bcType=Outlet; then\n",
141        "      + For all fluid models ([SinglePhase](../Models/inc/SinglePhase.hxx), [DriftModel](../Models/inc/DriftModel.hxx), [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx), [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx): \t\t\n",
142        "\t  - limitOutlet.p = 155e5;\n",
143        "      + then boundaryFields[''\\a outlet'']= limitOutlet;\n",
144        "      \n",
145        "- for a Wall with friction and/or heat conduction : LimitField limitWall; limitWall.bcType=Wall; then\n",
146        "      + For [SinglePhase](../Models/inc/SinglePhase.hxx) (3D case): \n",
147        "\t  - limitWall.T = 600;\t\n",
148        "\t  - limitWall.v\\_x = $vector<double>(1,0)$;\t\n",
149        "\t  - limitWall.v\\_y = $vector<double>(1,0)$; \t\n",
150        "\t  - limitWall.v\\_z = $vector<double>(1,0)$;\n",
151        "      + For [DriftModel](../Models/inc/DriftModel.hxx) (3D case):\t\t\n",
152        "\t  - limitWall.T = 600;\t\n",
153        "\t  - limitWall.v\\_x = $vector<double>(1,0)$;\t\n",
154        "\t  - limitWall.v\\_y = $vector<double>(1,0)$;\t\n",
155        "\t  - limitWall.v\\_z = $vector<double>(1,0)$;\n",
156        "      + For [IsothermalTwoFluid](../Models/inc/IsothermalTwoFluid.hxx) Model (3D case):\t\n",
157        "\t  - limitWall.v\\_x = $vector<double>(2,0)$;\n",
158        "\t  - limitWall.v\\_y = $vector<double>(2,0)$;\n",
159        "\t  - limitWall.v\\_z = $vector<double>(2,0)$;\n",
160        "      + For [FiveEqsTwoFluid](../Models/inc/FiveEqsTwoFluid.hxx) (3D case): \t\t\n",
161        "\t  - limitWall.T = 600;\n",
162        "\t  - limitWall.v\\_x = $vector<double>(2,0)$;\t\n",
163        "\t  - limitWall.v\\_y = $vector<double>(2,0)$;\t\n",
164        "\t  - limitWall.v\\_z = $vector<double>(2,0)$;\t\n",
165        "      + Then boundaryFields['' \\a Wall '']= limitWall;\t\n",
166        "\n",
167        "- for a Dirichlet boundary condition (only for [DiffusionEquation](../Models/inc/DiffusionEquation.hxx)) : LimitField limitDirichlet; limitDirichlet.bcType=Dirichlet; then\n",
168        "  \t- limitDirichlet.T = 600; \n",
169        "\t- boundaryFields['' \\a Dirichlet'']= limitDirichlet; \n",
170        "\n",
171        "\n"
172       ],
173       "text/plain": [
174        "<IPython.core.display.Markdown object>"
175       ]
176      },
177      "metadata": {},
178      "output_type": "display_data"
179     }
180    ],
181    "source": [
182     "from IPython.display import display, Markdown\n",
183     "display(Markdown('functionalities.md'))"
184    ]
185   }
186  ],
187  "metadata": {
188   "kernelspec": {
189    "display_name": "Python 2",
190    "language": "python",
191    "name": "python2"
192   },
193   "language_info": {
194    "codemirror_mode": {
195     "name": "ipython",
196     "version": 2
197    },
198    "file_extension": ".py",
199    "mimetype": "text/x-python",
200    "name": "python",
201    "nbconvert_exporter": "python",
202    "pygments_lexer": "ipython2",
203    "version": "2.7.12"
204   }
205  },
206  "nbformat": 4,
207  "nbformat_minor": 2
208 }