Skip to content

Commit

Permalink
Add an ALM reg test
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Dec 6, 2024
1 parent 92ac870 commit d6866b9
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 0 deletions.
6 changes: 6 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_turbfastline = 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,7 @@ void Actuator::pre_init_actions()
pp.query("type", type);
pp1.query("type", type);
AMREX_ALWAYS_ASSERT(!type.empty());
cnt_turbfastline += (type == "TurbineFastLine") ? 1 : 0;

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

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

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

if(AMR_WIND_ENABLE_OPENFAST)
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 ${CMAKE_COMMAND} -E create_symlink
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${AERO_FILE}
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_BASELINE_DIR}/${AERO_FILE}
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${ELASTO_FILE}
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_BASELINE_DIR}/${ELASTO_FILE}
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}
${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_BASELINE_DIR}/${SERVO_FILE}
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/5 PCMode/0 PCMode/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/5 VSContrl/1 VSContrl/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/9999.9 VS_RtGnSp/1161.963 VS_RtGnSp/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/9999.9 VS_RtTq/43093.55 VS_RtTq/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/9999.9 VS_Rgn2K/0.0255764 VS_Rgn2K/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/9999.9 VS_SlPc/10.0 VS_SlPc/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${SERVO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/1 WakeMod/0 WakeMod/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${AERO_FILE}"
WORKING_DIRECTORY
"${ACT_UNIFORM_ALM_TEST_BINARY_DIR}"
COMMAND_ERROR_IS_FATAL ANY)
execute_process(
COMMAND bash -c "sed -i -e 's/True YawDOF/False YawDOF/g' ${RTEST_ACT_UNIFORM_ALM_TEST_BINARY_DIR}/${5MW_LAND_DIR}/${ELASTO_FILE}"
WORKING_DIRECTORY
"${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 ==
Loading

0 comments on commit d6866b9

Please sign in to comment.