1 #include "FiveEqsTwoFluid.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 map<string, LimitField> boundaryFields;
22 limitNeumann.bcType=Neumann;
24 limitNeumann.p = 155e5;
25 limitNeumann.alpha = 0;
26 limitNeumann.v_x = vector<double>(2,0);
27 limitNeumann.v_y = vector<double>(2,0);
28 limitNeumann.v_z = vector<double>(2,0);
29 boundaryFields["Neumann"] = limitNeumann;
31 FiveEqsTwoFluid myProblem(around155bars600K,spaceDim);
32 int nbPhase = myProblem.getNumberOfPhases();
33 int nVar = myProblem.getNumberOfVariables();
34 Field VV("Primitive", CELLS, M, nVar);
36 // Prepare for the initial condition
37 Vector VV_Left(nVar),VV_Right(nVar);
38 double discontinuity = (xinf+xsup)/2.;
40 VV_Left(0) = 0.5; VV_Right(0) = 0.2;
41 VV_Left(1) = 155e5; VV_Right(1) = 155e5;
42 for (int idim=0; idim<spaceDim;idim++){
43 VV_Left(2+idim) = 1;VV_Right(2+idim) = 1;
44 VV_Left(2+idim +spaceDim) =1;VV_Right(2+idim +spaceDim) = 1;
46 VV_Left(2+spaceDim*nbPhase) = 618;
47 VV_Right(2+spaceDim*nbPhase) = 618;
49 //Initial field creation
50 cout << "Building initial data" << endl;
51 myProblem.setInitialFieldStepFunction(M,VV_Left,VV_Right,discontinuity);
53 //set the boundary fields
54 myProblem.setBoundaryFields(boundaryFields);
56 // set the numerical method
57 myProblem.setNumericalScheme(upwind, Explicit);
59 // name of result file
60 string fileName = "RiemannProblem";
62 // simuulation parameters
63 unsigned MaxNbOfTimeStep =3;
67 double precision = 1e-6;
69 myProblem.setCFL(cfl);
70 myProblem.setPrecision(precision);
71 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
72 myProblem.setTimeMax(maxTime);
73 myProblem.setFreqSave(freqSave);
74 myProblem.setFileName(fileName);
76 // set display options to monitor the calculation
77 myProblem.setVerbose( true);
78 myProblem.saveConservativeField(true);
81 myProblem.initialize();
83 bool ok = myProblem.run();
85 cout << "Simulation "<<fileName<<" is successful !" << endl;
87 cout << "Simulation "<<fileName<<" failed ! " << endl;
89 cout << "------------ End of calculation -----------" << endl;
90 myProblem.terminate();