]> SALOME platform Git repositories - tools/solverlab.git/blob
Salome HOME
526bcf875bd9b4bbac410bb913e47a3467f36c05
[tools/solverlab.git] /
1 #!/usr/bin/env python
2 # -*-coding:utf-8 -*
3
4 import CoreFlows as cf
5 import cdmath
6
7
8 def SinglePhase_2DSphericalExplosion_HEXAGON():
9
10         inputfile="./meshHexagonWithTriangles300.med";
11         my_mesh=cdmath.Mesh(inputfile);
12         spaceDim=2
13         
14         # Initial field data
15         nVar=2+spaceDim;
16         radius=0.5;
17         Center=cdmath.Vector(spaceDim);#default value is (0,0,0)
18         Vout=cdmath.Vector(nVar)
19         Vin =cdmath.Vector(nVar)
20         Vin[0]=155e5;
21         Vin[1]=0;
22         Vin[2]=0;
23         Vin[3]=563;
24         Vout[0]=154e5;
25         Vout[1]=0;
26         Vout[2]=0;
27         Vout[3]=563;
28
29         myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim);
30
31         # Initial field creation
32         print ("Setting mesh and initial data" ) ;
33         myProblem.setInitialFieldSphericalStepFunction( my_mesh, Vout, Vin, radius, Center);
34
35         # set the boundary conditions
36         wallVelocityX=0;
37         wallVelocityY=0;
38         wallTemperature=563;
39
40         myProblem.setWallBoundaryCondition("boundaries", wallTemperature, wallVelocityX, wallVelocityY);
41
42         # set the numerical method
43         myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
44     
45         # name file save
46         fileName = "2DSphericalExplosion_HEXAGON";
47
48         # parameters calculation
49         MaxNbOfTimeStep = 3000 ;
50         freqSave = 20;
51         cfl = 0.5;
52         maxTime = 5;
53         precision = 1e-6;
54
55         myProblem.setCFL(cfl);
56         myProblem.setPrecision(precision);
57         myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
58         myProblem.setTimeMax(maxTime);
59         myProblem.setFreqSave(freqSave);
60         myProblem.setFileName(fileName);
61         myProblem.setNewtonSolver(precision,20);
62         myProblem.saveConservativeField(False);
63         if(spaceDim>1):
64                 myProblem.saveVelocity();
65                 pass
66
67
68         # evolution
69         myProblem.initialize();
70
71         ok = myProblem.run();
72         if (ok):
73                 print( "Simulation python " + fileName + " is successful !" );
74                 pass
75         else:
76                 print( "Simulation python " + fileName + "  failed ! " );
77                 pass
78
79         print( "------------ End of calculation !!! -----------" );
80
81         myProblem.terminate();
82         return ok
83
84 if __name__ == """__main__""":
85     SinglePhase_2DSphericalExplosion_HEXAGON()