# 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.
# @author Paul Dechamps
# @date 2024
# Test the blaster api for a 2D problem.
# Imports.
fromfwk.wutilsimportparseargs
importfwk
fromfwk.testingimport*
fromfwk.coloringimportccolors
importblast.utilsasvutils
importmath
importnumpyasnp
importos
fromblast.api.blaster_apiimportinit_blaster
defcfgInviscid(nthrds,verb):
# Parameters
return{
# Options
'scenario':'aerodynamic',
'task':'analysis',
'Threads':nthrds,# number of threads
'Verb':verb,# verbosity
# Model (geometry or mesh)
'File':os.path.abspath(os.path.join(os.path.abspath(__file__),'../../models/dart/rae_3.geo')),# Input file containing the model
'Pars':{'spn':1.0,'lgt':6.0,'wdt':3.0,'hgt':6.0,'msN':0.02,'msF':1},# parameters for input file model
'Dim':3,# problem dimension
'Format':'vtk',# save format (vtk or gmsh)
# Markers
'Fluid':'field',# name of physical group containing the fluid
'Farfield':['upstream','farfield','downstream'],# LIST of names of physical groups containing the farfield boundaries (upstream/downstream should be first/last element)
'Wings':['wing'],# LIST of names of physical groups containing the lifting surface boundary
'Wakes':['wake'],# LIST of names of physical group containing the wake
'WakeTips':['wakeTip'],# LIST of names of physical group containing the edge of the wake
'Tes':['te'],# LIST of names of physical group containing the trailing edge
'Symmetry':'symmetry',# name of physical group containing the symmetry BC
'Upstream':'upstream',
# Freestream
'M_inf':0.8,# freestream Mach number
'AoA':0.0,# freestream angle of attack
# Geometry
'S_ref':1.0,# reference surface length
'c_ref':1.0,# reference chord length
'x_ref':0.0,# reference point for moment computation (x)
'y_ref':0.0,# reference point for moment computation (y)
'z_ref':0.0,# reference point for moment computation (z)
# Numerical
'LSolver':'GMRES',# inner solver (Pardiso, MUMPS or GMRES)
'G_fill':2,# fill-in factor for GMRES preconditioner
'G_tol':1e-5,# tolerance for GMRES
'G_restart':50,# restart for GMRES
'Rel_tol':1e-6,# relative tolerance on solver residual
'Abs_tol':1e-8,# absolute tolerance on solver residual
'Max_it':50# solver maximum number of iterations
}
defcfgBlast(verb):
return{
'Re':1e7,# Freestream Reynolds number
'Minf':0.8,# Freestream Mach number (used for the computation of the time step only)
'CFL0':1,# Inital CFL number of the calculation
'sections':np.linspace(0.01,0.95,3),# Sections on the wing
'writeSections':[0.2,0.4,0.6,0.8,1.0],# Spanwise locations to write the solution
'Sym':[0.],# Symmetry plane
'span':1.,# Span of the wing
'interpolator':'Rbf',# Interpolator type
'rbftype':'linear',# Radial basis function (rbf) type
'smoothing':1e-8,# rbf smoothing factor
'degree':0,# Degree of the interpolator
'neighbors':10,# Number of neighbors for the interpolator
'saveTag':4,# Tag to save the solution with VTK
'Verb':verb,# Verbosity level of the solver
'couplIter':5,# Maximum number of iterations
'couplTol':5e-2,# Tolerance of the VII methodology
'iterPrint':1,# int, number of iterations between outputs
'resetInv':False,# bool, flag to reset the inviscid calculation at every iteration.