PeriDyno 1.0.0
Loading...
Searching...
No Matches
SemiAnalyticalPositionBasedFluidModel.cpp
Go to the documentation of this file.
1
9
10#include "ParticleSystem/Module/ParticleIntegrator.h"
13
14#include "Collision/NeighborPointQuery.h"
16
17#include "SemiAnalyticalPBD.h"
19
21
22namespace dyno {
24
25 template <typename TDataType>
27 : GroupModule()
28 {
29 auto smoothingLength = std::make_shared<FloatingNumber<TDataType>>();
30 smoothingLength->setName("Smoothing Length");
31 smoothingLength->varValue()->setValue(Real(0.012));
32 this->pushModule(smoothingLength);
33
34 auto samplingDistance = std::make_shared<FloatingNumber<TDataType>>();
35 samplingDistance->setName("Sampling Distance");
36 samplingDistance->varValue()->setValue(Real(0.005));
37 this->pushModule(samplingDistance);
38
39 auto m_nbrQueryPoint = std::make_shared<NeighborPointQuery<TDataType>>();
40 smoothingLength->outFloating()->connect(m_nbrQueryPoint->inRadius());
41 this->inPosition()->connect(m_nbrQueryPoint->inPosition());
42 this->pushModule(m_nbrQueryPoint);
43 //m_nbrQueryPoint->initialize();
44
45 auto m_nbrQueryTri = std::make_shared<NeighborTriangleQuery<TDataType>>();
46 smoothingLength->outFloating()->connect(m_nbrQueryTri->inRadius());
47 this->inPosition()->connect(m_nbrQueryTri->inPosition());
48 this->inTriangleSet()->connect(m_nbrQueryTri->inTriangleSet());
49 this->pushModule(m_nbrQueryTri);
50
51// auto m_pbdModule2 = std::make_shared<SemiAnalyticalPBD<TDataType>>();
52// this->inTimeStep()->connect(m_pbdModule2->inTimeStep());
53// this->inPosition()->connect(m_pbdModule2->inPosition());
54// this->inVelocity()->connect(m_pbdModule2->inVelocity());
55// smoothingLength->outFloating()->connect(m_pbdModule2->inSmoothingLength());
56// samplingDistance->outFloating()->connect(m_pbdModule2->inSamplingDistance());
57// m_nbrQueryPoint->outNeighborIds()->connect(m_pbdModule2->inNeighborParticleIds());
58// m_nbrQueryTri->outNeighborIds()->connect(m_pbdModule2->inNeighborTriangleIds());
59// this->inTriangleSet()->connect(m_pbdModule2->inTriangleSet());
60// this->pushModule(m_pbdModule2);
61
62 auto m_integrator = std::make_shared<ParticleIntegrator<TDataType>>();
63 this->inTimeStep()->connect(m_integrator->inTimeStep());
64 this->inPosition()->connect(m_integrator->inPosition());
65 this->inVelocity()->connect(m_integrator->inVelocity());
66 this->pushModule(m_integrator);
67
68 auto m_visModule = std::make_shared<ImplicitViscosity<TDataType>>();
69 this->inTimeStep()->connect(m_visModule->inTimeStep());
70 this->inPosition()->connect(m_visModule->inPosition());
71 this->inVelocity()->connect(m_visModule->inVelocity());
72 m_visModule->varViscosity()->setValue(Real(1));
73 smoothingLength->outFloating()->connect(m_visModule->inSmoothingLength());
74 m_nbrQueryPoint->outNeighborIds()->connect(m_visModule->inNeighborIds());
75 this->pushModule(m_visModule);
76
77 //TODO:
78 auto m_meshCollision = std::make_shared<TriangularMeshConstraint<TDataType>>();
79 this->inTimeStep()->connect(m_meshCollision->inTimeStep());
80 this->inPosition()->connect(m_meshCollision->inPosition());
81 this->inVelocity()->connect(m_meshCollision->inVelocity());
82 this->inTriangleSet()->connect(m_meshCollision->inTriangleSet());
83 m_nbrQueryTri->outNeighborIds()->connect(m_meshCollision->inTriangleNeighborIds());
84 this->pushModule(m_meshCollision);
85
86 this->varSmoothingLength()->attach(
87 std::make_shared<FCallBackFunc>(
88 [=]() {
89 smoothingLength->varValue()->setValue(this->varSmoothingLength()->getValue());
90 })
91 );
92 }
93
95} // namespace PhysIKA
#define DEFINE_CLASS(name)
Definition Object.h:140
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
void pushModule(std::shared_ptr< Module > m)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25