Salome HOME
Updated GUI documentation
[tools/solverlab.git] / CoreFlows / Models / inc / TransportEquation.hxx
index 6f17e7f46c91d7e362f5eb9c201ecd6aaf1263be..d1dd186d625fee3a25df24ae4527a351da478539 100755 (executable)
 using namespace std;
 
 
-//! enumeration phase
-/*! The fluid type can be LiquidPhase or water  */
-enum phase
-{
-       LiquidPhase,/**< Fluid considered is GasPhase */
-       GasPhase/**< Fluid considered is Gas */
-};
-
-//! enumeration pressureEstimate
-/*! the pressure estimate needed to fit physical parameters  */
-enum pressureMagnitude
-{
-       around1bar300KTransport,/**< pressure is around 1 bar and temperature around 300K (for TransportEquation, SinglePhase and IsothermalTwoFluid) or 373 K (saturation for DriftModel and FiveEqsTwoFluid) */
-       around155bars600KTransport/**< pressure is around 155 bars  and temperature around 618 K (saturation) */
-};
-
 //! enumeration BoundaryType
 /*! Boundary condition type  */
 enum BoundaryTypeTransport     {InletTransport,  OutletTransport, NeumannTransport, DirichletTransport, NoneBCTransport};//Actually Inlet=Dirichlet and Outlet=Neumann
 
+//! enumeration phaseType
+/*! The material phase can be Solid, Gas or liquid  */
+enum FluidMaterial
+{
+       Air,/**< Material considered is air */
+       Water/**< Material considered is water */
+};
+
 /** \struct LimitField
  * \brief value of some fields on the boundary  */
 struct LimitFieldTransport{
@@ -61,10 +53,10 @@ public :
        /** \fn TransportEquation
                         * \brief Constructor for the enthalpy transport in a fluid
                         * \param [in] phase : \ref Liquid or \ref Gas
-                        * \param [in] pressureMagnitude : \ref around1bar or \ref around155bars
+                        * \param [in] pressureEstimate : \ref around1bar or \ref around155bars
                         * \param [in] vector<double> : fluid velocity (assumed constant)
                         *  */
-       TransportEquation(phase fluid, pressureMagnitude pEstimate,vector<double> vitesseTransport, MPI_Comm comm = MPI_COMM_WORLD);
+       TransportEquation(FluidMaterial fluid, pressureEstimate pEstimate,vector<double> vitesseTransport, MPI_Comm comm = MPI_COMM_WORLD);
 
        //Gestion du calcul
        virtual void initialize();
@@ -77,25 +69,74 @@ public :
        virtual void validateTimeStep();
 
        /* Boundary conditions */
-       /** \fn setIntletBoundaryCondition
+       /** \fn setIntletBoundaryCondition 
                         * \brief adds a new boundary condition of type Inlet
-                        * \details
+                        * \details same as setDirichletBoundaryCondition
                         * \param [in] string : the name of the boundary
-                        * \param [in] double : the value of the temperature at the boundary
+                        * \param [in] double : the value of the enthalpy at the boundary
                         * \param [out] void
                         *  */
        void setInletBoundaryCondition(string groupName,double enthalpy){
                _limitField[groupName]=LimitFieldTransport(InletTransport,-1,enthalpy,-1);
        };
+       /** \fn setDirichletBoundaryCondition 
+                        * \brief adds a new boundary condition of type Dirichlet
+                        * \details same as setInletBoundaryCondition
+                        * \param [in] string : the name of the boundary
+                        * \param [in] double : the value of the enthalpy at the boundary
+                        * \param [out] void
+                        *  */
+       void setDirichletBoundaryCondition(string groupName,double enthalpy){
+               _limitField[groupName]=LimitFieldTransport(DirichletTransport,-1,enthalpy,-1);
+       };
+       /** \fn setDirichletBoundaryCondition
+                        * \brief adds a new boundary condition of type Inlet
+                        * \details Reads the boundary field in a med file
+                        * \param [in] string : the name of the boundary
+                        * \param [in] string : the file name
+                        * \param [in] string : the field name
+                        * \param [in] int : the time step number
+                        * \param [in] int : int corresponding to the enum CELLS or NODES
+                        * \param [out] void
+                        *  */
+       void setDirichletBoundaryCondition(string groupName, string fileName, string fieldName, int timeStepNumber, int order, int meshLevel, int field_support_type);
+       void setDirichletBoundaryCondition(string groupName, Field bc_field){
+               _limitField[groupName]=LimitFieldTransport(DirichletTransport, -1, 0, -1);
+       };
 
-       /** \fn setNeumannBoundaryCondition
+       /** \fn setNeumannBoundaryCondition 
         * \brief adds a new boundary condition of type Neumann
-        * \details
+        * \details same as setOutletBoundaryCondition
         * \param [in] string the name of the boundary
+        * \param [in] double : the value of the enthalpy flux at the boundary
         * \param [out] void
         *  */
        void setNeumannBoundaryCondition(string groupName, double flux=0){
-               _limitField[groupName]=LimitFieldTransport(NeumannTransport,-1,flux,-1);
+               _limitField[groupName]=LimitFieldTransport(NeumannTransport,-1,-1,flux);
+       };
+       /** \fn setOutletBoundaryCondition 
+        * \brief adds a new boundary condition of type Outlet
+        * \details same as setNeumannBoundaryCondition
+        * \param [in] string the name of the boundary
+        * \param [in] double : the value of the enthalpy flux at the boundary
+        * \param [out] void
+        *  */
+       void setOutletBoundaryCondition(string groupName, double flux=0){
+               _limitField[groupName]=LimitFieldTransport(OutletTransport,-1,-1,flux);
+       };
+       /** \fn setNeumannBoundaryCondition
+                        * \brief adds a new boundary condition of type Neumann
+                        * \details Reads the boundary field in a med file
+                        * \param [in] string : the name of the boundary
+                        * \param [in] string : the file name
+                        * \param [in] string : the field name
+                        * \param [in] int : the time step number
+                        * \param [in] int : int corresponding to the enum CELLS or NODES 
+                        * \param [out] void
+                        *  */
+       void setNeumannBoundaryCondition(string groupName, string fileName, string fieldName, int timeStepNumber, int order, int meshLevel, int field_support_type);
+       void setNeumannBoundaryCondition(string groupName, Field bc_field){
+               _limitField[groupName]=LimitFieldTransport(NeumannTransport,-1,-1, 0);
        };
 
        /** \fn setBoundaryFields
@@ -126,7 +167,40 @@ public :
                _vitesseTransport=v;
        };
 
-       //get output fields for postprocessing or coupling
+       /* set input fields to prepare the simulation */
+       vector<string> getInputFieldsNames();
+       void setInputField(const string& nameField, Field& inputField );//supply of a required input field
+       
+       /** \fn setRodTemperatureField
+        * \brief Set the rod temperature field
+        * \details
+        * \param [in] Field
+        * \param [out] void
+        *  */
+       void setRodTemperatureField(Field rodTemperature);
+
+       /** \fn setRodTemperature 
+        * \brief Set a constant rod temperature field
+        * \details
+        * \param [in] double
+        * \param [out] void
+        *  */
+       void setRodTemperature(double rodTemp){
+               _rodTemperature=rodTemp;
+               _isStationary=false;//Source term may be changed after previously reaching a stationary state
+       }
+
+       /** \fn getRodTemperatureField
+        * \brief
+        * \details
+        * \param [in] void
+        * \param [out] Field
+        *  */
+       Field& getRodTemperatureField(){ // ?? je ne retrouve pas cet attribut dans le file.cxx
+               return _rodTemperatureField;
+       }
+
+       /* get output fields for postprocessing or coupling */
        vector<string> getOutputFieldsNames() ;//liste tous les champs que peut fournir le code pour le postraitement
        Field&         getOutputField(const string& nameField );//Renvoie un champs pour le postraitement
 
@@ -138,10 +212,24 @@ public :
                return _VV;
        }
 
+       Field& getVoidFractionField(){
+               return _Alpha;
+       }
+
+       Field& getDensityField(){
+               return _Rho;
+       }
+
 protected :
        double computeTransportMatrix();
        double computeRHS();
        void updatePrimitives();
+
+       /* Postprocessing fields */
+       Field   _TT, _Alpha, _Rho;//Fields of temperature, void fraction, density. Unknown field is enthalpy (_VV)
+       double _rhosatv, _rhosatl;
+       double _Tref, _href, _cpref;
+
        double temperature(double h){
                return _Tref+(h-_href)/_cpref;
        };
@@ -157,15 +245,18 @@ protected :
                return alpha*_rhosatv+(1-alpha)*_rhosatl;
        };
 
-       Field   _TT, _Alpha, _Rho;//Fields of temperature and coupled temperature
-       double _rhosatv, _rhosatl;
-       double _Tref, _href, _cpref;
        Vector _vitesseTransport, _normale;
        bool _transportMatrixSet;
        Vec _Hn, _deltaH, _Hk, _Hkm1, _b0;
+       Vec _Hn_seq; // Local sequential copy of the parallel vector _Hn, used for saving result files
        double _dt_transport, _dt_src;
 
        map<string, LimitFieldTransport> _limitField;
+       
+       /* source terms */
+       bool   _rodTemperatureFieldSet;
+       Field  _rodTemperatureField;
+       double _rodTemperature;
 };
 
 #endif /* TransportEquation_HXX_ */