Salome HOME
Suppressed pre_requis directory
[tools/solverlab.git] / CoreFlows / mainCoreFlows.cxx
1 #include "SinglePhase.hxx"\r
2 #include "DriftModel.hxx"\r
3 #include "FiveEqsTwoFluid.hxx"\r
4 #include "IsothermalTwoFluid.hxx"\r
5 #include "TransportEquation.hxx"\r
6 #include "DiffusionEquation.hxx"\r
7 \r
8 #include <iostream>\r
9 \r
10 using namespace std;\r
11 \r
12 int main()\r
13 {\r
14         int spaceDim = 2;\r
15 \r
16         // set the limit field for each boundary\r
17         double wallVelocityX=0;\r
18         double wallVelocityY=0;\r
19         double wallTemperature=563;\r
20 \r
21         double inletConcentration=0;\r
22         double inletVelocityX=0;\r
23         double inletVelocityY=1;\r
24         double inletTemperature=563;\r
25 \r
26         double outletPressure=155e5;\r
27 \r
28         // physical constants\r
29         vector<double> gravite(spaceDim,0.) ;\r
30         gravite[1]=-8.5;\r
31         gravite[0]=5;\r
32 \r
33         DriftModel  myProblem(around155bars600K,spaceDim);\r
34         int nVar = myProblem.getNumberOfVariables();\r
35 \r
36         //Prepare for the mesh\r
37         double xinf=0.0;\r
38         double xsup=1.0;\r
39         double yinf=0.0;\r
40         double ysup=1.0;\r
41         int nx=2;\r
42         int ny=2;\r
43 \r
44         // Prepare for the initial condition\r
45         vector<double> VV_Constant(nVar);\r
46         // constant vector\r
47         VV_Constant[0] = 0;\r
48         VV_Constant[1] = 155e5;\r
49         VV_Constant[2] = 0;\r
50         VV_Constant[3] = 1;\r
51         VV_Constant[4] = 563;\r
52 \r
53         //Initial field creation\r
54         cout << "Building initial data" << endl;\r
55         myProblem.setVerbose(true);\r
56         myProblem.setInitialFieldConstant(spaceDim,VV_Constant,xinf,xsup,nx,"wall","wall",yinf,ysup,ny,"inlet","outlet");\r
57 \r
58         //set the boundary conditions\r
59         vector<double>pressure_reference_point(2);\r
60         pressure_reference_point[0]=xsup;\r
61         pressure_reference_point[1]=ysup;\r
62         myProblem.setOutletBoundaryCondition("outlet", outletPressure,pressure_reference_point);\r
63         myProblem.setInletBoundaryCondition("inlet", inletTemperature, inletConcentration, inletVelocityX, inletVelocityY);\r
64         myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX, wallVelocityY);\r
65 \r
66         // set physical parameters\r
67         myProblem.setGravity(gravite);\r
68 \r
69         // set the numerical method\r
70         myProblem.setNumericalScheme(staggered, Implicit);\r
71         myProblem.setWellBalancedCorrection(true);\r
72         myProblem.setNonLinearFormulation(VFFC);\r
73 \r
74         // name of result file\r
75         string fileName = "DriftModel_2DInclinedBoilingChannel";\r
76 \r
77         // computation parameters\r
78         unsigned MaxNbOfTimeStep = 1 ;\r
79         int freqSave = 1;\r
80         double cfl = 0.5;\r
81         double maxTime = 5;\r
82         double precision = 1e-4;\r
83 \r
84         myProblem.setCFL(cfl);\r
85         myProblem.setPrecision(precision);\r
86         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);\r
87         myProblem.setTimeMax(maxTime);\r
88         myProblem.setFreqSave(freqSave);\r
89         myProblem.setFileName(fileName);\r
90         myProblem.saveVelocity();\r
91         myProblem.setNewtonSolver(precision,1);\r
92 \r
93         // evolution\r
94         myProblem.initialize();\r
95 \r
96         bool ok = myProblem.run();\r
97         if (ok)\r
98                 cout << "Simulation "<<fileName<<" is successful !" << endl;\r
99         else\r
100                 cout << "Simulation "<<fileName<<"  failed ! " << endl;\r
101 \r
102         cout << "------------ End of calculation !!! -----------" << endl;\r
103         myProblem.terminate();\r
104 \r
105         return ok;\r
106 }\r