]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/C/FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx
Salome HOME
Updated GUI documentation
[tools/solverlab.git] / CoreFlows / examples / C / FiveEqsTwoFluid_2DInclinedBoilingChannel.cxx
1 #include "FiveEqsTwoFluid.hxx"
2
3 using namespace std;
4
5 int main(int argc, char** argv)
6 {
7         //Preprocessing: mesh and group creation
8         cout << "Building regular mesh " << endl;
9         double xinf=0.0;
10         double xsup=1.0;
11         double yinf=0.0;
12         double ysup=1.0;
13         int nx=20;
14         int ny=20;
15         Mesh M(xinf,xsup,nx,yinf,ysup,ny);
16         double eps=1.E-6;
17         M.setGroupAtPlan(xsup,0,eps,"Wall");
18         M.setGroupAtPlan(xinf,0,eps,"Wall");
19         M.setGroupAtPlan(yinf,1,eps,"Inlet");
20         M.setGroupAtPlan(ysup,1,eps,"Outlet");
21         int spaceDim = M.getSpaceDimension();
22
23         // physical constants
24         vector<double> gravite(spaceDim,0.) ;
25         gravite[1]=-7;
26         gravite[0]=7;
27
28         // set the limit field for each boundary
29         LimitField limitWall;
30         map<string, LimitField> boundaryFields;
31         limitWall.bcType=Wall;
32         limitWall.T = 563;
33         limitWall.v_x = vector<double>(2,0);
34         limitWall.v_y = vector<double>(2,0);
35         boundaryFields["Wall"]= limitWall;
36
37         LimitField limitInlet;
38         limitInlet.bcType=Inlet;
39         limitInlet.T = 563;
40         limitInlet.alpha = 0;
41         limitInlet.v_x = vector<double>(2,0);
42         limitInlet.v_y = vector<double>(2,1);
43         boundaryFields["Inlet"]= limitInlet;
44
45         LimitField limitOutlet;
46         limitOutlet.bcType=Outlet;
47         limitOutlet.p = 155e5;
48         boundaryFields["Outlet"]= limitOutlet;
49
50         // physical constants
51         double heatPower=1e8;
52
53         FiveEqsTwoFluid  myProblem(around155bars600K,spaceDim);
54         int nbPhase = myProblem.getNumberOfPhases();
55         int nVar = myProblem.getNumberOfVariables();
56         // Prepare for the initial condition
57         Vector VV_Constant(nVar);
58         // constant vector
59         VV_Constant(0) = 0;
60         VV_Constant(1) = 155e5;
61         VV_Constant(2) = 0;
62         VV_Constant(3) = 1;
63         VV_Constant(4) = 0;
64         VV_Constant(5) = 1;
65         VV_Constant(6) = 563;
66
67         //Initial field creation
68         cout << "Building initial data " << endl;
69         myProblem.setInitialFieldConstant(M,VV_Constant);
70
71         //set the boundary conditions
72         myProblem.setBoundaryFields(boundaryFields);
73
74         // set physical parameters
75         myProblem.setHeatSource(heatPower);
76         myProblem.setGravity(gravite);
77
78         // name file save
79         string fileName = "2DInclinedBoilingChannel";
80
81         //numerical parameters
82         myProblem.setNumericalScheme(upwind, Explicit);
83         unsigned MaxNbOfTimeStep = 3 ;
84         int freqSave = 5;
85         double cfl = 0.5;
86         double maxTime = 5;
87         double precision = 1e-6;
88
89         myProblem.setCFL(cfl);
90         myProblem.setPrecision(precision);
91         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
92         myProblem.setTimeMax(maxTime);
93         myProblem.setFreqSave(freqSave);
94         myProblem.setFileName(fileName);
95         myProblem.saveVelocity();
96
97         // evolution
98         myProblem.initialize();
99
100         bool ok = myProblem.run();
101         if (ok)
102                 cout << "Simulation "<<fileName<<" is successful !" << endl;
103         else
104                 cout << "Simulation "<<fileName<<"  failed ! " << endl;
105
106         cout << "------------ End of calculation !!! -----------" << endl;
107         myProblem.terminate();
108
109         return EXIT_SUCCESS;
110 }