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