1 #include "SinglePhase.hxx"
5 int main(int argc, char** argv)
7 /*Preprocessing: mesh and group creation*/
12 cout << "Loading unstuctured mesh for test SinglePhase_2DHeatDrivenCavity_unstructured" << endl;
13 Mesh M("resources/BoxWithMeshWithTriangularCells.med");
15 M.setGroupAtPlan(xinf,0,eps,"coldWall");
16 M.setGroupAtPlan(xsup,0,eps,"hotWall");
17 M.setGroupAtPlan(yinf,1,eps,"coldWall");
18 M.setGroupAtPlan(ysup,1,eps,"hotWall");
19 int spaceDim = M.getSpaceDimension();
22 vector<double> viscosite(1), conductivite(1);
23 viscosite[0]= 8.85e-5;
24 conductivite[0]=1000;//transfert de chaleur du à l'ébullition en paroi.
25 vector<double> gravite(spaceDim,0.) ;
29 // set the limit field for each boundary
30 LimitField limitColdWall, limitHotWall;
31 map<string, LimitField> boundaryFields;
32 limitColdWall.bcType=Wall;
33 limitColdWall.T = 590;//Temperature de la parois froide
34 limitColdWall.v_x = vector<double>(1,0);
35 limitColdWall.v_y = vector<double>(1,0);
36 boundaryFields["coldWall"]= limitColdWall;
38 limitHotWall.bcType=Wall;
39 limitHotWall.T = 560;//Temperature des parois chauffantes
40 limitHotWall.v_x = vector<double>(1,0);
41 limitHotWall.v_y = vector<double>(1,0);
42 boundaryFields["hotWall"]= limitHotWall;
44 SinglePhase myProblem(Liquid,around155bars600K,spaceDim);
45 int nVar = myProblem.getNumberOfVariables();
47 //Initial field creation
48 cout << "Construction de la condition initiale" << endl;
49 /* First case constant initial data */
50 Vector VV_Constant(nVar);
52 VV_Constant(0) = 155e5;
57 myProblem.setInitialFieldConstant(M,VV_Constant);
59 //set the boundary conditions
60 myProblem.setBoundaryFields(boundaryFields);
62 // physical parameters
63 myProblem.setViscosity(viscosite);
64 myProblem.setConductivity(conductivite);
65 myProblem.setGravity(gravite);
67 // set the numerical method
68 myProblem.setNumericalScheme(upwind, Implicit);
70 // set the Petsc resolution
71 myProblem.setLinearSolver(GMRES,ILU,true);
74 string fileName = "2DHeatDrivenCavity_unstructured";
76 // parameters calculation
77 unsigned MaxNbOfTimeStep = 3;
81 double precision = 1e-7;
83 myProblem.setCFL(cfl);
84 myProblem.setPrecision(precision);
85 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
86 myProblem.setTimeMax(maxTime);
87 myProblem.setFreqSave(freqSave);
88 myProblem.setFileName(fileName);
89 myProblem.setNewtonSolver(precision,50);
90 myProblem.saveVelocity();
93 myProblem.initialize();
94 bool ok = myProblem.run();
96 cout << "Simulation "<<fileName<<" is successful !" << endl;
98 cout << "Simulation "<<fileName<<" failed ! " << endl;
100 cout << "------------ End of calculation !!! -----------" << endl;
102 myProblem.terminate();