Skip to content
Snippets Groups Projects

Update master

Merged Boman Romain requested to merge mergeAdrien into master
1 file
+ 12
12
Compare changes
  • Side-by-side
  • Inline
+ 12
12
@@ -18,8 +18,8 @@ def main():
tms["total"].start()
# define flow variables
alpha = 0 # must be zero for this testfile
U_inf = [np.cos(alpha), np.sin(alpha)] # norm should be 1
alpha0 = 0 # must be zero for this testfile
U_inf = [np.cos(alpha0), np.sin(alpha0)] # norm should be 1
M_inf = 0.3
gamma = 1.4
M_crit = 5 # Squared critical Mach number (above which density is modified)
@@ -34,24 +34,24 @@ def main():
print ccolors.ANSI_BLUE + 'PyMeshing...' + ccolors.ANSI_RESET
pars = {'xLength' : 5, 'yLength' : 5, 'sEleFar' : 0.5, 'sEleAirfTE' : 0.01, 'sEleAirfLE' : 0.01}
msh = gmsh.MeshLoader("../models/n0012.geo",__file__).execute(**pars)
pbl = f.Problem(msh, alfa, M_inf, c_ref)
pbl = f.Problem(msh, alpha0, M_inf, c_ref)
# create mesh deformation handler
mshDef = tbox.MshDeformation(msh, "internalField", ["upstream", "sideUp", "sideLw", "downstream", "airfoil"], ["wakeUp", "wakeLw"])
# mesh the reference airfoil
pars = {'xLength' : 5, 'yLength' : 5, 'sEleFar' : 0.5, 'sEleAirfTE' : 0.01, 'sEleAirfLE' : 0.01, 'angle' : alfa}
msh_ref = gmsh.MeshLoader("../models/n0012rot.geo",__file__).execute(**pars)
pbl_ref = f.Problem(msh_ref, alfa, M_inf, c_ref)
pbl_ref = f.Problem(msh_ref, alpha0, M_inf, c_ref)
# add a medium "air"
if M_inf == 0:
pbl.set(f.Medium(msh, "internalField", f.Fun0EleRhoL(), f.Fun0EleMachL(), f.Fun0EleCpL(), f.Fun0PosPhiInf(alpha)))
pbl_ref.set(f.Medium(msh_ref, "internalField", f.Fun0EleRhoL(), f.Fun0EleMachL(), f.Fun0EleCpL(), f.Fun0PosPhiInf(alpha)))
pbl.set(f.Medium(msh, "internalField", f.Fun0EleRhoL(), f.Fun0EleMachL(), f.Fun0EleCpL(), f.Fun0PosPhiInf(alpha0)))
pbl_ref.set(f.Medium(msh_ref, "internalField", f.Fun0EleRhoL(), f.Fun0EleMachL(), f.Fun0EleCpL(), f.Fun0PosPhiInf(alpha0)))
else:
pbl.set(f.Medium(msh, "internalField", f.Fun0EleRho(gamma, M_inf, M_crit), f.Fun0EleMach(gamma, M_inf), f.Fun0EleCp(gamma, M_inf), f.Fun0PosPhiInf(alpha)))
pbl_ref.set(f.Medium(msh_ref, "internalField", f.Fun0EleRho(gamma, M_inf, M_crit), f.Fun0EleMach(gamma, M_inf), f.Fun0EleCp(gamma, M_inf), f.Fun0PosPhiInf(alpha)))
pbl.set(f.Medium(msh, "internalField", f.Fun0EleRho(gamma, M_inf, M_crit), f.Fun0EleMach(gamma, M_inf), f.Fun0EleCp(gamma, M_inf), f.Fun0PosPhiInf(alpha0)))
pbl_ref.set(f.Medium(msh_ref, "internalField", f.Fun0EleRho(gamma, M_inf, M_crit), f.Fun0EleMach(gamma, M_inf), f.Fun0EleCp(gamma, M_inf), f.Fun0PosPhiInf(alpha0)))
# add initial condition
pbl.add(f.Assign(msh,"internalField", f.Fun0PosPhiInf(alpha)),"IC")
pbl_ref.add(f.Assign(msh_ref,"internalField", f.Fun0PosPhiInf(alpha)),"IC")
pbl.add(f.Assign(msh,"internalField", f.Fun0PosPhiInf(alpha0)),"IC")
pbl_ref.add(f.Assign(msh_ref,"internalField", f.Fun0PosPhiInf(alpha0)),"IC")
# add boundary conditions
pbl.add(f.Neumann(msh, "upstream", tbox.Fct1C(-U_inf[0], -U_inf[1], 0.)))
pbl.add(f.Neumann(msh, "sideUp", tbox.Fct1C(-U_inf[0], -U_inf[1], 0.)))
@@ -130,8 +130,8 @@ def main():
Cp_ref = u.extract(airfoil_ref.tag.elems, solver_ref.Cp)
u.write(Cp_ref, "Cp_airfoil_ref.dat", "%1.5e", ", ", "x, y, z, Cp", "")
# compute 2D force coefficients
Cl, Cd, Cm = u.computeAeroCoef(Cp[:,0], Cp[:,1], Cp[:,3], alfa)
Cl_ref, Cd_ref, Cm_ref = u.computeAeroCoef(Cp_ref[:,0], Cp_ref[:,1], Cp_ref[:,3], alfa)
Cl, Cd, Cm = u.computeAeroCoef(Cp[:,0], Cp[:,1], Cp[:,3], alpha0)
Cl_ref, Cd_ref, Cm_ref = u.computeAeroCoef(Cp_ref[:,0], Cp_ref[:,1], Cp_ref[:,3], alpha0)
# display results
print ccolors.ANSI_BLUE + 'PyRes...' + ccolors.ANSI_RESET
print " case M alpha Cl Cd Cm"
Loading