1 #include "SinglePhase.hxx"
5 int main(int argc, char** argv)
7 //Preprocessing: mesh and group creation
8 cout << "Building cartesian mesh " << endl;
15 Mesh M(xinf,xsup,nx,yinf,ysup,ny);
16 int spaceDim = M.getSpaceDimension();
19 vector<double> viscosite(1) ;
22 // set the limit field for each boundary
23 double fixedWallVelocityX=0;
24 double fixedWallVelocityY=0;
25 double fixedWallTemperature=273;
27 double movingWallVelocityX=1;
28 double movingWallVelocityY=0;
29 double movingWallTemperature=273;
32 SinglePhase myProblem(Gas,around1bar300K,spaceDim);
33 // Prepare for the initial condition
34 int nVar = myProblem.getNumberOfVariables();
35 vector<double> VV_Constant(nVar);
43 string fileName = "2DLidDrivenCavityStructuredCentered1bar";
45 //Initial field creation
46 cout << "Building initial data" << endl;
47 myProblem.setInitialFieldConstant(spaceDim,VV_Constant,xinf,xsup,nx,"fixedWall","fixedWall",yinf,ysup,ny,"fixedWall","movingWall");
49 //set the boundary conditions
50 myProblem.setWallBoundaryCondition("fixedWall", fixedWallTemperature, fixedWallVelocityX, fixedWallVelocityY);
51 myProblem.setWallBoundaryCondition("movingWall", movingWallTemperature, movingWallVelocityX, movingWallVelocityY);
53 // physical parameters
54 myProblem.setViscosity(viscosite);
56 // set the numerical method
57 myProblem.setNumericalScheme(staggered, Implicit);
59 // set the Petsc resolution
60 myProblem.setLinearSolver(GMRES,LU,true);
62 //Numerical parameters
63 unsigned MaxNbOfTimeStep = 3 ;
66 double maxTime = 100000;
67 double precision = 1e-9;
69 myProblem.setCFL(cfl);
70 myProblem.setPrecision(precision);
71 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
72 myProblem.setTimeMax(maxTime);
73 myProblem.setFreqSave(freqSave);
74 myProblem.setFileName(fileName);
75 myProblem.setNewtonSolver(precision*1e8,20);
76 myProblem.saveVelocity();
79 myProblem.initialize();
81 bool ok = myProblem.run();
83 cout << "Simulation "<<fileName<<" is successful !" << endl;
85 cout << "Simulation "<<fileName<<" failed ! " << endl;
87 cout << "------------ End of calculation !!! -----------" << endl;
88 myProblem.terminate();