MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / step

Method step

SPlisHSPlasH/Drag/DragForce_Gissler2017.cpp:42–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40#ifdef USE_AVX
41
42void DragForce_Gissler2017::step()
43{
44 Simulation *sim = Simulation::getCurrent();
45 const Real supportRadius = sim->getSupportRadius();
46 const Real radius = sim->getValue<Real>(Simulation::PARTICLE_RADIUS);
47 const Real diam = static_cast<Real>(2.0)*radius;
48 static const Real pi = static_cast<Real>(M_PI);
49 const Real rho_l = m_model->getDensity0();
50 const unsigned int fluidModelIndex = m_model->getPointSetIndex();
51 const unsigned int nFluids = sim->numberOfFluidModels();
52 const unsigned int nBoundaries = sim->numberOfBoundaryModels();
53 FluidModel *model = m_model;
54 const unsigned int numParticles = m_model->numActiveParticles();
55 if (numParticles == 0)
56 return;
57
58 const Real fluidParticleVolume = m_model->getVolume(0);
59
60 // Air velocity.
61 const Vector3r va(0, 0, 0);
62
63 const Real L = cbrt(static_cast<Real>(0.75) / pi) * diam;
64
65 const Real inv_td = static_cast<Real>(0.5)*C_d * mu_l / (rho_l * L*L);
66 const Real td = static_cast<Real>(1.0) / inv_td;
67 Real omegaSquare = C_k * sigma / (rho_l * L*L*L) - inv_td*inv_td;
68 omegaSquare = std::max(omegaSquare, static_cast<Real>(0.0));
69 const Real omega = sqrt(omegaSquare);
70
71 // Equation (6)
72 Real val = td*td*omegaSquare;
73 val = sqrt(val+ static_cast<Real>(1.0)) + td*omega;
74 val = std::max(val, -static_cast<Real>(0.5) * pi);
75 val = std::min(val, static_cast<Real>(0.5) * pi);
76 const Real t_max = -static_cast<Real>(2.0) * (atan(val) - pi) / omega;
77
78 // Equation (7)
79 const Real c_def = static_cast<Real>(1.0) - exp(-t_max / td) * (cos(omega * t_max) + static_cast<Real>(1.0)/(omega*td) * sin(omega * t_max));
80
81 // Weber number without velocity
82 const Real We_i_wo_v = rho_a * L / sigma;
83
84 // Equation (8)
85 const Real y_coeff = (C_F * We_i_wo_v * c_def) / (C_k * C_b);
86
87 const Real n_full = 38;
88 const Real n_full_23 = n_full * static_cast<Real>(2.0/3.0);
89
90 #pragma omp parallel default(shared)
91 {
92 #pragma omp for schedule(static)
93 for (int i = 0; i < (int)numParticles; i++)
94 {
95 const Vector3r &vi = m_model->getVelocity(i);
96 Vector3r v_i_rel = va - vi;
97 const Real vi_rel_square = v_i_rel.squaredNorm();
98 const Real vi_rel_norm = sqrt(vi_rel_square);
99 const Real We_i = We_i_wo_v * vi_rel_square;

Callers

nothing calls this directly

Calls 15

maxFunction · 0.85
minFunction · 0.85
forall_volume_mapsFunction · 0.85
blendFunction · 0.85
getSupportRadiusMethod · 0.80
getDensity0Method · 0.80
numberOfFluidModelsMethod · 0.80
numActiveParticlesMethod · 0.80
getVolumeMethod · 0.80
getVelocityMethod · 0.80

Tested by

no test coverage detected