FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Disk.h
1#pragma once
102#include "DiskBase.h"
103
104#include <fhsim/simobject/SimObject.h>
105#include <fhsim_environment/BodyFlowInteraction.h>
106#include <fhsim_environment/hydrodynamics/DiskHydro.h>
107
108#include <optional>
109
110class Disk : public SimObject
111{
112public:
113 Disk(const std::string& SimObjectName, ISimObjectCreator* const Creator);
114 ~Disk() override;
115 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const Creator);
117 void PreOdeFcn(double T, const double* X, IStateUpdater* updater) override;
118 const double* Position(const double T, const double* const X);
119 const double* Velocity(const double T, const double* const X);
120 void OdeFcn(const double T, const double* const X, double* const XDot) const;
121
125 bool HasJacobians() const override;
126 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
127 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
128
130 const environment::wake::BodyWake* Wake() const { return m_flow.Wake(); }
131
132private:
134 environment::disk_hydro::DragFactors DiskDragFactors() const;
135
136 ISignalPort* m_IForce;
137
138 int m_PosIdx;
139 int m_VelIdx;
140
141 double m_DiskD;
142 double m_DiskT;
143 double m_DiskMass;
144 double m_Rho;
145 double m_lift;
146
147 mutable bool m_onSeabed = false;
148
150 double AxialInertiaShare(double fraction) const;
151
159 void ApplyInverseInertia(const double axis[3], double fraction, const double force[3], double acceleration[3]) const;
160
161 double m_axialAddedMass = 0.0;
162
164 const environment::disk_hydro::Disk& Shape() const { return m_caster->Shape(); }
165
166 std::optional<environment::disk_hydro::DiskCaster> m_caster;
167 environment::wake::BodyFlowInteraction m_flow;
168
169#ifdef FH_VISUALIZATION
170public:
171 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
172 void RenderUpdate(const double dT, const double* const adX);
173
174private:
175 Ogre::SceneNode* m_Node;
176 Ogre::Entity* m_Entity;
177 Ogre::String m_Material;
178 std::string m_DiskMesh;
179#endif
180};
Definition Disk.h:111
bool HasJacobians() const override
const environment::wake::BodyWake * Wake() const
The wake: null without an Environment or before FinalSetup.
Definition Disk.h:130
void PreOdeFcn(double T, const double *X, IStateUpdater *updater) override
With CastWake: takes the disk axis from the Force input and rebuilds the wake when due.