]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/C/TransportEquation_1DHeatedChannel_MPI.cxx
Salome HOME
Updated test with new enum
[tools/solverlab.git] / CoreFlows / examples / C / TransportEquation_1DHeatedChannel_MPI.cxx
1 #include "TransportEquation.hxx"\r
2 \r
3 using namespace std;\r
4 \r
5 \r
6 int main(int argc, char** argv)\r
7 {\r
8         //Preprocessing: mesh and group creation\r
9         double xinf=0.0;\r
10         double xsup=4.2;\r
11         int nx=10;\r
12         cout << "Building a 1D mesh with "<<nx<<" cells" << endl;\r
13         Mesh M(xinf,xsup,nx);\r
14         double eps=1.E-8;\r
15         M.setGroupAtPlan(xsup,0,eps,"Neumann");\r
16         M.setGroupAtPlan(xinf,0,eps,"Inlet");\r
17         int spaceDim = M.getSpaceDimension();\r
18 \r
19         // Boundary conditions\r
20         map<string, LimitFieldTransport> boundaryFields;\r
21 \r
22         LimitFieldTransport limitNeumann;\r
23         limitNeumann.bcType=NeumannTransport;\r
24         boundaryFields["Neumann"] = limitNeumann;\r
25 \r
26         LimitFieldTransport limitInlet;\r
27         limitInlet.bcType=InletTransport;\r
28         limitInlet.h =1.3e6;//Inlet water enthalpy\r
29         boundaryFields["Inlet"] = limitInlet;\r
30 \r
31         //Set the fluid transport velocity\r
32         vector<double> transportVelocity(1,5);//fluid velocity vector\r
33 \r
34         TransportEquation  myProblem(Water,around155bars600K,transportVelocity);\r
35         Field VV("Enthalpy", CELLS, M, 1);\r
36 \r
37 \r
38         //Set initial field\r
39         Vector VV_Constant(1);//initial enthalpy\r
40         VV_Constant(0) = 1.3e6;\r
41 \r
42         cout << "Building the initial data " << endl;\r
43         myProblem.setInitialFieldConstant(M,VV_Constant);\r
44 \r
45         //Set rod temperature and heat exchamge coefficient\r
46         double rodTemp=623;//Rod clad temperature\r
47         double heatTransfertCoeff=1000;//fluid/solid exchange coefficient \r
48         myProblem.setRodTemperature(rodTemp);\r
49         myProblem.setHeatTransfertCoeff(heatTransfertCoeff);\r
50 \r
51         //set the boundary conditions\r
52         myProblem.setBoundaryFields(boundaryFields);\r
53 \r
54         // set the numerical method\r
55         myProblem.setTimeScheme( Explicit);\r
56 \r
57         // name result file\r
58         string fileName = "1DFluidEnthalpy";\r
59 \r
60         // parameters calculation\r
61         unsigned MaxNbOfTimeStep =3;\r
62         int freqSave = 1;\r
63         double cfl = 0.95;\r
64         double maxTime = 5;\r
65         double precision = 1e-6;\r
66 \r
67         myProblem.setCFL(cfl);\r
68         myProblem.setPrecision(precision);\r
69         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);\r
70         myProblem.setTimeMax(maxTime);\r
71         myProblem.setFreqSave(freqSave);\r
72         myProblem.setFileName(fileName);\r
73 \r
74         // set display option to monitor the calculation\r
75         bool computation=true;\r
76         bool system=true;\r
77         myProblem.setVerbose( computation, system);\r
78         myProblem.setSaveFileFormat(CSV);\r
79 \r
80         // evolution\r
81         myProblem.initialize();\r
82         bool ok = myProblem.run();\r
83         if (ok)\r
84                 cout << "Simulation "<<fileName<<" is successful !" << endl;\r
85         else\r
86                 cout << "Simulation "<<fileName<<"  failed ! " << endl;\r
87 \r
88         cout << "------------ End of calculation -----------" << endl;\r
89         myProblem.terminate();\r
90 \r
91         return EXIT_SUCCESS;\r
92 }\r