1 #include "IsothermalTwoFluid.hxx"
5 int main(int argc, char** argv)
7 //Preprocessing: mesh and group creation
8 cout << "Building Cartesian mesh " << endl;
14 M.setGroupAtPlan(xsup,0,eps,"Neumann");
15 M.setGroupAtPlan(xinf,0,eps,"Neumann");
16 int spaceDim = M.getSpaceDimension();
18 // set the limit field for each boundary
19 LimitField limitNeumann;
20 limitNeumann.bcType=Neumann;
21 map<string, LimitField> boundaryFields;
23 limitNeumann.p = 155e5;
24 limitNeumann.alpha = 0;
25 limitNeumann.v_x = vector<double>(2,0);
26 limitNeumann.v_y = vector<double>(2,0);
27 limitNeumann.v_z = vector<double>(2,0);
28 boundaryFields["Neumann"] = limitNeumann;
30 IsothermalTwoFluid myProblem(around155bars600K,spaceDim);
31 int nbPhase = myProblem.getNumberOfPhases();
32 int nVar = myProblem.getNumberOfVariables();
33 Field VV("Primitive", CELLS, M, nVar);
35 // Prepare for the initial condition
36 Vector VV_Left(nVar),VV_Right(nVar);
37 double discontinuity = (xinf+xsup)/2.;
39 VV_Left(0) = 0.5; VV_Right(0) = 0.2;
40 VV_Left(1) = 155e5; VV_Right(1) = 155e5;
41 for (int idim=0; idim<spaceDim;idim++){
42 VV_Left(2+idim) = 1;VV_Right(2+idim) = 1;
43 VV_Left(2+idim +spaceDim) =2;VV_Right(2+idim +spaceDim) = 1;
46 //Initial field creation
47 cout << "Building initial data" << endl;
49 myProblem.setInitialFieldStepFunction(M,VV_Left,VV_Right,discontinuity);
51 //set the boundary fields
52 myProblem.setBoundaryFields(boundaryFields);
54 // set the numerical method
55 myProblem.setNumericalScheme(upwind, Explicit);
58 string fileName = "RiemannProblem";
60 // parameters calculation
61 unsigned MaxNbOfTimeStep =3 ;
65 double precision = 1e-6;
67 myProblem.setCFL(cfl);
68 myProblem.setPrecision(precision);
69 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
70 myProblem.setTimeMax(maxTime);
71 myProblem.setFreqSave(freqSave);
72 myProblem.setFileName(fileName);
73 myProblem.saveConservativeField(true);
74 myProblem.setSaveFileFormat(MED);
76 /* set display option to monitor the calculation */
77 myProblem.setVerbose( true);
80 myProblem.initialize();
82 bool ok = myProblem.run();
84 cout << "Simulation "<<fileName<<" is successful !" << endl;
86 cout << "Simulation "<<fileName<<" failed ! " << endl;
88 cout << "------------ End of calculation -----------" << endl;
89 myProblem.terminate();