7 def SinglePhase_2DLidDrivenCavity_unstructured():
10 print( "Loading unstructured mesh " );
11 inputfile="../resources/BoxWithMeshWithTriangularCells.med";
13 # set the limit field for each boundary
17 fixedWallTemperature=273;
19 movingWallVelocityX=1;
20 movingWallVelocityY=0;
21 movingWallTemperature=273;
27 myProblem = cf.SinglePhase(cf.Gas,cf.around1bar300K,spaceDim);
28 nVar = myProblem.getNumberOfVariables();
30 #Initial field creation
31 print("Building initial data " );
33 # Prepare for the initial condition
35 VV_Constant = [0] * nVar
43 #Initial field creation
44 print("Setting mesh and initial data" );
45 myProblem.setInitialFieldConstant(inputfile,VV_Constant);
47 # Set the boundary conditions
48 myProblem.setWallBoundaryCondition("BAS", fixedWallTemperature, fixedWallVelocityX, fixedWallVelocityY);
49 myProblem.setWallBoundaryCondition("GAUCHE", fixedWallTemperature, fixedWallVelocityX, fixedWallVelocityY);
50 myProblem.setWallBoundaryCondition("DROITE", fixedWallTemperature, fixedWallVelocityX, fixedWallVelocityY);
51 myProblem.setWallBoundaryCondition("HAUT", movingWallTemperature, movingWallVelocityX, movingWallVelocityY);
53 # set physical parameters
54 myProblem.setViscosity(viscosite);
56 # set the numerical method
57 myProblem.setNumericalScheme(cf.pressureCorrection, cf.Implicit);
58 myProblem.setLinearSolver(cf.GMRES,cf.ILU,True);
61 fileName = "2DLidDrivenCavityUnstructured";
63 # simulation parameters
70 myProblem.setCFL(cfl);
71 myProblem.setPrecision(precision);
72 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
73 myProblem.setTimeMax(maxTime);
74 myProblem.setFreqSave(freqSave);
75 myProblem.setFileName(fileName);
76 myProblem.setNewtonSolver(precision,20);
77 myProblem.saveConservativeField(True);
79 myProblem.saveVelocity();
83 myProblem.initialize();
87 print( "Simulation python " + fileName + " is successful !" );
90 print( "Simulation python " + fileName + " failed ! " );
93 print( "------------ End of calculation !!! -----------" );
95 myProblem.terminate();
98 if __name__ == """__main__""":
99 SinglePhase_2DLidDrivenCavity_unstructured()