Skip to content

Commit

Permalink
Print information about modeling options to user
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Dec 30, 2024
1 parent 5a9bc96 commit 08ebbf3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions weis/aeroelasticse/FileTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import operator
import numpy as np
import yaml
import sys
from functools import reduce
try:
import ruamel_yaml as ry
Expand Down Expand Up @@ -136,6 +137,12 @@ def save_yaml(outdir, fname, data_out):
yaml.dump(data_out, f)
f.close()

def print_yaml(data_struct):
data_struct = remove_numpy(data_struct)
yaml=ry.YAML()
yaml.indent(mapping=4, sequence=6, offset=3)
yaml.dump(data_struct,sys.stdout)


def select_cases(cases, var_sel, val_sel):
# Find a variable value from the AeroelasticSE case_matrix
Expand Down
17 changes: 14 additions & 3 deletions weis/glue_code/mpi_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import sys
import numpy as np
from openmdao.utils.mpi import MPI
from weis.aeroelasticse.FileTools import print_yaml


def compute_optimal_nP(nFD, nOF, modeling_options, opt_options, maxnP=1):

Expand Down Expand Up @@ -82,9 +84,18 @@ def compute_optimal_nP(nFD, nOF, modeling_options, opt_options, maxnP=1):
print("python weis_driver.py --preMPI=True --maxnP=xx")
print("And substitute xx with your number of processors\n")

modeling_options['General']['openfast_configuration']['nP'] = nP
modeling_options['General']['openfast_configuration']['nFD'] = nFD
modeling_options['General']['openfast_configuration']['nOFp'] = nOFp
modeling_updates = {}
modeling_updates['General'] = {}
modeling_updates['General']['openfast_configuration'] = {}
modeling_updates['General']['openfast_configuration']['nP'] = nP
modeling_updates['General']['openfast_configuration']['nFD'] = nFD
modeling_updates['General']['openfast_configuration']['nOFp'] = nOFp

print('The following changes should be made to the modeling options:')
print_yaml(modeling_updates)

# Apply updates
modeling_options['General']['openfast_configuration'].update(modeling_updates['General']['openfast_configuration'])

return modeling_options

Expand Down
1 change: 1 addition & 0 deletions weis/glue_code/weis_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def get_max_procs(args):
return maxnP

def set_modopt_procs(modeling_options):
print('Applying the modeling option updates as overrides.')
modeling_override = {}
modeling_override['General'] = {}
modeling_override['General']['openfast_configuration'] = {}
Expand Down

0 comments on commit 08ebbf3

Please sign in to comment.