From: michael Date: Thu, 13 Jan 2022 17:05:55 +0000 (+0100) Subject: Updated documentation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=587806228fa8056f4c15660c52387fd2234509dc;p=tools%2Fsolverlab.git Updated documentation --- diff --git a/CoreFlows/Models/inc/DiffusionEquation.hxx b/CoreFlows/Models/inc/DiffusionEquation.hxx index 16e24c5..0ff4817 100755 --- a/CoreFlows/Models/inc/DiffusionEquation.hxx +++ b/CoreFlows/Models/inc/DiffusionEquation.hxx @@ -78,6 +78,20 @@ public : void setDirichletBoundaryCondition(string groupName,double Temperature=0){ _limitField[groupName]=LimitFieldDiffusion(DirichletDiffusion,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]=LimitFieldDiffusion(DirichletDiffusion,0,-1);//This line will be deleted when variable BC are properly treated in solverlab + } /** \fn setNeumannBoundaryCondition * \brief adds a new boundary condition of type Neumann * \details @@ -87,7 +101,20 @@ public : void setNeumannBoundaryCondition(string groupName, double normalFlux=0){ _limitField[groupName]=LimitFieldDiffusion(NeumannDiffusion,-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]=LimitFieldDiffusion(NeumannDiffusion,-1, 0);//This line will be deleted when variable BC are properly treated in solverlab + }; void setDirichletValues(map< int, double> dirichletBoundaryValues); void setNeumannValues(map< int, double> neumannBoundaryValues); @@ -155,6 +182,6 @@ protected : bool _neumannValuesSet; std::map< int, double> _dirichletBoundaryValues; std::map< int, double> _neumannBoundaryValues; - }; +}; #endif /* DiffusionEquation_HXX_ */ diff --git a/CoreFlows/Models/src/DiffusionEquation.cxx b/CoreFlows/Models/src/DiffusionEquation.cxx index f769870..549cc2c 100755 --- a/CoreFlows/Models/src/DiffusionEquation.cxx +++ b/CoreFlows/Models/src/DiffusionEquation.cxx @@ -266,39 +266,8 @@ void DiffusionEquation::initialize() VecCreateSeq(PETSC_COMM_SELF, _globalNbUnknowns, &_Tn_seq);//For saving results on proc 0 VecScatterCreateToZero(_Tn,&_scat,&_Tn_seq); - //Linear solver - KSPCreate(PETSC_COMM_WORLD, &_ksp); - KSPSetType(_ksp, _ksptype); - KSPGetPC(_ksp, &_pc); - if(_mpi_size==1 ) - PCSetType(_pc, _pctype); - else - { - PCSetType(_pc, PCBJACOBI);//Global preconditioner is block jacobi - if(_pctype != (char*)&PCILU)//Default pc type is ilu - { - PetscOptionsSetValue(NULL,"-sub_pc_type ",_pctype); - PetscOptionsSetValue(NULL,"-sub_ksp_type ","preonly"); - //If the above setvalue does not work, try the following - /* - KSPSetUp(_ksp);//to set the block Jacobi data structures (including creation of an internal KSP context for each block) - KSP * subKSP; - PC subpc; - int nlocal;//nb local blocs (should equal 1) - PCBJacobiGetSubKSP(_pc,&nlocal,NULL,&subKSP); - if(nlocal==1) - { - KSPSetType(subKSP[0], KSPPREONLY);//local block solver is same as global - KSPGetPC(subKSP[0],&subpc); - PCSetType(subpc,_pctype); - } - else - throw CdmathException("PC Block Jacobi, more than one block in this processor!!"); - */ - } - } - KSPSetTolerances(_ksp,_precision,_precision,PETSC_DEFAULT,_maxPetscIts); - + createKSP(); + _initializedMemory=true; save();//save initial data } @@ -938,3 +907,61 @@ DiffusionEquation::setFluidTemperatureField(Field coupledTemperatureField){ _fluidTemperatureField=coupledTemperatureField; _fluidTemperatureFieldSet=true; }; + +void +DiffusionEquation::setDirichletBoundaryCondition(string groupName, string fileName, string fieldName, int timeStepNumber, int order, int meshLevel, int field_support_type){ + if(_FECalculation && field_support_type != NODES) + cout<<"Warning : finite element simulation should have boundary field on nodes!!! Change parameter field_support_type"<