Core API
The core API is the common base of all APIs. It simply consists in a initDart
method which will return all the C++ objects wrapped in python required to run DART. If a new API is created, it should initialize itself by calling this method.
1. Defining the parameters
In practise, DART is initialized by using a dictionary of parameters, and the type of scenario and task. The different parameters are listed hereunder.
p = {
# Options
'Threads' : int, # number of threads
'Verb' : int, # verbosity
# Model (geometry or mesh)
'File' : str, # Input file containing the model
'Pars' : dict, # parameters for input file model
'Dim' : int, # problem dimension (2 or 3)
'Format' : str, # save format (vtk or gmsh)
# Markers...
'Fluid' : str, # name of physical group containing the fluid
'Farfield' : list of str, # LIST of names of physical groups containing the farfield boundaries (downstream should be last element)
# ... only 2D
'Wing' : str, # name of physical group containing the airfoil boundary (will be the body of interest for aerostructural and optimization)
'Wake' : str, # name of physical group containing the wake
'Te' : str, # name of physical group containing the trailing edge
# ... only 3D
'Wings' : list of str, # LIST of names of physical groups containing the lifting surface boundary (first element will be the body of interest for aerostructural and optimization)
'Wakes' : list of str, # LIST of names of physical group containing the wake
'WakeTips' : list of str, # LIST of names of physical group containing the edge of the wake (not for 2.5D)
'TeTips' : list of str, # LIST of names of physical group containing the edge of the wake and the trailing edge
# ... optional for 3D
'Symmetry' : str, # name of physical group containing the symmetry boundaries
# Freestream
'M_inf' : float, # freestream Mach number
'AoA' : float, # freestream angle of attack [deg] (optional, default=0)
'AoS' : float, # freestream angle of sideslip [deg] (optional, default=0)
'Q_inf' : float, # freesteam dynamic pressure (only required for aerostructural computations)
# Geometry
'S_ref' : float, # reference surface length
'c_ref' : float, # reference chord length
'x_ref' : float, # x-coordinate of reference point for moment computation
'y_ref' : float, # y-coordinate of reference point for moment computation
'z_ref' : float, # z-coordinate of reference point for moment computation
# Numerical
'LSolver' : 'GMRES', # inner solver (PARDISO, MUMPS or GMRES)
'G_fill' : int, # fill-in factor for GMRES preconditioner (optional, default=2)
'G_tol' : float, # tolerance for GMRES (optional, default=1e-5)
'G_restart' : int, # restart for GMRES (optional, default=50)
'Rel_tol' : float, # relative tolerance on solver residual
'Abs_tol' : float, # absolute tolerance on solver residual
'Max_it' : int # maximum number of iterations for nonlinear solver
}
2. Initializing DART
Once the parameters have been defined, DART can simply be initialized by calling,
from dart.api.core import initDart
dim, qinf, msh, wrtr, mrf, pbl, bnd, sol, adj = initDart(p, scenario=..., task=...)
where scenario
can be 'aerodynamic'
or 'aerostructural'
, and task
can be 'analysis'
or 'optimization'
, and where:
-
dim
is the number of dimensions (2
or3
) -
qinf
is the freestream dynamic pressure (0
except ifscenario='aerostructural'
) -
msh
is the mesh -
wrtr
is the utility to write mesh/results on disk -
mrf
is the mesh morpher (None
except ifscenario='aerostructural'
ortask='optimization'
) -
pbl
is the formulation of the problem -
bnd
is the body of interest -
sol
is the direct (Newton) solver -
adj
is the adjoint solver (None
except iftask='optimization'
)