Skip to content

Commit

Permalink
Merge 82ed80f into aae8a75
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarter committed Jan 24, 2023
2 parents aae8a75 + 82ed80f commit 7eb23b3
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 34 deletions.
4 changes: 3 additions & 1 deletion RAFT/raft/omdao_raft.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def setup(self):

if n == 'Tmoor':
myval = np.zeros((n_cases, 2*nlines)) if s not in ['PSD'] else np.zeros((n_cases, 2*nlines, nfreq))
elif n == 'Mbase':
myval = np.zeros(n_cases) if s not in ['PSD','std'] else np.zeros((n_cases, nfreq))
else:
myval = np.zeros(n_cases) if s not in ['PSD'] else np.zeros((n_cases, nfreq))

Expand Down Expand Up @@ -657,7 +659,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
for s in stats:
if s == 'DEL' and not n in ['Tmoor','Mbase']: continue
iout = f'{n}_{s}'
outputs['stats_'+iout][case_mask] = results['case_metrics'][iout]
outputs['stats_'+iout][case_mask] = np.squeeze( results['case_metrics'][iout] )

# Other case outputs
for n in ['wind_PSD','wave_PSD']:
Expand Down
2 changes: 1 addition & 1 deletion RAFT/raft/raft_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, mi, nw, BEM=[]):

# discretize into strips with a node at the midpoint of each strip (flat surfaces have dl=0)
dorsl = list(self.d) if self.shape=='circular' else list(self.sl) # get a variable that is either diameter or side length pair
dlsMax = mi['dlsMax']
dlsMax = getFromDict(mi, 'dlsMax', shape=-1, default=5.0)

# start things off with the strip for end A
ls = [0.0] # list of lengths along member axis where a node is located <<< should these be midpoints instead of ends???
Expand Down
24 changes: 21 additions & 3 deletions RAFT/raft/raft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.patches import Circle
import mpl_toolkits.mplot3d.art3d as art3d
import yaml

try:
Expand Down Expand Up @@ -803,7 +805,8 @@ def preprocess_HAMS(self, dw=0, wMax=0, dz=0, da=0):


def plot(self, ax=None, hideGrid=False, draw_body=True, color='k', nodes=0,
xbounds=None, ybounds=None, zbounds=None, plot_rotor=True, airfoils=False, station_plot=[]):
xbounds=None, ybounds=None, zbounds=None, plot_rotor=True, airfoils=False, station_plot=[],
plot_water=False, plot_soil=False):
'''plots the whole model, including FOWTs and mooring system...'''

# for now, start the plot via the mooring system, since MoorPy doesn't yet know how to draw on other codes' plots
Expand All @@ -821,8 +824,8 @@ def plot(self, ax=None, hideGrid=False, draw_body=True, color='k', nodes=0,
self.ms.plot(ax=ax, color=color, draw_body=draw_body, xbounds=xbounds, ybounds=ybounds, zbounds=zbounds)

# plot each FOWT
for fowt in self.fowtList:
fowt.plot(ax, color=color, nodes=nodes, plot_rotor=plot_rotor, station_plot=station_plot, airfoils=airfoils)
for ifowt in self.fowtList:
ifowt.plot(ax, color=color, nodes=nodes, plot_rotor=plot_rotor, station_plot=station_plot, airfoils=airfoils)

if hideGrid:
ax.set_xticks([]) # Hide axes ticks
Expand All @@ -832,6 +835,21 @@ def plot(self, ax=None, hideGrid=False, draw_body=True, color='k', nodes=0,
ax.grid(b=None)
ax.axis('off')
ax.set_frame_on(False)

#vx = np.array( ax.get_xlim() )
#vy = np.array( ax.get_ylim() )
r = 75 #0.1*np.maximum(vx.max(), vy.max())

if plot_water:
water_color = (0.122, 0.4667, 0.706)
p_sea = Circle((0,0), r, color=water_color, alpha=0.3)
ax.add_patch(p_sea)
art3d.pathpatch_2d_to_3d(p_sea, z=0, zdir="z")
if plot_soil:
soil_color = (0.703125, 0.390625, 0.0)
p_soil = Circle((0,0), r, color=soil_color, alpha=0.5)
ax.add_patch(p_soil)
art3d.pathpatch_2d_to_3d(p_soil, z=-self.depth, zdir="z")

return fig, ax

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The core WEIS modules are:

## Installation

On laptop and personal computers, installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis. WEIS requires [Anaconda 64-bit](https://www.anaconda.com/distribution/). WEIS is currently supported on Linux, MAC and Windows Sub-system for Linux (WSL). Installing WEIS on native Windows is not supported.
On laptop and personal computers, installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis. WEIS requires [Anaconda 64-bit](https://www.anaconda.com/distribution/). WEIS is currently supported on Linux, MAC (intel only) and Windows Sub-system for Linux (WSL). Installing WEIS on native Windows is not supported. To install WEIS with conda on a M1/M2 Mac, you must start with conda for x86 on the Mac.

The installation instructions below use the environment name, "weis-env," but any name is acceptable. For those working behind company firewalls, you may have to change the conda authentication with `conda config --set ssl_verify no`. Proxy servers can also be set with `conda config --set proxy_servers.http http://id:pw@address:port` and `conda config --set proxy_servers.https https://id:pw@address:port`.

Expand All @@ -56,13 +56,13 @@ The installation instructions below use the environment name, "weis-env," but an

1. Setup and activate the Anaconda environment from a prompt (WSL terminal on Windows or Terminal.app on Mac)

conda env create --name weis-env -f https://raw.githubusercontent.com/WISDEM/WEIS/develop/environment.yml python=3.9
conda config --add channels conda-forge
conda env create --name weis-env -f https://raw.githubusercontent.com/WISDEM/WEIS/develop/environment.yml
conda activate weis-env # (if this does not work, try source activate weis-env)
sudo apt update # (WSL only, assuming Ubuntu)

2. Use conda to add platform specific dependencies.

conda config --add channels conda-forge
conda install -y petsc4py mpi4py # (Mac / Linux only)
conda install -y compilers # (Mac only)
sudo apt install gcc g++ gfortran libblas-dev liblapack-dev -y # (WSL only, assuming Ubuntu)
Expand Down
1 change: 1 addition & 0 deletions WISDEM/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ project(
meson_version: '>= 0.60',
default_options: [
'buildtype=debugoptimized',
'c_std=c11',
],
)

Expand Down
14 changes: 10 additions & 4 deletions WISDEM/wisdem/glue_code/gc_WT_InitModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,10 +1047,16 @@ def assign_floating_values(wt_opt, modeling_options, floating, opt_options):
memname = kgrp["names"][0]
idx2 = floating_init_options["members"]["name2idx"][memname]
if idx == idx2:
wt_opt[f"floating.memgrp{idx}.outer_diameter_in"][:] = floating["members"][i]["outer_shape"][
"outer_diameter"
]["values"][0]
diameter_assigned = True
if "diameter" in float_opt["members"]["groups"][j]:
if float_opt["members"]["groups"][j]["diameter"]["constant"]:
wt_opt[f"floating.memgrp{idx}.outer_diameter_in"] = floating["members"][i]["outer_shape"][
"outer_diameter"
]["values"][0]
else:
wt_opt[f"floating.memgrp{idx}.outer_diameter_in"][:] = floating["members"][i]["outer_shape"][
"outer_diameter"
]["values"]
diameter_assigned = True

if not diameter_assigned:
wt_opt[f"floating.memgrp{idx}.outer_diameter_in"] = np.interp(
Expand Down
15 changes: 15 additions & 0 deletions WISDEM/wisdem/inputs/analysis_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ properties:
names: *floatname
diameter:
type: object
#default: {}
description: Diameter optimization of member group
properties:
lower_bound: *dbound
Expand All @@ -745,12 +746,14 @@ properties:
default: False
thickness:
type: object
#default: {}
description: Thickness optimization of member group
properties:
lower_bound: *tbound
upper_bound: *tbound
ballast:
type: object
#default: {}
description: Ballast volume optimization of member group
properties:
lower_bound:
Expand All @@ -764,11 +767,14 @@ properties:
unit: m^3
description: Design variable bound
minimum: 0.0
default: 100000.0
axial_joints:
type: array
description: List of axial joint sets in this member group that are optimized as one
#default: []
items:
type: object
default: {}
properties:
names: *floatname
lower_bound:
Expand All @@ -785,14 +791,17 @@ properties:
default: 1.0
stiffeners:
type: object
#default: {}
description: Stiffener optimization of member group
properties:
ring:
type: object
#default: {}
description: Ring stiffener optimization of member group
properties:
size: # currently not implemented as a DV in gc_PoseOptimization.py
type: object
#default: {}
description: Ring stiffener sizing multiplier on T-shape
properties:
min_gain: &mingain
Expand All @@ -807,6 +816,7 @@ properties:
spacing:
type: object
description: Ring stiffener spacing along member axis
#default: {}
properties:
lower_bound:
type: number
Expand All @@ -818,19 +828,23 @@ properties:
type: number
unit: none
description: Design variable bound
default: 0.1
minimum: 0.0
longitudinal:
type: object
#default: {}
description: Longitudinal stiffener optimization of member group
properties:
size: # currently not implemented as a DV in gc_PoseOptimization.py
type: object
#default: {}
description: Longitudinal stiffener sizing multiplier on T-shape
properties:
min_gain: *mingain
max_gain: *maxgain
spacing:
type: object
#default: {}
description: Longitudinal stiffener spacing around member annulus
properties:
lower_bound:
Expand All @@ -844,6 +858,7 @@ properties:
type: number
unit: rad
description: Design variable bound
default: 0.1
minimum: 0.0
maximum: 3.141592653589793 #180 deg
mooring:
Expand Down
2 changes: 2 additions & 0 deletions WISDEM/wisdem/inputs/geometry_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,8 @@ properties:
- fixed
- fix
- connection
- connect
- free
- vessel
location:
type: array
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def build_extension(self, ext):
for pkg in ['WISDEM','ROSCO','pCrunch','pyHAMS','MoorPy','RAFT','dtqpy']:
os.chdir(pkg)
if pkg in ['WISDEM', 'pyHAMS']:
# This option runs `pip install -e .` on each package
subprocess.check_call([sys.executable, "-m", "pip", "install", "-e", "."])
# This option runs `python setup.py install/develop` on each package
subprocess.check_call([sys.executable, "setup.py", "develop"])
else:
run_setup('setup.py', script_args=sys.argv[1:], stop_after='run')
os.chdir('..')
Expand Down
4 changes: 2 additions & 2 deletions weis/glue_code/gc_PoseOptimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ def set_constraints(self, wt_opt):
wt_opt.model.add_constraint('aeroelastic.openfast_failed',upper = 1.)

# Max offset
if self.opt['constraints']['Max_Offset']['flag']:
if self.opt['constraints']['floating']['Max_Offset']['flag']:
if not any(self.level_flags):
raise Exception('Please turn on the call to OpenFAST or RAFT if you are trying to optimize with openfast_failed constraint.')
wt_opt.model.add_constraint(
f'{self.solve_component}.Max_Offset',
upper = self.opt['constraints']['Max_Offset']['max']
upper = self.opt['constraints']['floating']['Max_Offset']['max']
)

# Tower constraints
Expand Down
6 changes: 3 additions & 3 deletions weis/glue_code/runWEIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options, overridd

# Parallel settings for OpenMDAO
if opt_options['driver']['design_of_experiments']['flag']:
wt_opt = om.Problem(model=WindPark(modeling_options = modeling_options, opt_options = opt_options))
wt_opt = om.Problem(model=WindPark(modeling_options = modeling_options, opt_options = opt_options), reports=False)
else:
wt_opt = om.Problem(model=om.Group(num_par_fd=n_FD), comm=comm_i)
wt_opt = om.Problem(model=om.Group(num_par_fd=n_FD), comm=comm_i, reports=False)
wt_opt.model.add_subsystem('comp', WindPark(modeling_options = modeling_options, opt_options = opt_options), promotes=['*'])
else:
# Sequential finite differencing and openfast simulations
modeling_options['General']['openfast_configuration']['mpi_run'] = False
modeling_options['General']['openfast_configuration']['cores'] = 1
wt_opt = om.Problem(model=WindPark(modeling_options = modeling_options, opt_options = opt_options))
wt_opt = om.Problem(model=WindPark(modeling_options = modeling_options, opt_options = opt_options), reports=False)

# If at least one of the design variables is active, setup an optimization
if opt_options['opt_flag']:
Expand Down
30 changes: 15 additions & 15 deletions weis/inputs/analysis_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,21 @@ properties:
minimum: 0.0
maximum: 30.0
unit: deg/s
floating:
type: object
default: {}
properties:
Max_Offset:
type: object
default: {}
properties:
flag: *flag
max:
type: number
default: 20
minimum: 0.0
maximum: 20000.0
unit: m
damage:
type: object
default: {}
Expand Down Expand Up @@ -483,21 +498,6 @@ properties:
description: Constrain design to one where OpenFAST simulations don't fail_value
default: False

Max_Offset:
type: object
default: {}
properties:
flag:
type: boolean
description: Constrain maximum offset of platform from equilibrium point
default: False
max:
type: number
default: 20
minimum: 0.0
maximum: 20000.0
unit: m



merit_figure:
Expand Down
1 change: 1 addition & 0 deletions weis/test/test_examples_skinny.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"02_control_opt/weis_driver", #It's fast, I promise (49 sec. locally)
"02_control_opt/weis_driver_sm", #Not as fast as weis_driver, but not too bad (120 sec. locally)
"03_NREL5MW_OC3_spar/weis_driver",
"03_NREL5MW_OC3_spar/weis_freq_driver",
"06_IEA-15-240-RWT/weis_driver",
"06_IEA-15-240-RWT/weis_driver_TMDs",
"09_design_of_experiments/weis_driver",
Expand Down

0 comments on commit 7eb23b3

Please sign in to comment.