Skip to content

Commit

Permalink
Fixes segfault in regression test from change in OpenFAST API
Browse files Browse the repository at this point in the history
  • Loading branch information
ddement committed Dec 24, 2024
1 parent 14b21d5 commit cb48806
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/utilities/aerodynamics/aerodyn_inflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,10 @@ struct VTKSettings {
kSurface_Line = 3, //< Both surfaces and lines
};

std::string output_dir_name{"ADI_vtk"}; //< VTK output directory name
WriteType write_vtk{WriteType::kNone}; //< Flag to write VTK output
OutputType vtk_type{OutputType::kLine}; //< Type of VTK output
double vtk_dt{0.}; //< VTK output time step
std::array<float, 6> vtk_nacelle_dimensions{//< Nacelle dimensions for VTK rendering
-2.5F, -2.5F, 0.F, 10.F, 5.F, 5.F
};
Expand Down Expand Up @@ -665,7 +667,7 @@ class AeroDynInflowLibrary {
air_{fp},
env_conditions_{ec},
sim_controls_{std::move(sc)},
vtk_settings_{vtk} {}
vtk_settings_{std::move(vtk)} {}

/// Getter methods for the private member variables
[[nodiscard]] const ErrorHandling& GetErrorHandling() const { return error_handling_; }
Expand Down Expand Up @@ -780,11 +782,10 @@ class AeroDynInflowLibrary {
* @brief Finalizes the initialization process
*/
void FinalizeInitialization() {
auto ADI_C_Init =
lib_.get_function<
void(int*, char**, int*, int*, char**, int*, const char*, float*, float*, float*, float*, float*, float*, float*, float*, int*, double*, double*, int*, int*, int*, float*, float*, int*, double*, int*, char*, char*, int*, char*)>(
"ADI_C_Init"
);
auto ADI_C_Init = lib_.get_function<
void(int*, char**, int*, int*, char**, int*, const char*, const char*, float*, float*, float*, float*, float*, float*, float*, float*, int*, double*, double*, int*, int*, int*, double*, float*, float*, int*, double*, int*, char*, char*, int*, char*)>(
"ADI_C_Init"
);

// Convert bool -> int32_t to pass to the Fortran routine
int32_t is_aerodyn_input_passed_as_string = 0; // AeroDyn input is path to file
Expand Down Expand Up @@ -820,6 +821,7 @@ class AeroDynInflowLibrary {
&inflowwind_input_pointer, // input: IfW input file as string
&inflowwind_input_length, // input: IfW input file string length
sim_controls_.output_root_name.c_str(), // input: rootname for ADI file writing
vtk_settings_.output_dir_name.c_str(), // input: VTK output directory name
&env_conditions_.gravity, // input: gravity
&air_.density, // input: air density
&air_.kinematic_viscosity, // input: kinematic viscosity
Expand All @@ -834,6 +836,7 @@ class AeroDynInflowLibrary {
&store_HH_wind_speed_int, // input: store HH wind speed
&write_vtk, // input: write VTK output
&vtk_type, // input: VTK output type
&vtk_settings_.vtk_dt, // input: VTK output time step
vtk_settings_.vtk_nacelle_dimensions.data(), // input: VTK nacelle dimensions
&vtk_settings_.vtk_hub_radius, // input: VTK hub radius
&output_format, // input: output format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,19 +511,17 @@ TEST(Milestone, IEA15RotorAeroController) {
util::VTKSettings vtk_settings;
vtk_settings.write_vtk = util::VTKSettings::WriteType::kNone; // Animation
vtk_settings.vtk_type = util::VTKSettings::OutputType::kLine; // Lines
vtk_settings.vtk_dt = step_size;
vtk_settings.vtk_nacelle_dimensions = {-2.5F, -2.5F, 0.F, 10.F, 5.F, 5.F};
vtk_settings.vtk_hub_radius = static_cast<float>(hub_radius);

util::AeroDynInflowLibrary adi(
adi_shared_lib_path, util::ErrorHandling{}, util::FluidProperties{},
util::EnvironmentalConditions{}, sc, vtk_settings
);

// Remove the ADI vtk folder if outputting animation
if (vtk_settings.write_vtk != util::VTKSettings::WriteType::kNone) {
RemoveDirectoryWithRetries("vtk-ADI");
}

adi.Initialize(turbine_configs);

//--------------------------------------------------------------------------
Expand Down

0 comments on commit cb48806

Please sign in to comment.