Salome HOME
Tested mesh fast equivalence when giving an input field
[tools/solverlab.git] / CoreFlows / Models / inc / StationaryDiffusionEquation.hxx
index 7810a39d3cd48eaf8d428abedeeb8d8d6ae99d48..f0c1568618a65ca6179cb942d091071d6685ce3d 100755 (executable)
@@ -50,14 +50,13 @@ public :
                         * \param [in] double : solid conductivity
                         *  */
 
-       StationaryDiffusionEquation( int dim,bool FECalculation=true,double lambda=1);
+       StationaryDiffusionEquation( int dim,bool FECalculation=true,double lambda=1,MPI_Comm comm = MPI_COMM_WORLD);
 
     void setMesh(const Mesh &M);
     void setFileName(string fileName){
        _fileName = fileName;
     }
     bool solveStationaryProblem();
-    Field getOutputTemperatureField();
     
     //Linear system and spectrum
     void setLinearSolver(linearSolver kspType, preconditioner pcType);
@@ -106,33 +105,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 +133,36 @@ 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
+        * \details
+        * \param [in] bool
+        * \param [in] bool
+        * \param [out] void
+        *  */
+       void setVerbose(bool verbose,  bool system=false)
+       {
+               _verbose = verbose;
+               _system = system;
+       };
 
 protected :
        //Main unknown field
@@ -187,6 +205,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
@@ -205,6 +225,7 @@ protected :
 
        double computeRHS(bool & stop);
        double computeDiffusionMatrixFV(bool & stop);
+       double computeDiffusionMatrixFE(bool & stop);
 
     /************ Data for FE calculation *************/
     bool _FECalculation;
@@ -216,18 +237,18 @@ protected :
     std::vector< int > _boundaryNodeIds;/* List of boundary nodes */
     std::vector< int > _dirichletNodeIds;/* List of boundary nodes with Dirichlet BC */
 
-    /*********** Functions for finite element method ***********/
-    Vector gradientNodal(Matrix M, vector< double > v);//gradient of nodal shape functions
-       double computeDiffusionMatrixFE(bool & stop);
-    static int fact(int n);
-    static int unknownNodeIndex(int globalIndex, std::vector< int > dirichletNodes);
-    static int globalNodeIndex(int unknownIndex, std::vector< int > dirichletNodes);
-
     /********* Possibility to set a boundary field as DirichletNeumann boundary condition *********/
     bool _dirichletValuesSet;
     bool _neumannValuesSet;
     std::map< int, double> _dirichletBoundaryValues;
     std::map< int, double> _neumannBoundaryValues;
+
+       /**** 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_ */