Skip to content
Snippets Groups Projects
Commit 695e8769 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Add benchmark and LFS

parent d151237e
Branches adrien
No related tags found
No related merge requests found
*_lfs.msh filter=lfs diff=lfs merge=lfs -text
......@@ -36,7 +36,8 @@ build
# Gmsh
*.pos
*.msh
*.msh # do not commit the mesh...
!*_lfs.msh # ... except in the lfs
#*.opt
# sge output
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# @brief Compute flow around the Onera M6 wing at 3 degrees AOA and Mach 0.84 for benchmark
# @authors Adrien Crovato
from __future__ import print_function
import numpy as np
import flow as flo
import flow.utils as floU
import flow.default as floD
import tbox
import tbox.utils as tbxU
import tbox.gmsh as gmsh
import fwk
from fwk.testing import *
from fwk.coloring import ccolors
try:
import tboxVtk
BestWriter = tboxVtk.VtkExport
canPost = True
except:
BestWriter = tbox.GmshExport
canPost = False
def main():
# timer
tms = fwk.Timers()
tms['total'].start()
# define flow variables
alpha = 3.06*np.pi/180
U_inf = [np.cos(alpha), 0., np.sin(alpha)] # norm should be 1
M_inf = 0.839
M_crit = 5 # Squared critical Mach number (above which density is modified)
dim = len(U_inf)
# define dimension
S_ref = 0.7528 # reference area
c_ref = 0.64 # reference chord (MAC)
# mesh the wing
print(ccolors.ANSI_BLUE + 'PyMeshing...' + ccolors.ANSI_RESET)
tms['msh'].start()
msh = gmsh.MeshLoader("onera_lfs.msh",__file__).execute()
# crack the mesh
mshCrck = tbox.MshCrack(msh, dim)
mshCrck.setCrack('wake')
mshCrck.addBoundaries(['field', 'wing', 'symmetry', 'downstream'])
mshCrck.setExcluded('wakeTip')
mshCrck.run()
del mshCrck
writer = tbox.GmshExport(msh)
writer.save(msh.name)
tms['msh'].stop()
# set the problem and add medium, initial/boundary conditions
tms['pre'].start()
pbl = flo.Problem(msh, dim, alpha, M_inf, S_ref, c_ref, 0., 0., 0.)
pbl.set(flo.Medium(msh, 'field', flo.F0ElRho(M_inf, M_crit), flo.F0ElMach(M_inf), flo.F0ElCp(M_inf), flo.F0PsPhiInf(dim, alpha)))
pbl.add(flo.Initial(msh, 'field', flo.F0PsPhiInf(dim, alpha)))
pbl.add(flo.Dirichlet(msh, 'upstream', flo.F0PsPhiInf(dim, alpha)))
pbl.add(flo.Freestream(msh, 'farfield', tbox.Fct1C(-U_inf[0], -U_inf[1], -U_inf[2])))
pbl.add(flo.Freestream(msh, 'downstream', tbox.Fct1C(-U_inf[0], -U_inf[1], -U_inf[2])))
pbl.add(flo.Wake(msh, ['wake', 'wake_', 'field', 'teTip']))
pbl.add(flo.Boundary(msh, ['wing', 'field']))
tms['pre'].stop()
# solve problem
print(ccolors.ANSI_BLUE + 'PySolving...' + ccolors.ANSI_RESET)
tms['solver'].start()
solver = flo.Newton(pbl)
floD.initNewton(solver)
solver.run()
solver.save(0, writer)
tms['solver'].stop()
# display timers
tms['total'].stop()
print(ccolors.ANSI_BLUE + 'PyTiming...' + ccolors.ANSI_RESET)
print('CPU statistics')
print(tms)
# check results
print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET)
tests = CTests()
tests.add(CTest('CL', solver.Cl, 0.29, 1e-1))
tests.add(CTest('CD', solver.Cd, 0.011, 1e-1))
tests.add(CTest('CM', solver.Cm, -0.212, 1e-1))
tests.run()
# eof
print('')
if __name__ == "__main__":
main()
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment