1 #include "DriftModel.hxx"
5 int main(int argc, char** argv)
7 //setting mesh and groups
8 cout << "Building a regular grid " << endl;
17 M.setGroupAtPlan(xsup,0,eps,"Outlet");
18 M.setGroupAtPlan(xinf,0,eps,"Inlet");
19 int spaceDim = M.getSpaceDimension();
21 // setting boundary conditions
23 double inletVelocityX=1;
24 double inletTemperature=565;
25 double outletPressure=155e5;
27 // setting physical parameters
28 Field heatPowerField=Field("heatPowerField",CELLS, M, 1);
29 int nbCells=M.getNumberOfCells();
31 for(int i=0;i<nbCells;i++){
32 double x=M.getCell(i).x();
34 if (x> xinfcore && x< xsupcore)
35 heatPowerField[i]=1e8;
39 heatPowerField.writeVTK("heatPowerField",true);
41 DriftModel myProblem(around155bars600K,spaceDim);
42 int nbPhase = myProblem.getNumberOfPhases();
43 int nVar = myProblem.getNumberOfVariables();
44 Field VV("Primitive", CELLS, M, nVar);
46 // Prepare for the initial condition
47 Vector VV_Constant(nVar);
50 VV_Constant(1) = 155e5;
51 for (int idim=0; idim<spaceDim;idim++)
52 VV_Constant(2+idim) = 1;
53 VV_Constant(nVar-1) = 565;
55 //Initial field creation
56 cout << "Building initial field " << endl;
57 myProblem.setInitialFieldConstant( M, VV_Constant);
59 //set the boundary conditions
60 myProblem.setInletBoundaryCondition("Inlet",inletTemperature,inletConc,inletVelocityX);
61 myProblem.setOutletBoundaryCondition("Outlet", outletPressure,vector<double>(1,xsup));
63 // physical parameters
64 myProblem.setHeatPowerField(heatPowerField);
67 // set the numerical method
68 myProblem.setNumericalScheme(upwind, Explicit);
69 myProblem.setWellBalancedCorrection(true);
71 // name the result file
72 string fileName = "DriftModel1DBoilingAssembly";
74 // setting numerical parameters
75 unsigned MaxNbOfTimeStep =3 ;
79 double precision = 1e-7;
81 myProblem.setCFL(cfl);
82 myProblem.setPrecision(precision);
83 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
84 myProblem.setTimeMax(maxTime);
85 myProblem.setFreqSave(freqSave);
86 myProblem.setFileName(fileName);
87 myProblem.saveAllFields(true);
91 myProblem.initialize();
95 cout << "Simulation "<<fileName<<" is successful !" << endl;
97 cout << "Simulation "<<fileName<<" failed ! " << endl;
99 cout << "------------ End of calculation -----------" << endl;
100 myProblem.terminate();