Skip to content
Snippets Groups Projects

2.1.0 - Feature viscous-inviscid interaction

Merged Adrien Crovato requested to merge adrien into master
8 files
+ 859
66
Compare changes
  • Side-by-side
  • Inline
Files
8
  • Squashed commit of the following:
    
    commit c6c791de
    Author: AmauryBilocq <amaury.bilocq@gmail.com>
    Date:   Fri Nov 6 12:03:29 2020 +0100
    
        Quasi-simultaneous coupler for VII with test cases
    
    commit 0cbee7e4
    Merge: fd99999c ca62dcef
    Author: AmauryBilocq <amaury.bilocq@gmail.com>
    Date:   Sun Apr 26 14:58:26 2020 +0200
    
        V1.0 Viscous Inviscid interaction with direct solver
    
    commit fd99999c
    Author: AmauryBilocq <amaury.bilocq@gmail.com>
    Date:   Sun Apr 26 14:47:01 2020 +0200
    
        V1.0 Viscous Inviscid interaction with direct solver
    
    commit ca62dcef
    Author: AmauryBilocq <amaury.bilocq@gmail.com>
    Date:   Wed Oct 30 18:41:17 2019 +0100
    
        Trial to find the stagnation point
+ 47
14
@@ -16,9 +16,18 @@
# limitations under the License.
# @brief Compute lifting (linear or nonlinear) viscous flow around a naca0012
# @authors Adrien Crovato, Amaury Bilocq
## Compute lifting (linear or nonlinear) viscous flow around a NACA 0012
#
# Amaury Bilocq
# Test the viscous-inviscid interaction scheme
# Reference to the master's thesis: http://hdl.handle.net/2268/252195
# Reference test cases with Naca0012:
# 1) Incompressible: Re = 1e7, M_inf = 0, alpha = 5°, p = 2, m = 7, tol = 10^-4, msTE = 0.01, msLE = 0.001
# -> nIt = 41, Cl = 0.58, Cd = 0.0062, xtrTop = 0.0555, xtrBot = 0.7397
# 2) Compressible: Re = 1e7, M_inf = 5, alpha = 5°, p = 2, m = 7, tol = 10^-4, msTE = 0.01, msLE = 0.001
# -> nIt = , Cl = 0.69, Cd = 0.0067, xtrTop = 0.0384, xtrBot = 0.7364
# 3) Separated: Re = 1e7, M_inf = 0, alpha = 12°, p = 2, m = 11, tol = 5.2*10^-3, msTE = 0.01, msLE = 0.00075
# -> nIt = , Cl = 1.39 , Cd = 0.011, xtrTop = 0.008, xtrBot = 1
#
# CAUTION
# This test is provided to ensure that the solver works properly.
@@ -29,10 +38,11 @@ import flow.utils as floU
import flow.default as floD
import flow.viscous.solver as floVS
import flow.viscous.coupler as floVC
import tbox
import tbox.utils as tboxU
import fwk
from fwk.testing import *
from fwk.coloring import ccolors
from fwk.coloring import ccolors
def main():
# timer
@@ -40,16 +50,23 @@ def main():
tms['total'].start()
# define flow variables
alpha = 0*math.pi/180
M_inf = 0.0
Re = 1e7
alpha = 5*math.pi/180
U_inf = [math.cos(alpha), math.sin(alpha)] # norm should be 1
M_inf = 0.5
M_crit = 5 # Squared critical Mach number (above which density is modified)
c_ref = 1
dim = 2
# define filter parameters and tolerance of the VII
p = 2
m = 7
tol = 1e-4
# mesh the geometry
print(ccolors.ANSI_BLUE + 'PyMeshing...' + ccolors.ANSI_RESET)
tms['msh'].start()
pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.0075, 'msLe' : 0.0075}
pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1, 'msTe' : 0.01, 'msLe' : 0.001}
msh, gmshWriter = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream'])
tms['msh'].stop()
@@ -62,8 +79,8 @@ def main():
print(ccolors.ANSI_BLUE + 'PySolving...' + ccolors.ANSI_RESET)
tms['solver'].start()
isolver = floD.newton(pbl)
vsolver = floVS.Solver(blw)
coupler = floVC.Coupler(isolver, vsolver, gmshWriter)
vsolver = floVS.Solver(Re, p, m)
coupler = floVC.Coupler(isolver, vsolver, blw[0], blw[1], tol, gmshWriter)
coupler.run()
tms['solver'].stop()
@@ -72,8 +89,8 @@ def main():
tboxU.write(Cp, 'Cp_airfoil.dat', '%1.5e', ', ', 'x, y, z, Cp', '')
# display results
print(ccolors.ANSI_BLUE + 'PyRes...' + ccolors.ANSI_RESET)
print(' M alpha Cl Cd Cm')
print('{0:8.2f} {1:8.1f} {2:8.4f} {3:8.4f} {4:8.4f}'.format(M_inf, alpha*180/math.pi, isolver.Cl, isolver.Cd, isolver.Cm))
print(' Re M alpha Cl Cd Cdp Cdf Cm')
print('{0:6.1f}e6 {1:8.2f} {2:8.1f} {3:8.4f} {4:8.4f} {5:8.4f} {6:8.4f} {7:8.4f}'.format(Re/1e6, M_inf, alpha*180/math.pi, isolver.Cl, vsolver.Cd, vsolver.Cdp, vsolver.Cdf, isolver.Cm))
# display timers
tms['total'].stop()
@@ -83,16 +100,32 @@ def main():
# visualize solution and plot results
floD.initViewer(pbl)
tboxU.plot(Cp[:,0], Cp[:,3], 'x', 'Cp', 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(isolver.Cl, isolver.Cd, isolver.Cm, 4), True)
tboxU.plot(Cp[:,0], Cp[:,3], 'x', 'Cp', 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(isolver.Cl, vsolver.Cd, isolver.Cm, 4), True)
# check results
print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET)
tests = CTests()
if M_inf == 0 and alpha == 0*math.pi/180:
tests.add(CTest('min(Cp)', min(Cp[:,3]), -0.41, 1e-1)) # TODO check value and tolerance
tests.add(CTest('Cl', isolver.Cl, 0., 5e-2))
if Re == 1e7 and M_inf == 0 and alpha == 5*math.pi/180:
tests.add(CTest('Cl', isolver.Cl, 0.58, 5e-2))
tests.add(CTest('Cd', vsolver.Cd, 0.0062, 0.01))
tests.add(CTest('Cdp', vsolver.Cdp, 0.0018, 0.01))
tests.add(CTest('xtr_top', vsolver.xtr[0], 0.056, 0.05))
tests.add(CTest('xtr_bot', vsolver.xtr[1], 0.740, 0.05))
elif Re == 1e7 and M_inf == 0.5 and alpha == 5*math.pi/180:
tests.add(CTest('Cl', isolver.Cl, 0.69, 5e-2))
tests.add(CTest('Cd', vsolver.Cd, 0.0067, 0.01))
tests.add(CTest('Cdp', vsolver.Cdp, 0.0025, 0.01))
tests.add(CTest('xtr_top', vsolver.xtr[0], 0.038, 0.05))
tests.add(CTest('xtr_bot', vsolver.xtr[1], 0.736, 0.05))
elif Re == 1e7 and M_inf == 0 and alpha == 12*math.pi/180:
tests.add(CTest('Cl', isolver.Cl, 1.39, 5e-2))
tests.add(CTest('Cd', vsolver.Cd, 0.0011, 0.01))
tests.add(CTest('Cdp', vsolver.Cdp, 0.0025, 0.01))
tests.add(CTest('xtr_top', vsolver.xtr[0], 0.008, 0.05))
tests.add(CTest('xtr_bot', vsolver.xtr[1], 1.000, 0.05))
else:
raise Exception('Test not defined for this flow')
tests.run()
# eof
Loading