7 def SinglePhase_2DWallHeatedChannel_ChangeSect():
10 print("Reading a mesh with sudden cross-section change for test SinglePhase_2DWallHeatedChannel_ChangeSect()")
11 M=cm.Mesh("../resources/VaryingSectionDuct.med")
13 # Prepare the mesh boundaries
19 M.setGroupAtPlan(xsup,0,eps,"Wall");
20 M.setGroupAtPlan(xinf,0,eps,"Wall");
21 M.setGroupAtPlan(yinf,1,eps,"Inlet");
22 M.setGroupAtPlan(ysup,1,eps,"Outlet");
24 #Nombre de cellules utilisees au depart dans Salome ou Alamos
31 M.setGroupAtFaceByCoords((xsup-xinf)/4,(ysup-yinf)/4+(i+0.5)*dy,0,eps,"Wall");#Paroi verticale intérieure gauche
32 M.setGroupAtFaceByCoords((xsup-xinf)*3/4,(ysup-yinf)/4+(i+0.5)*dy,0,eps,"Wall");#Paroi verticale intérieure droitee
35 M.setGroupAtFaceByCoords((i+0.5)*dx,(ysup-yinf)/4,0,eps,"Wall");#paroi horizontale en bas à gauche
36 M.setGroupAtFaceByCoords((i+0.5)*dx,(ysup-yinf)*3/4,0,eps,"Wall");#paroi horizontale en haut à gauche
37 M.setGroupAtFaceByCoords((xsup-xinf)*3/4+(i+0.5)*dx,(ysup-yinf)/4,0,eps,"Wall");#paroi horizontale en bas à droite
38 M.setGroupAtFaceByCoords((xsup-xinf)*3/4+(i+0.5)*dx,(ysup-yinf)*3/4,0,eps,"Wall");#paroi horizontale en haut à droite
40 spaceDim = M.getSpaceDimension();
42 # set the limit field for each boundary
55 myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim);
56 nVar =myProblem.getNumberOfVariables();
58 # Prepare for the initial condition
59 VV_Constant =cm.Vector(nVar)
62 VV_Constant[0] = outletPressure ;
63 VV_Constant[1] = inletVelocityX;
64 VV_Constant[2] = inletVelocityY;
65 VV_Constant[3] = inletTemperature ;
67 #Initial field creation
68 print("Building mesh and initial data" );
69 myProblem.setInitialFieldConstant(M,VV_Constant);
71 # the boundary conditions
72 myProblem.setOutletBoundaryCondition("Outlet", outletPressure,[xsup,ysup]);
73 myProblem.setInletBoundaryCondition("Inlet", inletTemperature, inletVelocityX, inletVelocityY);
74 myProblem.setWallBoundaryCondition("Wall", wallTemperature, wallVelocityX, wallVelocityY);
76 # set physical parameters
77 myProblem.setViscosity(viscosite);
78 myProblem.setConductivity(conductivite);
81 # set the numerical method
82 myProblem.setNumericalScheme(cf.upwind, cf.Implicit);
83 myProblem.setLinearSolver(cf.GMRES,cf.ILU,True);
86 fileName = "2DWallHeatedChannel_ChangeSect";
88 # parameters calculation
95 myProblem.setCFL(cfl);
96 myProblem.setPrecision(precision);
97 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
98 myProblem.setTimeMax(maxTime);
99 myProblem.setFreqSave(freqSave);
100 myProblem.setFileName(fileName);
101 myProblem.setNewtonSolver(float('inf'),20);#newton precision should be infinite for staggered scheme!!!
102 myProblem.saveConservativeField(True);
104 myProblem.saveVelocity();
108 myProblem.initialize();
110 ok = myProblem.run();
112 print( "Simulation python " + fileName + " is successful !" );
115 print( "Simulation python " + fileName + " failed ! " );
118 print( "------------ End of calculation !!! -----------" );
120 myProblem.terminate();
123 if __name__ == """__main__""":
124 SinglePhase_2DWallHeatedChannel_ChangeSect()