22 #ifndef __LP_SOLVER_H__
23 #define __LP_SOLVER_H__
68 virtual int solve(
double dt) = 0;
141 virtual int solve(
double dt);
158 bool m_iIfMultiThreads;
160 bool m_iRandomDirSplitOrder;
162 std::size_t m_iNumRow2ndOrder;
163 std::size_t m_iNumRow1stOrder;
164 std::size_t m_iNumCol2ndOrder;
165 std::size_t m_iNumCol1stOrder;
166 bool m_iMovingBoxForGhostParticle;
167 double m_fInitParticleSpacing;
169 double m_fInvalidPressure;
170 double m_fInvalidVolume;
171 double m_fNeiSearchRadius;
172 size_t m_iNumParticleWithinSearchRadius;
173 double m_fContactLength;
184 std::vector<std::vector<int> > m_vDirSplitTable;
186 int m_iDirSplitOrder;
219 void computeSetupsForNextIteration();
228 void updateFluidBoundingBox();
237 void checkForContactAlert();
244 void generateGhostParticle();
252 bool isValidGhostParticle(
double x,
double y,
double z,
int* neiList,
size_t numNei,
int objectTag);
261 void searchNeighbourForAllParticle();
269 void setUpwindNeighbourList();
278 void resetLPFOrder();
286 void computeMinParticleSpacing();
294 void computeMaxSoundSpeed();
302 void computeMaxFluidVelocity();
312 void changeFluidObjectTagIfInContact(
int index,
size_t numNeiFound,
const double* neiListDist);
324 void changeNeighbourhoodToIncludeOnlyFluidNeiFromSameObject(
int index,
size_t numNeiFound);
332 void changeNeighbourhoodToIncludeOnlyFluidNei(
int index,
size_t numNeiFound);
348 bool directionalSplitting(
int phase);
355 void setNeighbourListPointers(
int dir,
356 const int **neighbourList0,
const int **neighbourList1,
357 const int **neighbourListSize0,
const int **neighbourListSize1);
364 void setInAndOutDataPointers(
int phase,
int dir,
365 const double** inVelocity,
const double** inPressure,
const double** inVolume,
const double** inSoundSpeed,
366 double** outVelocity,
double** outPressure,
double** outVolume,
double** outSoundSpeed);
373 void setLPFOrderPointers(
int dir,
374 int** LPFOrder0,
int** LPFOrder1, std::vector<int*>& LPFOrderOther);
382 void computeSpatialDer(
int dir,
size_t index,
383 int offset,
void (
HyperbolicLPSolver::*computeA) (
size_t,
const int *,
const int*,
size_t,
size_t,
double*),
384 const double* inPressure,
const double* inVelocity,
385 const int *neighbourList,
const int *neighbourListSize,
386 int* LPFOrder,
double* vel_d,
double* vel_dd,
double* p_d,
double* p_dd);
394 void timeIntegration(
double real_dt,
double multiplier1st,
double multiplier2nd,
395 double gravity,
double inVolume,
double inVelocity,
double inPressure,
397 double vel_d_0,
double vel_dd_0,
double p_d_0,
double p_dd_0,
398 double vel_d_1,
double vel_dd_1,
double p_d_1,
double p_dd_1,
399 double* outVolume,
double* outVelocity,
double* outPressure);
407 void printInvalidState(
int phase,
int dir,
int index,
double positionX,
double positionY,
double positionZ,
408 double vel_d_0,
double vel_dd_0,
double p_d_0,
double p_dd_0,
409 double vel_d_1,
double vel_dd_1,
double p_d_1,
double p_dd_1);
424 bool lowerLPFOrder(
int index,
const std::vector<int*>& LPFOrderOther,
425 int* LPFOrder0,
int* LPFOrder1);
433 void computeNumRowAndNumColAndLPFOrder(
size_t index,
434 const int *neighbourList,
const int *neighbourListSize,
size_t numRow2nd,
size_t numRow1st,
435 int* LPFOrder,
size_t *numRow,
size_t *numCol);
443 void computeA2D(
size_t index,
const int *neighbourList,
const int* LPFOrder,
size_t numRow,
size_t numCol,
451 void computeA3D(
size_t index,
const int *neighbourList,
const int* LPFOrder,
size_t numRow,
size_t numCol,
459 void computeB(
size_t index,
const int *neighbourList,
size_t numRow,
const double* inData,
468 void setBoundaryPressureAndVelocity(
int phase);
475 void setGhostPressureAndVelocity(
int phase);
482 void computeOthOrderWeightedLPF(std::vector<const double*>& position,
483 std::size_t startIndex, std::size_t numParticle,
484 std::vector<double*>& data);
491 void updateFluidState();
498 void moveFluidParticle();
505 void updateFluidVelocity();
513 void testNeighbourSearch();
520 void searchNeighbourBruteForce(
int,
int* neighbourList,
int* neighbourListSize);
527 void searchNeighbourBruteForce(
double x,
double y,
double z,
int* neighbourList,
size_t& numNeiFound);
534 void generateGhostParticleByBruteForceNeighbourSearch();
541 void searchNeighbourForAllParticleByBruteForceNeighbourSearch();
548 bool checkUpwindNeighbourList();
555 std::string rightFlush(
size_t writeStep,
size_t numDigits);
562 int writeResult(
double time,
size_t writeStep,
size_t startIndex,
size_t numParticle);
607 virtual int solve(
double dt);
624 std::size_t m_iNumRow2ndOrder;
625 std::size_t m_iNumRow1stOrder;
626 std::size_t m_iNumCol2ndOrder;
627 std::size_t m_iNumCol1stOrder;
628 double m_fInitParticleSpacing;
629 double m_fInvalidPressure;
630 double m_fInvalidVolume;
632 std::string m_sBoundaryType;
634 double m_fThresholdP;
639 double m_fPeriodicLeftBoundary;
640 double m_fPeriodicRightBoundary;
641 double m_fDisBetweenPeriodicBoundaries;
666 void computeSetupsForNextIteration();
673 void updateFreeBoundaryLocation();
683 void updateFreeBoundaryPressureAndVelocity();
693 void updateSolidBoundaryPressureAndVelocity();
704 void computeMinParticleSpacing();
716 void computeMaxSoundSpeed();
725 void computeMaxFluidVelocity();
733 void updateLimiter();
741 void computeLPFOrder(std::size_t index,
int& left_order,
int& right_order);
749 void computeSpatialDer(
int order,
int direction,
int i,
750 const double *local_u,
const double *local_x,
751 double& dudx,
double& dudxx);
762 void solveByQR(
int order,
int num_nei,
const double *local_u,
const double *local_x,
763 double &dudx,
double &dudxx);
775 void solveByCramer(
int order,
int num_nei,
const double *local_u,
const double *local_x,
776 double &dudx,
double &dudxx);
784 double constantWeight(
double h);
791 void timeIntegration(
int i,
const double* V_old,
const double* up_old,
792 const double* p_old,
const double* cs_old,
793 double ux_left,
double uxx_left,
794 double px_left,
double pxx_left,
795 double ux_right,
double uxx_right,
796 double px_right,
double pxx_right,
797 double* V,
double* up,
double* p);
805 void printInvalidState(
int i,
806 double ux_left,
double uxx_left,
double px_left,
double pxx_left,
807 double ux_right,
double uxx_right,
double px_right,
double pxx_right);
815 void updateFluidState();
823 void moveFluidParticle();
869 #endif // __LP_SOLVER_H__
virtual ~LPSolver()
Destructor.
Definition: lp_solver.h:57
virtual double getMaxFluidVelocity() const
Getter function of the maximum absolute value velocity among all fluid particles. ...
Definition: lp_solver.h:89
virtual double getMaxSoundSpeed() const
Getter function of the maximum sound speed among all fluid particles.
Definition: lp_solver.h:82
An abstract class for the family of classes that performs the task of nearest neighbour search for pa...
Definition: neighbour_searcher.h:64
virtual int solve(double dt)
The Lagrangian particle solver for the compressible Euler's equations for one iteration step...
Definition: lp_solver.cpp:145
double m_fMaxFluidVelocity
Maximum absolute value velocity of fluid particles at a time step.
Definition: lp_solver.h:95
virtual int solve(double dt)=0
The black box main Lagrangian particle solver for one iteration step.
double m_fMaxSoundSpeed
Maximum sound speed of fluid particles at a time step.
Definition: lp_solver.h:94
HyperbolicLPSolver(const Initializer &init, ParticleData *pData, NeighbourSearcher *ns)
Constructor.
Definition: lp_solver.cpp:25
The default Lagrangian Particle solver for the compressible Euler's equation in 2D and 3D...
Definition: lp_solver.h:118
An abstract class for the family of Lagrangian Particle solvers.
Definition: lp_solver.h:53
This class initializes the simulation.
Definition: initializer.h:227
An abstract class for the calculation of energy and sound speed based on different EOS models...
Definition: eos.h:42
double m_fMinParticleSpacing
Minimum inter-particle spacing among fluid particles at a time step.
Definition: lp_solver.h:93
The default Lagrangian Particle solver for the compressible Euler's equation in 1D.
Definition: lp_solver.h:584
HyperbolicLPSolver1D(const Initializer &init, ParticleData *pData)
Constructor.
Definition: lp_solver.cpp:3256
virtual double getMinParticleSpacing() const
Getter function of the minimum inter-particle distance among all fluid particles. ...
Definition: lp_solver.h:75
std::ofstream debug
output information for debugging
Definition: lp_solver.h:97
virtual int solve(double dt)
The 1D Lagrangian particle solver for the compressible Euler's equations for one iteration step...
Definition: lp_solver.cpp:3333
A class that stores all information and data of particles, such as x, y, and z coordinates, neighbour lists, and bounding boxes.
Definition: particle_data.h:51
bool m_iIfDebug
if true then print debug info
Definition: lp_solver.h:96