Parameters for pyFAST

Hello, I’m trying to setup a study with a few runs of OpenFAST with varying parameters, using the pyFAST’s case generator and an Excel file (which I got from python-toolbox/pyFAST/case_generation/examples at main · OpenFAST/python-toolbox · GitHub).

I managed to vary a few parameters which, in input files, are placed one parameter per line. For example, to change ExctnMod in HydroDyn input file:

         0   ExctnMod       - Wave-excitation model {0: no wave-excitation calculation, 1: DFT, 2: state-space} (switch) [only used when PotMod=1; STATE-SPACE REQUIRES *.ssexctn INPUT FILE]

I set HydroFile|ExctnMod in the excel sheet, and it works fine.

However, I have trouble setting the parameters that are placed as one of a few per line, such as the simple hydrodynamic coefficients. For example:

---------------------- SIMPLE HYDRODYNAMIC COEFFICIENTS (model 1) --------------
SimplCd SimplCdMG SimplCa SimplCaMG SimplCp SimplCpMG SimplAxCd SimplAxCdMG SimplAxCa SimplAxCaMG SimplAxCp SimplAxCpMG
(-) (-) (-) (-) (-) (-) (-) (-) (-) (-) (-) (-)
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

I would like to set HydroFile|SimplCd in the excel sheet, but this seems not to work (OpenFAST runs without error, however the HydroDyn echo file shows no change to the value of the parameter).

I would appreciate your advice on how to set this kind of parameters.

Kind regards,

Kasia

Hi Kasia,

You are right, to modify a single value within a table, you can’t do that with the Excel way.

Instead, you need to do it the python way, using a test case like this one:
Example_Parametric.py

First you need to find the “key” that is used to store this table:

hd_ref = FASTInputFile('ReferenceHD.dat')
print(hd_ref.keys())

You’ll see that the simple properties are stored in a key called SmplProp, and if you look at the values, you’ll see that hd_ref['SmplProp'] is a 1 x 10 array.

What I would do, is store this array at the beginning of the script, and then change it within your parametric study loop (you need to use “copy”, because arrays are stored by value in python, you would have surprises otherwise).

# Backup reference hydrodyn
hd_ref = FASTInputFile('ReferenceHD.dat')
SmplProp_ref = hd_ref['SmplProp']

# [...]
for i in range(nParams):
     #[..]
    # Changing HydroDyn properties
    SmplProp  = SmplProp_ref.copy() # Perform a copy to be safe
    SmplProp[0,0] = Cd[i]  # Change Cd value (column 0)
    p['HDFile|SmplProp'] = SmplProp   # Use the updated table for this case

I’ve updated the example file to include this HydroDyn example (it’s commented out).

(You could try to change SmplProp directly in the excel file, by setting in the cell, the full table [0,0,0,0,0,0,0,0,0,0], It might work, but might be impractical.

Ideally, we should be able to change `HDFile|SmplProp[0,0]’ (with Excel, or the scripted way) directly, but so far the python script does not handle that.

Let us know if you run into issues.

Emmanuel

Hi Emmanuel,

Thank you so much for your quick response!

I tried the easiest solution of setting the cell to the full table:

But this did not work.

I then tried modifying and running the Example_Parametric.py file (as copied from the link you provided), but I’m getting the FileNotFoundError on this line:

HD_ref = FASTInputFile('HD_ref.dat')

Which file do we actually need as an argument here?

Hi Kasia,
This file would be your reference HydroDyn file that you want to use as a template. In your case, you could just do SmplProp_ref=np.zeros((1,10)).
I hope that helps,
Emmanuel