Loading [MathJax]/extensions/tex2jax.js
MAIA bb96820c
Multiphysics at AIA
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
lptspherical.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef _PARTICLESPHERICAL_H
8#define _PARTICLESPHERICAL_H
9
10#include <cmath>
11#include "UTIL/materialstate.h"
12#include "lptbase.h"
13
14template <MInt nDim, class SysEqn>
16
17template <MInt nDim>
18class LPTBase;
19
20template <MInt nDim>
21class LPTSpherical : public LPTBase<nDim> {
22
23 public:
24 using LPTBase<nDim>::m_oldPos;
25 using LPTBase<nDim>::m_position;
26 using LPTBase<nDim>::m_velocity;
27 using LPTBase<nDim>::m_accel;
28 using LPTBase<nDim>::m_oldVel;
29 using LPTBase<nDim>::m_densityRatio;
30 using LPTBase<nDim>::s_backPtr;
31 using LPTBase<nDim>::m_cellId;
32 using LPTBase<nDim>::m_oldCellId;
33 using LPTBase<nDim>::m_partId;
34 using LPTBase<nDim>::m_creationTime;
35
36 using LPTBase<nDim>::firstStep;
37 using LPTBase<nDim>::isWindow;
38 using LPTBase<nDim>::reqSend;
39 using LPTBase<nDim>::reqBroadcast;
40 using LPTBase<nDim>::isInvalid;
41 using LPTBase<nDim>::hasCollided;
42 using LPTBase<nDim>::hadWallColl;
43 using LPTBase<nDim>::toBeDeleted;
44 using LPTBase<nDim>::wasSend;
45 using LPTBase<nDim>::toBeRespawn;
46 using LPTBase<nDim>::fullyEvaporated;
49
51 using LPTBase<nDim>::getNghbrList;
52 using LPTBase<nDim>::checkCellChange;
53 using LPTBase<nDim>::updateProperties;
54 using LPTBase<nDim>::m_neighborList;
55
57 ~LPTSpherical() override = default;
58
59 LPTSpherical(const LPTSpherical&) = default;
61
63 std::array<MFloat, nDim> m_fluidVel{};
65 MFloat m_fluidDensity = std::numeric_limits<MFloat>::quiet_NaN();
66
68 std::array<MFloat, nDim> m_oldAccel{};
70 std::array<MFloat, nDim> m_oldFluidVel{};
71
73 MFloat m_oldFluidDensity = std::numeric_limits<MFloat>::quiet_NaN();
74
76 MFloat m_diameter = std::numeric_limits<MFloat>::quiet_NaN();
78 MFloat m_temperature = std::numeric_limits<MFloat>::quiet_NaN();
80 MFloat m_breakUpTime = std::numeric_limits<MFloat>::quiet_NaN();
82 MFloat m_shedDiam = std::numeric_limits<MFloat>::quiet_NaN();
86 MFloat m_dM = std::numeric_limits<MFloat>::quiet_NaN();
88 MFloat m_fluidVelMag = std::numeric_limits<MFloat>::quiet_NaN();
90 MFloat m_heatFlux = std::numeric_limits<MFloat>::quiet_NaN();
91
92 static constexpr MInt s_floatElements = 9 + 4 * nDim;
93 static constexpr MInt s_intElements = 1;
94
96 static MFloat s_Re;
97 static MFloat s_Pr;
98 static MFloat s_Sc;
99 static MFloat s_We;
100 static std::array<MFloat, nDim> s_Frm;
101
102 // store neighbor cells including diagonals
103 // std::vector<MInt> m_neighborList;
104 // weights of the matching neighbors
105 std::vector<MFloat> m_redistWeight{};
106
107 void motionEquation() override;
108 void energyEquation() override;
109 void coupling() override;
110 void advanceParticle() override;
111 void resetWeights() override {
112 m_neighborList.clear();
113 this->template interpolateAndCalcWeights<0, 0>(m_cellId, m_position.data(), nullptr, m_redistWeight);
114 };
115
116 // void timeStepRK();
117 MFloat dragFactor(const MFloat partRe);
118
119 template <MInt>
120 friend std::ostream& operator<<(std::ostream& os, const LPTSpherical& m);
121
123 inline MFloat sphericalVolume() const { return 1.0 / 6.0 * PI * POW3(m_diameter); }
124
126 inline MFloat sphericalMass() const {
127 return 1.0 / 6.0 * PI * POW3(m_diameter) * s_backPtr->m_material->density(m_temperature);
128 }
129
131 inline MFloat magRelVel(const MFloat* const velocity1, const MFloat* const velocity2) const {
132 MFloat magnitude = 0.0;
133 for(MInt i = 0; i < nDim; i++) {
134 magnitude += POW2(velocity1[i] - velocity2[i]);
135 }
136 return sqrt(magnitude);
137 }
138
140 inline MFloat magVel() const {
141 MFloat magnitude = 0.0;
142 for(MInt i = 0; i < nDim; i++) {
143 magnitude += POW2(m_velocity[i]);
144 }
145 return sqrt(magnitude);
146 }
147
149 inline MFloat particleRe(const MFloat velocity, const MFloat density, const MFloat dynamicViscosity) {
150 return density * velocity * m_diameter / dynamicViscosity;
151 }
152
154 inline MFloat fParticleRelTime(const MFloat dynamicViscosity) {
155 return 18.0 * dynamicViscosity / (m_diameter * m_diameter * s_backPtr->m_material->density(m_temperature));
156 }
157
159 inline MFloat WeberNumber(const MFloat density, const MFloat velocity, const MFloat temperature) {
160 return density * velocity * 0.5 * m_diameter / s_backPtr->m_material->spraySurfaceTension(temperature);
161 }
162
164 inline MFloat effectiveWallCollisionRadius() const override { return F1B2 * m_diameter; }
165
167 std::array<MFloat, nDim + 1> result{};
168 std::vector<MFloat> weights;
169 this->template interpolateAndCalcWeights<0, nDim + 1>(m_cellId, m_position.data(), result.data(), weights);
170 for(MInt i = 0; i < nDim; i++) {
171 m_oldFluidVel[i] = result[i];
172 m_fluidVel[i] = result[i];
173 }
174 m_oldFluidDensity = result[nDim];
175 m_fluidDensity = result[nDim];
176 }
177
178 private:
179 void interpolateVelocityAndDensity(const MInt cellId, const MFloat* const position, MFloat* const velocity,
180 MFloat& density, std::vector<MFloat>& weights) {
181 std::array<MFloat, nDim + 1> result{};
182 this->template interpolateAndCalcWeights<0, nDim + 1>(cellId, position, result.data(), weights);
183 for(MInt n = 0; n < nDim; n++) {
184 velocity[n] = result[n];
185 }
186 density = result[nDim];
187 }
188
189 void interpolateAllFluidVariables(const MInt cellId, const MFloat* const position, MFloat* const velocity,
190 MFloat& density, MFloat& pressure, MFloat& temperature, MFloat& species,
191 std::vector<MFloat>& weights) {
192 std::array<MFloat, nDim + 4> result{};
193 this->template interpolateAndCalcWeights<0, nDim + 4>(cellId, position, result.data(), weights);
194 for(MInt n = 0; n < nDim; n++) {
195 velocity[n] = result[n];
196 }
197 density = result[nDim];
198 pressure = result[nDim + 1];
199 temperature = result[nDim + 2];
200 species = result[nDim + 3];
201 }
202 void interpolateAllFluidVariables(const MInt cellId, const MFloat* const position, MFloat* const velocity,
203 MFloat& density, MFloat& pressure, MFloat& temperature,
204 std::vector<MFloat>& weights) {
205 std::array<MFloat, nDim + 3> result{};
206 this->template interpolateAndCalcWeights<0, nDim + 3>(cellId, position, result.data(), weights);
207 for(MInt n = 0; n < nDim; n++) {
208 velocity[n] = result[n];
209 }
210 density = result[nDim];
211 pressure = result[nDim + 1];
212 temperature = result[nDim + 2];
213 }
214
215 void momentumCoupling();
216 void heatCoupling();
217 void massCoupling();
218};
219
220template <MInt nDim>
221std::ostream& operator<<(std::ostream& os, const LPTSpherical<nDim>& m) {
222 return os << m.m_partId;
223}
224
225#endif
BitsetType::reference toBeRespawn()
Definition: lptbase.h:208
virtual void particleWallCollision()
particle-wall collision step
Definition: lptbase.cpp:319
static LPT< nDim > * s_backPtr
Definition: lptbase.h:29
std::vector< MInt > m_neighborList
Definition: lptbase.h:82
void interpolateAndCalcWeights(const MInt cellId, const MFloat *const x, MFloat *const result, std::vector< MFloat > &weight, MFloat *const gradientResult=nullptr)
Definition: lptbase.cpp:24
MFloat m_creationTime
creation time modifier
Definition: lptbase.h:50
std::array< MFloat, nDim > m_position
Definition: lptbase.h:34
MLong m_partId
Definition: lptbase.h:45
void getNghbrList(std::vector< MInt > &, const MInt)
Definition: lptbase.cpp:183
std::array< MFloat, nDim > m_velocity
Definition: lptbase.h:35
BitsetType::reference firstStep()
Definition: lptbase.h:179
std::array< MFloat, nDim > m_oldPos
particle position of the last time step
Definition: lptbase.h:39
BitsetType::reference wasSend()
Definition: lptbase.h:199
virtual void wallParticleCollision()
wall-particle collision step
Definition: lptbase.cpp:656
BitsetType::reference hadWallColl()
Definition: lptbase.h:169
void updateProperties(const MBool init=true)
Update particle properties.
Definition: lptbase.cpp:299
BitsetType::reference isWindow()
Definition: lptbase.h:124
MInt m_oldCellId
Definition: lptbase.h:47
std::array< MFloat, nDim > m_oldVel
particle velocity of the last time step
Definition: lptbase.h:41
BitsetType::reference hasCollided()
Definition: lptbase.h:160
BitsetType::reference toBeDeleted()
Definition: lptbase.h:189
BitsetType::reference reqBroadcast()
Definition: lptbase.h:142
BitsetType::reference reqSend()
Definition: lptbase.h:133
MFloat m_densityRatio
Definition: lptbase.h:44
BitsetType::reference fullyEvaporated()
Definition: lptbase.h:218
MInt m_cellId
Definition: lptbase.h:46
BitsetType::reference isInvalid()
Definition: lptbase.h:151
void checkCellChange(const MFloat *oldPosition, const MBool allowHaloNonLeaf=false)
Checks whether position is within cell with number cellId if not, cellId is updated.
Definition: lptbase.cpp:233
std::array< MFloat, nDim > m_accel
Definition: lptbase.h:36
static constexpr MInt s_intElements
Definition: lptspherical.h:93
MFloat m_shedDiam
shedding diameter
Definition: lptspherical.h:82
void motionEquation() override
std::array< MFloat, nDim > m_oldFluidVel
fluid velocity of the last time step
Definition: lptspherical.h:70
MFloat fParticleRelTime(const MFloat dynamicViscosity)
Calculate the reciprocal of the particle relaxation time.
Definition: lptspherical.h:154
LPTSpherical & operator=(const LPTSpherical &)=default
MFloat WeberNumber(const MFloat density, const MFloat velocity, const MFloat temperature)
Calculate the particle Weber-number (radius based)
Definition: lptspherical.h:159
static MFloat s_Pr
Definition: lptspherical.h:97
static std::array< MFloat, nDim > s_Frm
Definition: lptspherical.h:100
LPTSpherical()
constructor of spherical particles, used to invalidate values when debugging!
static MFloat s_lengthFactor
Definition: lptspherical.h:95
std::vector< MFloat > m_redistWeight
Definition: lptspherical.h:105
MFloat sphericalVolume() const
Calculate the current volume.
Definition: lptspherical.h:123
MFloat m_temperature
temperature
Definition: lptspherical.h:78
MFloat m_oldFluidDensity
old fluid density
Definition: lptspherical.h:73
MFloat m_dM
mass evaporation rate
Definition: lptspherical.h:86
static MFloat s_Sc
Definition: lptspherical.h:98
static constexpr MInt s_floatElements
Definition: lptspherical.h:92
friend std::ostream & operator<<(std::ostream &os, const LPTSpherical &m)
Definition: lptspherical.h:221
MFloat sphericalMass() const
Calculate the current mass.
Definition: lptspherical.h:126
MInt m_noParticles
parceled particles
Definition: lptspherical.h:84
void coupling() override
single particle coupling terms
MFloat magRelVel(const MFloat *const velocity1, const MFloat *const velocity2) const
Calculate the magnitude of the relative velocity of the two given velocity vectors.
Definition: lptspherical.h:131
std::array< MFloat, nDim > m_oldAccel
particle acceleration of the last time step
Definition: lptspherical.h:68
MFloat particleRe(const MFloat velocity, const MFloat density, const MFloat dynamicViscosity)
Calculate the particle reynoldsnumber.
Definition: lptspherical.h:149
MFloat magVel() const
Calculate the magnitude of the relative velocity of the two given velocity vectors.
Definition: lptspherical.h:140
void interpolateAllFluidVariables(const MInt cellId, const MFloat *const position, MFloat *const velocity, MFloat &density, MFloat &pressure, MFloat &temperature, MFloat &species, std::vector< MFloat > &weights)
Definition: lptspherical.h:189
MFloat m_diameter
particle diameter
Definition: lptspherical.h:76
MFloat effectiveWallCollisionRadius() const override
Returns the relevant particle radius for the wall collision.
Definition: lptspherical.h:164
MFloat m_heatFlux
heat flux to cell
Definition: lptspherical.h:90
MFloat m_breakUpTime
time since last breakUp
Definition: lptspherical.h:80
void momentumCoupling()
add the momentum flux from the particle to the cell/all surrounding cells
void advanceParticle() override
advance to new timeStep
void heatCoupling()
add the heat flux from the particle to the cell/all surrounding cells
MFloat m_fluidVelMag
fluid velocity magnitude
Definition: lptspherical.h:88
MFloat m_fluidDensity
fluid density
Definition: lptspherical.h:65
void initVelocityAndDensity()
Definition: lptspherical.h:166
void interpolateAllFluidVariables(const MInt cellId, const MFloat *const position, MFloat *const velocity, MFloat &density, MFloat &pressure, MFloat &temperature, std::vector< MFloat > &weights)
Definition: lptspherical.h:202
LPTSpherical(const LPTSpherical &)=default
void energyEquation() override
std::array< MFloat, nDim > m_fluidVel
fluid velocity
Definition: lptspherical.h:63
MFloat dragFactor(const MFloat partRe)
Calculate drag factor of the current particle for the given particle Reynolds number....
~LPTSpherical() override=default
void interpolateVelocityAndDensity(const MInt cellId, const MFloat *const position, MFloat *const velocity, MFloat &density, std::vector< MFloat > &weights)
Definition: lptspherical.h:179
static MFloat s_Re
Definition: lptspherical.h:96
static MFloat s_We
Definition: lptspherical.h:99
void resetWeights() override
Definition: lptspherical.h:111
void massCoupling()
add the mass flux from the particle to the cell/all surrounding cells
constexpr Real POW3(const Real x)
Definition: functions.h:123
constexpr Real POW2(const Real x)
Definition: functions.h:119
std::ostream & operator<<(std::ostream &os, const LPTSpherical< nDim > &m)
Definition: lptspherical.h:221
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52