8 def SinglePhase_1DDepressurisation():
11 # Prepare for the mesh
12 print("Building mesh " );
16 M=cm.Mesh(xinf,xsup,nx)
18 # set the initial field
19 initialPressure=155e5;
21 initialTemperature=573;
23 # set the boundary data for each boundary
28 myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim);
29 nVar = myProblem.getNumberOfVariables();
31 # Prepare for the initial condition
32 VV_Constant =[0]*nVar;
35 VV_Constant[0] = initialPressure ;
36 VV_Constant[1] = initialVelocityX;
37 VV_Constant[2] = initialTemperature ;
40 #Initial field creation
41 print("Building initial data" );
42 myProblem.setInitialFieldConstant( spaceDim, VV_Constant, xinf, xsup, nx,"wall","outlet");
44 # set the boundary conditions
45 myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX);
46 myProblem.setOutletBoundaryCondition("outlet", outletPressure,[xsup]);
49 # set the numerical method
50 myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
53 fileName = "1DDepressurisation";
55 # simulation parameters
62 myProblem.setCFL(cfl);
63 myProblem.setPrecision(precision);
64 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
65 myProblem.setTimeMax(maxTime);
66 myProblem.setFreqSave(freqSave);
67 myProblem.setFileName(fileName);
68 myProblem.setNewtonSolver(precision,20);
69 #myProblem.saveConservativeField(True);
71 myProblem.saveVelocity();
75 myProblem.initialize();
79 print( "Simulation python " + fileName + " is successful !" );
82 print( "Simulation python " + fileName + " failed ! " );
85 print( "------------ End of calculation !!! -----------" );
87 myProblem.terminate();
90 if __name__ == """__main__""":
91 SinglePhase_1DDepressurisation()