1 #include "DiffusionEquation.hxx"
\r
5 #define PI 3.14159265
\r
7 void power_field_diffusionTest(Field & Phi){
\r
12 Mesh M = Phi.getMesh();
\r
13 int nbCells = M.getNumberOfCells();
\r
14 for (int j = 0; j < nbCells; j++) {
\r
16 Phi(j) = phi*cos(PI*(x-L/2)/(L+lambda));
\r
20 int main(int argc, char** argv)
\r
22 //Preprocessing: mesh and group creation
\r
26 cout << "Building of a 1D mesh with "<<nx<<" cells" << endl;
\r
27 Mesh M(xinf,xsup,nx);
\r
29 M.setGroupAtPlan(xsup,0,eps,"Neumann");
\r
30 M.setGroupAtPlan(xinf,0,eps,"Neumann");
\r
31 int spaceDim = M.getSpaceDimension();
\r
35 double cp_ur=300;//Uranium specific heat
\r
36 double rho_ur=10000;//Uranium density
\r
39 bool FEcalculation=false;
\r
40 DiffusionEquation myProblem(spaceDim,FEcalculation,rho_ur,cp_ur,lambda_ur);
\r
41 Field VV("Solid temperature", CELLS, M, 1);
\r
43 //Set fluid temperature (temperature du fluide)
\r
44 double fluidTemp=573;//fluid mean temperature
\r
45 double heatTransfertCoeff=1000;//fluid/solid exchange coefficient
\r
46 myProblem.setFluidTemperature(fluidTemp);
\r
47 myProblem.setHeatTransfertCoeff(heatTransfertCoeff);
\r
49 Field Phi("Heat power field", CELLS, M, 1);
\r
50 power_field_diffusionTest(Phi);
\r
51 myProblem.setHeatPowerField(Phi);
\r
52 Phi.writeVTK("1DheatPowerField");
\r
54 //Initial field creation
\r
55 Vector VV_Constant(1);
\r
56 VV_Constant(0) = 623;//Rod clad temperature
\r
58 cout << "Building initial data" << endl;
\r
59 myProblem.setInitialFieldConstant(M,VV_Constant);
\r
61 //set the boundary conditions
\r
62 myProblem.setNeumannBoundaryCondition("Neumann");
\r
64 // set the numerical method
\r
65 myProblem.setNumericalScheme(upwind, Explicit);
\r
68 string fileName = "1DRodTemperature_FV";
\r
70 // parameters calculation
\r
71 unsigned MaxNbOfTimeStep =3;
\r
74 double maxTime = 1000000;
\r
75 double precision = 1e-6;
\r
77 myProblem.setCFL(cfl);
\r
78 myProblem.setPrecision(precision);
\r
79 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
\r
80 myProblem.setTimeMax(maxTime);
\r
81 myProblem.setFreqSave(freqSave);
\r
82 myProblem.setFileName(fileName);
\r
84 // set display option to monitor the calculation
\r
85 myProblem.setVerbose( true);
\r
86 //set file saving format
\r
87 myProblem.setSaveFileFormat(CSV);
\r
90 myProblem.initialize();
\r
91 bool ok = myProblem.run();
\r
93 cout << "Simulation "<<fileName<<" is successful !" << endl;
\r
95 cout << "Simulation "<<fileName<<" failed ! " << endl;
\r
97 cout << "------------ End of calculation -----------" << endl;
\r
98 myProblem.terminate();
\r
100 return EXIT_SUCCESS;
\r