|
|
## Core API
|
|
|
The [core](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/core.py) API is the common base of all APIs. It simply consists in a `init_dart` 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.
|
|
|
```python
|
|
|
cfg = {
|
|
|
# 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 free edge of the wake (not for 2.5D)
|
|
|
'Tes' : list of str, # LIST of names of physical group containing the trailing edges
|
|
|
# ... optional for 3D
|
|
|
'Symmetry' : str, # name of physical group containing the symmetry boundaries
|
|
|
'Fuselage' : str, # name of physical group containing the fuselage boundary
|
|
|
'WakeExs' : str, # LIST of names of physical group containing the free edge of the wake and the intersection of lifting surface with fuselage (to be excluded from Wake B.C.), only required if a 'Fuselage' if present, otherwise 'WakeTips' is sufficient
|
|
|
# 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,
|
|
|
```python
|
|
|
from dart.api.core import init_dart
|
|
|
_dart = init_dart(cfg, scenario='aerodynamic', task='analysis', `viscous=False`)
|
|
|
```
|
|
|
where `scenario` can be `'aerodynamic'` or `'aerostructural'`, and `task` can be `'analysis'` or `'optimization'`, and viscous is a boolean indicating whether the solver should also be configured for viscous-inviscid interaction. `_dart` is a dictionary containing the following objects (named after their key):
|
|
|
- `dim` is the number of dimensions (`2` or `3`)
|
|
|
- `qinf` is the freestream dynamic pressure (`0` except if `scenario='aerostructural'`)
|
|
|
- `msh` is the mesh
|
|
|
- `wrt` is the utility to write mesh/results on disk
|
|
|
- `mrf` is the mesh morpher (`None` except if `scenario='aerostructural'` or `task='optimization'`)
|
|
|
- `pbl` is the formulation of the problem
|
|
|
- `bnd` is the body of interest
|
|
|
- `blwb` is the blowing boundary condition on the body (`None` except if `viscous=True`)
|
|
|
- `blww` is the blowing boundary condition on the wake (`None` except if `viscous=True`)
|
|
|
- `sol` is the direct (Newton) solver
|
|
|
- `adj` is the adjoint solver (`None` except if `task='optimization'`) |
|
|
## Core API
|
|
|
The [core](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/core.py) API is the common base of all APIs. It simply consists in a `init_dart` 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.
|
|
|
```python
|
|
|
cfg = {
|
|
|
# Options
|
|
|
'Threads': int, # number of threads (optional, default=1)
|
|
|
'Verb': int, # verbosity (optional, default=1)
|
|
|
# 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 free edge of the wake (not for 2.5D)
|
|
|
'Tes': list of str, # LIST of names of physical group containing the trailing edges
|
|
|
# ... optional for 3D
|
|
|
'Symmetry': str, # name of physical group containing the symmetry boundaries
|
|
|
'Fuselage': str, # name of physical group containing the fuselage boundary
|
|
|
'WakeExs': str, # LIST of names of physical group containing the free edge of the wake and the intersection of lifting surface with fuselage (to be excluded from Wake B.C.), only required if a 'Fuselage' if present, otherwise 'WakeTips' is sufficient
|
|
|
# Freestream
|
|
|
'M_inf': float, # freestream Mach number (optional, default=0)
|
|
|
'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,
|
|
|
```python
|
|
|
from dart.api.core import init_dart
|
|
|
_dart = init_dart(cfg, scenario='aerodynamic', task='analysis', `viscous=False`)
|
|
|
```
|
|
|
where `scenario` can be `'aerodynamic'` or `'aerostructural'`, and `task` can be `'analysis'` or `'optimization'`, and viscous is a boolean indicating whether the solver should also be configured for viscous-inviscid interaction. `_dart` is a dictionary containing the following objects (named after their key):
|
|
|
- `dim` is the number of dimensions (`2` or `3`)
|
|
|
- `qinf` is the freestream dynamic pressure (`0` except if `scenario='aerostructural'`)
|
|
|
- `msh` is the mesh
|
|
|
- `wrt` is the utility to write mesh/results on disk
|
|
|
- `mrf` is the mesh morpher (`None` except if `scenario='aerostructural'` or `task='optimization'`)
|
|
|
- `pbl` is the formulation of the problem
|
|
|
- `bnd` is the body of interest
|
|
|
- `blwb` is the blowing boundary condition on the body (`None` except if `viscous=True`)
|
|
|
- `blww` is the blowing boundary condition on the wake (`None` except if `viscous=True`)
|
|
|
- `sol` is the direct (Newton) solver
|
|
|
- `adj` is the adjoint solver (`None` except if `task='optimization'`) |