|
|
## MPHYS API
|
|
|
[MPHYS](https://github.com/openMDAO/MPHYS) (Multi-PHYSics) is a framework designed to perform multi-physics analysis and optimization, and is built on top of [openMDAO](https://openmdao.org/). The API allows to interface DART with other software through MPHYS, and is implemented under [api/mphys](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/mphys.py).
|
|
|
|
|
|
**0. Importing the modules**
|
|
|
Since MPHYS couples multiple software, it is required to install them before using MPHYS. As such, DART cannot be used from a development environement (it must be installed), and must be imported by calling,
|
|
|
```python
|
|
|
from dartflo.dart.api.mphys import DartBuilder
|
|
|
```
|
|
|
Additionaly, the interface must be setup in an MPHYS class,
|
|
|
```python
|
|
|
from mphys import Multipoint
|
|
|
class Top(Multipoint):
|
|
|
...
|
|
|
```
|
|
|
|
|
|
**1. Defining the parameters**
|
|
|
The list of parameters required to setup the interface is essentialy a simplified version of that used for the internal API. Parameters are listed hereunder:
|
|
|
```python
|
|
|
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
|
|
|
'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
|
|
|
'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
|
|
|
}
|
|
|
```
|
|
|
*Note* DART can be coupled with [pyGeo](https://github.com/mdolab/pyGeo), which uses the free-form deformation technique, to perform aerodynamic shape optimization. Since pyGeo only handles 3D geometries, users wanting to perform 2D shape optimization must provide a so-called 2.5D geometry, which consists of an extruded 2D geometry enclosed between two symmetry walls. In such a case, the parameters `'WakeTips'` MUST NOT be given.
|
|
|
|
|
|
**2. Using the interface**
|
|
|
Once the parameters have been defined, the interface can simply be setup by calling,
|
|
|
```python
|
|
|
dart = DartBuilder(p, scenario=..., task=...)
|
|
|
```
|
|
|
where valid choices for `scenario` are `'aerodynamic'` or `'aerostructural'`, and valid choices for `task` are `'analysis'` or `'optimization'`.
|
|
|
Users must then refer to the MPHYS documention to connect the interface through MPHYS. In version 0.4.0, this is done by calling,
|
|
|
```python
|
|
|
# for pure aerodynamic computations...
|
|
|
from mphys.scenario_aerodynamic import ScenarioAerodynamic
|
|
|
self.mphys_add_scenario('...', ScenarioAerodynamic(aero_builder=dart))
|
|
|
# ... or for aerostructural computations
|
|
|
from mphys.scenario_aerostructural import ScenarioAeroStructural
|
|
|
self.mphys_add_scenario('...', ScenarioAeroStructural(aero_builder=dart, struct_builder=..., ldxfer_builder=...), coupling_nonlinear_solver=..., coupling_linear_solver=...)
|
|
|
``` |