11 # Prepare for the mesh
15 M=cm.Mesh("../CoreFlows_src/examples/ressources/BifurcatingFlow2BranchesEqualSections.med")
16 M.getFace(0).setGroupName("Inlet")
17 M.getFace(31).setGroupName("Outlet")
18 #M.setGroupAtPlan(xsup,0,eps,"Outlet");
19 #M.setGroupAtPlan(xinf,0,eps,"Inlet");
21 # set the initial field
23 initialPressure=155e5;
25 initialTemperature=573;
27 # set the limit field for each boundary
33 myProblem = cf.SinglePhase(cf.Liquid,cf.around155bars600K,spaceDim);
34 nVar = myProblem.getNumberOfVariables();
36 # Prepare for the initial condition
37 VV_Constant =[0]*nVar;
40 VV_Constant[0] = initialPressure ;
41 VV_Constant[1] = initialVelocityX;
42 VV_Constant[2] = initialTemperature ;
45 #Initial field creation
46 print("Building initial data" );
47 myProblem.setInitialFieldConstant( M, VV_Constant);
49 # set the boundary conditions
50 myProblem.setInletBoundaryCondition("Inlet", inletTemperature, inletVelocityX);
51 myProblem.setOutletBoundaryCondition("Outlet",outletPressure);
53 #set porosity, heat and gravity source
54 Sections=cm.Field("../CoreFlows_src/examples/ressources/BifurcatingFlow2BranchesEqualSections", cm.CELLS,"Section area");
55 heatPowerField=cm.Field("../CoreFlows_src/examples/ressources/BifurcatingFlow2BranchesEqualSections", cm.CELLS,"Heat power");
56 myProblem.setSectionField(Sections);
57 myProblem.setHeatPowerField(heatPowerField)
59 myProblem.setGravity(gravite)
60 # set the numerical method
61 myProblem.setNumericalScheme(cf.upwind, cf.Explicit);
62 myProblem.setWellBalancedCorrection(True)
65 fileName = "2BranchesHeatedChannels";
67 # simulation parameters
68 MaxNbOfTimeStep = 100000 ;
74 myProblem.setCFL(cfl);
75 myProblem.setPrecision(precision);
76 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
77 myProblem.setTimeMax(maxTime);
78 myProblem.setFreqSave(freqSave);
79 myProblem.setFileName(fileName);
80 myProblem.setNewtonSolver(precision,20);
81 #myProblem.saveConservativeField(True);
83 myProblem.saveVelocity();
87 myProblem.initialize();
88 print("Running python "+ fileName );
92 print( "Simulation python " + fileName + " is successful !" );
95 print( "Simulation python " + fileName + " failed ! " );
98 print( "------------ End of calculation !!! -----------" );
100 myProblem.terminate();
103 if __name__ == """__main__""":