Salome HOME
Some code factoring
[tools/solverlab.git] / CoreFlows / Models / inc / StationaryDiffusionEquation.hxx
index ab0f1c336d279adb365e73b343617604eb189c84..1365b2357bf89fdc3f2a4afcc6fe3918490d1845 100755 (executable)
@@ -57,7 +57,6 @@ public :
        _fileName = fileName;
     }
     bool solveStationaryProblem();
-    Field getOutputTemperatureField();
     
     //Linear system and spectrum
     void setLinearSolver(linearSolver kspType, preconditioner pcType);
@@ -88,6 +87,20 @@ public :
        void setDirichletBoundaryCondition(string groupName,double Temperature){
                _limitField[groupName]=LimitFieldStationaryDiffusion(DirichletStationaryDiffusion,Temperature,-1);
        };
+       /** \fn setDirichletBoundaryCondition
+                        * \brief adds a new boundary condition of type Dirichlet
+                        * \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]=LimitFieldStationaryDiffusion(DirichletStationaryDiffusion, 0, -1);
+       };
 
        /** \fn setNeumannBoundaryCondition
                         * \brief adds a new boundary condition of type Neumann
@@ -99,6 +112,20 @@ public :
        void setNeumannBoundaryCondition(string groupName, double normalFlux=0){
                _limitField[groupName]=LimitFieldStationaryDiffusion(NeumannStationaryDiffusion,-1, normalFlux);
        };
+       /** \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]=LimitFieldStationaryDiffusion(NeumannStationaryDiffusion,-1, 0);
+       };
 
        void setDirichletValues(map< int, double> dirichletBoundaryValues);
        void setNeumannValues  (map< int, double>   neumannBoundaryValues);
@@ -106,33 +133,26 @@ public :
        void setConductivity(double conductivite){
                _conductivity=conductivite;
        };
-       void setFluidTemperatureField(Field coupledTemperatureField){
-               _fluidTemperatureField=coupledTemperatureField;
-               _fluidTemperatureFieldSet=true;
-       };
-       void setFluidTemperature(double fluidTemperature){
-       _fluidTemperature=fluidTemperature;
-       }
-       Field& getRodTemperatureField(){
-               return _VV;
-       }
-       Field& getFluidTemperatureField(){
-               return _fluidTemperatureField;
-       }
        void setDiffusiontensor(Matrix DiffusionTensor){
                _DiffusionTensor=DiffusionTensor;
        };
 
+
+       //get input fields to prepare the simulation or coupling
+       vector<string> getInputFieldsNames();
+       void setInputField(const string& nameField, Field& inputField );//supply of a required input field
+       
+       void setFluidTemperatureField(Field coupledTemperatureField);
+       void setFluidTemperature(double fluidTemperature){      _fluidTemperature=fluidTemperature;     }
+       Field& getFluidTemperatureField(){      return _fluidTemperatureField;  }
+       
        /** \fn setHeatPowerField
         * \brief set the heat power field (variable in space)
         * \details
         * \param [in] Field
         * \param [out] void
         *  */
-       void setHeatPowerField(Field heatPower){
-               _heatPowerField=heatPower;
-               _heatPowerFieldSet=true;
-       }
+       void setHeatPowerField(Field heatPower);
 
        /** \fn setHeatPowerField
         * \brief set the heat power field (variable in space)
@@ -141,10 +161,23 @@ public :
         * \param [in] string fieldName
         * \param [out] void
         *  */
-       void setHeatPowerField(string fileName, string fieldName){
-               _heatPowerField=Field(fileName, CELLS,fieldName);
-               _heatPowerFieldSet=true;
+       void setHeatPowerField(string fileName, string fieldName, int iteration = 0, int order = 0, int meshLevel=0);
+
+       /** \fn getHeatPowerField
+        * \brief returns the heat power field
+        * \details
+        * \param [in] void
+        * \param [out] Field
+        *  */
+       Field getHeatPowerField(){
+               return _heatPowerField;
        }
+       //get output fields names 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
+
+    Field& getOutputTemperatureField();
+       Field& getRodTemperatureField();
 
        /** \fn setVerbose
         * \brief Updates display options
@@ -200,6 +233,8 @@ protected :
        Vector _normale;
        Matrix _DiffusionTensor;
        Vec _deltaT, _Tk, _Tkm1, _b0;
+       Vec _Tk_seq; // Local sequential copy of the parallel vector _Tk, used for saving result files
+
        double _dt_src;
     
        //Heat transfert variables
@@ -236,9 +271,12 @@ protected :
     std::map< int, double> _dirichletBoundaryValues;
     std::map< int, double> _neumannBoundaryValues;
 
-       //MPI variables
-       PetscMPIInt    _size;        /* size of communicator */
-       PetscMPIInt    _rank;        /* processor rank */
+       /**** MPI related variables ***/
+       PetscMPIInt    _mpi_size;        /* size of communicator */
+       PetscMPIInt    _mpi_rank;        /* processor rank */
+       VecScatter _scat;                       /* For the distribution of a local vector */
+       int _globalNbUnknowns, _localNbUnknowns;
+       int _d_nnz, _o_nnz;                     /* local and "non local" numbers of non zeros corfficients */
 };
 
 #endif /* StationaryDiffusionEquation_HXX_ */