7 def FiveEqsTwoFluid_1DBoilingAssembly():
10 # Prepare for the mesh
11 print("Building mesh " );
15 M=cm.Mesh(xinf,xsup,nx)
17 M.setGroupAtPlan(xsup,0,eps,"outlet")
18 M.setGroupAtPlan(xinf,0,eps,"inlet")
20 # set the limit field for each boundary
28 heatPowerField=cm.Field("heatPowerField", cm.CELLS, M, 1);
30 nbCells=M.getNumberOfCells();
32 for i in range (nbCells):
34 if (x> (xsup-xinf)/4) and (x< (xsup-xinf)*3/4):
38 heatPowerField.writeVTK("heatPowerField",True)
41 myProblem = cf.FiveEqsTwoFluid(cf.around155bars600K,spaceDim);
42 nVar = myProblem.getNumberOfVariables();
44 # Prepare for the initial condition
45 VV_Constant =[0]*nVar;
48 VV_Constant[0] = inletVoidFraction;
49 VV_Constant[1] = outletPressure ;
50 VV_Constant[2] = inletVelocityX[0];
51 VV_Constant[3] = inletVelocityX[1];
52 VV_Constant[4] = inletTemperature ;
55 #Initial field creation
56 print("Building initial data " );
57 myProblem.setInitialFieldConstant(M,VV_Constant)
59 # set the boundary conditions
60 myProblem.setInletBoundaryCondition("inlet",inletVoidFraction,inletTemperature,inletVelocityX)
61 myProblem.setOutletBoundaryCondition("outlet", outletPressure);
63 # set physical parameters
64 myProblem.setHeatPowerField(heatPowerField)
66 # set the numerical method
67 myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
68 myProblem.setEntropicCorrection(True);
69 myProblem.setWellBalancedCorrection(True);
72 fileName = "1DBoilingAssembly";
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);
87 myProblem.setNewtonSolver(precision,20);
88 #myProblem.saveConservativeField(True);
90 myProblem.saveVelocity();
94 myProblem.initialize();
95 print("Running python "+ fileName );
99 print( "Simulation python " + fileName + " is successful !" );
102 print( "Simulation python " + fileName + " failed ! " );
105 print( "------------ End of calculation !!! -----------" );
107 myProblem.terminate();
110 if __name__ == """__main__""":
111 FiveEqsTwoFluid_1DBoilingAssembly()