Skip to content

Commit

Permalink
Count elements in each design variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Dec 30, 2024
1 parent fc4cf7c commit 7aedb7c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion weis/glue_code/runWEIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options,
# Estimate number of design variables and parallel calls to OpenFASRT given
# the computational resources available. This is used to setup WEIS for an MPI run
if prepMPI:
nFD = max([1,len(wt_opt.model.list_outputs(is_design_var=True, out_stream=None))])
nFD = 0
for dv in wt_opt.model.list_outputs(is_design_var=True, out_stream=None):
# dv is a tuple with (name, info)
nFD += len(dv[1]['val'])

# number of finite differences should be at least 1
nFD = max([1,nFD])

# Compute number of processors
modeling_options = compute_optimal_nP(nFD, myopt.n_OF_runs, modeling_options, opt_options, maxnP = maxnP)

# If WEIS is called simply to prep for an MPI call, no need to proceed and simply
Expand Down

1 comment on commit 7aedb7c

@ptrbortolotti
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch here

Please sign in to comment.