1 //============================================================================
3 * \file TransportEquation.hxx
4 * \author Michael NDJINGA
7 * \brief Fluid enthalpy transport equation
9 //============================================================================
11 /*! \class TransportEquation TransportEquation.hxx "TransportEquation.hxx"
12 * \brief Scalar advection equation for a fluid enthalpy
13 * \details see \ref TransportEqPage for more details
15 #ifndef TransportEquation_HXX_
16 #define TransportEquation_HXX_
18 #include "ProblemCoreFlows.hxx"
24 /*! The fluid type can be LiquidPhase or water */
27 LiquidPhase,/**< Fluid considered is GasPhase */
28 GasPhase/**< Fluid considered is Gas */
31 //! enumeration pressureEstimate
32 /*! the pressure estimate needed to fit physical parameters */
33 enum pressureMagnitude
35 around1bar300KTransport,/**< pressure is around 1 bar and temperature around 300K (for TransportEquation, SinglePhase and IsothermalTwoFluid) or 373 K (saturation for DriftModel and FiveEqsTwoFluid) */
36 around155bars600KTransport/**< pressure is around 155 bars and temperature around 618 K (saturation) */
39 //! enumeration BoundaryType
40 /*! Boundary condition type */
41 enum BoundaryTypeTransport {InletTransport, OutletTransport, NeumannTransport, DirichletTransport, NoneBCTransport};//Actually Inlet=Dirichlet and Outlet=Neumann
43 /** \struct LimitField
44 * \brief value of some fields on the boundary */
45 struct LimitFieldTransport{
46 LimitFieldTransport(){bcType=NoneBCTransport; T=0; h=0; flux=0; }
47 LimitFieldTransport(BoundaryTypeTransport _bcType, double _T, double _h,double _flux ){
48 bcType=_bcType; T=_T; h=_h; flux=_flux;
51 BoundaryTypeTransport bcType;
52 double T; //for inlet or Dirichlet
53 double h; //for inlet or Dirichlet
54 double flux; //for Neumann or outlet
57 class TransportEquation: public ProblemCoreFlows
61 /** \fn TransportEquation
62 * \brief Constructor for the enthalpy transport in a fluid
63 * \param [in] phase : \ref Liquid or \ref Gas
64 * \param [in] pressureMagnitude : \ref around1bar or \ref around155bars
65 * \param [in] vector<double> : fluid velocity (assumed constant)
67 TransportEquation(phase fluid, pressureMagnitude pEstimate,vector<double> vitesseTransport);
70 virtual void initialize();
71 virtual void terminate();//vide la mémoire et enregistre le résultat final
72 bool initTimeStep(double dt);
73 double computeTimeStep(bool & stop);//propose un pas de temps pour le calcul. Celà nécessite de discrétiser les opérateur (convection, diffusion, sources) et pour chacun d'employer la condition cfl. En cas de problème durant ce calcul (exemple t=tmax), renvoie stop=true
74 void abortTimeStep();//efface les inconnues calculées par solveTimeStep() et reinitialise dt à 0
75 bool iterateTimeStep(bool &ok);
77 virtual void validateTimeStep();
79 /* Boundary conditions */
80 /** \fn setIntletBoundaryCondition
81 * \brief adds a new boundary condition of type Inlet
83 * \param [in] string : the name of the boundary
84 * \param [in] double : the value of the temperature at the boundary
87 void setInletBoundaryCondition(string groupName,double enthalpy){
88 _limitField[groupName]=LimitFieldTransport(InletTransport,-1,enthalpy,-1);
91 /** \fn setNeumannBoundaryCondition
92 * \brief adds a new boundary condition of type Neumann
94 * \param [in] string the name of the boundary
97 void setNeumannBoundaryCondition(string groupName, double flux=0){
98 _limitField[groupName]=LimitFieldTransport(NeumannTransport,-1,flux,-1);
101 /** \fn setBoundaryFields
102 * \brief met à jour _limitField ( le type de condition limite )
107 void setBoundaryFields(map<string, LimitFieldTransport> boundaryFields){
108 _limitField = boundaryFields;
112 /*Physical parameters*/
113 void setLiqSatEnthalpy(double hsatl){
116 void setVapSatEnthalpy(double hsatv){
119 void setLiqSatDensity(double rhosatl){
122 void setVapSatDensity(double rhosatv){
125 void setTransportVelocity(Vector v){
129 //get output fields for postprocessing or coupling
130 vector<string> getOutputFieldsNames() ;//liste tous les champs que peut fournir le code pour le postraitement
131 Field& getOutputField(const string& nameField );//Renvoie un champs pour le postraitement
133 Field& getFluidTemperatureField(){
137 Field& getEnthalpyField(){
141 /** \fn getTimeScheme
142 * \brief returns the time scheme name
144 * \param [out] enum TimeScheme (explicit or implicit)
146 TimeScheme getTimeScheme();
149 double computeTransportMatrix();
151 void updatePrimitives();
152 double temperature(double h){
153 return _Tref+(h-_href)/_cpref;
155 double voidFraction(double h){
156 double titre=(h-_href)/(_hsatv-_hsatl);
161 else return titre*_rhosatl/(titre*_rhosatl+(1-titre)*_rhosatv);
163 double density(double alpha){
164 return alpha*_rhosatv+(1-alpha)*_rhosatl;
167 Field _TT, _Alpha, _Rho;//Fields of temperature and coupled temperature
168 double _rhosatv, _rhosatl;
169 double _Tref, _href, _cpref;
170 Vector _vitesseTransport, _normale;
171 bool _transportMatrixSet;
172 Vec _Hn, _deltaH, _Hk, _Hkm1, _b0;
173 double _dt_transport, _dt_src;
175 map<string, LimitFieldTransport> _limitField;
178 #endif /* TransportEquation_HXX_ */