19#include "SpreaderModel.h"
20#include "SimpleFish.h"
22#include <CEnvironment.h>
24#include "IBasicBottom.h"
25#include "ICurrentVel.h"
28#include "sfh/util/diagnostic.h"
30#include "sfh/constants.h"
38#ifdef FH_VISUALIZATION
39#include <OgreBoxEmitter.h>
51 static const int USE_SIMPLE_FISH_MODEL = 0;
54 PelletField(std::string sSimObjectName, ISimObjectCreator* pCreator );
56 void FinalSetup(
const double T,
const double *
const X, ISimObjectCreator*
const creator);
58 void InitialConditionSetup(
const double T,
const double *
const currentIC,
double*
const updatedIC, ISimObjectCreator*
const creator);
60 void OdeFcn(
const double dT,
const double*
const adX,
double*
const adXDot,
const bool bIsMajorTimeStep);
62 int getIndex(
int x,
int y,
int z);
64 void calcAdvectAndDiff(
double T,
const double*
const adX,
double*
const adXDot);
66 void calcAdvectAndDiffWorker(
double T,
double dt,
const double*
const adX,
double*
const adXDot,
int kstart,
int kend);
68 int* getIndexFromPos(Eigen::Vector3d position);
70 double getConcentration(Eigen::Vector3d position,
const double*
const X);
72 double getConcentrationAndGradient(Eigen::Vector3d position,
const double*
const X,
double* gradient);
74 double removePellet(Eigen::Vector3d position,
const double*
const X, IStateUpdater* updater);
76 double getPelletWeight();
78 double getTotalFeed(
const double *
const X);
80 double superbeeAdv(
double dt,
double dx,
double c_ll,
double c_l,
double c_c,
double c_r,
double c_rr,
double v_l,
double v_r);
82 bool checkSign(
double value,
bool signToTest);
84 double minmod(
double v1,
double v2);
86 double maxmod(
double v1,
double v2);
88 void PreOdeFcn(
const double T,
const double *
const X, IStateUpdater* updater);
90 const virtual double* ConcAtRefPos(
const double T,
const double *
const X,
int iPos);
91 const virtual double *concOutputAtStaticPos(
const double dT,
const double *
const adX,
int iExtNode);
94 const virtual double* OutputIngestion(
const double T,
const double*
const X);
96#ifdef FH_VISUALIZATION
98 virtual void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
101 virtual void RenderUpdate(
const double T,
const double*
const X);
103 void CloudRenderInit(Ogre::SceneManager* sceneMgr);
104 void RenderCloud(
const double T,
const double*
const X);
110 std::vector<std::string> SplitString(std::string sData,std::string separator);
111 virtual const double* Position(
const double dT,
const double*
const adX);
113 double getAtPos(
int i,
int j,
int k,
const double*
const X);
115 ISimObjectCreator* m_pCreator;
118 const double* local_adX;
119 double* local_adXdot;
122 int m_nRefPosOutputs;
123 ISignalPort **m_refPos;
124 double *m_concAtRefPos;
132 int m_nfishstates, m_isimplefish;
134 double m_time_last = -1;
135 double m_dx, m_sinkingSpeed, m_diffKappaXY, m_diffKappaZ;
136 int m_imax, m_jmax, m_kmax;
137 double m_cageRad, m_cageCylDepth, m_cageTotDepth;
138 int m_feederCenterX, m_feederCenterY, m_feederType, m_feederTilt;
139 double m_feederAirSpeed, m_feederAngle;
141 double m_simpleFishN, m_simpleFishW, m_simpleFishStd;
143 double m_feedingRateMult;
144 double m_pelletWeight;
146 double m_temperature;
148 vector<double> m_advect, m_diffus, m_feeding;
149 vector<vector<double>> m_feedingRate;
154 vector<vector<vector<vector<double>>>> m_currentField;
156 vector<vector<int>> m_cellOffsets;
158 int m_readCurrentField, m_outputcounter;
162 int m_nStaticSensorPoints;
163 ISignalPort **m_staticPosInputs;
164 double* m_staticPosOutputs;
192 double m_prevTextOutputTime;
198 double m_IngestionRate[3];
199 double m_CurrentReduction;
200 double m_UpdateStepSize;
208#ifdef FH_VISUALIZATION
210 double m_visParticleSize;
211 double m_visParticleMultiplier;
212 double m_visSinkingSpeedMultiplier;
213 double m_visParticleTimeToLive;
214 double m_visParticleFadeRate;
215 int m_visParticleQuota;
216 double m_visAngleSpread;
217 std::string m_visParticleColor;
219 std::string m_sMaterial;
220 std::string m_sMeshName;
222 Ogre::Entity* m_pRenderEntity;
223 Ogre::SceneNode* m_pRenderNode;
224 Ogre::SceneManager* m_pSceneMgr;
226 Ogre::ParticleSystem* m_particleSystem;
227 Ogre::SceneNode* m_particleNode;
228 Ogre::ParticleEmitter* m_particleEmitter;
Definition: CEnvironment.h:10
Interface for calculating the bottom force on various objects.
Definition: IBasicBottom.h:23
Definition: ICurrentVel.h:12
Definition: PelletField.h:48
float * m_gridCentre
Grid centre in cartesian coordinates. Fixed during simulation if m_boolMoveGrid equals false....
Definition: PelletField.h:175
ISignalPort * m_feedRateIn
Signal port. Input port receiving feeding rate in g/s, (grams/second).
Definition: PelletField.h:190
float * m_gridCentreInit
Grid centre in cartesian coordinates. Initial value.
Definition: PelletField.h:176
bool m_useTankFeeding
Boolean. True if tank feeding pattern should be used.
Definition: PelletField.h:205
int * m_dij_tot
Total movement of grid centre (since initialization) in grid coordinates (i,j).
Definition: PelletField.h:181
bool m_boolVarFeedRate
Feeding (time and rate) determined by input during simulation.
Definition: PelletField.h:188
std::string m_startDateString
String describing the start date for the data to be used.
Definition: PelletField.h:191
double ** m_feedingRegime
Feeding regime with first dimension being m_nFeedingPeriods and second dimension being [startup time ...
Definition: PelletField.h:187
double * m_cageCentre
Time dependent centre postion of cage. Updated by input port m_cageCentreNED.
Definition: PelletField.h:182
double m_dynFeedRate
Feeding rate (g/s, grams/second) set by input port.
Definition: PelletField.h:189
bool m_boolMoveGrid
Boolean. If true, the grid is moving with the centre of the grid. m_gridCentre will be equal to m_cag...
Definition: PelletField.h:173
bool m_boolCagePos
Boolean indicating whether time dependent cage position is received or not.
Definition: PelletField.h:172
void setVarValFromInputPort(ISignalPort *inputPort, double *varVal, int nVal, const double T, const double *const X)
Internal (to PelletField) function setting varVal equal to inputPort.
int m_nFeedingPeriods
Number of feeding periods in feeding regime.
Definition: PelletField.h:186
PelletField(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
bool m_useFeedAsExperimentalO2Proxy
Boolean. True if feed distribution model shall be used as O2 level proxy.
Definition: PelletField.h:206
ISignalPort * m_cageCentreNED
Input port receiving (x,y,z) coordinates in NED frame of cage top position. x and y are used in the c...
Definition: PelletField.h:174
Definition: SimpleFish.h:28
Definition: SpreaderModel.h:21