Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ALM reg tests #1389

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions amr-wind/wind_energy/actuator/Actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void Actuator::pre_init_actions()
<< std::endl;
}

int cnt_turbfast = 0;
for (int i = 0; i < nturbines; ++i) {
const std::string& tname = labels[i];
const std::string& prefix = identifier() + "." + tname;
Expand All @@ -63,6 +64,9 @@ void Actuator::pre_init_actions()
pp.query("type", type);
pp1.query("type", type);
AMREX_ALWAYS_ASSERT(!type.empty());
cnt_turbfast +=
((type == "TurbineFastLine") || (type == "TurbineFastDisk")) ? 1
: 0;

auto obj = ActuatorModel::create(type, m_sim, tname, i);

Expand All @@ -72,6 +76,10 @@ void Actuator::pre_init_actions()
obj->read_inputs(inp);
m_actuators.emplace_back(std::move(obj));
}
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
cnt_turbfast <= amrex::ParallelDescriptor::NProcs(),
"Number of OpenFAST turbines must match or be lower than the number of "
"ranks");
}

void Actuator::post_init_actions()
Expand Down
38 changes: 38 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,44 @@ if(AMR_WIND_ENABLE_W2A)
add_test_re(abl_multiphase_w2a)
endif()

if(AMR_WIND_ENABLE_OPENFAST)
set(ACT_UNIFORM_ALM_TEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test_files/act_uniform_alm)
set(ACT_UNIFORM_ALM_TEST_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/test_files/act_uniform_alm)
set(RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR ${ACT_UNIFORM_ALM_TEST_BINARY_DIR}/r-test)
set(5MW_BASELINE_DIR glue-codes/openfast/5MW_Baseline)
set(5MW_LAND_DIR glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp)
set(AERO_FILE NRELOffshrBsline5MW_Onshore_AeroDyn15.dat)
set(ELASTO_FILE NRELOffshrBsline5MW_Onshore_ElastoDyn.dat)
set(SERVO_FILE NRELOffshrBsline5MW_Onshore_ServoDyn.dat)
file(MAKE_DIRECTORY ${ACT_UNIFORM_ALM_TEST_BINARY_DIR})
if(NOT EXISTS "${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}")
execute_process(
COMMAND bash -c "${GIT_EXECUTABLE} clone -n --depth=1 --filter=tree:0 [email protected]:OpenFAST/r-test.git"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "${GIT_EXECUTABLE} sparse-checkout set --no-cone ${5MW_BASELINE_DIR} ${5MW_LAND_DIR}"
WORKING_DIRECTORY
"${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "${GIT_EXECUTABLE} checkout"
WORKING_DIRECTORY
"${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "${GIT_EXECUTABLE} apply ${ACT_UNIFORM_ALM_TEST_SOURCE_DIR}/custom_openfast_options.patch"
WORKING_DIRECTORY
"${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
endif()
add_test_re(act_uniform_alm)
if(AMR_WIND_ENABLE_NETCDF)
add_test_red(act_uniform_alm_restart act_uniform_alm)
endif()
endif()

#=============================================================================
# Regression tests excluded from CI with a test dependency
#=============================================================================
Expand Down
145 changes: 145 additions & 0 deletions test/test_files/act_uniform_alm/act_uniform_alm.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# --- Simulation time control parameters ---
time.stop_time = 0.2 # Max (simulated) time to evolve [s]
time.max_step = -1
time.fixed_dt = 0.02 # Fixed timestep size (in seconds). If negative, then time.cfl is used
incflo.physics = FreeStream Actuator # List of physics models to include in simulation.
incflo.verbose = 0
io.check_file = chk
incflo.use_godunov = true
incflo.godunov_type = weno_z
turbulence.model = Laminar
incflo.density = 1.225 # Fluid density [kg/m^3]
transport.viscosity = 1.872e-05 # Fluid dynamic viscosity [kg/m-s]
transport.laminar_prandtl = 0.7 # Laminar prandtl number
transport.turbulent_prandtl = 0.3333 # Turbulent prandtl number
ConstValue.density.value = 1.225
ConstValue.velocity.value = 11.0 0.0 0.0

# --- Geometry and Mesh ---
geometry.prob_lo = -960.0 -960.0 -960.0
geometry.prob_hi = 960.0 960.0 960.0
amr.n_cell = 96 96 96 # Number of cells in x, y, and z directions
amr.max_level = 0
geometry.is_periodic = 0 1 1
xlo.type = mass_inflow
xlo.density = 1.225
xlo.velocity = 11.0 0.0 0.0
xhi.type = pressure_outflow

# --- ABL parameters ---
ICNS.source_terms = ActuatorForcing
incflo.velocity = 11.0 0.0 0.0
time.plot_interval = 10
time.checkpoint_interval = 5
io.plot_file = plt
Actuator.type = TurbineFastLine
Actuator.TurbineFastLine.epsilon = 5.0 5.0 5.0
Actuator.TurbineFastLine.epsilon_tower = 5.0 5.0 5.0
Actuator.TurbineFastLine.fllc = false

#---- tagging defs ----
tagging.labels = T0_level_0_zone T1_level_0_zone T0_level_1_zone T1_level_1_zone T0_level_2_zone T1_level_2_zone T0_level_3_zone T1_level_3_zone
tagging.T0_level_0_zone.type = GeometryRefinement
tagging.T0_level_0_zone.shapes = T0_level_0_zone
tagging.T0_level_0_zone.level = 0
tagging.T0_level_0_zone.T0_level_0_zone.type = box
tagging.T0_level_0_zone.T0_level_0_zone.origin = -252.0 -439.0 -189.0
tagging.T0_level_0_zone.T0_level_0_zone.xaxis = 504.0 0.0 0.0
tagging.T0_level_0_zone.T0_level_0_zone.yaxis = -0.0 378.0 -0.0
tagging.T0_level_0_zone.T0_level_0_zone.zaxis = 0.0 0.0 378.0
tagging.T1_level_0_zone.type = GeometryRefinement
tagging.T1_level_0_zone.shapes = T1_level_0_zone
tagging.T1_level_0_zone.level = 0
tagging.T1_level_0_zone.T1_level_0_zone.type = box
tagging.T1_level_0_zone.T1_level_0_zone.origin = -252.0 61.0 -189.0
tagging.T1_level_0_zone.T1_level_0_zone.xaxis = 504.0 0.0 0.0
tagging.T1_level_0_zone.T1_level_0_zone.yaxis = -0.0 378.0 -0.0
tagging.T1_level_0_zone.T1_level_0_zone.zaxis = 0.0 0.0 378.0
tagging.T0_level_1_zone.type = GeometryRefinement
tagging.T0_level_1_zone.shapes = T0_level_1_zone
tagging.T0_level_1_zone.level = 1
tagging.T0_level_1_zone.T0_level_1_zone.type = box
tagging.T0_level_1_zone.T0_level_1_zone.origin = -189.0 -376.0 -151.2
tagging.T0_level_1_zone.T0_level_1_zone.xaxis = 378.0 0.0 0.0
tagging.T0_level_1_zone.T0_level_1_zone.yaxis = -0.0 252.0 -0.0
tagging.T0_level_1_zone.T0_level_1_zone.zaxis = 0.0 0.0 302.4
tagging.T1_level_1_zone.type = GeometryRefinement
tagging.T1_level_1_zone.shapes = T1_level_1_zone
tagging.T1_level_1_zone.level = 1
tagging.T1_level_1_zone.T1_level_1_zone.type = box
tagging.T1_level_1_zone.T1_level_1_zone.origin = -189.0 124.0 -151.2
tagging.T1_level_1_zone.T1_level_1_zone.xaxis = 378.0 0.0 0.0
tagging.T1_level_1_zone.T1_level_1_zone.yaxis = -0.0 252.0 -0.0
tagging.T1_level_1_zone.T1_level_1_zone.zaxis = 0.0 0.0 302.4
tagging.T0_level_2_zone.type = GeometryRefinement
tagging.T0_level_2_zone.shapes = T0_level_2_zone
tagging.T0_level_2_zone.level = 2
tagging.T0_level_2_zone.T0_level_2_zone.type = box
tagging.T0_level_2_zone.T0_level_2_zone.origin = -126.0 -344.5 -100.80000000000001
tagging.T0_level_2_zone.T0_level_2_zone.xaxis = 252.0 0.0 0.0
tagging.T0_level_2_zone.T0_level_2_zone.yaxis = -0.0 189.0 -0.0
tagging.T0_level_2_zone.T0_level_2_zone.zaxis = 0.0 0.0 201.60000000000002
tagging.T1_level_2_zone.type = GeometryRefinement
tagging.T1_level_2_zone.shapes = T1_level_2_zone
tagging.T1_level_2_zone.level = 2
tagging.T1_level_2_zone.T1_level_2_zone.type = box
tagging.T1_level_2_zone.T1_level_2_zone.origin = -126.0 155.5 -100.80000000000001
tagging.T1_level_2_zone.T1_level_2_zone.xaxis = 252.0 0.0 0.0
tagging.T1_level_2_zone.T1_level_2_zone.yaxis = -0.0 189.0 -0.0
tagging.T1_level_2_zone.T1_level_2_zone.zaxis = 0.0 0.0 201.60000000000002
tagging.T0_level_3_zone.type = GeometryRefinement
tagging.T0_level_3_zone.shapes = T0_level_3_zone
tagging.T0_level_3_zone.level = 3
tagging.T0_level_3_zone.T0_level_3_zone.type = box
tagging.T0_level_3_zone.T0_level_3_zone.origin = -31.5 -325.6 -75.6
tagging.T0_level_3_zone.T0_level_3_zone.xaxis = 63.0 0.0 0.0
tagging.T0_level_3_zone.T0_level_3_zone.yaxis = -0.0 151.2 -0.0
tagging.T0_level_3_zone.T0_level_3_zone.zaxis = 0.0 0.0 151.2
tagging.T1_level_3_zone.type = GeometryRefinement
tagging.T1_level_3_zone.shapes = T1_level_3_zone
tagging.T1_level_3_zone.level = 3
tagging.T1_level_3_zone.T1_level_3_zone.type = box
tagging.T1_level_3_zone.T1_level_3_zone.origin = -31.5 174.4 -75.6
tagging.T1_level_3_zone.T1_level_3_zone.xaxis = 63.0 0.0 0.0
tagging.T1_level_3_zone.T1_level_3_zone.yaxis = -0.0 151.2 -0.0
tagging.T1_level_3_zone.T1_level_3_zone.zaxis = 0.0 0.0 151.2

#---- actuator defs ----
Actuator.labels = T0 T1
Actuator.T0.type = TurbineFastLine
Actuator.T0.openfast_input_file = nrel5mw.fst
Actuator.T0.base_position = 0.0 -250.0 -90.0
Actuator.T0.rotor_diameter = 126.0
Actuator.T0.hub_height = 90.0
Actuator.T0.num_points_blade = 64
Actuator.T0.num_points_tower = 12
Actuator.T0.epsilon = 5.0 5.0 5.0
Actuator.T0.epsilon_tower = 5.0 5.0 5.0
Actuator.T0.openfast_start_time = 0.0
Actuator.T0.openfast_stop_time = 1000.0
Actuator.T0.fllc = false
Actuator.T0.nacelle_drag_coeff = 1.0
Actuator.T0.nacelle_area = 8.0
Actuator.T0.output_frequency = 1
Actuator.T0.density = 1.225
Actuator.T0.num_blades = 3
Actuator.T1.type = TurbineFastLine
Actuator.T1.openfast_input_file = nrel5mw.fst
Actuator.T1.base_position = 0.0 250.0 -90.0
Actuator.T1.rotor_diameter = 126.0
Actuator.T1.hub_height = 90.0
Actuator.T1.num_points_blade = 64
Actuator.T1.num_points_tower = 12
Actuator.T1.epsilon = 5.0 5.0 5.0
Actuator.T1.epsilon_tower = 5.0 5.0 5.0
Actuator.T1.openfast_start_time = 0.0
Actuator.T1.openfast_stop_time = 1000.0
Actuator.T1.fllc = false
Actuator.T1.nacelle_drag_coeff = 1.0
Actuator.T1.nacelle_area = 8.0
Actuator.T1.output_frequency = 1
Actuator.T1.density = 1.225
Actuator.T1.num_blades = 3

#---- extra params ----
#== END AMR-WIND INPUT ==
63 changes: 63 additions & 0 deletions test/test_files/act_uniform_alm/custom_openfast_options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_AeroDyn15.dat b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_AeroDyn15.dat
index 5044aa8..ad90a3f 100644
--- a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_AeroDyn15.dat
+++ b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_AeroDyn15.dat
@@ -3,7 +3,7 @@ NREL 5.0 MW offshore baseline aerodynamic input properties.
====== General Options ============================================================================
False Echo - Echo the input to "<rootname>.AD.ech"? (flag)
"default" DTAero - Time interval for aerodynamic calculations {or "default"} (s)
- 1 WakeMod - Type of wake/induction model (switch) {0=none, 1=BEMT, 2=DBEMT, 3=OLAF} [WakeMod cannot be 2 or 3 when linearizing]
+ 0 WakeMod - Type of wake/induction model (switch) {0=none, 1=BEMT, 2=DBEMT, 3=OLAF} [WakeMod cannot be 2 or 3 when linearizing]
2 AFAeroMod - Type of blade airfoil aerodynamics model (switch) {1=steady model, 2=Beddoes-Leishman unsteady model} [AFAeroMod must be 1 when linearizing]
1 TwrPotent - Type tower influence on wind based on potential flow around the tower (switch) {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}
0 TwrShadow - Calculate tower influence on wind based on downstream tower shadow (switch) {0=none, 1=Powles model, 2=Eames model}
diff --git a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ElastoDyn.dat b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ElastoDyn.dat
index 9ff6722..3a0e441 100644
--- a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ElastoDyn.dat
+++ b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ElastoDyn.dat
@@ -11,7 +11,7 @@ True EdgeDOF - First edgewise blade mode DOF (flag)
False TeetDOF - Rotor-teeter DOF (flag) [unused for 3 blades]
True DrTrDOF - Drivetrain rotational-flexibility DOF (flag)
True GenDOF - Generator DOF (flag)
-True YawDOF - Yaw DOF (flag)
+False YawDOF - Yaw DOF (flag)
True TwFADOF1 - First fore-aft tower bending-mode DOF (flag)
True TwFADOF2 - Second fore-aft tower bending-mode DOF (flag)
True TwSSDOF1 - First side-to-side tower bending-mode DOF (flag)
diff --git a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ServoDyn.dat b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ServoDyn.dat
index 9b1839f..35a6c03 100644
--- a/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ServoDyn.dat
+++ b/glue-codes/openfast-cpp/5MW_Land_DLL_WTurb_cpp/NRELOffshrBsline5MW_Onshore_ServoDyn.dat
@@ -4,7 +4,7 @@ NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis. Properties from
False Echo - Echo input data to <RootName>.ech (flag)
"default" DT - Communication interval for controllers (s) (or "default")
---------------------- PITCH CONTROL -------------------------------------------
- 5 PCMode - Pitch control mode {0: none, 3: user-defined from routine PitchCntrl, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
+ 0 PCMode - Pitch control mode {0: none, 3: user-defined from routine PitchCntrl, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
0 TPCOn - Time to enable active pitch control (s) [unused when PCMode=0]
9999.9 TPitManS(1) - Time to start override pitch maneuver for blade 1 and end standard pitch control (s)
9999.9 TPitManS(2) - Time to start override pitch maneuver for blade 2 and end standard pitch control (s)
@@ -16,7 +16,7 @@ False Echo - Echo input data to <RootName>.ech (flag)
0 BlPitchF(2) - Blade 2 final pitch for pitch maneuvers (degrees)
0 BlPitchF(3) - Blade 3 final pitch for pitch maneuvers (degrees) [unused for 2 blades]
---------------------- GENERATOR AND TORQUE CONTROL ----------------------------
- 5 VSContrl - Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from routine UserVSCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
+ 1 VSContrl - Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from routine UserVSCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
2 GenModel - Generator model {1: simple, 2: Thevenin, 3: user-defined from routine UserGen} (switch) [used only when VSContrl=0]
94.4 GenEff - Generator efficiency [ignored by the Thevenin and user-defined generator models] (%)
True GenTiStr - Method to start the generator {T: timed using TimGenOn, F: generator speed using SpdGenOn} (flag)
@@ -25,10 +25,10 @@ True GenTiStp - Method to stop the generator {T: timed using TimGen
0 TimGenOn - Time to turn on the generator for a startup (s) [used only when GenTiStr=True]
9999.9 TimGenOf - Time to turn off the generator (s) [used only when GenTiStp=True]
---------------------- SIMPLE VARIABLE-SPEED TORQUE CONTROL --------------------
- 9999.9 VS_RtGnSp - Rated generator speed for simple variable-speed generator control (HSS side) (rpm) [used only when VSContrl=1]
- 9999.9 VS_RtTq - Rated generator torque/constant generator torque in Region 3 for simple variable-speed generator control (HSS side) (N-m) [used only when VSContrl=1]
- 9999.9 VS_Rgn2K - Generator torque constant in Region 2 for simple variable-speed generator control (HSS side) (N-m/rpm^2) [used only when VSContrl=1]
- 9999.9 VS_SlPc - Rated generator slip percentage in Region 2 1/2 for simple variable-speed generator control (%) [used only when VSContrl=1]
+ 1161.963 VS_RtGnSp - Rated generator speed for simple variable-speed generator control (HSS side) (rpm) [used only when VSContrl=1]
+ 43093.55 VS_RtTq - Rated generator torque/constant generator torque in Region 3 for simple variable-speed generator control (HSS side) (N-m) [used only when VSContrl=1]
+ 0.0255764 VS_Rgn2K - Generator torque constant in Region 2 for simple variable-speed generator control (HSS side) (N-m/rpm^2) [used only when VSContrl=1]
+ 10.0 VS_SlPc - Rated generator slip percentage in Region 2 1/2 for simple variable-speed generator control (%) [used only when VSContrl=1]
---------------------- SIMPLE INDUCTION GENERATOR ------------------------------
9999.9 SIG_SlPc - Rated generator slip percentage (%) [used only when VSContrl=0 and GenModel=1]
9999.9 SIG_SySp - Synchronous (zero-torque) generator speed (rpm) [used only when VSContrl=0 and GenModel=1]
Loading
Loading