]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/C/TransportEquation_1DHeatedChannel.cxx
Salome HOME
Updated test with new enum
[tools/solverlab.git] / CoreFlows / examples / C / TransportEquation_1DHeatedChannel.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 \r
36         //Set initial field\r
37         Vector VV_Constant(1);//initial enthalpy\r
38         VV_Constant(0) = 1.3e6;\r
39 \r
40         cout << "Building the initial data " << endl;\r
41         myProblem.setInitialFieldConstant(M,VV_Constant);\r
42 \r
43         //Set rod temperature and heat exchamge coefficient\r
44         double rodTemp=623;//Rod clad temperature\r
45         double heatTransfertCoeff=1000;//fluid/solid exchange coefficient \r
46         myProblem.setRodTemperature(rodTemp);\r
47         myProblem.setHeatTransfertCoeff(heatTransfertCoeff);\r
48 \r
49         //set the boundary conditions\r
50         myProblem.setBoundaryFields(boundaryFields);\r
51 \r
52         // set the numerical method\r
53         myProblem.setTimeScheme( Explicit);\r
54 \r
55         // name result file\r
56         string fileName = "1DFluidEnthalpy";\r
57 \r
58         // parameters calculation\r
59         unsigned MaxNbOfTimeStep =3;\r
60         int freqSave = 1;\r
61         double cfl = 0.95;\r
62         double maxTime = 5;\r
63         double precision = 1e-6;\r
64 \r
65         myProblem.setCFL(cfl);\r
66         myProblem.setPrecision(precision);\r
67         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);\r
68         myProblem.setTimeMax(maxTime);\r
69         myProblem.setFreqSave(freqSave);\r
70         myProblem.setFileName(fileName);\r
71 \r
72         // set display option to monitor the calculation\r
73         bool computation=true;\r
74         bool system=true;\r
75         myProblem.setVerbose( computation, system);\r
76         myProblem.setSaveFileFormat(CSV);\r
77 \r
78         // evolution\r
79         myProblem.initialize();\r
80         bool ok = myProblem.run();\r
81         if (ok)\r
82                 cout << "Simulation "<<fileName<<" is successful !" << endl;\r
83         else\r
84                 cout << "Simulation "<<fileName<<"  failed ! " << endl;\r
85 \r
86         cout << "------------ End of calculation -----------" << endl;\r
87         myProblem.terminate();\r
88 \r
89         return EXIT_SUCCESS;\r
90 }\r