7 def FiveEqsTwoFluid_1DVidangeReservoir():
10 # Prepare for the mesh
11 print("Building mesh " );
15 M=cm.Mesh(xinf,xsup,nx)
16 # set the limit field for each boundary
18 M.setGroupAtPlan(xinf,0,eps,"wall")
19 M.setGroupAtPlan(xsup,0,eps,"inlet")
21 # set the limit field for each boundary
25 # set the limit field for each boundary
27 initialAlphaBottom=0.;
28 initialVelocityX=[0]*2;
30 initialTemperature=300
35 myProblem = cf.FiveEqsTwoFluid(cf.around1bar300K,spaceDim);
36 nVar = myProblem.getNumberOfVariables();
38 # Prepare for the initial condition
39 VV_top =cm.Vector(nVar)
40 VV_bottom =cm.Vector(nVar)
42 # top and bottom vectors
43 VV_top[0] = initialAlphaTop ;
44 VV_top[1] = initialPressure ;
45 VV_top[2] = initialVelocityX[0];
46 VV_top[3] = initialVelocityX[1];
47 VV_top[4] = initialTemperature
49 VV_bottom[0] = initialAlphaBottom ;
50 VV_bottom[1] = initialPressure ;
51 VV_bottom[2] = initialVelocityX[0];
52 VV_bottom[3] = initialVelocityX[1];
53 VV_bottom[4] = initialTemperature
55 #Initial field creation
56 print("Building initial data " );
57 myProblem.setInitialFieldStepFunction( M, VV_bottom, VV_top, .8, 0);
59 # the boundary conditions
60 myProblem.setWallBoundaryCondition("wall",initialTemperature, wallVelocityX);
61 myProblem.setNeumannBoundaryCondition("inlet");
63 # set physical parameters
64 myProblem.setGravity(gravite);
66 # set the numerical method
67 myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
68 #myProblem.setEntropicCorrection(True);
69 myProblem.setNonLinearFormulation(cf.VFFC)
72 fileName = "1DVidangeReservoir";
74 # simulation parameters
81 myProblem.setCFL(cfl);
82 myProblem.setPrecision(precision);
83 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
84 myProblem.setTimeMax(maxTime);
85 myProblem.setFreqSave(freqSave);
86 myProblem.setFileName(fileName);
89 myProblem.initialize();
93 print( "Simulation python " + fileName + " is successful !" );
96 print( "Simulation python " + fileName + " failed ! " );
99 print( "------------ End of calculation !!! -----------" );
101 myProblem.terminate();
106 if __name__ == """__main__""":
107 FiveEqsTwoFluid_1DVidangeReservoir()