vector<string> getInputFieldsNames();
void setInputField(const string& nameField, Field& inputField );//supply of a required input field
- void setFluidTemperatureField(Field coupledTemperatureField){
- _fluidTemperatureField=coupledTemperatureField;
- _fluidTemperatureFieldSet=true;
- };
- void setFluidTemperature(double fluidTemperature){
- _fluidTemperature=fluidTemperature;
- }
- Field& getFluidTemperatureField(){
- return _fluidTemperatureField;
- }
+ 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){
- heatPower.getMesh().checkFastEquivalWith(_mesh);
- _heatPowerField=heatPower;
- _heatPowerFieldSet=true;
- }
+ void setHeatPowerField(Field heatPower);
/** \fn setHeatPowerField
* \brief set the heat power field (variable in space)
* \param [in] string fieldName
* \param [out] void
* */
- void setHeatPowerField(string fileName, string fieldName, int iteration = 0, int order = 0, int meshLevel=0){
- _heatPowerField=Field(fileName, CELLS,fieldName, iteration, order, meshLevel);
- _heatPowerField.getMesh().checkFastEquivalWith(_mesh);
- _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
}
MPI_Comm_rank(PETSC_COMM_WORLD,&_mpi_rank);
MPI_Comm_size(PETSC_COMM_WORLD,&_mpi_size);
- PetscPrintf(PETSC_COMM_WORLD,"Simulation on %d processors\n",_mpi_size);//Prints to standard out, only from the first processor in the communicator. Calls from other processes are ignored.
+ PetscPrintf(PETSC_COMM_WORLD,"\n Simulation on %d processors\n",_mpi_size);//Prints to standard out, only from the first processor in the communicator. Calls from other processes are ignored.
PetscSynchronizedPrintf(PETSC_COMM_WORLD,"Processor [%d] ready for action\n",_mpi_rank);//Prints synchronized output from several processors. Output of the first processor is followed by that of the second, etc.
PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
if(lambda < 0.)
{
std::cout<<"Conductivity="<<lambda<<endl;
- throw CdmathException("Error : conductivity parameter lambda cannot be negative");
+ throw CdmathException("!!!!!!!!Error : conductivity parameter lambda cannot be negative");
}
if(dim<=0)
{
std::cout<<"Space dimension="<<dim<<endl;
- throw CdmathException("Error : parameter dim cannot be negative");
+ throw CdmathException("!!!!!!!!Error : parameter dim cannot be negative");
}
_FECalculation=FECalculation;
_DiffusionTensor=Matrix(_Ndim);
for(int idim=0;idim<_Ndim;idim++)
_DiffusionTensor(idim,idim)=_conductivity;
+
+ PetscPrintf(PETSC_COMM_WORLD,"\n Stationary diffusion problem with conductivity %.2f", lambda);
+ if(FECalculation)
+ PetscPrintf(PETSC_COMM_WORLD," and finite elements method\n\n");
+ else
+ PetscPrintf(PETSC_COMM_WORLD," and finite volumes method\n\n");
}
void StationaryDiffusionEquation::initialize()
_runLogFile->open((_fileName+".log").c_str(), ios::out | ios::trunc);;//for creation of a log file to save the history of the simulation
if(!_meshSet)
- throw CdmathException("StationaryDiffusionEquation::initialize() set mesh first");
+ throw CdmathException("!!!!!!!!StationaryDiffusionEquation::initialize() set mesh first");
else
{
- cout<<"!!!! Initialisation of the computation of the temperature diffusion in a solid using ";
- *_runLogFile<<"!!!!! Initialisation of the computation of the temperature diffusion in a solid using ";
+ cout<<"\n Initialisation of the computation of the temperature diffusion in a solid using ";
+ *_runLogFile<<"\n Initialisation of the computation of the temperature diffusion in a solid using ";
if(!_FECalculation)
{
cout<< "Finite volumes method"<<endl<<endl;
if (reason!=2 and reason!=3)
{
PetscPrintf(PETSC_COMM_WORLD,"!!!!!!!!!!!!! Erreur système linéaire : pas de convergence de Petsc.");
- PetscPrintf(PETSC_COMM_WORLD,"!!!!!!!!!!!!! Itérations maximales %d atteintes, résidu = %1.2f, précision demandée= %1.2f",_maxPetscIts,residu,_precision);
+ PetscPrintf(PETSC_COMM_WORLD,"!!!!!!!!!!!!! Itérations maximales %d atteintes, résidu = %1.2e, précision demandée= %1.2e",_maxPetscIts,residu,_precision);
PetscPrintf(PETSC_COMM_WORLD,"Solver used %s, preconditioner %s, Final number of iteration = %d",_ksptype,_pctype,_PetscIts);
*_runLogFile<<"!!!!!!!!!!!!! Erreur système linéaire : pas de convergence de Petsc."<<endl;
*_runLogFile<<"!!!!!!!!!!!!! Itérations maximales "<<_maxPetscIts<<" atteintes, résidu="<<residu<<", précision demandée= "<<_precision<<endl;
else{
if( _MaxIterLinearSolver < _PetscIts)
_MaxIterLinearSolver = _PetscIts;
- PetscPrintf(PETSC_COMM_WORLD,"## Système linéaire résolu en %d itérations par le solveur %s et le preconditioneur %s, précision demandée = %1.2f",_PetscIts,_ksptype,_pctype,_precision);
+ PetscPrintf(PETSC_COMM_WORLD,"## Système linéaire résolu en %d itérations par le solveur %s et le preconditioneur %s, précision demandée = %1.2e",_PetscIts,_ksptype,_pctype,_precision);
*_runLogFile<<"## Système linéaire résolu en "<<_PetscIts<<" itérations par le solveur "<< _ksptype<<" et le preconditioneur "<<_pctype<<", précision demandée= "<<_precision<<endl<<endl;
VecCopy(_Tk, _deltaT);//ici on a deltaT=Tk
VecAXPY(_deltaT, -1, _Tkm1);//On obtient deltaT=Tk-Tkm1
VecNorm(_deltaT,NORM_INFINITY,&_erreur_rel);
if(_verbose)
- PetscPrintf(PETSC_COMM_WORLD,"Fin calcul de la variation relative, erreur maximale : %1.2f", _erreur_rel );
+ PetscPrintf(PETSC_COMM_WORLD,"Fin calcul de la variation relative, erreur maximale : %1.2e", _erreur_rel );
stop=false;
converged = (_erreur_rel <= _precision) ;//converged=convergence des iterations de Newton
}
void
StationaryDiffusionEquation::setInputField(const string& nameField, Field& inputField )
{
+ if(!_meshSet)
+ throw CdmathException("!!!!!!!! StationaryDiffusionEquation::setInputField set the mesh first");
+
if(nameField=="FluidTemperature" || nameField=="FLUIDTEMPERATURE" || nameField=="TemperatureFluide" || nameField=="TEMPERATUREFLUIDE")
return setFluidTemperatureField( inputField) ;
else if(nameField=="HeatPower" || nameField=="HEATPOWER" || nameField=="PuissanceThermique" || nameField=="PUISSANCETHERMIQUE" )
throw CdmathException("StationaryDiffusionEquation::setInputField error : Unknown Field name");
}
}
+
+void
+StationaryDiffusionEquation::setFluidTemperatureField(Field coupledTemperatureField){
+ if(!_meshSet)
+ throw CdmathException("!!!!!!!! StationaryDiffusionEquation::setFluidTemperatureField set initial field first");
+
+ coupledTemperatureField.getMesh().checkFastEquivalWith(_mesh);
+ _fluidTemperatureField=coupledTemperatureField;
+ _fluidTemperatureFieldSet=true;
+};
+
+void
+StationaryDiffusionEquation::setHeatPowerField(Field heatPower){
+ if(!_meshSet)
+ throw CdmathException("!!!!!!!! StationaryDiffusionEquation::setHeatPowerField set initial field first");
+
+ heatPower.getMesh().checkFastEquivalWith(_mesh);
+ _heatPowerField=heatPower;
+ _heatPowerFieldSet=true;
+}
+
+void
+StationaryDiffusionEquation::setHeatPowerField(string fileName, string fieldName, int iteration, int order, int meshLevel){
+ if(!_meshSet)
+ throw CdmathException("!!!!!!!! StationaryDiffusionEquation::setHeatPowerField set initial field first");
+
+ _heatPowerField=Field(fileName, CELLS,fieldName, iteration, order, meshLevel);
+ _heatPowerField.getMesh().checkFastEquivalWith(_mesh);
+ _heatPowerFieldSet=true;
+}