1 #include "SinglePhase.hxx"
5 int main(int argc, char** argv)
7 /* preprocessing: mesh and group creation */
8 cout << "Loading unstructured mesh for test SinglePhase_2DLidDrivenCavity_unstructured()" << endl;
13 Mesh M("resources/BoxWithMeshWithTriangularCells.med");
15 M.setGroupAtPlan(xsup,0,eps,"wall");
16 M.setGroupAtPlan(xinf,0,eps,"wall");
17 M.setGroupAtPlan(yinf,1,eps,"wall");
18 M.setGroupAtPlan(ysup,1,eps,"MovingWall");
19 int spaceDim = M.getSpaceDimension();
22 vector<double> viscosite(1) ;
25 /* set the limit field for each boundary*/
27 map<string, LimitField> boundaryFields;
28 limitWall.bcType=Wall;
31 limitWall.v_x = vector<double>(1,0);
32 limitWall.v_y = vector<double>(1,0);
33 limitWall.v_z = vector<double>(1,0);
34 boundaryFields["wall"]= limitWall;
36 LimitField limitMovingWall;
37 limitMovingWall.bcType=Wall;
38 limitMovingWall.T = 273;
39 limitMovingWall.p = 1e5;
40 limitMovingWall.v_x = vector<double>(1,1);
41 limitMovingWall.v_y = vector<double>(1,0);
42 limitMovingWall.v_z = vector<double>(1,0);
43 boundaryFields["MovingWall"]= limitMovingWall;
46 SinglePhase myProblem(Liquid,around1bar300K,spaceDim);
47 int nbPhase = myProblem.getNumberOfPhases();
48 // Prepare for the initial condition
49 int nVar = myProblem.getNumberOfVariables();
50 Vector VV_Constant(nVar);
57 //Initial field creation
58 cout << "Setting initial data " << endl;
59 myProblem.setInitialFieldConstant(M,VV_Constant);
61 //set the boundary conditions
62 myProblem.setBoundaryFields(boundaryFields);
64 // physical parameters
65 myProblem.setViscosity(viscosite);
67 // set the numerical method
68 myProblem.setNumericalScheme(upwind, Implicit);
70 // set the Petsc resolution
71 myProblem.setLinearSolver(GMRES,ILU,true);
74 string fileName = "2DLidDrivenCavity_unstructured";
76 // parameters calculation
77 unsigned MaxNbOfTimeStep = 3 ;
81 double precision = 1e-8;
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,20);
90 myProblem.saveVelocity();
93 myProblem.initialize();
95 bool ok = myProblem.run();
97 cout << "Simulation "<<fileName<<" is successful !" << endl;
99 cout << "Simulation "<<fileName<<" failed ! " << endl;
101 cout << "------------ End of calculation !!! -----------" << endl;
102 myProblem.terminate();