Update use_api_internal authored by Adrien Crovato's avatar Adrien Crovato
## Internal API
The internal API is meant for users wanting to run a standard computational procedure on a classic lifting configuration. The procedures that are currently implemented can be found under [api/internal](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal):
- a [polar](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal/polar.py) analysis, to compute the aerodynamic coefficients for various angles of attack,
- a [trim](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal/trim.py) analysis, to find the angle of attack that produces a desired lift coefficient.
Sample cases making use of the internal API can be found under [cases](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/cases).
**1. Defining the parameters**
In practise, all the internal APIs use the [Core API](use_api_core) to initialize DART using a dictionary of parameters. Some additional parameters need to be defined and are listed hereunder.
Additional common parameters:
```python
# Post-pro
cfg['Slice'] = list of float # y-coordinates of cutting planes to extract slices on the geometry (optional, will only work with VTK)
cfg['TagId'] = int # id of physical group to be sliced (id can be obtained through gmsh)
```
Additional parameters specific to Polar class:
```python
cfg['AoA_begin'] = float # first value of the angle of attack [degrees]
cfg['AoA_end'] = float # last value of the angle of attack [degrees]
cfg['AoA_step'] = float # step in the angle of attack [degrees]
```
Additional parameters specific to Trim class:
```python
cfg['CL'] = float # target lift coefficient
cfg['AoA'] = float # guess (first) angle of attack
cfg['dCL'] = float # guess (first) slope of CL w.r.t AoA [1/rad]
```
**2. Using the solver**
After the parameters have been defined, the solver can be set up automatically by instantiating the object as,
```python
import dart.api.internal.polar as pol
polar = pol.Polar(cfg)
# or
import dart.api.internal.trim as trm
trim = trm.Trim(cfg)
```
The script can then be run by calling,
```python
polar.run()
# or
trim.run()
```
Finally, the results can be displayed using,
```python
polar.disp()
# or
trim.disp()
```
## Internal API
The internal API is meant for users wanting to run a standard computational procedure on a classic lifting configuration. The procedures that are currently implemented can be found under [api/internal](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal):
- a [polar](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal/polar.py) analysis, to compute the aerodynamic coefficients for various angles of attack,
- a [trim](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/api/internal/trim.py) analysis, to find the angle of attack that produces a desired lift coefficient.
Sample cases making use of the internal API can be found under [cases](https://gitlab.uliege.be/am-dept/dartflo/blob/master/dart/cases).
**1. Defining the parameters**
In practise, all the internal APIs use the [Core API](use_api_core) to initialize DART using a dictionary of parameters. Additional configuration dicts must be provided and are listed hereunder.
Additional dict for post-processing:
```python
post_cfg = {
'cut_tag': int # id of physical group to be sliced (can be obtained through Gmsh)
'y_slices': list(float) # y-coordinates of cutting planes to extract slices on the geometry (will only work if output format is VTK)
}
```
Additional dict for polar calculation:
```python
polar_cfg = {
'aoas': list(float) # list of angles of attack [deg] (optional, default=[0])
}
```
Additional dict for trim calculation:
```python
trim_cfg = {
'cl_target': float, # target lift coefficient (optional, default=0)
'aoa_init': float, # guess (first) angle of attack [deg] (optional, default=0)
'cl_slope': float # guess (first) slope of CL w.r.t AoA [1/rad] (optional, default=6.3)
}
```
**2. Using the solver**
After the parameters have been defined, the solver can be set up automatically by instantiating the object as,
```python
import dart.api.internal.polar as pol
polar = pol.Polar(cfg, polar_cfg, post_cfg=None)
# or
import dart.api.internal.trim as trm
trim = trm.Trim(cfg, trim_cfg, post_cfg=None)
```
The script can then be run by calling,
```python
polar.run()
# or
trim.run()
```
Finally, the results can be displayed using,
```python
polar.disp()
# or
trim.disp()
```