]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/C/IsothermalTwoFluid_1DSedimentation.cxx
Salome HOME
Updated GUI documentation
[tools/solverlab.git] / CoreFlows / examples / C / IsothermalTwoFluid_1DSedimentation.cxx
1 #include "IsothermalTwoFluid.hxx"
2
3 using namespace std;
4
5 int main(int argc, char** argv)
6 {
7         cout << "Building Cartesian mesh " << endl;
8         int spaceDim=1;
9         double xinf=0.0;
10         double xsup=1.0;
11         int nx=50;
12
13         vector<double> wallVelocityX(2,0);
14
15         // physical constants
16         vector<double> gravite(spaceDim,0.) ;
17         gravite[0]=-10;
18
19         IsothermalTwoFluid  myProblem(around1bar300K,spaceDim);
20         int nVar = myProblem.getNumberOfVariables();
21
22         // Prepare for the initial condition
23         vector<double> VV_Constant(nVar,0.);
24         // constant vector
25         VV_Constant[0] = 0.5;
26         VV_Constant[1] = 1e5;
27         VV_Constant[2] = 0;
28         VV_Constant[3] = 0;
29
30         //Initial field creation
31         cout << "Building initial data " << endl;
32         myProblem.setInitialFieldConstant(spaceDim,VV_Constant,xinf,xsup,nx,"wall","wall");
33         myProblem.setWallBoundaryCondition("wall",wallVelocityX);
34
35
36         // physical parameters
37         myProblem.setGravity(gravite);
38
39         // set the numerical method
40         myProblem.setNumericalScheme(upwind, Implicit);
41         myProblem.setEntropicCorrection(true);
42
43         // name file save
44         string fileName = "1DSedimentation";
45
46         // parameters calculation
47         unsigned MaxNbOfTimeStep = 3;
48         int freqSave = 1;
49         double cfl = 1;
50         double maxTime = 5;
51         double precision = 1e-6;
52
53         myProblem.setCFL(cfl);
54         myProblem.setPrecision(precision);
55         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
56         myProblem.setTimeMax(maxTime);
57         myProblem.setFreqSave(freqSave);
58         myProblem.setFileName(fileName);
59         myProblem.displayConditionNumber();
60         myProblem.setSaveFileFormat(CSV);
61
62         // evolution
63         myProblem.initialize();
64
65         bool ok = myProblem.run();
66         if (ok)
67                 cout << "Simulation "<<fileName<<" is successful !" << endl;
68         else
69                 cout << "Simulation "<<fileName<<"  failed ! " << endl;
70
71         cout << "------------ End of simulation !!! -----------" << endl;
72         myProblem.terminate();
73
74         return EXIT_SUCCESS;
75 }