]> SALOME platform Git repositories - tools/solverlab.git/commitdiff
Salome HOME
Added simulation of NACA airfoil
authormichael <michael@localhost.localdomain>
Sat, 28 Nov 2020 23:12:52 +0000 (00:12 +0100)
committermichael <michael@localhost.localdomain>
Sat, 28 Nov 2020 23:12:52 +0000 (00:12 +0100)
CoreFlows/examples/Python/CMakeLists.txt
CoreFlows/examples/Python/SinglePhase/SinglePhase_2DAirfoil.py [new file with mode: 0644]

index 7fe76f64b58c886697b4febf2a3108666a41cadf..f24f688ac1e71ec2e12420e09b18ed99dd99d17d 100755 (executable)
@@ -125,6 +125,7 @@ CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py)
+CreatePythonTest(SinglePhase/SinglePhase_2DAirfoil.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_HEXAGON.py)
 CreatePythonTest(SinglePhase/SinglePhase_2DHeatedChannelInclined.py)
diff --git a/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DAirfoil.py b/CoreFlows/examples/Python/SinglePhase/SinglePhase_2DAirfoil.py
new file mode 100644 (file)
index 0000000..3ad0def
--- /dev/null
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+# -*-coding:utf-8 -*
+
+import CoreFlows as cf
+import cdmath as cm
+
+def SinglePhase_2DAirfoil():
+       spaceDim = 2;
+
+    # Prepare the mesh data
+       print("Loading the mesh" );
+       filename="./resources/naca10.med"
+       my_mesh=cm.Mesh(filename)
+       
+       # Boundary data
+       inletVelocityX   = 175;
+       inletVelocityY   = 0.;
+       inletTemperature = 300
+       outletPressure   = 1e5
+       wallVelocityX    = 0;
+       wallVelocityY    = 0;
+       wallTemperature  = 300;
+
+    # physical constants
+       gravite  = [0] * spaceDim
+       gravite[0]= 0;
+       gravite[1]= -10;
+       viscosity = 15e-6
+       viscosite = [viscosity];
+
+       myProblem = cf.SinglePhase(cf.Gas,cf.around1bar300K,spaceDim);
+       nVar =myProblem.getNumberOfVariables();
+
+    # Prepare for the initial condition
+       VV_Constant =[0]*nVar
+
+       VV_Constant[0] = outletPressure ;
+       VV_Constant[1] = inletVelocityX;
+       VV_Constant[2] = inletVelocityY;
+       VV_Constant[3] = inletTemperature ;
+
+    #Initial field creation
+       print("Setting initial data" );
+       myProblem.setInitialFieldConstant(my_mesh,VV_Constant)
+
+    # the boundary conditions
+       myProblem.setOutletBoundaryCondition("Inlet", outletPressure);
+       myProblem.setInletBoundaryCondition( "Outlet", inletTemperature, inletVelocityX, inletVelocityY);
+       myProblem.setWallBoundaryCondition("Top",     wallTemperature, wallVelocityX, wallVelocityY);
+       myProblem.setWallBoundaryCondition("Bottom",  wallTemperature, wallVelocityX, wallVelocityY);
+       myProblem.setWallBoundaryCondition("Airfoil_boundary", wallTemperature, wallVelocityX, wallVelocityY);
+
+    # set physical parameters
+       myProblem.setViscosity(viscosite);
+       myProblem.setGravity(gravite);
+
+       # set the numerical method
+       myProblem.setNumericalScheme(cf.upwind, cf.Implicit);
+       myProblem.setLinearSolver(cf.GMRES,cf.ILU,True);
+    
+       # name file save
+       fileName = "2DAirfoil";
+
+       # parameters calculation
+       MaxNbOfTimeStep = 10000 ;
+       freqSave = 100;
+       cfl = 50;
+       maxTime = 5000;
+       precision = 1e-4;
+
+       myProblem.setCFL(cfl);
+       myProblem.setPrecision(precision);
+       myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
+       myProblem.setTimeMax(maxTime);
+       myProblem.setNewtonSolver(precision,50);
+       myProblem.setFreqSave(freqSave);
+       myProblem.setFileName(fileName);
+       if(spaceDim>1):
+               myProblem.saveVelocity();
+               pass
+
+       # evolution
+       myProblem.initialize();
+
+       ok = myProblem.run();
+       if (ok):
+               print( "Simulation " + fileName + " is successful !" );
+               pass
+       else:
+               print( "Simulation " + fileName + "  failed ! " );
+               pass
+
+       print( "------------ End of Simulation !!! -----------" );
+
+       myProblem.terminate();
+       return ok
+
+if __name__ == """__main__""":
+    SinglePhase_2DAirfoil()