Update home authored by Adrien Crovato's avatar Adrien Crovato
# PyPK # PyPK
PyPK is a collection of p-k methods for solving the flutter equation. PyPK is a collection of p-k methods for solving the flutter equation.
The original p-k method is described in [Rodden, Aerodynamic lag functions, divergence, and the British flutter method](https://doi.org/10.2514/3.44772) and its non-iterative version is described in [van Zyl, Aeroelastic Divergence and Aerodynamic Lag Roots](https://doi.org/10.2514/2.2806). The mode tracking algorithm is described in [van Zyl, Use of eigenvectors in the solution of the flutter equation](https://doi.org/10.2514/3.46380). The original p-k method is described in [Rodden, Aerodynamic lag functions, divergence, and the British flutter method](https://doi.org/10.2514/3.44772) and its non-iterative version is described in [van Zyl, Aeroelastic Divergence and Aerodynamic Lag Roots](https://doi.org/10.2514/2.2806). The mode tracking algorithm is described in [van Zyl, Use of eigenvectors in the solution of the flutter equation](https://doi.org/10.2514/3.46380). The methodology implemented in PyPk is decribed in this [technical note](https://hdl.handle.net/2268/324281).
## Install and run ## Install and run
If you only want to use PyPK, you can install it using If you only want to use PyPK, you can install it using
```bash ```bash
python3 -m pip install . [--user] python3 -m pip install . [--user]
``` ```
and then run a case using and then run a case using
```bash ```bash
python3 path/to/case.py python3 path/to/case.py
``` ```
If you need to develop in PyPK before using it, you do not need to install anything, and you can just run your case from the repo folder using If you need to develop in PyPK before using it, you do not need to install anything, and you can just run your case from the repo folder using
```bash ```bash
python3 run.py path/to/case.py python3 run.py path/to/case.py
``` ```
## Use ## Use
PyPK is initialized through its API `init_pypk`. Examples can be found under the tests directory. A case file typically contains the following lines PyPK is initialized through its API `init_pypk`. Examples can be found under the tests directory. A case file typically contains the following lines
```python ```python
# Initialize # Initialize
from pypk import init_pypk from pypk import init_pypk
cfg = {...} cfg = {...}
solver = init_pypk(cfg) solver = init_pypk(cfg)
solver.set_matrices(m, k, q) solver.set_matrices(m, k, q)
# Compute flutter solution # Compute flutter solution
solver.compute() solver.compute()
solver.find_flutter() solver.find_flutter()
solver.save(case_name) solver.save(case_name)
solver.plot(case_name, show=True, format=fmt) solver.plot(case_name, show=True, format=fmt)
# Compute gradients (only available for NIPK) # Compute gradients (only available for NIPK)
solver.compute_gradients() solver.compute_gradients()
``` ```
where `cfg` is a `dict` defining the configuration of the solution method, `m`, `k` and `q` are the mass, stiffness and aerodynamic force matrices provided as `numpy array`, and `case_name` and `fmt` are `str`. The variables are stored as public attributes of the `solver` and are listed in [`Solution.__init__()`](https://gitlab.uliege.be/am-dept/pypk/-/blob/master/pypk/solution.py). where `cfg` is a `dict` defining the configuration of the solution method, `m`, `k` and `q` are the mass, stiffness and aerodynamic force matrices provided as `numpy array`, and `case_name` and `fmt` are `str`. The variables are stored as public attributes of the `solver` and are listed in [`Solution.__init__()`](https://gitlab.uliege.be/am-dept/pypk/-/blob/master/pypk/solution.py).
PyPK has also been interfaced with OpenMDAO for performing flutter-constrained optimization, see [OMFlut](https://gitlab.uliege.be/am-dept/omflut). Within that context, its builder must be imported using `from pypk.api_om import PypkBuilder`, then initialized with a configuration dictionary and provided to an OMFLut FlutterGroup as `FlutterGroup(..., flutter=PypkBuilder(cfg))`. PyPK has also been interfaced with OpenMDAO for performing flutter-constrained optimization, see [OMFlut](https://gitlab.uliege.be/am-dept/omflut). Within that context, its builder must be imported using `from pypk.api_om import PypkBuilder`, then initialized with a configuration dictionary and provided to an OMFLut FlutterGroup as `FlutterGroup(..., flutter=PypkBuilder(cfg))`.
The configuration dictionary contains the following entries The configuration dictionary contains the following entries
```python ```python
'k_ref': numpy array, # reference reduced frequencies 'k_ref': numpy array, # reference reduced frequencies
'l_ref': float, # reference length (usually half root chord) 'l_ref': float, # reference length (usually half root chord)
'mach': float, # freestream Mach number 'mach': float, # freestream Mach number
'n_modes': int, # number of modes 'n_modes': int, # number of modes
'g_struct': float, # structural damping (complex proportional stiffness) 'g_struct': float, # structural damping (complex proportional stiffness)
'rho_ks': float, # aggregation parameter for KS 'rho_ks': float, # aggregation parameter for KS
'method': str, # method type ('pk' or 'nipk') 'method': str, # method type ('pk' or 'nipk')
'vrb': int # verbosity level 'vrb': int # verbosity level
'fluid': str, # fluid type ('unmatched' or 'matched_isa') 'fluid': str, # fluid type ('unmatched' or 'matched_isa')
# IF 'fluid' is 'unmatched' # IF 'fluid' is 'unmatched'
'rho_inf': float, # freesteam density 'rho_inf': float, # freesteam density
'u_idx': numpy array, # velocity index range 'u_idx': numpy array, # velocity index range
'mu': float, # mass ratio 'mu': float, # mass ratio
'f_ref': float, # frequency of first torsional mode 'f_ref': float, # frequency of first torsional mode
# IF 'fluid' is 'mached_isa' # IF 'fluid' is 'mached_isa'
'alt': numpy array, # altitudes range 'alt': numpy array, # altitudes range
``` ```
\ No newline at end of file