From a51ece7f00a578e17ae8c2b2c3ca814194a11328 Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Tue, 27 Dec 2022 15:44:04 -0700 Subject: [PATCH 1/6] remove reports --- environment.yml | 1 + examples/01_nrel_csm/costs.py | 3 +- examples/01_nrel_csm/mass.py | 3 +- examples/01_nrel_csm/mass_and_cost.py | 3 +- examples/01_nrel_csm/parametric.py | 5 +- examples/05_tower_monopile/monopile_direct.py | 2 +- examples/05_tower_monopile/tower_direct.py | 2 +- examples/06_drivetrain/drivetrain_direct.py | 2 +- examples/06_drivetrain/drivetrain_geared.py | 2 +- examples/07_generator/dfig.py | 3 +- examples/07_generator/eesg.py | 3 +- examples/07_generator/pmsg_arms.py | 3 +- examples/07_generator/pmsg_disc.py | 3 +- examples/07_generator/pmsg_outer.py | 3 +- examples/07_generator/scig.py | 3 +- examples/08_plant_finance/example.py | 3 +- examples/09_floating/tlp_example.py | 5 +- .../create_conv_plots.py | 11 +- wisdem/commonse/wind_wave_drag.py | 13 +- wisdem/drivetrainse/hub.py | 24 +-- wisdem/glue_code/runWISDEM.py | 8 +- wisdem/plant_financese/plant_finance.py | 130 +++++++++----- wisdem/rotorse/blade_cost.py | 21 ++- wisdem/test/test_ccblade/test_om_gradients.py | 9 +- .../test/test_commonse/test_distribution.py | 3 +- wisdem/test/test_commonse/test_environment.py | 13 +- wisdem/test/test_commonse/test_fileIO.py | 3 +- wisdem/test/test_commonse/test_member.py | 163 +++++++++--------- wisdem/test/test_commonse/test_wind_wave.py | 7 +- .../test_drivetrainse/test_drivetrainse.py | 9 +- wisdem/test/test_drivetrainse/test_hub.py | 7 +- .../test/test_fixed_bottomse/test_jacket.py | 6 +- .../test/test_fixed_bottomse/test_monopile.py | 8 +- wisdem/test/test_floatingse/test_floating.py | 11 +- wisdem/test/test_floatingse/test_system.py | 2 +- wisdem/test/test_landbosse/test_landbosse.py | 3 +- .../test_nrelcsm/test_nrel_csm_cost_2015.py | 3 +- .../test_nrelcsm/test_nrel_csm_mass_2015.py | 5 +- .../test_intermittent_component.py | 2 +- .../test_nlopt_driver.py | 114 ++++++------ wisdem/test/test_orbit/api/test_wisdem_api.py | 6 +- .../test_plantfinancese.py | 23 +-- wisdem/test/test_rotorse/test_blade_cost.py | 16 +- .../test/test_rotorse/test_rail_transport.py | 11 +- wisdem/test/test_rotorse/test_rotor_power.py | 33 ++-- wisdem/test/test_towerse/test_tower.py | 11 +- wisdem/test/test_yaml/test_grid_derivs.py | 3 +- 47 files changed, 407 insertions(+), 320 deletions(-) diff --git a/environment.yml b/environment.yml index 3335cd419..073cd3972 100644 --- a/environment.yml +++ b/environment.yml @@ -17,6 +17,7 @@ dependencies: - openpyxl - pandas - pip + - pydoe2 - pyoptsparse - pyside2 - pytest diff --git a/examples/01_nrel_csm/costs.py b/examples/01_nrel_csm/costs.py index 753295ff9..aad26e1bf 100644 --- a/examples/01_nrel_csm/costs.py +++ b/examples/01_nrel_csm/costs.py @@ -1,12 +1,13 @@ # 0 ---------- (marker for docs) import openmdao.api as om + from wisdem.nrelcsm.nrel_csm_cost_2015 import Turbine_CostsSE_2015 # 0 ---------- (marker for docs) # 1 ---------- (marker for docs) # OpenMDAO Problem instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Turbine_CostsSE_2015(verbosity=True) prob.setup() # 1 ---------- (marker for docs) diff --git a/examples/01_nrel_csm/mass.py b/examples/01_nrel_csm/mass.py index 4f325b5c7..466b8298e 100644 --- a/examples/01_nrel_csm/mass.py +++ b/examples/01_nrel_csm/mass.py @@ -1,12 +1,13 @@ # 0 ---------- (marker for docs) import openmdao.api as om + from wisdem.nrelcsm.nrel_csm_mass_2015 import nrel_csm_mass_2015 # 0 ---------- (marker for docs) # 1 ---------- (marker for docs) # OpenMDAO Problem instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = nrel_csm_mass_2015() prob.setup() # 1 ---------- (marker for docs) diff --git a/examples/01_nrel_csm/mass_and_cost.py b/examples/01_nrel_csm/mass_and_cost.py index e414010a5..3642ad1fd 100644 --- a/examples/01_nrel_csm/mass_and_cost.py +++ b/examples/01_nrel_csm/mass_and_cost.py @@ -1,12 +1,13 @@ # 0 ---------- (marker for docs) import openmdao.api as om + from wisdem.nrelcsm.nrel_csm_mass_2015 import nrel_csm_2015 # 0 ---------- (marker for docs) # 1 ---------- (marker for docs) # OpenMDAO Problem instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = nrel_csm_2015() prob.setup() # 1 ---------- (marker for docs) diff --git a/examples/01_nrel_csm/parametric.py b/examples/01_nrel_csm/parametric.py index c6446f82f..46656058d 100644 --- a/examples/01_nrel_csm/parametric.py +++ b/examples/01_nrel_csm/parametric.py @@ -1,14 +1,15 @@ # 0 ---------- (marker for docs) import numpy as np import openmdao.api as om -from wisdem.nrelcsm.nrel_csm_mass_2015 import nrel_csm_2015 + from wisdem.nrelcsm.nrel_csm_orig import aep_csm +from wisdem.nrelcsm.nrel_csm_mass_2015 import nrel_csm_2015 # 0 ---------- (marker for docs) # 1 ---------- (marker for docs) # OpenMDAO Problem instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = nrel_csm_2015() prob.setup() diff --git a/examples/05_tower_monopile/monopile_direct.py b/examples/05_tower_monopile/monopile_direct.py index d7df96a86..240368a02 100644 --- a/examples/05_tower_monopile/monopile_direct.py +++ b/examples/05_tower_monopile/monopile_direct.py @@ -72,7 +72,7 @@ # --- # Instantiate OpenMDAO problem and create a model using the FixedBottomSE group -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = MonopileSE(modeling_options=modeling_options) # --- diff --git a/examples/05_tower_monopile/tower_direct.py b/examples/05_tower_monopile/tower_direct.py index 4748a6ae6..964613f0d 100644 --- a/examples/05_tower_monopile/tower_direct.py +++ b/examples/05_tower_monopile/tower_direct.py @@ -58,7 +58,7 @@ # --- # Instantiate OpenMDAO problem and create a model using the TowerSE group -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = TowerSE(modeling_options=modeling_options) # --- diff --git a/examples/06_drivetrain/drivetrain_direct.py b/examples/06_drivetrain/drivetrain_direct.py index d997849ef..387779c19 100644 --- a/examples/06_drivetrain/drivetrain_direct.py +++ b/examples/06_drivetrain/drivetrain_direct.py @@ -30,7 +30,7 @@ # --- # Initialize OpenMDAO problem -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) # --- diff --git a/examples/06_drivetrain/drivetrain_geared.py b/examples/06_drivetrain/drivetrain_geared.py index 2f0fe7c5a..294816586 100644 --- a/examples/06_drivetrain/drivetrain_geared.py +++ b/examples/06_drivetrain/drivetrain_geared.py @@ -30,7 +30,7 @@ # --- # Initialize OpenMDAO problem -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) # --- diff --git a/examples/07_generator/dfig.py b/examples/07_generator/dfig.py index 7e2b2e231..1341c14af 100644 --- a/examples/07_generator/dfig.py +++ b/examples/07_generator/dfig.py @@ -1,5 +1,6 @@ import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -7,7 +8,7 @@ n_pc = 20 # Example optimization of a generator for costs on a 5 MW reference turbine -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="dfig", n_pc=n_pc) if opt_flag: diff --git a/examples/07_generator/eesg.py b/examples/07_generator/eesg.py index 5213c1a4f..42330a522 100644 --- a/examples/07_generator/eesg.py +++ b/examples/07_generator/eesg.py @@ -1,5 +1,6 @@ import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -7,7 +8,7 @@ n_pc = 20 # Example optimization of a generator for costs on a 5 MW reference turbine -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="eesg", n_pc=n_pc) if opt_flag: diff --git a/examples/07_generator/pmsg_arms.py b/examples/07_generator/pmsg_arms.py index b9742e478..625be651c 100644 --- a/examples/07_generator/pmsg_arms.py +++ b/examples/07_generator/pmsg_arms.py @@ -1,5 +1,6 @@ import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -7,7 +8,7 @@ n_pc = 20 # Example optimization of a generator for costs on a 5 MW reference turbine -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="pmsg_arms", n_pc=n_pc) if opt_flag: diff --git a/examples/07_generator/pmsg_disc.py b/examples/07_generator/pmsg_disc.py index 89983cf9e..d462dc59d 100644 --- a/examples/07_generator/pmsg_disc.py +++ b/examples/07_generator/pmsg_disc.py @@ -1,5 +1,6 @@ import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -7,7 +8,7 @@ n_pc = 20 # Example optimization of a generator for costs on a 5 MW reference turbine -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="pmsg_disc", n_pc=n_pc) if opt_flag: diff --git a/examples/07_generator/pmsg_outer.py b/examples/07_generator/pmsg_outer.py index 78c2962f5..c384b9986 100644 --- a/examples/07_generator/pmsg_outer.py +++ b/examples/07_generator/pmsg_outer.py @@ -1,6 +1,7 @@ # Import the modules import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -15,7 +16,7 @@ n_pc = 20 # Initialize problem instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="pmsg_outer", n_pc=n_pc) # --- diff --git a/examples/07_generator/scig.py b/examples/07_generator/scig.py index ccb4d9963..a3cb43982 100644 --- a/examples/07_generator/scig.py +++ b/examples/07_generator/scig.py @@ -1,5 +1,6 @@ import numpy as np import openmdao.api as om + import wisdem.commonse.fileIO as fio from wisdem.drivetrainse.generator import Generator @@ -7,7 +8,7 @@ n_pc = 20 # Example optimization of a generator for costs on a 5 MW reference turbine -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = Generator(design="scig", n_pc=n_pc) if opt_flag: diff --git a/examples/08_plant_finance/example.py b/examples/08_plant_finance/example.py index e7d897912..1735c1a49 100644 --- a/examples/08_plant_finance/example.py +++ b/examples/08_plant_finance/example.py @@ -2,10 +2,11 @@ # Import the libraries import openmdao.api as om + from wisdem.plant_financese.plant_finance import PlantFinance # Initialize the OpenMDAO instance -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = PlantFinance() prob.setup() diff --git a/examples/09_floating/tlp_example.py b/examples/09_floating/tlp_example.py index 6f9c8b825..2b5e8de6a 100644 --- a/examples/09_floating/tlp_example.py +++ b/examples/09_floating/tlp_example.py @@ -2,6 +2,7 @@ import numpy as np import openmdao.api as om + from wisdem.commonse import fileIO from wisdem.floatingse import FloatingSE @@ -48,7 +49,7 @@ opt["materials"] = {} opt["materials"]["n_mat"] = 2 -prob = om.Problem() +prob = om.Problem(reports=False) prob.model = FloatingSE(modeling_options=opt) prob.setup() @@ -72,7 +73,7 @@ prob["member0.outfitting_factor_in"] = 1.05 # Fraction of additional outfitting mass for each column prob["member0.grid_axial_joints"] = [] prob["member0.ballast_grid"] = np.array([[0, 0.25], [0, 0.5]]) -prob["member0.ballast_volume"] = [np.pi * 7 ** 2 * 5, 0.0] +prob["member0.ballast_volume"] = [np.pi * 7**2 * 5, 0.0] prob["member0.s_in"] = np.cumsum(np.r_[0, h]) / h.sum() prob["member0.outer_diameter_in"] = 14 * np.ones(npts) prob["member0.layer_thickness"] = 0.05 * np.ones((1, npts)) diff --git a/examples/18_rotor_tower_monopile/create_conv_plots.py b/examples/18_rotor_tower_monopile/create_conv_plots.py index 226851d7a..0d238f734 100644 --- a/examples/18_rotor_tower_monopile/create_conv_plots.py +++ b/examples/18_rotor_tower_monopile/create_conv_plots.py @@ -1,12 +1,13 @@ -import openmdao.api as om -from wisdem.glue_code.gc_RunTools import PlotRecorder -import wisdem.inputs as sch import os +import openmdao.api as om + +import wisdem.inputs as sch +from wisdem.glue_code.gc_RunTools import PlotRecorder mydir = os.path.dirname(os.path.realpath(__file__)) # get path to this file fname_analysis_options = mydir + os.sep + "analysis_options.yaml" analysis_options = sch.load_analysis_yaml(fname_analysis_options) -wt_opt = om.Problem(model=PlotRecorder(opt_options=analysis_options)) +wt_opt = om.Problem(reports=False, model=PlotRecorder(opt_options=analysis_options)) wt_opt.setup(derivatives=False) -wt_opt.run_model() \ No newline at end of file +wt_opt.run_model() diff --git a/wisdem/commonse/wind_wave_drag.py b/wisdem/commonse/wind_wave_drag.py index fc74ab24e..a26d5b98e 100644 --- a/wisdem/commonse/wind_wave_drag.py +++ b/wisdem/commonse/wind_wave_drag.py @@ -2,6 +2,7 @@ import numpy as np import openmdao.api as om + from wisdem.commonse.akima import Akima from wisdem.commonse.csystem import DirectionVector from wisdem.commonse.utilities import cosd, sind # , linspace_with_deriv, interp_with_deriv, hstack, vstack @@ -275,7 +276,7 @@ def compute(self, inputs, outputs): beta = inputs["beta_wind"] # dynamic pressure - q = 0.5 * rho * U ** 2 + q = 0.5 * rho * U**2 # Reynolds number and drag if float(inputs["cd_usr"]) < 0.0: @@ -310,7 +311,7 @@ def compute_partials(self, inputs, J): beta = inputs["beta_wind"] # dynamic pressure - q = 0.5 * rho * U ** 2 + q = 0.5 * rho * U**2 # Reynolds number and drag if float(inputs["cd_usr"]) < 0.0: @@ -457,7 +458,7 @@ def compute(self, inputs, outputs): dcd_dRe = 0.0 # inertial and drag forces - Fi = rho * inputs["cm"] * math.pi / 4.0 * d ** 2 * inputs["A"] # Morrison's equation + Fi = rho * inputs["cm"] * math.pi / 4.0 * d**2 * inputs["A"] # Morrison's equation Fd = q * cd * d Fp = Fi + Fd @@ -515,7 +516,7 @@ def compute_partials(self, inputs, J): # beta0 = inputs['beta0'] # dynamic pressure - q = 0.5 * rho * U ** 2 + q = 0.5 * rho * U**2 # q0= 0.5*rho*U0**2 # Reynolds number and drag @@ -537,7 +538,7 @@ def compute_partials(self, inputs, J): dPx_dd = const * cosd(beta) dPy_dd = const * sind(beta) - const = rho * inputs["cm"] * math.pi / 4.0 * d ** 2 + const = rho * inputs["cm"] * math.pi / 4.0 * d**2 dPx_dA = const * cosd(beta) dPy_dA = const * sind(beta) @@ -655,7 +656,7 @@ def main(): nPoints = len(z) - prob = om.Problem() + prob = om.Problem(reports=False) root = prob.model = om.Group() diff --git a/wisdem/drivetrainse/hub.py b/wisdem/drivetrainse/hub.py index f4b16b1c9..1114dee63 100644 --- a/wisdem/drivetrainse/hub.py +++ b/wisdem/drivetrainse/hub.py @@ -1,7 +1,9 @@ -import openmdao.api as om +import sys + import numpy as np +import openmdao.api as om + import wisdem.commonse.utilities as util -import sys class FindMaxTorque(om.ExplicitComponent): @@ -124,14 +126,14 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): # Size shell thickness, assuming max torsional stress from torque can not exceed design allowable stress, and solving, torsional stress (t=Tr/J), and polar moment of inertia (J=PI/32(Do^4-Di^4), for thickness. sph_hub_shell_thick = ( ( - (dsgn_hub_diam ** 4.0 - 32.0 / np.pi * inputs["max_torque"] * dsgn_hub_rad / stress_allow_pa) + (dsgn_hub_diam**4.0 - 32.0 / np.pi * inputs["max_torque"] * dsgn_hub_rad / stress_allow_pa) ** (1.0 / 4.0) ) - dsgn_hub_diam ) / (-2.0) # Compute volume and mass of the shell - sph_hub_vol = 4.0 / 3.0 * np.pi * (dsgn_hub_rad ** 3.0 - (dsgn_hub_rad - sph_hub_shell_thick) ** 3.0) + sph_hub_vol = 4.0 / 3.0 * np.pi * (dsgn_hub_rad**3.0 - (dsgn_hub_rad - sph_hub_shell_thick) ** 3.0) sph_hub_mass = sph_hub_vol * inputs["rho"] # Assume outer (OD) and inner diameter (ID) of the flanges based on hub diameter @@ -269,13 +271,13 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): # Estimate thickness of the shell of the spinner. Stress equation for a flat plate with simply supported edges, with a load equal to the extreme gust pressure load. # The equation is [Stress=(.75*P*b^2)/(t^2*(1.61*(b/a)^3 +1)). See Roarks for reference. Shell is curved and not flat but simplifying for calculation purposes. spin_shell_thickness = np.sqrt( - (0.75 * extr_gust_dsgn_pressure * spin_panel_width ** 2.0) + (0.75 * extr_gust_dsgn_pressure * spin_panel_width**2.0) / (allow_tensile_strength * (1.61 * (spin_panel_width / sph_spin_diam) ** 3.0 + 1.0)) ) # Compute volume and mass of the spinner shell spin_shell_volume = ( - (4.0 / 3.0) * np.pi * (sph_spin_rad ** 3.0 - ((sph_spin_diam - 2.0 * spin_shell_thickness) / 2.0) ** 3.0) + (4.0 / 3.0) * np.pi * (sph_spin_rad**3.0 - ((sph_spin_diam - 2.0 * spin_shell_thickness) / 2.0) ** 3.0) ) spin_shell_mass = spin_shell_volume * inputs["composite_rho"] @@ -284,7 +286,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): 2.0 * np.pi * sph_spin_rad - * (sph_spin_rad - np.sqrt(sph_spin_rad ** 2.0 - (spin_acc_hole_diam / 2.0) ** 2.0)) + * (sph_spin_rad - np.sqrt(sph_spin_rad**2.0 - (spin_acc_hole_diam / 2.0) ** 2.0)) ) sph_caps_volume = discrete_inputs["n_blades"] * sph_cap_area * spin_shell_thickness sph_caps_mass = sph_caps_volume * inputs["composite_rho"] @@ -292,14 +294,14 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): # Estimate main flange diameter, area, volume, and mass main_flange_diam = 0.6 * inputs["hub_diameter"] main_flange_area = ( - 2.0 * np.pi * sph_spin_rad * (sph_spin_rad - np.sqrt(sph_spin_rad ** 2.0 - (main_flange_diam / 2.0) ** 2.0)) + 2.0 * np.pi * sph_spin_rad * (sph_spin_rad - np.sqrt(sph_spin_rad**2.0 - (main_flange_diam / 2.0) ** 2.0)) ) main_flange_volume = main_flange_area * spin_shell_thickness main_flange_mass = main_flange_volume * inputs["composite_rho"] spin_shell_mass = spin_shell_mass - sph_caps_mass - main_flange_mass # Compute frontal area of spherical spinner - spin_frontal_area = np.pi * (sph_spin_diam ** 2.0) / 4.0 + spin_frontal_area = np.pi * (sph_spin_diam**2.0) / 4.0 # Compute load given frontal area frontal_gust_load = spin_frontal_area * extr_gust_dsgn_pressure @@ -399,7 +401,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): + 12.6 * np.abs(inputs["BRFM"]) * inputs["rho"] / inputs["Xy"] ) r_hub = 0.5 * inputs["hub_diameter"] - I = np.r_[mass * r_hub ** 2 * np.array([1.0, 0.5, 0.5]), np.zeros(3)] + I = np.r_[mass * r_hub**2 * np.array([1.0, 0.5, 0.5]), np.zeros(3)] outputs["pitch_mass"] = mass outputs["pitch_cost"] = 0.0 @@ -594,7 +596,7 @@ def setup(self): if __name__ == "__main__": - hub_prob = om.Problem(model=Hub_System()) + hub_prob = om.Problem(model=Hub_System(), reports=False) hub_prob.setup() hub_prob["n_blades"] = 3 diff --git a/wisdem/glue_code/runWISDEM.py b/wisdem/glue_code/runWISDEM.py index 7a08e0151..5db2b0329 100644 --- a/wisdem/glue_code/runWISDEM.py +++ b/wisdem/glue_code/runWISDEM.py @@ -99,13 +99,15 @@ def run_wisdem(fname_wt_input, fname_modeling_options, fname_opt_options, overri if color_i == 0: # the top layer of cores enters if MPI: # Parallel settings for OpenMDAO - 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 - 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"] and not run_only: @@ -202,7 +204,7 @@ def load_wisdem(frootin): wt_initial = WindTurbineOntologyPython(fgeom, fmodel, fopt) wt_init, modeling_options, opt_options = wt_initial.get_input_data() - 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) wt_opt.setup() wt_opt = fileIO.load_data(fpkl, wt_opt) diff --git a/wisdem/plant_financese/plant_finance.py b/wisdem/plant_financese/plant_finance.py index 7ebb1c0fc..0bb2651ef 100644 --- a/wisdem/plant_financese/plant_finance.py +++ b/wisdem/plant_financese/plant_finance.py @@ -83,23 +83,69 @@ def setup(self): self.add_input("wake_loss_factor", val=0.15) self.add_input("fixed_charge_rate", val=0.075) self.add_input("electricity_price", val=0.04, units="USD/kW/h") - self.add_input("reserve_margin_price", val=120., units="USD/kW/yr") - self.add_input("capacity_credit", val=1.) - self.add_input("benchmark_price", val=0.071, units='USD/kW/h') + self.add_input("reserve_margin_price", val=120.0, units="USD/kW/yr") + self.add_input("capacity_credit", val=1.0) + self.add_input("benchmark_price", val=0.071, units="USD/kW/h") self.add_output("plant_aep", val=0.0, units="USD/kW/h") self.add_output("capacity_factor", val=0.0, desc="Capacity factor of the wind farm") - self.add_output("lcoe", val=0.0, units="USD/kW/h", desc="Levelized cost of energy: LCOE is the cost that, if assigned to every unit of electricity by an asset over an evaluation period, will equal the total costs during that same period when discounted to the base year.") - self.add_output("lvoe", val=0.0, units="USD/kW/h", desc="Levelized value of energy: LVOE is the discounted sum of total value divided by the discounted sum of electrical energy generated.") + self.add_output( + "lcoe", + val=0.0, + units="USD/kW/h", + desc="Levelized cost of energy: LCOE is the cost that, if assigned to every unit of electricity by an asset over an evaluation period, will equal the total costs during that same period when discounted to the base year.", + ) + self.add_output( + "lvoe", + val=0.0, + units="USD/kW/h", + desc="Levelized value of energy: LVOE is the discounted sum of total value divided by the discounted sum of electrical energy generated.", + ) self.add_output("value_factor", val=0.0, desc="Value factor is the LVOE divided by a benchmark price.") - self.add_output("nvoc", val=0.0, units="USD/kW/yr", desc="Net value of capacity: NVOC is the difference in an asset’s total annualized value and annualized cost, divided by the installed capacity of the asset. NVOC ≥ 0 for economic viability.") - self.add_output("nvoe", val=0.0, units="USD/kW/h", desc="Net value of energy: NVOE is the difference between LVOE and LCOE. NVOE ≥ 0 for economic viability.") - self.add_output("slcoe", val=0.0, units="USD/kW/h", desc="System LCOE: SLCOE is the negative of NVOE but further adjusted by a benchmark price. System LCOE ≤ benchmark price for economic viability.") - self.add_output("bcr", val=0.0, desc="Benefit cost ratio: BCR is the discounted sum of total value divided by the discounted sum of total cost. A higher BCR is more competitive. BCR ≥ 1 for economic viability") - self.add_output("cbr", val=0.0, desc="Cost benefit ratio: CBR is the inverse of BCR. CBR ≤ 1 for economic viability. A lower CBR is more competitive.") - self.add_output("roi", val=0.0, desc="Return on investment: ROI can also be expressed as BCR – 1. A higher ROI is more competitive. ROI ≥ 0 for economic viability.") - self.add_output("pm", val=0.0, desc="Profit margin: PM can also be expressed as 1 - CBR. A higher PM is more competitive. PM ≥ 0 for economic viability.") - self.add_output("plcoe", val=0.0, units="USD/kW/h", desc="Profitability adjusted PLCOE is the product of a benchmark price and CBR, which is equal to LCOE divided by value factor. A lower PLCOE is more competitive. PLCOE ≤ benchmark price for economic viability.") + self.add_output( + "nvoc", + val=0.0, + units="USD/kW/yr", + desc="Net value of capacity: NVOC is the difference in an asset’s total annualized value and annualized cost, divided by the installed capacity of the asset. NVOC ≥ 0 for economic viability.", + ) + self.add_output( + "nvoe", + val=0.0, + units="USD/kW/h", + desc="Net value of energy: NVOE is the difference between LVOE and LCOE. NVOE ≥ 0 for economic viability.", + ) + self.add_output( + "slcoe", + val=0.0, + units="USD/kW/h", + desc="System LCOE: SLCOE is the negative of NVOE but further adjusted by a benchmark price. System LCOE ≤ benchmark price for economic viability.", + ) + self.add_output( + "bcr", + val=0.0, + desc="Benefit cost ratio: BCR is the discounted sum of total value divided by the discounted sum of total cost. A higher BCR is more competitive. BCR ≥ 1 for economic viability", + ) + self.add_output( + "cbr", + val=0.0, + desc="Cost benefit ratio: CBR is the inverse of BCR. CBR ≤ 1 for economic viability. A lower CBR is more competitive.", + ) + self.add_output( + "roi", + val=0.0, + desc="Return on investment: ROI can also be expressed as BCR – 1. A higher ROI is more competitive. ROI ≥ 0 for economic viability.", + ) + self.add_output( + "pm", + val=0.0, + desc="Profit margin: PM can also be expressed as 1 - CBR. A higher PM is more competitive. PM ≥ 0 for economic viability.", + ) + self.add_output( + "plcoe", + val=0.0, + units="USD/kW/h", + desc="Profitability adjusted PLCOE is the product of a benchmark price and CBR, which is equal to LCOE divided by value factor. A lower PLCOE is more competitive. PLCOE ≤ benchmark price for economic viability.", + ) self.declare_partials("*", "*") @@ -186,24 +232,24 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): slcoe = benchmark_price - nvoe bcr = V / C cbr = C / V - roi = (V - C)/C - pm = (V - C)/V + roi = (V - C) / C + pm = (V - C) / V plcoe = C / V * benchmark_price # Assign openmdao outputs outputs["plant_aep"] = park_aep - outputs["capacity_factor"] = nec / 8760. - outputs['lcoe'] = lcoe - outputs['lvoe'] = lvoe - outputs['value_factor'] = value_factor - outputs['nvoc'] = nvoc - outputs['nvoe'] = nvoe - outputs['slcoe'] = slcoe - outputs['bcr'] = bcr - outputs['cbr'] = cbr - outputs['roi'] = roi - outputs['pm'] = pm - outputs['plcoe'] = plcoe + outputs["capacity_factor"] = nec / 8760.0 + outputs["lcoe"] = lcoe + outputs["lvoe"] = lvoe + outputs["value_factor"] = value_factor + outputs["nvoc"] = nvoc + outputs["nvoe"] = nvoe + outputs["slcoe"] = slcoe + outputs["bcr"] = bcr + outputs["cbr"] = cbr + outputs["roi"] = roi + outputs["pm"] = pm + outputs["plcoe"] = plcoe self.J = {} self.J["lcoe", "tcc_per_kW"] = dicc_dcturb * fcr / nec @@ -216,35 +262,29 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): self.J["lcoe", "plant_aep_in"] = -dnec_dpaep * lcoe / nec self.J["lcoe", "machine_rating"] = (dicc_dtrating * fcr + dcopex_dtrating) / nec - dnec_dtrating * lcoe / nec - def compute_partials(self, inputs, J, discrete_inputs): J = self.J + # OpenMDAO group to execute the plant finance SE model as a standalone class StandalonePlantFinanceSE(om.Group): - def setup(self): - self.add_subsystem( - "financese", - PlantFinance(), - promotes=['*'] - ) + self.add_subsystem("financese", PlantFinance(), promotes=["*"]) if __name__ == "__main__": - wt_opt = om.Problem(model=StandalonePlantFinanceSE()) + wt_opt = om.Problem(model=StandalonePlantFinanceSE(), reports=False) wt_opt.setup(derivatives=False) - wt_opt['machine_rating'] = 5.e+3 - wt_opt['tcc_per_kW'] = 1.5e+3 - wt_opt['bos_per_kW'] = 446. - wt_opt['opex_per_kW'] = 43. - wt_opt['turbine_aep'] = 25.e+6 - wt_opt['fixed_charge_rate'] = 0.065 - wt_opt['turbine_number'] = 120 + wt_opt["machine_rating"] = 5.0e3 + wt_opt["tcc_per_kW"] = 1.5e3 + wt_opt["bos_per_kW"] = 446.0 + wt_opt["opex_per_kW"] = 43.0 + wt_opt["turbine_aep"] = 25.0e6 + wt_opt["fixed_charge_rate"] = 0.065 + wt_opt["turbine_number"] = 120 wt_opt.run_model() - - + print("plant_aep ", wt_opt["plant_aep"]) print("lcoe ", wt_opt["lcoe"]) print("lvoe ", wt_opt["lvoe"]) @@ -256,4 +296,4 @@ def setup(self): print("cbr ", wt_opt["cbr"]) print("roi ", wt_opt["roi"]) print("pm ", wt_opt["pm"]) - print("plcoe ", wt_opt["plcoe"]) \ No newline at end of file + print("plcoe ", wt_opt["plcoe"]) diff --git a/wisdem/rotorse/blade_cost.py b/wisdem/rotorse/blade_cost.py index 1568550b2..bef50a18e 100644 --- a/wisdem/rotorse/blade_cost.py +++ b/wisdem/rotorse/blade_cost.py @@ -597,10 +597,10 @@ def execute_blade_labor_ct(self, root): operation[5 + self.n_webs] = "Lp skin" # Set gating cycle time. If blades are longer than 30 m, use 24 hrs, if shorter, use 12 hr - if self.lp_skin_parameters["blade_length"] > 30.: - gating_time_target = 24. + if self.lp_skin_parameters["blade_length"] > 30.0: + gating_time_target = 24.0 else: - gating_time_target = 12. + gating_time_target = 12.0 def labor_ct_lp_skin(team_size): lp_skin = lphp_skin_labor(self.lp_skin_parameters, team_size) @@ -616,7 +616,7 @@ def labor_ct_lp_skin(team_size): def min_ct_lp_skin(team_size, gating_time_target): _, ct = labor_ct_lp_skin(team_size) - return ct - (gating_time_target-1.e-4 - skin_mold_gating_ct[8 + self.n_webs]) * 0.7 + return ct - (gating_time_target - 1.0e-4 - skin_mold_gating_ct[8 + self.n_webs]) * 0.7 try: team_size = brentq(lambda x: min_ct_lp_skin(x, gating_time_target), 0.01, 100.0, xtol=1e-4, disp=False) @@ -646,7 +646,7 @@ def labor_ct_hp_skin(team_size): def min_ct_hp_skin(team_size, gating_time_target): _, ct = labor_ct_hp_skin(team_size) - return ct - (gating_time_target-1.e-4 - skin_mold_gating_ct[8 + self.n_webs]) * 0.7 + return ct - (gating_time_target - 1.0e-4 - skin_mold_gating_ct[8 + self.n_webs]) * 0.7 try: team_size = brentq(lambda x: min_ct_hp_skin(x, gating_time_target), 0.01, 100.0, xtol=1e-4) @@ -676,7 +676,12 @@ def labor_ct_assembly(team_size): def min_ct_assembly(team_size, gating_time_target): _, ct = labor_ct_assembly(team_size) - return ct - (gating_time_target-1.e-4 - skin_mold_gating_ct[5 + self.n_webs] - skin_mold_gating_ct[8 + self.n_webs]) + return ct - ( + gating_time_target + - 1.0e-4 + - skin_mold_gating_ct[5 + self.n_webs] + - skin_mold_gating_ct[8 + self.n_webs] + ) try: team_size = brentq(lambda x: min_ct_assembly(x, gating_time_target), 0.01, 100.0, xtol=1e-4) @@ -4056,7 +4061,9 @@ def initialize_omdao_prob(wt_opt, modeling_options, wt_init): wt_initial = WindTurbineOntologyPython(fname_wt_input, fname_modeling_options, fname_opt_options) wt_init, modeling_options, opt_options = wt_initial.get_input_data() modeling_options["WISDEM"]["RotorSE"]["flag"] = False - wt_opt = om.Problem(model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options)) + wt_opt = om.Problem( + model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options), reports=False + ) wt_opt.setup(derivatives=False) myopt = PoseOptimization(wt_init, modeling_options, opt_options) wt_opt = myopt.set_initial(wt_opt, wt_init) diff --git a/wisdem/test/test_ccblade/test_om_gradients.py b/wisdem/test/test_ccblade/test_om_gradients.py index 9b1783aaf..9cea97be0 100644 --- a/wisdem/test/test_ccblade/test_om_gradients.py +++ b/wisdem/test/test_ccblade/test_om_gradients.py @@ -4,6 +4,7 @@ import numpy as np import openmdao.api as om from openmdao.utils.assert_utils import assert_check_partials + from wisdem.ccblade.ccblade_component import CCBladeLoads, CCBladeTwist, CCBladeEvaluate, CCBladeGeometry np.random.seed(314) @@ -13,7 +14,7 @@ class Test(unittest.TestCase): def test_ccblade_geometry(self): n_span = 10 - prob = om.Problem() + prob = om.Problem(reports=False) comp = CCBladeGeometry(n_span=n_span) prob.model.add_subsystem("comp", comp, promotes=["*"]) @@ -32,7 +33,7 @@ def test_ccblade_geometry(self): assert_check_partials(check) def test_ccblade_loads(self): - prob = om.Problem() + prob = om.Problem(reports=False) # Load in airfoil and blade shape inputs for NREL 5MW npzfile = np.load( @@ -119,7 +120,7 @@ def test_ccblade_twist(self): However, it ensures that we have the derivatives set up in the component to actually be finite differenced. """ - prob = om.Problem() + prob = om.Problem(reports=False) # Add some arbitrary inputs # Load in airfoil and blade shape inputs for NREL 5MW @@ -210,7 +211,7 @@ def test_ccblade_twist(self): def test_ccblade_standalone(self): """""" - prob = om.Problem() + prob = om.Problem(reports=False) # Add some arbitrary inputs # Load in airfoil and blade shape inputs for NREL 5MW diff --git a/wisdem/test/test_commonse/test_distribution.py b/wisdem/test/test_commonse/test_distribution.py index f3bced0d9..fa274aace 100644 --- a/wisdem/test/test_commonse/test_distribution.py +++ b/wisdem/test/test_commonse/test_distribution.py @@ -4,6 +4,7 @@ import numpy as np import openmdao.api as om from openmdao.utils.assert_utils import assert_check_partials + from wisdem.commonse.distribution import WeibullCDF, RayleighCDF, WeibullWithMeanCDF np.random.seed(314) @@ -13,7 +14,7 @@ class Test(unittest.TestCase): def test_distributions(self): nspline = 10 - prob = om.Problem() + prob = om.Problem(reports=False) prob.model.add_subsystem("comp1", WeibullCDF(nspline=nspline), promotes_inputs=["*"]) prob.model.add_subsystem("comp2", WeibullWithMeanCDF(nspline=nspline), promotes_inputs=["*"]) diff --git a/wisdem/test/test_commonse/test_environment.py b/wisdem/test/test_commonse/test_environment.py index 855199933..6b6c22e4a 100644 --- a/wisdem/test/test_commonse/test_environment.py +++ b/wisdem/test/test_commonse/test_environment.py @@ -3,9 +3,10 @@ import numpy as np import openmdao.api as om import numpy.testing as npt +from openmdao.utils.assert_utils import assert_check_partials + import wisdem.commonse.environment as env from wisdem.commonse import gravity as g -from openmdao.utils.assert_utils import assert_check_partials npts = 100 myones = np.ones((npts,)) @@ -73,7 +74,7 @@ def testRegular(self): rho = 1e3 U_exp = 5 + omega * a * np.cosh(k * (z + D)) / np.sinh(k * D) W_exp = -omega * a * np.sinh(k * (z + D)) / np.sinh(k * D) - V_exp = np.sqrt(U_exp ** 2 + W_exp ** 2) + V_exp = np.sqrt(U_exp**2 + W_exp**2) A_exp = omega * omega * a * np.cosh(k * (z + D)) / np.sinh(k * D) p_exp = -rho * g * (z - a * np.cosh(k * (z + D)) / np.cosh(k * D)) @@ -120,7 +121,7 @@ def test(self): z = np.linspace(0.0, 100.0, 20) nPoints = len(z) - prob = om.Problem() + prob = om.Problem(reports=False) root = prob.model = om.Group() root.add_subsystem("p", env.PowerWind(nPoints=nPoints)) @@ -144,7 +145,7 @@ def test(self): nPoints = 20 z = np.linspace(0.1, 100.0, nPoints) - prob = om.Problem() + prob = om.Problem(reports=False) root = prob.model = om.Group() root.add_subsystem("p", env.LogWind(nPoints=nPoints)) @@ -171,7 +172,7 @@ def test(self): # z = np.linspace(z_floor, z_surface, 20) # nPoints = len(z) # -# prob = om.Problem() +# prob = om.Problem(reports=False) # root = prob.model = om.Group() # root.add_subsystem('p', env.LinearWaves(nPoints=nPoints)) # @@ -200,7 +201,7 @@ def test(self): # G = 140e6 # nu = 0.4 # -# prob = om.Problem() +# prob = om.Problem(reports=False) # root = prob.model = om.Group() # root.add_subsystem('p', env.TowerSoil()) # diff --git a/wisdem/test/test_commonse/test_fileIO.py b/wisdem/test/test_commonse/test_fileIO.py index ae0e62cfd..37d516de1 100644 --- a/wisdem/test/test_commonse/test_fileIO.py +++ b/wisdem/test/test_commonse/test_fileIO.py @@ -5,6 +5,7 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + from wisdem.commonse import fileIO @@ -46,7 +47,7 @@ def setup(self): class TestFileIO(unittest.TestCase): def setUp(self): - self.prob = om.Problem(model=MyGroup()) + self.prob = om.Problem(reports=False, model=MyGroup()) self.prob.setup() self.prob["float_in"] = 5.0 self.prob.run_model() diff --git a/wisdem/test/test_commonse/test_member.py b/wisdem/test/test_commonse/test_member.py index 45fac4009..15ad701ae 100644 --- a/wisdem/test/test_commonse/test_member.py +++ b/wisdem/test/test_commonse/test_member.py @@ -3,6 +3,7 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + import wisdem.commonse.utilities as util import wisdem.commonse.cylinder_member as member from wisdem.commonse import gravity as g @@ -67,8 +68,8 @@ def testDiscYAML_1Material(self): npt.assert_equal(outputs["outfitting_factor"], 1.05 * myones) npt.assert_equal(outputs["ballast_density"], np.array([1e5, 1e5, 1e3])) npt.assert_equal(outputs["ballast_unit_cost"], np.array([2e1, 2e1, 0.0])) - A = np.pi * (16 - 3.75 ** 2) - I = (256.0 - 3.75 ** 4) * np.pi / 4.0 + A = np.pi * (16 - 3.75**2) + I = (256.0 - 3.75**4) * np.pi / 4.0 npt.assert_equal(outputs["z_param"], 100 * np.linspace(0, 1, 5)) npt.assert_equal(outputs["sec_loc"], np.linspace(0, 1, 4)) # npt.assert_equal(outputs["str_tw"], np.zeros(nout)) @@ -277,9 +278,9 @@ def testSortedDict(self): def testMainSections(self): self.mem.add_main_sections(self.inputs, self.outputs) - m = np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) * 1e3 * 1.1 * 100.0 - Iax = 0.5 * m * 0.25 * (10.0 ** 2 + 9.9 ** 2) - Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0 ** 2 + 9.9 ** 2) + 100 ** 2) + m * 50 * 50 # parallel axis on last term + m = np.pi * 0.25 * (10.0**2 - 9.9**2) * 1e3 * 1.1 * 100.0 + Iax = 0.5 * m * 0.25 * (10.0**2 + 9.9**2) + Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0**2 + 9.9**2) + 100**2) + m * 50 * 50 # parallel axis on last term self.assertAlmostEqual(self.outputs["shell_mass"], m) self.assertAlmostEqual(self.outputs["shell_z_cg"], 50.0) npt.assert_almost_equal(self.outputs["shell_I_base"], [Ix, Ix, Iax, 0.0, 0.0, 0.0], decimal=5) @@ -293,10 +294,10 @@ def testMainSections(self): else: self.assertAlmostEqual(self.mem.sections[k].D, 10.0) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) self.assertAlmostEqual(self.mem.sections[k].E, 1e6) self.assertAlmostEqual(self.mem.sections[k].G, 1e5) @@ -314,9 +315,9 @@ def testMainSectionsWithAxial(self): A_stiff = 0.2 * 0.5 + 1 * 0.3 n_stiff = 8 - m = np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) * 1e3 * 1.1 * 100.0 - Iax = 0.5 * m * 0.25 * (10.0 ** 2 + 9.9 ** 2) - Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0 ** 2 + 9.9 ** 2) + 100 ** 2) + m * 50 * 50 # parallel axis on last term + m = np.pi * 0.25 * (10.0**2 - 9.9**2) * 1e3 * 1.1 * 100.0 + Iax = 0.5 * m * 0.25 * (10.0**2 + 9.9**2) + Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0**2 + 9.9**2) + 100**2) + m * 50 * 50 # parallel axis on last term m += n_stiff * A_stiff * 1e3 * 1.1 * 100.0 Iz_stiff = n_stiff * (0.2 * 0.5 * (0.5 * 9.9 - 0.25) ** 2 + 1 * 0.3 * (0.5 * 9.9 - 0.5 - 0.15) ** 2) Iax += Iz_stiff * 1e3 * 1.1 * 100 @@ -334,10 +335,10 @@ def testMainSectionsWithAxial(self): self.assertAlmostEqual(self.mem.sections[k].D, 10.0) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05 + n_stiff * A_stiff / (2 * np.pi * 4.7)) self.assertAlmostEqual( - self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) + n_stiff * A_stiff + self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2) + n_stiff * A_stiff ) self.assertAlmostEqual( - self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64 + Iz_stiff + self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64 + Iz_stiff ) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) self.assertAlmostEqual(self.mem.sections[k].E, 1e6) @@ -349,9 +350,9 @@ def testMainSectionsWithGhost(self): self.inputs["s_ghost2"] = 0.9 self.mem.add_main_sections(self.inputs, self.outputs) - m = np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) * 1e3 * 1.1 * 90.0 - Iax = 0.5 * m * 0.25 * (10.0 ** 2 + 9.9 ** 2) - Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0 ** 2 + 9.9 ** 2) + 90 ** 2) + m * 45 * 45 + m = np.pi * 0.25 * (10.0**2 - 9.9**2) * 1e3 * 1.1 * 90.0 + Iax = 0.5 * m * 0.25 * (10.0**2 + 9.9**2) + Ix = (1 / 12.0) * m * (3 * 0.25 * (10.0**2 + 9.9**2) + 90**2) + m * 45 * 45 self.assertAlmostEqual(self.outputs["shell_mass"], m) self.assertAlmostEqual(self.outputs["shell_z_cg"], 45.0) npt.assert_almost_equal(self.outputs["shell_I_base"], [Ix, Ix, Iax, 0.0, 0.0, 0.0], decimal=5) @@ -365,10 +366,10 @@ def testMainSectionsWithGhost(self): if k < 0.9: self.assertAlmostEqual(self.mem.sections[k].D, 10.0) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) self.assertAlmostEqual(self.mem.sections[k].E, 1e6) self.assertAlmostEqual(self.mem.sections[k].G, 1e5) @@ -399,19 +400,19 @@ def testBulk(self): inbulk = np.any(np.logical_and(k >= bulks[:, 0], k < bulks[:, 1])) if inbulk: self.assertAlmostEqual(self.mem.sections[k].t, 5.0) - self.assertAlmostEqual(self.mem.sections[k].A, np.pi * 0.25 * (10.0 ** 2 - 0 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, np.pi * (10.0 ** 4 - 0 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, np.pi * (10.0 ** 4 - 0 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * np.pi * (10.0 ** 4 - 0 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, np.pi * 0.25 * (10.0**2 - 0**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, np.pi * (10.0**4 - 0**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, np.pi * (10.0**4 - 0**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * np.pi * (10.0**4 - 0**4) / 64) self.assertAlmostEqual(self.mem.sections[k].rho, 1.1 * 1e3) elif k == 1.0: self.assertEqual(self.mem.sections[k], None) continue else: - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) @@ -422,12 +423,12 @@ def testBulk(self): nbulk = len(bgrid) R_i = 0.5 * 10 - 0.05 - m_bulk = 1.1 * 1e3 * np.pi * R_i ** 2 * 1.0 + m_bulk = 1.1 * 1e3 * np.pi * R_i**2 * 1.0 npt.assert_almost_equal(self.outputs["bulkhead_mass"], m_bulk * nbulk) npt.assert_almost_equal(self.outputs["bulkhead_z_cg"], 100 * bgrid.mean()) - J0 = 0.50 * m_bulk * R_i ** 2 - I0 = 0.25 * m_bulk * R_i ** 2 + J0 = 0.50 * m_bulk * R_i**2 + I0 = 0.25 * m_bulk * R_i**2 I = np.zeros(6) I[2] = nbulk * J0 @@ -454,10 +455,10 @@ def testBulkWithGhost(self): inbulk = np.any(np.logical_and(k >= bulks[:, 0], k < bulks[:, 1])) if inbulk: self.assertAlmostEqual(self.mem.sections[k].t, 5.0) - self.assertAlmostEqual(self.mem.sections[k].A, np.pi * 0.25 * (10.0 ** 2 - 0 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, np.pi * (10.0 ** 4 - 0 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, np.pi * (10.0 ** 4 - 0 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * np.pi * (10.0 ** 4 - 0 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, np.pi * 0.25 * (10.0**2 - 0**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, np.pi * (10.0**4 - 0**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, np.pi * (10.0**4 - 0**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * np.pi * (10.0**4 - 0**4) / 64) self.assertAlmostEqual(self.mem.sections[k].rho, 1.1 * 1e3) self.assertAlmostEqual(self.mem.sections[k].D, 10.0) elif k == 1.0: @@ -465,10 +466,10 @@ def testBulkWithGhost(self): continue else: if k < 0.9: - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) self.assertAlmostEqual(self.mem.sections[k].D, 10.0) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) @@ -489,12 +490,12 @@ def testBulkWithGhost(self): nbulk = len(bgrid) R_i = 0.5 * 10 - 0.05 - m_bulk = 1.1 * 1e3 * np.pi * R_i ** 2 * 1.0 + m_bulk = 1.1 * 1e3 * np.pi * R_i**2 * 1.0 npt.assert_almost_equal(self.outputs["bulkhead_mass"], m_bulk * nbulk) npt.assert_almost_equal(self.outputs["bulkhead_z_cg"], 100 * bgrid.mean()) - J0 = 0.50 * m_bulk * R_i ** 2 - I0 = 0.25 * m_bulk * R_i ** 2 + J0 = 0.50 * m_bulk * R_i**2 + I0 = 0.25 * m_bulk * R_i**2 I = np.zeros(6) I[2] = nbulk * J0 @@ -524,8 +525,8 @@ def testStiff(self): self.assertEqual(self.outputs["constr_web_compactness"], np.sqrt(5) * 0.2 / 0.5) # Test Mass - A1 = np.pi * (Rwo ** 2 - Rwi ** 2) - A2 = np.pi * (Rwi ** 2 - Rfi ** 2) + A1 = np.pi * (Rwo**2 - Rwi**2) + A2 = np.pi * (Rwi**2 - Rfi**2) V1 = A1 * 0.2 V2 = A2 * 1.0 m1 = V1 * 1e3 @@ -542,7 +543,7 @@ def testStiff(self): I_sec = (I_web + I_fl).flatten() I = np.zeros(6) - I[0] = np.sum(I_sec[0] + m * z_stiff ** 2.0) + I[0] = np.sum(I_sec[0] + m * z_stiff**2.0) I[1] = I[0] I[2] = 5 * I_sec[2] npt.assert_almost_equal(self.outputs["stiffener_I_base"], I) @@ -555,20 +556,20 @@ def testStiff(self): for k in key: instiff = np.any(np.logical_and(k >= stiffs[:, 0], k < stiffs[:, 1])) if instiff: - a = f * A1 + A2 + 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) + a = f * A1 + A2 + 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2) self.assertAlmostEqual(self.mem.sections[k].A, a) - self.assertGreater(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertGreater(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertGreater(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertGreater(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertGreater(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertGreater(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 5 - np.sqrt(25 - a / np.pi)) elif k == 1.0: self.assertEqual(self.mem.sections[k], None) continue else: - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) self.assertAlmostEqual(self.mem.sections[k].D, 10.0) @@ -598,8 +599,8 @@ def testStiffWithGhost(self): self.assertEqual(self.outputs["constr_web_compactness"], np.sqrt(5) * 0.2 / 0.5) # Test Mass - A1 = np.pi * (Rwo ** 2 - Rwi ** 2) - A2 = np.pi * (Rwi ** 2 - Rfi ** 2) + A1 = np.pi * (Rwo**2 - Rwi**2) + A2 = np.pi * (Rwi**2 - Rfi**2) V1 = A1 * 0.2 V2 = A2 * 1.0 m1 = V1 * 1e3 @@ -616,7 +617,7 @@ def testStiffWithGhost(self): I_sec = (I_web + I_fl).flatten() I = np.zeros(6) - I[0] = np.sum(I_sec[0] + m * z_stiff ** 2.0) + I[0] = np.sum(I_sec[0] + m * z_stiff**2.0) I[1] = I[0] I[2] = 4 * I_sec[2] npt.assert_almost_equal(self.outputs["stiffener_I_base"], I) @@ -629,11 +630,11 @@ def testStiffWithGhost(self): for k in key: instiff = np.any(np.logical_and(k >= stiffs[:, 0], k < stiffs[:, 1])) if instiff: - a = f * A1 + A2 + 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) + a = f * A1 + A2 + 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2) self.assertAlmostEqual(self.mem.sections[k].A, a) - self.assertGreater(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertGreater(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertGreater(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertGreater(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertGreater(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertGreater(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 5 - np.sqrt(25 - a / np.pi)) self.assertAlmostEqual(self.mem.sections[k].D, 10.0) elif k == 1.0: @@ -641,10 +642,10 @@ def testStiffWithGhost(self): continue else: if k < 0.9: - self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2)) - self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + self.assertAlmostEqual(self.mem.sections[k].A, 1.1 * np.pi * 0.25 * (10.0**2 - 9.9**2)) + self.assertAlmostEqual(self.mem.sections[k].Ixx, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].Iyy, 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + self.assertAlmostEqual(self.mem.sections[k].J0, 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) self.assertAlmostEqual(self.mem.sections[k].t, 1.1 * 0.05) self.assertAlmostEqual(self.mem.sections[k].rho, 1e3) self.assertAlmostEqual(self.mem.sections[k].E, 1e6) @@ -667,15 +668,15 @@ def testBallast(self): self.mem.add_main_sections(self.inputs, self.outputs) self.mem.add_ballast_sections(self.inputs, self.outputs) - area = 0.25 * np.pi * 9.9 ** 2 + area = 0.25 * np.pi * 9.9**2 h = 10 * np.pi / area cg_perm = (2 * 0.5 * h + 4 * (8 + 0.5 * h)) / 6 m_perm = np.pi * 6e4 I_perm = np.zeros(6) - I_perm[2] = 0.5 * m_perm * 0.25 * 9.9 ** 2 + I_perm[2] = 0.5 * m_perm * 0.25 * 9.9**2 I_perm[0] = ( - m_perm * (3 * 0.25 * 9.9 ** 2 + h ** 2) / 12.0 + m_perm * (3 * 0.25 * 9.9**2 + h**2) / 12.0 + (1 / 3) * m_perm * (0.5 * h) ** 2 + (2 / 3) * m_perm * (8 + 0.5 * h) ** 2 ) @@ -696,15 +697,15 @@ def testBallastWithGhost(self): self.mem.add_main_sections(self.inputs, self.outputs) self.mem.add_ballast_sections(self.inputs, self.outputs) - area = 0.25 * np.pi * 9.9 ** 2 + area = 0.25 * np.pi * 9.9**2 h = 10 * np.pi / area cg_perm = (2 * (10 + 0.5 * h) + 4 * (18 + 0.5 * h)) / 6 m_perm = np.pi * 6e4 I_perm = np.zeros(6) - I_perm[2] = 0.5 * m_perm * 0.25 * 9.9 ** 2 + I_perm[2] = 0.5 * m_perm * 0.25 * 9.9**2 I_perm[0] = ( - m_perm * (3 * 0.25 * 9.9 ** 2 + h ** 2) / 12.0 + m_perm * (3 * 0.25 * 9.9**2 + h**2) / 12.0 + (1 / 3) * m_perm * (10 + 0.5 * h) ** 2 + (2 / 3) * m_perm * (18 + 0.5 * h) ** 2 ) @@ -725,19 +726,19 @@ def testMassProp(self): self.mem.add_ballast_sections(self.inputs, self.outputs) self.mem.compute_mass_properties(self.inputs, self.outputs) - m_shell = np.pi * 0.25 * (10.0 ** 2 - 9.9 ** 2) * 1e3 * 1.1 * 100.0 + m_shell = np.pi * 0.25 * (10.0**2 - 9.9**2) * 1e3 * 1.1 * 100.0 R_i = 0.5 * 10 - 0.05 cg_shell = 50 nbulk = len(self.inputs["bulkhead_grid"]) - m_bulk = 1.1 * 1e3 * np.pi * R_i ** 2 * 1.0 + m_bulk = 1.1 * 1e3 * np.pi * R_i**2 * 1.0 cg_bulk = 100 * self.inputs["bulkhead_grid"].mean() Rwo = 0.5 * (10 - 2 * 0.05) Rwi = Rwo - 0.5 Rfi = Rwi - 0.3 - A1 = np.pi * (Rwo ** 2 - Rwi ** 2) - A2 = np.pi * (Rwi ** 2 - Rfi ** 2) + A1 = np.pi * (Rwo**2 - Rwi**2) + A2 = np.pi * (Rwi**2 - Rfi**2) V1 = A1 * 0.2 V2 = A2 * 1.0 m1 = V1 * 1e3 @@ -745,7 +746,7 @@ def testMassProp(self): m_stiff = m1 + m2 cg_stiff = 50.0 - area = 0.25 * np.pi * 9.9 ** 2 + area = 0.25 * np.pi * 9.9**2 h = 10 * np.pi / area cg_perm = (2 * 0.5 * h + 4 * (8 + 0.5 * h)) / 6 m_perm = np.pi * 6e4 @@ -791,9 +792,9 @@ def testNodalFinish(self): npt.assert_almost_equal(self.outputs["section_" + var][nelem:], NULL) npt.assert_almost_equal(self.outputs["section_D"][:nelem], 10.0) npt.assert_almost_equal(self.outputs["section_t"][:nelem], 1.1 * 0.05) - npt.assert_almost_equal(self.outputs["section_Ixx"][:nelem], 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - npt.assert_almost_equal(self.outputs["section_Iyy"][:nelem], 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) - npt.assert_almost_equal(self.outputs["section_J0"][:nelem], 2 * 1.1 * np.pi * (10.0 ** 4 - 9.9 ** 4) / 64) + npt.assert_almost_equal(self.outputs["section_Ixx"][:nelem], 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + npt.assert_almost_equal(self.outputs["section_Iyy"][:nelem], 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) + npt.assert_almost_equal(self.outputs["section_J0"][:nelem], 2 * 1.1 * np.pi * (10.0**4 - 9.9**4) / 64) npt.assert_almost_equal(self.outputs["section_rho"][:nelem], 1e3) npt.assert_almost_equal(self.outputs["section_E"][:nelem], 1e6) npt.assert_almost_equal(self.outputs["section_G"][:nelem], 1e5) @@ -1029,7 +1030,7 @@ def testStandard(self): opt["n_ballasts"] = [0] opt["n_axial_joints"] = [0] - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = member.MemberStandard(column_options=opt, idx=0, n_mat=2) @@ -1084,7 +1085,7 @@ def testDetailed(self): opt["n_ballasts"] = [2] opt["n_axial_joints"] = [3] - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = member.MemberDetailed(column_options=opt, idx=0, n_mat=2) diff --git a/wisdem/test/test_commonse/test_wind_wave.py b/wisdem/test/test_commonse/test_wind_wave.py index 7e77f0fcf..f5c33f93e 100644 --- a/wisdem/test/test_commonse/test_wind_wave.py +++ b/wisdem/test/test_commonse/test_wind_wave.py @@ -3,9 +3,10 @@ import numpy as np import openmdao.api as om import numpy.testing as npt -import wisdem.commonse.wind_wave_drag as wwd from openmdao.utils.assert_utils import assert_check_partials +import wisdem.commonse.wind_wave_drag as wwd + npts = 100 myones = np.ones((npts,)) @@ -76,7 +77,7 @@ def testCDset(self): def test_wave_derivs(self): nPoints = 5 - prob = om.Problem() + prob = om.Problem(reports=False) comp = wwd.CylinderWaveDrag(nPoints=nPoints) prob.model.add_subsystem("comp", comp, promotes=["*"]) @@ -104,7 +105,7 @@ def test_wave_derivs(self): def test_wind_derivs(self): nPoints = 5 - prob = om.Problem() + prob = om.Problem(reports=False) comp = wwd.CylinderWindDrag(nPoints=nPoints) prob.model.add_subsystem("comp", comp, promotes=["*"]) diff --git a/wisdem/test/test_drivetrainse/test_drivetrainse.py b/wisdem/test/test_drivetrainse/test_drivetrainse.py index e59a26aa9..4e6cdb626 100644 --- a/wisdem/test/test_drivetrainse/test_drivetrainse.py +++ b/wisdem/test/test_drivetrainse/test_drivetrainse.py @@ -5,6 +5,7 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + from wisdem.drivetrainse.drivetrain import DrivetrainSE npts = 12 @@ -87,7 +88,7 @@ def testDirectDrive_withGen(self): opt["flags"] = {} opt["flags"]["generator"] = True - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) prob.setup() prob = set_common(prob, opt) @@ -189,7 +190,7 @@ def testDirectDrive_withSimpleGen(self): opt["flags"] = {} opt["flags"]["generator"] = False - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) prob.setup() prob = set_common(prob, opt) @@ -259,7 +260,7 @@ def testGeared_withGen(self): opt["flags"] = {} opt["flags"]["generator"] = True - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) prob.setup() prob = set_common(prob, opt) @@ -385,7 +386,7 @@ def testGeared_withSimpleGen(self): opt["materials"] = {} opt["materials"]["n_mat"] = 1 - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = DrivetrainSE(modeling_options=opt) prob.setup() prob = set_common(prob, opt) diff --git a/wisdem/test/test_drivetrainse/test_hub.py b/wisdem/test/test_drivetrainse/test_hub.py index 7ae1656c9..397d8a3cb 100644 --- a/wisdem/test/test_drivetrainse/test_hub.py +++ b/wisdem/test/test_drivetrainse/test_hub.py @@ -2,6 +2,7 @@ import numpy as np import openmdao.api as om + import wisdem.drivetrainse.hub as hub @@ -40,8 +41,8 @@ def testPitch(self): inputs["BRFM"] = ( (3.06 * np.pi / 8) * AirDensity - * (RatedWindSpeed ** 2) - * (Solidity * (rotor_diameter ** 3)) + * (RatedWindSpeed**2) + * (Solidity * (rotor_diameter**3)) / discrete_inputs["n_blades"] ) @@ -57,7 +58,7 @@ def testRegression(self): opt = {} opt["hub_gamma"] = 2.0 opt["spinner_gamma"] = 1.5 - hub_prob = om.Problem(model=hub.Hub_System(modeling_options=opt)) + hub_prob = om.Problem(reports=False, model=hub.Hub_System(modeling_options=opt)) hub_prob.setup() hub_prob["blades_I"] = 1e3 * np.ones(6) diff --git a/wisdem/test/test_fixed_bottomse/test_jacket.py b/wisdem/test/test_fixed_bottomse/test_jacket.py index e086264aa..4b2018123 100644 --- a/wisdem/test/test_fixed_bottomse/test_jacket.py +++ b/wisdem/test/test_fixed_bottomse/test_jacket.py @@ -30,11 +30,7 @@ def testAll(self): modeling_options["materials"] = {} modeling_options["materials"]["n_mat"] = 1 - prob = om.Problem( - model=JacketSE( - modeling_options=modeling_options, - ) - ) + prob = om.Problem(reports=False, model=JacketSE(modeling_options=modeling_options)) prob.setup() diff --git a/wisdem/test/test_fixed_bottomse/test_monopile.py b/wisdem/test/test_fixed_bottomse/test_monopile.py index 094fe1d09..11f0f4207 100644 --- a/wisdem/test/test_fixed_bottomse/test_monopile.py +++ b/wisdem/test/test_fixed_bottomse/test_monopile.py @@ -139,7 +139,7 @@ def testProblemFixedPile(self): self.modeling_options["WISDEM"]["FixedBottomSE"]["soil_springs"] = True self.modeling_options["WISDEM"]["FixedBottomSE"]["gravity_foundation"] = False - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = mon.MonopileSE(modeling_options=self.modeling_options) prob.setup() @@ -241,7 +241,7 @@ def testProblemFixedPile_GBF(self): self.modeling_options["WISDEM"]["FixedBottomSE"]["soil_springs"] = False self.modeling_options["WISDEM"]["FixedBottomSE"]["gravity_foundation"] = True - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = mon.MonopileSE(modeling_options=self.modeling_options) prob.setup() @@ -334,7 +334,7 @@ def testAddedMassForces(self): self.modeling_options["WISDEM"]["FixedBottomSE"]["soil_springs"] = False self.modeling_options["WISDEM"]["FixedBottomSE"]["gravity_foundation"] = False - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = mon.MonopileSE(modeling_options=self.modeling_options) prob.setup() @@ -464,7 +464,7 @@ def testExampleRegression(self): self.modeling_options["WISDEM"]["FixedBottomSE"]["gravity_foundation"] = False def fill_prob(): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = mon.MonopileSE(modeling_options=self.modeling_options) prob.setup() diff --git a/wisdem/test/test_floatingse/test_floating.py b/wisdem/test/test_floatingse/test_floating.py index f9d7ec3a9..443da5f82 100644 --- a/wisdem/test/test_floatingse/test_floating.py +++ b/wisdem/test/test_floatingse/test_floating.py @@ -3,6 +3,7 @@ import numpy as np import numpy.testing as npt from openmdao.api import Problem + from wisdem.floatingse.floating import FloatingSE npts = 5 @@ -48,7 +49,7 @@ def testMassPropertiesSpar(self): opt["materials"] = {} opt["materials"]["n_mat"] = 2 - prob = Problem() + prob = Problem(reports=False) prob.model = FloatingSE(modeling_options=opt) prob.setup() @@ -136,15 +137,15 @@ def testMassPropertiesSpar(self): prob.run_model() - m_top = np.pi * 3.2 ** 2.0 * 0.05 * 7850.0 + m_top = np.pi * 3.2**2.0 * 0.05 * 7850.0 ansys_m_bulk = 13204.0 + 2.0 * 27239.0 + m_top ansys_m_shell = 80150.0 + 32060.0 + 79701.0 + 1251800.0 ansys_m_stiff = 1390.9 * 52 + 1282.2 + 1121.2 + 951.44 * 3 ansys_m_spar = ansys_m_bulk + ansys_m_shell + ansys_m_stiff ansys_cg = np.array([0.0, 0.0, -58.926]) - ansys_Ixx = 2178400000.0 + m_top * (0.25 * 3.2 ** 2.0 + (10 - ansys_cg[-1]) ** 2) - ansys_Iyy = 2178400000.0 + m_top * (0.25 * 3.2 ** 2.0 + (10 - ansys_cg[-1]) ** 2) - ansys_Izz = 32297000.0 + 0.5 * m_top * 3.2 ** 2.0 + ansys_Ixx = 2178400000.0 + m_top * (0.25 * 3.2**2.0 + (10 - ansys_cg[-1]) ** 2) + ansys_Iyy = 2178400000.0 + m_top * (0.25 * 3.2**2.0 + (10 - ansys_cg[-1]) ** 2) + ansys_Izz = 32297000.0 + 0.5 * m_top * 3.2**2.0 ansys_I = np.array([ansys_Ixx, ansys_Iyy, ansys_Izz, 0.0, 0.0, 0.0]) npt.assert_allclose( diff --git a/wisdem/test/test_floatingse/test_system.py b/wisdem/test/test_floatingse/test_system.py index c601bcde1..f13410689 100644 --- a/wisdem/test/test_floatingse/test_system.py +++ b/wisdem/test/test_floatingse/test_system.py @@ -264,7 +264,7 @@ def testRunAll(self): opt["materials"] = {} opt["materials"]["n_mat"] = 2 - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = sys.FloatingSystem(modeling_options=opt) prob.setup() diff --git a/wisdem/test/test_landbosse/test_landbosse.py b/wisdem/test/test_landbosse/test_landbosse.py index 0a8d96620..ecc613eb5 100644 --- a/wisdem/test/test_landbosse/test_landbosse.py +++ b/wisdem/test/test_landbosse/test_landbosse.py @@ -1,6 +1,7 @@ import pandas as pd import pytest import openmdao.api as om + from wisdem.landbosse.landbosse_omdao.landbosse import LandBOSSE from wisdem.landbosse.landbosse_omdao.OpenMDAODataframeCache import OpenMDAODataframeCache @@ -11,7 +12,7 @@ def landbosse_costs_by_module_type_operation(): Executes LandBOSSE and extracts cost output for the regression test. """ - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = LandBOSSE() prob.setup() prob.run_model() diff --git a/wisdem/test/test_nrelcsm/test_nrel_csm_cost_2015.py b/wisdem/test/test_nrelcsm/test_nrel_csm_cost_2015.py index 9d10d604a..5b4abea27 100644 --- a/wisdem/test/test_nrelcsm/test_nrel_csm_cost_2015.py +++ b/wisdem/test/test_nrelcsm/test_nrel_csm_cost_2015.py @@ -2,13 +2,14 @@ import numpy as np from openmdao.api import Problem + from wisdem.nrelcsm.nrel_csm_cost_2015 import Turbine_CostsSE_2015 class TestNewAssembly(unittest.TestCase): def setUp(self): turbine = Turbine_CostsSE_2015(verbosity=False) - self.prob = Problem(turbine) + self.prob = Problem(turbine, reports=False) self.prob.setup() self.prob["blade_mass"] = 17650.67 # inline with the windpact estimates diff --git a/wisdem/test/test_nrelcsm/test_nrel_csm_mass_2015.py b/wisdem/test/test_nrelcsm/test_nrel_csm_mass_2015.py index 179614d37..f8c81608f 100644 --- a/wisdem/test/test_nrelcsm/test_nrel_csm_mass_2015.py +++ b/wisdem/test/test_nrelcsm/test_nrel_csm_mass_2015.py @@ -1,6 +1,7 @@ import unittest import openmdao.api as om + import wisdem.nrelcsm.nrel_csm_mass_2015 as nct2015 @@ -8,7 +9,7 @@ class TestAll(unittest.TestCase): def testMass(self): # simple test of module - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = nct2015.nrel_csm_mass_2015() prob.setup() @@ -51,7 +52,7 @@ def testMass(self): def testMassAndCost(self): # simple test of module - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = nct2015.nrel_csm_2015() prob.setup() diff --git a/wisdem/test/test_optimization_drivers/test_intermittent_component.py b/wisdem/test/test_optimization_drivers/test_intermittent_component.py index 2c275dc60..50429291f 100644 --- a/wisdem/test/test_optimization_drivers/test_intermittent_component.py +++ b/wisdem/test/test_optimization_drivers/test_intermittent_component.py @@ -63,7 +63,7 @@ def internal_compute(self, inputs, outputs): class TestIntermittentComponent(unittest.TestCase): def test_run(self): - prob = om.Problem(model=om.Group(num_par_fd=num_procs)) + prob = om.Problem(reports=False, model=om.Group(num_par_fd=num_procs)) prob.model.approx_totals(method="fd") indeps = prob.model.add_subsystem("indeps", om.IndepVarComp(), promotes=["*"]) indeps.add_output("x", 1.2 * np.ones(rosenbrock_size)) diff --git a/wisdem/test/test_optimization_drivers/test_nlopt_driver.py b/wisdem/test/test_optimization_drivers/test_nlopt_driver.py index e5f3308d0..85f059b59 100644 --- a/wisdem/test/test_optimization_drivers/test_nlopt_driver.py +++ b/wisdem/test/test_optimization_drivers/test_nlopt_driver.py @@ -30,7 +30,7 @@ def rastrigin(x): @unittest.skipIf(nlopt is None, "only run if NLopt is installed.") class TestNLoptDriver(unittest.TestCase): def test_driver_supports(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -51,7 +51,7 @@ def test_driver_supports(self): def test_compute_totals_basic_return_array(self): # Make sure 'array' return_format works. - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 0.0), promotes=["x"]) model.add_subsystem("p2", om.IndepVarComp("y", 0.0), promotes=["y"]) @@ -86,7 +86,7 @@ def test_compute_totals_basic_return_array(self): def test_compute_totals_return_array_non_square(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("px", om.IndepVarComp(name="x", val=np.ones((2,)))) @@ -117,7 +117,7 @@ def test_compute_totals_return_array_non_square(self): def test_deriv_wrt_self(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("px", om.IndepVarComp(name="x", val=np.ones((2,)))) @@ -137,7 +137,7 @@ def test_deriv_wrt_self(self): def test_optimizer_simple_paraboloid_unconstrained(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -161,7 +161,7 @@ def test_optimizer_simple_paraboloid_unconstrained(self): def test_simple_paraboloid_unconstrained(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -186,7 +186,7 @@ def test_simple_paraboloid_unconstrained(self): assert_near_equal(prob["y"], -7.3333333, 1e-6) def test_simple_paraboloid_unconstrained_LN_COBYLA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -212,7 +212,7 @@ def test_simple_paraboloid_unconstrained_LN_COBYLA(self): def test_simple_paraboloid_upper(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -241,7 +241,7 @@ def test_simple_paraboloid_upper(self): def test_simple_paraboloid_lower(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -271,7 +271,7 @@ def test_simple_paraboloid_lower(self): def test_simple_paraboloid_equality(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -300,7 +300,7 @@ def test_simple_paraboloid_equality(self): def test_missing_objective(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("x", om.IndepVarComp("x", 2.0), promotes=["*"]) @@ -324,7 +324,7 @@ def test_missing_objective(self): def test_simple_paraboloid_double_sided_low(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -351,7 +351,7 @@ def test_simple_paraboloid_double_sided_low(self): def test_simple_paraboloid_double_sided_high(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -378,7 +378,7 @@ def test_simple_paraboloid_double_sided_high(self): def test_simple_array_comp2D(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("widths", np.zeros((2, 2))), promotes=["*"]) @@ -413,7 +413,7 @@ def test_simple_array_comp2D(self): def test_simple_array_comp2D_eq_con(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("widths", np.zeros((2, 2))), promotes=["*"]) @@ -443,7 +443,7 @@ def test_simple_array_comp2D_eq_con(self): def test_simple_array_comp2D_dbl_sided_con(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("widths", np.zeros((2, 2))), promotes=["*"]) @@ -477,7 +477,7 @@ def test_simple_array_comp2D_dbl_sided_con(self): def test_simple_array_comp2D_dbl_sided_con_array(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("widths", np.zeros((2, 2))), promotes=["*"]) @@ -507,7 +507,7 @@ def test_simple_array_comp2D_dbl_sided_con_array(self): def test_simple_array_comp2D_array_lo_hi(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("widths", np.zeros((2, 2))), promotes=["*"]) @@ -542,7 +542,7 @@ def test_simple_array_comp2D_array_lo_hi(self): def test_simple_paraboloid_scaled_desvars_fwd(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -569,7 +569,7 @@ def test_simple_paraboloid_scaled_desvars_fwd(self): def test_simple_paraboloid_scaled_desvars_rev(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -596,7 +596,7 @@ def test_simple_paraboloid_scaled_desvars_rev(self): def test_simple_paraboloid_scaled_constraint_fwd(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -623,7 +623,7 @@ def test_simple_paraboloid_scaled_constraint_fwd(self): def test_simple_paraboloid_scaled_objective_fwd(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model prob.set_solver_print(level=0) @@ -650,7 +650,7 @@ def test_simple_paraboloid_scaled_objective_fwd(self): def test_simple_paraboloid_scaled_objective_rev(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model prob.set_solver_print(level=0) @@ -677,7 +677,7 @@ def test_simple_paraboloid_scaled_objective_rev(self): def test_sellar_mdf(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model = SellarDerivativesGrouped() prob.set_solver_print(level=0) @@ -703,7 +703,7 @@ def test_sellar_mdf(self): def test_bug_in_eq_constraints(self): # We were getting extra constraints created because lower and upper are maxfloat instead of # None when unused. - p = om.Problem(model=SineFitter()) + p = om.Problem(reports=False, model=SineFitter()) p.driver = NLoptDriver() p.setup() @@ -744,7 +744,7 @@ def compute_partials(self, inputs, J): J["Vd", "a"] = -2.0 * Vu - prob = om.Problem() + prob = om.Problem(reports=False) indeps = prob.model.add_subsystem("indeps", om.IndepVarComp(), promotes=["*"]) indeps.add_output("a", 0.5) indeps.add_output("Vu", 10.0, units="m/s") @@ -769,7 +769,7 @@ def compute_partials(self, inputs, J): def test_simple_paraboloid_upper_LN_COBYLA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -798,7 +798,7 @@ def test_simple_paraboloid_upper_LN_COBYLA(self): def test_sellar_mdf_LN_COBYLA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model = SellarDerivativesGrouped() prob.driver = NLoptDriver() @@ -823,7 +823,7 @@ def test_sellar_mdf_LN_COBYLA(self): def test_simple_paraboloid_lower_linear(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -854,7 +854,7 @@ def test_simple_paraboloid_lower_linear(self): def test_simple_paraboloid_equality_linear(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -883,7 +883,7 @@ def test_simple_paraboloid_equality_linear(self): def test_debug_print_option(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -946,7 +946,7 @@ def test_debug_print_option(self): def test_sellar_mdf_linear_con_directsolver(self): # This test makes sure that we call solve_nonlinear first if we have any linear constraints # to cache. - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model = SellarDerivatives() prob.driver = NLoptDriver() @@ -977,7 +977,7 @@ def test_sellar_mdf_linear_con_directsolver(self): def test_call_final_setup(self): # Make sure we call final setup if our model hasn't been setup. - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1011,7 +1011,7 @@ def test_LN_COBYLA_linear_constraint(self): # Bug where NLoptDriver tried to compute and cache the constraint derivatives for the # lower and upper bounds of the desvars even though we were using a non-gradient optimizer. # This causd a KeyError. - prob = om.Problem() + prob = om.Problem(reports=False) indeps = prob.model.add_subsystem("indeps", om.IndepVarComp()) indeps.add_output("x", 3.0) indeps.add_output("y", -4.0) @@ -1041,7 +1041,7 @@ def test_multiple_objectives_error(self): import openmdao.api as om from openmdao.test_suite.components.paraboloid import Paraboloid - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1086,7 +1086,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): x = inputs["x"] outputs["f"] = rastrigin(x) - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("indeps", om.IndepVarComp("x", np.ones(size)), promotes=["*"]) @@ -1119,7 +1119,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): x = inputs["x"] outputs["f"] = rastrigin(x) - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("indeps", om.IndepVarComp("x", np.ones(size)), promotes=["*"]) @@ -1152,7 +1152,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): x = inputs["x"] outputs["f"] = rastrigin(x) - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("indeps", om.IndepVarComp("x", np.ones(size)), promotes=["*"]) @@ -1185,7 +1185,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): x = inputs["x"] outputs["f"] = rastrigin(x) - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("indeps", om.IndepVarComp("x", np.ones(size)), promotes=["*"]) @@ -1218,7 +1218,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): x = inputs["x"] outputs["f"] = rastrigin(x) - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("indeps", om.IndepVarComp("x", np.ones(size)), promotes=["*"]) @@ -1237,7 +1237,7 @@ def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None): def test_simple_paraboloid_upper_LD_MMA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1265,7 +1265,7 @@ def test_simple_paraboloid_upper_LD_MMA(self): def test_simple_paraboloid_upper_LD_CCSAQ(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1293,7 +1293,7 @@ def test_simple_paraboloid_upper_LD_CCSAQ(self): def test_simple_paraboloid_upper_GN_ORIG_DIRECT(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 7.5), promotes=["*"]) @@ -1324,7 +1324,7 @@ def test_simple_paraboloid_upper_GN_ORIG_DIRECT(self): def test_simple_paraboloid_upper_GN_ORIG_DIRECT_L(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 7.5), promotes=["*"]) @@ -1355,7 +1355,7 @@ def test_simple_paraboloid_upper_GN_ORIG_DIRECT_L(self): def test_simple_paraboloid_equality_COBYLA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1384,7 +1384,7 @@ def test_simple_paraboloid_equality_COBYLA(self): def test_simple_paraboloid_equality_ISRES(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1418,7 +1418,7 @@ def test_simple_paraboloid_equality_ISRES(self): def test_simple_paraboloid_equality_failure_MMA(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1454,7 +1454,7 @@ def test_simple_paraboloid_equality_failure_MMA(self): def test_simple_paraboloid_equality_failure_LD_CCSAQ(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1490,7 +1490,7 @@ def test_simple_paraboloid_equality_failure_LD_CCSAQ(self): def test_simple_paraboloid_equality_failure_GN_ORIG_DIRECT(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1526,7 +1526,7 @@ def test_simple_paraboloid_equality_failure_GN_ORIG_DIRECT(self): def test_simple_paraboloid_equality_failure_GN_ORIG_DIRECT_L(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1562,7 +1562,7 @@ def test_simple_paraboloid_equality_failure_GN_ORIG_DIRECT_L(self): def test_simple_paraboloid_equality_failure_GN_AGS(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1598,7 +1598,7 @@ def test_simple_paraboloid_equality_failure_GN_AGS(self): def test_maxtime(self): - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1626,7 +1626,7 @@ def test_simple_paraboloid_inequalities(self): # for both the lower and upper bounds to effectively create an equality # constraint even if the optimization method doesn't allow equality constraints - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model # Start very close to the correct answer with tight bounds to @@ -1667,7 +1667,7 @@ def test_feature_basic(self): from wisdem.optimization_drivers.nlopt_driver import NLoptDriver - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1695,7 +1695,7 @@ def test_feature_optimizer(self): from wisdem.optimization_drivers.nlopt_driver import NLoptDriver - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1721,7 +1721,7 @@ def test_feature_maxiter(self): from wisdem.optimization_drivers.nlopt_driver import NLoptDriver - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) @@ -1748,7 +1748,7 @@ def test_feature_tol(self): from wisdem.optimization_drivers.nlopt_driver import NLoptDriver - prob = om.Problem() + prob = om.Problem(reports=False) model = prob.model model.add_subsystem("p1", om.IndepVarComp("x", 50.0), promotes=["*"]) diff --git a/wisdem/test/test_orbit/api/test_wisdem_api.py b/wisdem/test/test_orbit/api/test_wisdem_api.py index 5352e7f8f..8165546bd 100644 --- a/wisdem/test/test_orbit/api/test_wisdem_api.py +++ b/wisdem/test/test_orbit/api/test_wisdem_api.py @@ -13,7 +13,7 @@ def test_wisdem_monopile_api_default(): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = Orbit(floating=False, jacket=False, jacket_legs=0) prob.setup() @@ -25,7 +25,7 @@ def test_wisdem_monopile_api_default(): def test_wisdem_jacket_api_default(): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = Orbit(floating=False, jacket=True, jacket_legs=3) prob.setup() @@ -37,7 +37,7 @@ def test_wisdem_jacket_api_default(): def test_wisdem_floating_api_default(): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = Orbit(floating=True, jacket=False, jacket_legs=0) prob.setup() diff --git a/wisdem/test/test_plant_financese/test_plantfinancese.py b/wisdem/test/test_plant_financese/test_plantfinancese.py index db3536889..91e5980ea 100644 --- a/wisdem/test/test_plant_financese/test_plantfinancese.py +++ b/wisdem/test/test_plant_financese/test_plantfinancese.py @@ -2,9 +2,10 @@ import numpy as np import numpy.testing as npt -import wisdem.plant_financese.plant_finance as pf from openmdao.api import Group, Problem +import wisdem.plant_financese.plant_finance as pf + class TestPlantFinance(unittest.TestCase): def setUp(self): @@ -26,7 +27,7 @@ def setUp(self): self.inputs["electricity_price"] = 0.04 self.inputs["reserve_margin_price"] = 120 - self.inputs["capacity_credit"] = 1. + self.inputs["capacity_credit"] = 1.0 self.inputs["benchmark_price"] = 0.071 self.mypfin = pf.PlantFinance(verbosity=True) @@ -36,10 +37,10 @@ def testRun(self): self.mypfin.compute(self.inputs, self.outputs, self.discrete_inputs, {}) C = 0.12 * (1.2e3 + 7.7e3) + 7e2 - E = (1.6e7 * 50.0) / (1e3 * 50 ) - V = (1.6e7 * 50.0) / (1e3 * 50 ) * 0.04 + 120. * 1. - lcoe = C/E - plcoe = C/V*0.071 + E = (1.6e7 * 50.0) / (1e3 * 50) + V = (1.6e7 * 50.0) / (1e3 * 50) * 0.04 + 120.0 * 1.0 + lcoe = C / E + plcoe = C / V * 0.071 self.assertEqual(self.outputs["lcoe"], lcoe) self.assertEqual(self.outputs["plcoe"], plcoe) @@ -48,15 +49,15 @@ def testRun(self): self.mypfin.compute(self.inputs, self.outputs, self.discrete_inputs, {}) C = 0.12 * (1.2e3 + 7.7e3) + 7e2 - E = (1.6e7 * 50.0 * (1 - 0.15)) / (1e3 * 50 ) - V = (1.6e7 * 50.0 * (1 - 0.15)) / (1e3 * 50 ) * 0.04 + 120. * 1. - lcoe = C/E - plcoe = C/V*0.071 + E = (1.6e7 * 50.0 * (1 - 0.15)) / (1e3 * 50) + V = (1.6e7 * 50.0 * (1 - 0.15)) / (1e3 * 50) * 0.04 + 120.0 * 1.0 + lcoe = C / E + plcoe = C / V * 0.071 self.assertEqual(self.outputs["lcoe"], lcoe) self.assertEqual(self.outputs["plcoe"], plcoe) def testDerivatives(self): - prob = Problem() + prob = Problem(reports=False) root = prob.model = Group() root.add_subsystem("pf", pf.PlantFinance(), promotes=["*"]) prob.setup() diff --git a/wisdem/test/test_rotorse/test_blade_cost.py b/wisdem/test/test_rotorse/test_blade_cost.py index aafc83b53..697096d15 100644 --- a/wisdem/test/test_rotorse/test_blade_cost.py +++ b/wisdem/test/test_rotorse/test_blade_cost.py @@ -26,7 +26,9 @@ def testBladeCostIEA3p4(self): modeling_options["WISDEM"]["TowerSE"]["flag"] = False modeling_options["flags"]["nacelle"] = False modeling_options["flags"]["tower"] = False - wt_opt = om.Problem(model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options)) + wt_opt = om.Problem( + reports=False, model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options) + ) wt_opt.setup(derivatives=False) myopt = PoseOptimization(wt_init, modeling_options, opt_options) wt_opt = myopt.set_initial(wt_opt, wt_init) @@ -62,7 +64,9 @@ def testBladeCostIEA10(self): modeling_options["WISDEM"]["TowerSE"]["flag"] = False modeling_options["flags"]["nacelle"] = False modeling_options["flags"]["tower"] = False - wt_opt = om.Problem(model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options)) + wt_opt = om.Problem( + reports=False, model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options) + ) wt_opt.setup(derivatives=False) myopt = PoseOptimization(wt_init, modeling_options, opt_options) wt_opt = myopt.set_initial(wt_opt, wt_init) @@ -98,7 +102,9 @@ def testBladeCostIEA15(self): modeling_options["WISDEM"]["TowerSE"]["flag"] = False modeling_options["flags"]["nacelle"] = False modeling_options["flags"]["tower"] = False - wt_opt = om.Problem(model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options)) + wt_opt = om.Problem( + reports=False, model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options) + ) wt_opt.setup(derivatives=False) myopt = PoseOptimization(wt_init, modeling_options, opt_options) wt_opt = myopt.set_initial(wt_opt, wt_init) @@ -133,7 +139,9 @@ def testBladeCostBAR_USC(self): modeling_options["WISDEM"]["TowerSE"]["flag"] = False modeling_options["flags"]["nacelle"] = False modeling_options["flags"]["tower"] = False - wt_opt = om.Problem(model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options)) + wt_opt = om.Problem( + reports=False, model=StandaloneBladeCost(modeling_options=modeling_options, opt_options=opt_options) + ) wt_opt.setup(derivatives=False) myopt = PoseOptimization(wt_init, modeling_options, opt_options) wt_opt = myopt.set_initial(wt_opt, wt_init) diff --git a/wisdem/test/test_rotorse/test_rail_transport.py b/wisdem/test/test_rotorse/test_rail_transport.py index d42deacb8..e71f4e75c 100644 --- a/wisdem/test/test_rotorse/test_rail_transport.py +++ b/wisdem/test/test_rotorse/test_rail_transport.py @@ -4,12 +4,13 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + import wisdem.rotorse.rail_transport as rt class TestRT(unittest.TestCase): def testRailTransport(self): - prob = om.Problem() + prob = om.Problem(reports=False) # Data structure generated with # np.savez('rail.npz', blade_ref_axis = inputs['blade_ref_axis'], @@ -68,10 +69,10 @@ def testRailTransport(self): prob.run_model() - print(prob["constr_LV_4axle_horiz"][0]) - print(prob["constr_LV_4axle_horiz"][1]) - print(prob["constr_LV_8axle_horiz"][0]) - print(prob["constr_LV_8axle_horiz"][1]) + print(prob["constr_LV_4axle_horiz"][0]) + print(prob["constr_LV_4axle_horiz"][1]) + print(prob["constr_LV_8axle_horiz"][0]) + print(prob["constr_LV_8axle_horiz"][1]) self.assertAlmostEqual(prob["constr_LV_4axle_horiz"][0], 2.205225587616127, places=1) self.assertAlmostEqual(prob["constr_LV_4axle_horiz"][1], 2.5000819086864334, places=1) diff --git a/wisdem/test/test_rotorse/test_rotor_power.py b/wisdem/test/test_rotorse/test_rotor_power.py index ffe70145d..ae060d6d9 100644 --- a/wisdem/test/test_rotorse/test_rotor_power.py +++ b/wisdem/test/test_rotorse/test_rotor_power.py @@ -4,6 +4,7 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + import wisdem.rotorse.rotor_power as rp # Load in airfoil and blade shape inputs for NREL 5MW @@ -82,7 +83,7 @@ def testGust(self): self.assertTrue(True) def testRegulationTrajectory(self): - prob = om.Problem() + prob = om.Problem(reports=False) (n_span, n_aoa, n_Re, n_tab) = NPZFILE["airfoils_cl"].shape n_pc = 22 @@ -126,7 +127,7 @@ def testRegulationTrajectory(self): npt.assert_array_almost_equal(prob["Cp"], prob["Cp_aero"] * 0.975 * 0.975) npt.assert_allclose(prob["Cp"], prob["Cp"][0]) npt.assert_allclose(prob["Cp_aero"], prob["Cp_aero"][0]) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp, myCp[0], rtol=1e-6) self.assertGreater(myCp[0], 0.4) self.assertGreater(0.5, myCp[0]) @@ -158,7 +159,7 @@ def testRegulationTrajectory(self): self.assertAlmostEqual(prob["rated_V"], V_expect1[-1], 3) self.assertAlmostEqual(prob["rated_Omega"][0], 15.0) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) @@ -183,7 +184,7 @@ def testRegulationTrajectory(self): self.assertEqual(prob["rated_V"], V_expect1[-1]) self.assertAlmostEqual(prob["rated_Omega"][0], Omega_expect[-1]) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) @@ -209,7 +210,7 @@ def testRegulationTrajectory(self): # self.assertEqual(prob['rated_V'], V_expect1[-1]) self.assertAlmostEqual(prob["rated_Omega"][0], Omega_expect[-1]) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) @@ -234,7 +235,7 @@ def testRegulationTrajectory(self): self.assertEqual(prob["rated_V"], V_expect1[-1]) self.assertAlmostEqual(prob["rated_Omega"][0], 15.0) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[Omega_expect == Omega_tsr], myCp[6]) npt.assert_allclose(myCp[Omega_expect == Omega_tsr], prob["Cp"][Omega_expect == Omega_tsr]) @@ -261,12 +262,12 @@ def testRegulationTrajectory(self): self.assertAlmostEqual(prob["rated_V"], V_expect1[-1], 3) self.assertAlmostEqual(prob["rated_Omega"][0], 15.0) self.assertEqual(prob["rated_pitch"], 5.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) def testRegulationTrajectoryNoRegion3(self): - prob = om.Problem() + prob = om.Problem(reports=False) # Load in airfoil and blade shape inputs for NREL 5MW (n_span, n_aoa, n_Re, n_tab) = NPZFILE["airfoils_cl"].shape @@ -311,7 +312,7 @@ def testRegulationTrajectoryNoRegion3(self): npt.assert_array_almost_equal(prob["Cp"], prob["Cp_aero"] * 0.975 * 0.975) npt.assert_allclose(prob["Cp"], prob["Cp"][0], rtol=1e-6) npt.assert_allclose(prob["Cp_aero"], prob["Cp_aero"][0]) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp, myCp[0], rtol=1e-6) self.assertGreater(myCp[0], 0.4) self.assertGreater(0.5, myCp[0]) @@ -345,12 +346,12 @@ def testRegulationTrajectoryNoRegion3(self): # self.assertEqual(prob['rated_V'], V_expect1[-1]) self.assertAlmostEqual(prob["rated_Omega"][0], Omega_expect[-1]) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) def testRegulationTrajectory_PeakShaving(self): - prob = om.Problem() + prob = om.Problem(reports=False) (n_span, n_aoa, n_Re, n_tab) = NPZFILE["airfoils_cl"].shape n_pc = 22 @@ -395,7 +396,7 @@ def testRegulationTrajectory_PeakShaving(self): npt.assert_array_almost_equal(prob["Cp"], prob["Cp_aero"] * 0.975 * 0.975) npt.assert_allclose(prob["Cp"], prob["Cp"][0], rtol=1e-6) npt.assert_allclose(prob["Cp_aero"], prob["Cp_aero"][0]) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp, myCp[0], rtol=1e-6) self.assertGreater(myCp[0], 0.4) self.assertGreater(0.5, myCp[0]) @@ -427,7 +428,7 @@ def testRegulationTrajectory_PeakShaving(self): self.assertAlmostEqual(prob["rated_V"], V_expect1[-1], 3) self.assertAlmostEqual(prob["rated_Omega"][0], 15.0) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) @@ -452,7 +453,7 @@ def testRegulationTrajectory_PeakShaving(self): self.assertEqual(prob["rated_V"], V_expect1[-1]) self.assertAlmostEqual(prob["rated_Omega"][0], Omega_expect[-1]) self.assertEqual(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[:irated], myCp[0]) npt.assert_allclose(myCp[:irated], prob["Cp"][:irated]) @@ -475,12 +476,12 @@ def testRegulationTrajectory_PeakShaving(self): npt.assert_array_less(prob["T"], 0.8 * 880899) # From print out in first test self.assertAlmostEqual(prob["rated_Omega"][0], Omega_expect[-1]) self.assertGreater(prob["rated_pitch"], 0.0) - myCp = prob["P"] / (0.5 * 1.225 * V_expect1 ** 3.0 * np.pi * 70 ** 2) + myCp = prob["P"] / (0.5 * 1.225 * V_expect1**3.0 * np.pi * 70**2) npt.assert_allclose(myCp[: (irated - 1)], myCp[0]) npt.assert_allclose(myCp[: (irated - 1)], prob["Cp"][: (irated - 1)]) def testRegulationTrajectory_reindex(self): - prob = om.Problem() + prob = om.Problem(reports=False) debug_archive = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "debug.npz" debug_npz = np.load(debug_archive) diff --git a/wisdem/test/test_towerse/test_tower.py b/wisdem/test/test_towerse/test_tower.py index 93aa62c87..d059c0dde 100644 --- a/wisdem/test/test_towerse/test_tower.py +++ b/wisdem/test/test_towerse/test_tower.py @@ -4,6 +4,7 @@ import numpy as np import openmdao.api as om import numpy.testing as npt + import wisdem.towerse.tower as tow from wisdem.commonse import gravity as g @@ -87,7 +88,7 @@ def setUp(self): def testProblemLand(self): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = tow.TowerSE(modeling_options=self.modeling_options) prob.setup() @@ -126,7 +127,7 @@ def testProblemLand(self): prob.run_model() # All other tests from above - mass_dens = 1e4 * (5.0 ** 2 - 4.9 ** 2) * np.pi + mass_dens = 1e4 * (5.0**2 - 4.9**2) * np.pi npt.assert_equal(prob["z_start"], 0.0) npt.assert_equal(prob["transition_piece_height"], 0.0) npt.assert_equal(prob["z_param"], np.array([0.0, 40.0, 80.0])) @@ -154,7 +155,7 @@ def testProblemLand(self): def testAddedMassForces(self): self.modeling_options["WISDEM"]["TowerSE"]["n_height"] = 3 - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = tow.TowerSE(modeling_options=self.modeling_options) prob.setup() @@ -257,7 +258,7 @@ def test15MWmode_shapes(self): self.modeling_options["WISDEM"]["TowerSE"]["n_height"] = len(d_param) - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = tow.TowerSE(modeling_options=self.modeling_options) prob.setup() @@ -390,7 +391,7 @@ def testExampleRegression(self): self.modeling_options["WISDEM"]["TowerSE"]["gamma_fatigue"] = 1.35 * 1.3 * 1.0 def fill_prob(): - prob = om.Problem() + prob = om.Problem(reports=False) prob.model = tow.TowerSE(modeling_options=self.modeling_options) prob.setup() diff --git a/wisdem/test/test_yaml/test_grid_derivs.py b/wisdem/test/test_yaml/test_grid_derivs.py index 3e5d8fa0e..83c8b5aa9 100644 --- a/wisdem/test/test_yaml/test_grid_derivs.py +++ b/wisdem/test/test_yaml/test_grid_derivs.py @@ -3,6 +3,7 @@ import numpy as np import openmdao.api as om from openmdao.utils.assert_utils import assert_check_partials + from wisdem.glue_code.gc_WT_DataStruc import Compute_Grid @@ -11,7 +12,7 @@ def test_derivatives(self): n_height = 6 comp = Compute_Grid(n_height=n_height) - prob = om.Problem() + prob = om.Problem(reports=False) prob.model.add_subsystem("comp", comp) prob.setup(force_alloc_complex=True) From be14ea6db7e888e02c46e6064fbd57df2e8283c8 Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Tue, 27 Dec 2022 15:45:12 -0700 Subject: [PATCH 2/6] remove non-ascii characters --- wisdem/rotorse/PreCompPy.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wisdem/rotorse/PreCompPy.f90 b/wisdem/rotorse/PreCompPy.f90 index 4e8452f85..40284c99c 100644 --- a/wisdem/rotorse/PreCompPy.f90 +++ b/wisdem/rotorse/PreCompPy.f90 @@ -113,7 +113,7 @@ subroutine properties(chord, tw_aero_d, tw_prime_d, le_loc, & real(dbp), intent(out) :: area ! Area, Cross-Sectional area (m) real(dbp), intent(out) :: iflap_eta ! Flap_iner, Section flap inertia about the YG axis per unit length (Kg-m) real(dbp), intent(out) :: ilag_zeta ! Lag_iner, Section lag inertia about the XG axis per unit length (Kg-m) - real(dbp), intent(out) :: tw_iner ! Tw_iner, Orientation of the section principal inertia axes with respect the blade reference plane, θ (deg) + real(dbp), intent(out) :: tw_iner ! Tw_iner, Orientation of the section principal inertia axes with respect the blade reference plane, theta (deg) real(dbp), intent(out) :: zcm_ref ! X_cm, X-coordinate of the center-of-mass offset with respect to the XR-YR axes (m) real(dbp), intent(out) :: ycm_ref ! Y_cm, Chordwise offset of the section center of mass with respect to the XR-YR axes (m) From e0ff95216dd63f9889bb1eb744cfd62901fe27aa Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Tue, 27 Dec 2022 15:59:30 -0700 Subject: [PATCH 3/6] accommodating numpy warnings deprecation --- wisdem/glue_code/runWISDEM.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wisdem/glue_code/runWISDEM.py b/wisdem/glue_code/runWISDEM.py index 5db2b0329..32fdbbad7 100644 --- a/wisdem/glue_code/runWISDEM.py +++ b/wisdem/glue_code/runWISDEM.py @@ -13,7 +13,9 @@ from wisdem.glue_code.gc_WT_InitModel import yaml2openmdao from wisdem.glue_code.gc_PoseOptimization import PoseOptimization -np.warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning) +# Numpy deprecation warnings +warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning) + # Suppress the maxfev warnings is scipy _minpack_py, line:175 warnings.simplefilter("ignore", RuntimeWarning, lineno=175) From 68b390f6ba27fc7930318a8eca6aaa0870eabccd Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Wed, 28 Dec 2022 07:17:30 -0700 Subject: [PATCH 4/6] force inputs into an array --- wisdem/rotorse/blade_cost.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wisdem/rotorse/blade_cost.py b/wisdem/rotorse/blade_cost.py index bef50a18e..2ad73a274 100644 --- a/wisdem/rotorse/blade_cost.py +++ b/wisdem/rotorse/blade_cost.py @@ -3544,12 +3544,12 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): layer_volume_span_interp_ss = np.interp(root_preform_length, s, layer_volume_span_ss[i_lay, :]) layer_volume_span_interp_ps = np.interp(root_preform_length, s, layer_volume_span_ps[i_lay, :]) add_volume_ss = np.trapz( - [layer_volume_span_ss[i_lay, 0], layer_volume_span_interp_ss], - [0, blade_length * root_preform_length], + np.r_[layer_volume_span_ss[i_lay, 0], layer_volume_span_interp_ss], + np.r_[0, blade_length * root_preform_length], ) add_volume_ps = np.trapz( - [layer_volume_span_ps[i_lay, 0], layer_volume_span_interp_ps], - [0, blade_length * root_preform_length], + np.r_[layer_volume_span_ps[i_lay, 0], layer_volume_span_interp_ps], + np.r_[0, blade_length * root_preform_length], ) volume_root_preform_ss += add_volume_ss volume_root_preform_ps += add_volume_ps From a777526af3bdd528e36540b3c746a0b7717c2d64 Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Wed, 28 Dec 2022 07:24:56 -0700 Subject: [PATCH 5/6] fix other sources of same error --- wisdem/rotorse/blade_cost.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wisdem/rotorse/blade_cost.py b/wisdem/rotorse/blade_cost.py index 2ad73a274..d31433d77 100644 --- a/wisdem/rotorse/blade_cost.py +++ b/wisdem/rotorse/blade_cost.py @@ -3557,8 +3557,8 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): mass_root_preform_ps += add_volume_ps * rho_mat[i_mat] width_ss_interp = np.interp(root_preform_length, s, width_ss) width_ps_interp = np.interp(root_preform_length, s, width_ps) - area_root_ss = np.trapz([width_ss[0], width_ss_interp], [0, blade_length * root_preform_length]) - area_root_ps = np.trapz([width_ps[0], width_ps_interp], [0, blade_length * root_preform_length]) + area_root_ss = np.trapz(np.r_[width_ss[0], width_ss_interp], np.r_[0, blade_length * root_preform_length]) + area_root_ps = np.trapz(np.r_[width_ps[0], width_ps_interp], np.r_[0, blade_length * root_preform_length]) # Fabric shear webs if layer_web[i_lay] != 0: @@ -3711,11 +3711,11 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): spar_cap_ps_area = np.trapz(spar_cap_width_ps, blade_length * s) sect_perimeter_ss_interp = np.interp(root_preform_length, s, sect_perimeter_ss) ss_area_root = np.trapz( - [sect_perimeter_ss[0], sect_perimeter_ss_interp], [0, blade_length * root_preform_length] + np.r_[sect_perimeter_ss[0], sect_perimeter_ss_interp], np.r_[0, blade_length * root_preform_length] ) sect_perimeter_ps_interp = np.interp(root_preform_length, s, sect_perimeter_ps) ps_area_root = np.trapz( - [sect_perimeter_ps[0], sect_perimeter_ps_interp], [0, blade_length * root_preform_length] + np.r_[sect_perimeter_ps[0], sect_perimeter_ps_interp], np.r_[0, blade_length * root_preform_length] ) bom.blade_specs = {} bom.blade_specs["area_webs_w_flanges"] = web_area_w_flanges From 0d4267520511156f0c8bb1c0082fe6e8c3dcfecf Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Wed, 28 Dec 2022 07:54:43 -0700 Subject: [PATCH 6/6] more of the same errors --- wisdem/rotorse/rotor_structure.py | 6 +++--- wisdem/test/test_towerse/test_tower.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wisdem/rotorse/rotor_structure.py b/wisdem/rotorse/rotor_structure.py index a7b52c0a5..494d9d0cb 100644 --- a/wisdem/rotorse/rotor_structure.py +++ b/wisdem/rotorse/rotor_structure.py @@ -1437,7 +1437,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): n_bolt_pullout = 2 * ns * Fax_flap_ultimate / (S_ss * np.pi * (d_insert + 2 * t_adhesive)) # e - take max bolts needed as # bolt-insert pairs - n_bolt = np.max([n_bolt_flap_fatigue, n_bolt_flap_ultimate, n_insert_flap_ultimate, n_insert_flap_fatigue, + n_bolt = np.max(np.r_[n_bolt_flap_fatigue, n_bolt_flap_ultimate, n_insert_flap_ultimate, n_insert_flap_fatigue, n_bolt_pullout, n_bolt_min]) # if discrete: # n_bolt = np.ceil(n_bolt) @@ -1461,7 +1461,7 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): if Fi_sh > Fi70p: logger.debug('Warning, shear preload requirement (', Fi_sh, 'N) > 70% bolt proof load and will be limited to prevent overloading.') - Fi = np.min([np.max([Fi_sh, Fi_sep]), Fi70p]) + Fi = np.min(np.r_[np.max(np.r_[Fi_sh, Fi_sep]), Fi70p]) # if iteration is stuck in an Fi-driven loop, then take the max # bolts required by loop if i > itermax: @@ -1797,4 +1797,4 @@ def calc_axis_intersection(xy_coord, rotation, offset, p_le_d, side, thk=0.0): midpoint_arc.append(remap2grid(x_half, arc_half, midpoint_x, spline=interp1d)) - return midpoint_arc \ No newline at end of file + return midpoint_arc diff --git a/wisdem/test/test_towerse/test_tower.py b/wisdem/test/test_towerse/test_tower.py index d059c0dde..df581d258 100644 --- a/wisdem/test/test_towerse/test_tower.py +++ b/wisdem/test/test_towerse/test_tower.py @@ -443,8 +443,8 @@ def fill_prob(): prob["env1.Uref"] = wind_Uref1 prob["env2.Uref"] = wind_Uref2 - prob["tower.rna_F"] = np.c_[[Fx1, Fy1, Fz1], [Fx2, Fy2, Fz2]] - prob["tower.rna_M"] = np.c_[[Mxx1, Myy1, Mzz1], [Mxx2, Myy2, Mzz2]] + prob["tower.rna_F"] = np.c_[np.r_[Fx1, Fy1, Fz1], np.r_[Fx2, Fy2, Fz2]] + prob["tower.rna_M"] = np.c_[np.r_[Mxx1, Myy1, Mzz1], np.r_[Mxx2, Myy2, Mzz2]] # # --------------- return prob