1 #include "DriftModel.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;
22 boundaryFields["Neumann"] = limitNeumann;
24 DriftModel myProblem(around155bars600K,spaceDim);
25 int nbPhase = myProblem.getNumberOfPhases();
26 int nVar = myProblem.getNumberOfVariables();
27 Field VV("Primitive", CELLS, M, nVar);//3+spaceDim*nbPhase
29 // Prepare for the initial condition
30 Vector VV_Left(nVar),VV_Right(nVar);
31 double discontinuity = (xinf+xsup)/2.;
32 VV_Left(0) = 0.5; VV_Right(0) = 0.2;
33 VV_Left(1) = 155e5; VV_Right(1) = 155e5;
34 for (int idim=0; idim<spaceDim;idim++){
35 VV_Left(2+idim) = 1;VV_Right(2+idim) = 1;
37 VV_Left(2+spaceDim) = 573;
38 VV_Right(2+spaceDim) = 618;
40 //Initial field creation
41 cout << "Building initial data" << endl;
42 myProblem.setInitialFieldStepFunction(M,VV_Left,VV_Right,discontinuity);
44 //set the boundary fields
45 myProblem.setBoundaryFields(boundaryFields);
47 // set the numerical method
48 myProblem.setNumericalScheme(upwind, Explicit);
51 string fileName = "RiemannProblem";
53 //numerical parameters
54 unsigned MaxNbOfTimeStep =3 ;
58 double precision = 1e-6;
60 myProblem.setCFL(cfl);
61 myProblem.setPrecision(precision);
62 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
63 myProblem.setTimeMax(maxTime);
64 myProblem.setFreqSave(freqSave);
65 myProblem.setFileName(fileName);
67 // set display option to monitor the calculation
68 myProblem.setVerbose( true);
69 myProblem.saveConservativeField(true);
72 myProblem.initialize();
74 bool ok = myProblem.run();
76 cout << "Simulation "<<fileName<<" is successful !" << endl;
78 cout << "Simulation "<<fileName<<" failed ! " << endl;
80 cout << "------------ End of calculation -----------" << endl;
81 myProblem.terminate();