7 def FiveEqsTwoFluid_2DVidangeReservoir():
10 # Prepare for the mesh
11 print("Building mesh " );
18 diametreSortie=(ysup-yinf)/10.#10 percent of the height
19 nsortie=ny*diametreSortie/(ysup-yinf)
20 M=cm.Mesh(xinf,xsup,nx,yinf,ysup,ny)
21 # set the limit field for each boundary
23 M.setGroupAtPlan(xinf,0,eps,"wall")
24 M.setGroupAtPlan(ysup,1,eps,"inlet")
25 M.setGroupAtPlan(yinf,1,eps,"wall")
29 M.setGroupAtFaceByCoords(xsup,yinf+(i+0.5)*dy,0,eps,"wall")
32 M.setGroupAtFaceByCoords(xsup,yinf+(i+0.5)*dy,0,eps,"wall")
37 # set the limit field for each boundary
44 # set the limit field for each boundary
46 initialAlphaBottom=0.;
47 initialVelocityX=[0]*2;
48 initialVelocityY=[0]*2;
50 initialTemperature=300;
53 gravite = [0] * spaceDim
58 myProblem = cf.FiveEqsTwoFluid(cf.around1bar300K,spaceDim);
59 nVar =myProblem.getNumberOfVariables();
60 # Prepare for the initial condition
61 VV_top =cm.Vector(nVar)
62 VV_bottom =cm.Vector(nVar)
65 VV_top[0] = initialAlphaTop ;
66 VV_top[1] = initialPressure ;
67 VV_top[2] = initialVelocityX[0];
68 VV_top[3] = initialVelocityX[1];
69 VV_top[4] = initialVelocityY[0];
70 VV_top[5] = initialVelocityY[1];
71 VV_top[6] = initialTemperature ;
73 VV_bottom[0] = initialAlphaBottom ;
74 VV_bottom[1] = initialPressure ;
75 VV_bottom[2] = initialVelocityX[0];
76 VV_bottom[3] = initialVelocityX[1];
77 VV_bottom[4] = initialVelocityY[0];
78 VV_bottom[5] = initialVelocityY[1];
79 VV_bottom[6] = initialTemperature ;
81 #Initial field creation
82 print("Building initial data" );
83 myProblem.setInitialFieldStepFunction( M, VV_bottom, VV_top, .8, 1);
85 # the boundary conditions
86 myProblem.setOutletBoundaryCondition("outlet", outletPressure);
87 myProblem.setNeumannBoundaryCondition("inlet");
88 myProblem.setWallBoundaryCondition("wall", wallTemperature,wallVelocityX, wallVelocityY);
90 # set physical parameters
91 myProblem.setGravity(gravite);
93 # set the numerical method
94 myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
95 #myProblem.setEntropicCorrection(True);
96 myProblem.setNonLinearFormulation(cf.VFFC)
99 fileName = "2DVidangeReservoir";
101 # parameters calculation
102 MaxNbOfTimeStep = 3 ;
108 myProblem.setCFL(cfl);
109 myProblem.setPrecision(precision);
110 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
111 myProblem.setTimeMax(maxTime);
112 myProblem.setFreqSave(freqSave);
113 myProblem.setFileName(fileName);
114 myProblem.setNewtonSolver(precision,20);
115 myProblem.saveVelocity();
118 myProblem.initialize();
120 ok = myProblem.run();
122 print( "Simulation python " + fileName + " is successful !" );
125 print( "Simulation python " + fileName + " failed ! " );
128 print( "------------ End of calculation !!! -----------" );
130 myProblem.terminate();
134 if __name__ == """__main__""":
135 FiveEqsTwoFluid_2DVidangeReservoir()