/home/runner/work/kynema/kynema/kynema/src/interfaces/turbine/turbine_interface.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/interfaces/turbine/turbine_interface.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
turbine_interface.hpp
Go to the documentation of this file.
1#pragma once
2
9#include "model/model.hpp"
12
14struct SolutionInput;
15struct TurbineInput;
16} // namespace kynema::interfaces::components
17
18namespace kynema::interfaces {
19
27public:
28 using DeviceType =
29 Kokkos::Device<Kokkos::DefaultExecutionSpace, Kokkos::DefaultExecutionSpace::memory_space>;
30
38 explicit TurbineInterface(
39 const components::SolutionInput& solution_input,
40 const components::TurbineInput& turbine_input,
41 const components::AerodynamicsInput& aerodynamics_input = {},
42 const components::ControllerInput& controller_input = {}
43 );
44
46 [[nodiscard]] components::Turbine& Turbine();
47
56 double fluid_density,
57 const std::function<std::array<double, 3>(const std::array<double, 3>&)>& inflow_function
58 );
59
67 [[nodiscard]] bool Step();
68
70 void SaveState();
71
73 void RestoreState();
74
76 Model& GetModel() { return model; }
77
79 HostState<DeviceType>& GetHostState() { return host_state; }
80
85 [[nodiscard]] double CalculateAzimuthAngle() const;
86
91 [[nodiscard]] double CalculateRotorSpeed() const;
92
93private:
94 Model model;
95 components::Turbine turbine;
96 State<DeviceType> state;
97 Elements<DeviceType> elements;
98 Constraints<DeviceType> constraints;
99 StepParameters parameters;
100 Solver<DeviceType> solver;
101 State<DeviceType> state_save;
102 HostState<DeviceType> host_state;
103 std::unique_ptr<Outputs> outputs;
104 std::unique_ptr<util::TurbineController> controller;
105 std::unique_ptr<components::Aerodynamics> aerodynamics;
106
116 void WriteRotorTimeSeriesData();
117
122 void InitializeController(
123 const components::TurbineInput& turbine_input,
124 const components::SolutionInput& solution_input
125 );
126
127 void ApplyController();
128
132 void UpdateControllerInputs();
133};
134
135} // namespace kynema::interfaces
Struct to define the connectivity structure of elements, nodes, and constraints defining an Kynema pr...
Definition model.hpp:74
Interface for blade simulation that manages state, solver, and components.
Definition turbine_interface.hpp:26
HostState< DeviceType > & GetHostState()
Return a reference to this interface's host state.
Definition turbine_interface.hpp:79
void SaveState()
Saves the current state for potential restoration (in correction step)
Definition turbine_interface.cpp:158
void RestoreState()
Restores the previously saved state (in correction step)
Definition turbine_interface.cpp:162
bool Step()
Steps forward in time.
Definition turbine_interface.cpp:117
double CalculateRotorSpeed() const
Calculates rotor speed from constraint output.
Definition turbine_interface.cpp:199
components::Turbine & Turbine()
Returns a reference to the turbine model.
Definition turbine_interface.cpp:98
void UpdateAerodynamicLoads(double fluid_density, const std::function< std::array< double, 3 >(const std::array< double, 3 > &)> &inflow_function)
Updates the aerodynamic loads to be applied to the sturcture based on a provided function.
Definition turbine_interface.cpp:102
double CalculateAzimuthAngle() const
Calculates and normalizes azimuth angle from constraint output.
Definition turbine_interface.cpp:186
Kokkos::Device< Kokkos::DefaultExecutionSpace, Kokkos::DefaultExecutionSpace::memory_space > DeviceType
Definition turbine_interface.hpp:29
Model & GetModel()
Return a reference of the model owned by this interface.
Definition turbine_interface.hpp:76
Definition aerodynamics_input.hpp:27
Represents a turbine with nodes, elements, and constraints.
Definition turbine.hpp:87
Definition aerodynamics.cpp:3
Definition blade_interface.cpp:9
Container class for managing multiple constraints in a simulation.
Definition constraints.hpp:29
A container providing handle to all structural elements present in the model.
Definition elements.hpp:20
This object manages the assembly and solution of linear system arising from the generalized-alpha bas...
Definition solver.hpp:21
Container for storing the complete system state of the simulation at a given time increment.
Definition state.hpp:18
A Struct containing the paramters used to control the time stepping process.
Definition step_parameters.hpp:12
Host-side mirror of the simulation state for a given time increment.
Definition host_state.hpp:22
Configuration parameters for a DISCON-style turbine controller.
Definition controller_input.hpp:15
A configuration object used to create the low level StepParameters object.
Definition solution_input.hpp:13
Complete input specification for a turbine.
Definition turbine_input.hpp:17