1 #include "SinglePhase.hxx"
5 int main(int argc, char** argv)
7 //Preprocessing: mesh and group creation
11 cout << "Building a regular mesh of "<< nx<< " cells " << endl;
14 M.setGroupAtPlan(xsup,0,eps,"Outlet");//Neumann
15 M.setGroupAtPlan(xinf,0,eps,"Inlet");//
16 int spaceDim = M.getSpaceDimension();
18 // set the limit field for each boundary
19 LimitField limitInlet, limitOutlet;
20 map<string, LimitField> boundaryFields;
23 limitInlet.bcType=Inlet;
24 limitInlet.v_x = vector<double>(1,5);
25 boundaryFields["Inlet"] = limitInlet;
27 limitOutlet.bcType=Outlet;
28 limitOutlet.p = 155e5;
29 boundaryFields["Outlet"] = limitOutlet;
31 SinglePhase myProblem(Liquid,around155bars600K,spaceDim);
32 int nbPhase = myProblem.getNumberOfPhases();
33 int nVar = myProblem.getNumberOfVariables();
34 Field VV("Primitive", CELLS, M, nVar);//Field of primitive unknowns
36 // Prepare for the initial condition
37 Vector VV_Constant(nVar);
38 VV_Constant(0) = 155e5;//pression initiale
39 VV_Constant(1) = 5;//vitesse initiale
40 VV_Constant(2) = 573;//temperature initiale
42 cout << "Number of Phases = " << nbPhase << endl;
43 cout << "Construction de la condition initiale ... " << endl;
44 //set the initial field
45 myProblem.setInitialFieldConstant(M,VV_Constant);
47 //set the boundary conditions
48 myProblem.setBoundaryFields(boundaryFields);
52 myProblem.setHeatSource(heatPower);
53 // set the numerical method
54 myProblem.setNumericalScheme(upwind, Explicit);
57 string fileName = "1DHeatedChannel";
59 // parameters calculation
60 unsigned MaxNbOfTimeStep =3;
64 double precision = 1e-7;
66 myProblem.setCFL(cfl);
67 myProblem.setPrecision(precision);
68 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
69 myProblem.setTimeMax(maxTime);
70 myProblem.setFreqSave(freqSave);
71 myProblem.setFileName(fileName);
75 myProblem.initialize();
79 cout << "Simulation "<<fileName<<" is successful !" << endl;
81 cout << "Simulation "<<fileName<<" failed ! " << endl;
83 cout << "------------ End of calculation -----------" << endl;
84 myProblem.terminate();