MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lptspray.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 MAIA_SPRAY_H
8#define MAIA_SPRAY_H
9
10#include <random>
11#include "UTIL/maiamath.h"
12#include "UTIL/materialstate.h"
13#include "UTIL/tensor.h"
14#include "globals.h"
15#include "lptspherical.h"
16
17template <MInt nDim>
18class LPTSpherical;
19
20template <MInt nDim>
22
23 public:
25
26 void init(LPT<nDim>* _particle);
27
28 void injection(const MFloat dt);
29
30 void secondaryBreakUp(const MFloat dt);
31
34
37
38 static constexpr MInt m_injDataSize = 11;
39 MFloat* m_injData = nullptr;
40
42
46
49 return true;
50 }
51 if(m_injectionCrankAngle < 0) {
52 return true;
53 } else if(m_injectionCrankAngle > -1
55 return true;
56 }
57 return false;
58 }
59
63
64 private:
65 // Point back to particle container
68
69 MInt domainId() const { return s_backPtr->domainId(); }
70 MInt solverId() const { return s_backPtr->solverId(); }
71
72 MaterialState<nDim>& material() const { return *s_backPtr->m_material; }
73
74 MFloat sphericalMass(const MFloat diameter, const MFloat temperature) {
75 return 1.0 / 6.0 * PI * material().density(temperature) * POW3(diameter);
76 }
77
80
81 // ---------- properties which must be matching the used non-dimensionalisation ------------
82
83 // current injection rate [kg/sec] ( rho_ref * L_ref^2 * u_ref )
85
86 // list of injections rates [kg/sec] rho_ref * L_ref^2 * u_ref
88
89 // list of injection timings [sec] L_ref/u_ref
91
92 // minimal size of droplets during primary breakup [m] / L_ref
94
95 // time until injector closes [sec] L_ref/u_ref
96 MFloat m_injDuration = 0.00055; // 0.00055 20MPa 0.000625 10MPa
97
98 // Injector design parameter (diameter at the end of the injector nozzle)
99 // The size of the Blobs in the Blob-method is identical to this value! [m] / L_ref
101
102 // injection speed/velocity [m/sec] / u_ref
104
105 // diameter of multi-hole injector [m] / L_ref
107
108 // orifice angle of multi-hole injector [degree]
110
111 // diameter of multi-hole injector [m] / L_ref
113
114 // diameter of multi-hole injector orfice [m] / L_ref
116
117 // min diameter for Rosin-Rammler distribution [m] / L_ref
119
120 // mean diameter for Rosin-Rammler distribution [m] / L_ref
122
123 // max diameter for Rosin-Rammler distribution [m] / L_ref
125
126 //--------------------------------------------------------------------------------------------
127
128 // spread for Rosin-Rammler distribution [-]
130
131 // time until the injector is fully open [ percentage of the injection duration]
133
134 // injection direction
136
138
139 // using string2enum
141
142 // cone angle of the spray
145
146 // Properties for primary breakup Rosin-Rammler distribution
148
150
151 // Model properties of secondary break-up
152 MFloat m_B0 = 0.61;
164
167
169
171
173
174 // using string2enum!
179
184
185 MPI_Comm m_primBUp;
186
189
190 // random number for secondary breakup
191 std::mt19937_64 m_PRNGSecBU;
192
193 void updateInjectionRate();
194
195 void primaryBreakUp(const MFloat dt);
196
197 void injectParticles(const MInt spawnParticlesCount, const MFloat* spawnCoord, const MFloat particleDiameter,
198 const MFloat particleDensityRatio, const MFloat particleVelocity, const MFloat sprayConeAngle,
199 const MFloat coneDiameter, std::function<MFloat(MInt)> holePositionAngle,
200 std::function<MFloat(MInt)> injectorDiameter, std::function<MFloat(MInt)> holeNozzleAngle,
201 const MBool hull, const MInt parcelSize, const MInt noInjectionHoles);
202
203 void injectParticles(const MInt spawnParticlesCount, const MFloat* spawnCoord, const MFloat particleDiameter,
204 const MFloat particleDensityRatio, const MFloat particleVelocity, const MFloat sprayConeAngle,
205 const MFloat coneDiameter, const MBool hull, const MFloat nozzleAngle, const MInt parcelSize,
206 const MInt noInjectionHoles) {
207 std::function<MFloat(MInt)> dummyDefault = [&](MInt) { return -1.0; };
208 std::function<MFloat(MInt)> holeNozzleAngle = [&](MInt) { return nozzleAngle; };
209 ASSERT(noInjectionHoles == 1, "Incorrect function call!");
210
211 injectParticles(spawnParticlesCount, spawnCoord, particleDiameter, particleDensityRatio, particleVelocity,
212 sprayConeAngle, coneDiameter, dummyDefault, dummyDefault, holeNozzleAngle, hull, parcelSize,
213 noInjectionHoles);
214 }
215
216
217 // randon number generator for the secondary breakup
218 // set seed by particle-position and discard by globalTimeStep!
219 // only reset if the PRNG is required to be very predictable!
220 void initPRNG(const MInt seed, const MInt discard) {
221 if(m_predictivePRNG) {
222 m_PRNGSecBU.seed(seed);
223 m_PRNGSecBU.discard(discard);
224 }
225 }
226
227 inline std::mt19937_64& randomSecBreakUp() { return m_PRNGSecBU; }
228
229 public:
230 // randon number for primary breakup at spwanDomainId
231 std::mt19937_64 m_PRNGPrimBreakUp;
233
234 inline std::mt19937_64& randomPrimBreakUp(const MInt calls) {
235 ASSERT(domainId() == s_backPtr->m_spawnDomainId, "");
236 m_PRNGPrimBreakUpCount += calls;
237 return m_PRNGPrimBreakUp;
238 }
239
241
244};
245
246#endif // MAIA_SPRAY_H
Definition: lpt.h:82
std::mt19937_64 & randomSecBreakUp()
Definition: lptspray.h:227
MBool m_useNeedleLiftTime
Definition: lptspray.h:170
MInt m_noRTsecBreakUp
Definition: lptspray.h:242
MFloat timeSinceSOI() const
Definition: lptspray.h:32
MFloat * m_needleLiftTime
Definition: lptspray.h:132
MFloat m_CRT
Definition: lptspray.h:154
SprayModel()
Definition: lptspray.h:24
MInt m_primParcelsPerInj
Definition: lptspray.h:188
MLong m_spraySeed
Definition: lptspray.h:240
MFloat & timeSinceSOI()
Definition: lptspray.h:33
MFloat m_injectionCrankAngle
Definition: lptspray.h:60
MFloat m_CT
Definition: lptspray.h:155
MFloat m_injectionSpeed
Definition: lptspray.h:103
MFloat m_angularGap
Definition: lptspray.h:172
MFloat injectionDuration() const
Definition: lptspray.h:35
MBool soonInjection(const MFloat time)
Definition: lptspray.h:47
MFloat m_currentInjectionRate
Definition: lptspray.h:84
MFloat m_Strouhal
Definition: lptspray.h:61
MFloat sphericalMass(const MFloat diameter, const MFloat temperature)
Definition: lptspray.h:74
MFloat m_RosinRammlerSpread
Definition: lptspray.h:129
MaterialState< nDim > & material() const
Definition: lptspray.h:72
MBool m_multiHoleInjector
Definition: lptspray.h:176
MInt m_injStep
Definition: lptspray.h:43
void injectParticles(const MInt spawnParticlesCount, const MFloat *spawnCoord, const MFloat particleDiameter, const MFloat particleDensityRatio, const MFloat particleVelocity, const MFloat sprayConeAngle, const MFloat coneDiameter, const MBool hull, const MFloat nozzleAngle, const MInt parcelSize, const MInt noInjectionHoles)
Definition: lptspray.h:203
MInt m_partEmittDist
Definition: lptspray.h:140
std::mt19937_64 & randomPrimBreakUp(const MInt calls)
Definition: lptspray.h:234
MInt m_primBrkUpParcelSize
Definition: lptspray.h:168
MFloat * m_orificePositionAngle
Definition: lptspray.h:112
MFloat m_weberLimitRT
Definition: lptspray.h:158
void injectParticles(const MInt spawnParticlesCount, const MFloat *spawnCoord, const MFloat particleDiameter, const MFloat particleDensityRatio, const MFloat particleVelocity, const MFloat sprayConeAngle, const MFloat coneDiameter, std::function< MFloat(MInt)> holePositionAngle, std::function< MFloat(MInt)> injectorDiameter, std::function< MFloat(MInt)> holeNozzleAngle, const MBool hull, const MInt parcelSize, const MInt noInjectionHoles)
Create new random particles using the provided options.
Definition: lptspray.cpp:1696
static constexpr MInt m_injDataSize
Definition: lptspray.h:38
MFloat * m_injectorOrificeAngle
Definition: lptspray.h:109
MBool m_secBUDisplayMessage
Definition: lptspray.h:159
MPI_Comm m_primBUp
Definition: lptspray.h:185
MBool m_RTsecBreakUpLength
Definition: lptspray.h:183
MFloat m_injectorDir[nDim]
Definition: lptspray.h:135
MFloatTensor m_injectionTimings
Definition: lptspray.h:90
MBool m_activePrimaryBUp
Definition: lptspray.h:165
MFloatTensor m_injectionRateList
Definition: lptspray.h:87
MFloat * m_sprayAngle
Definition: lptspray.h:143
void logDistributionFunction()
create log of distribution functions for plots and debugging
Definition: lptspray.cpp:1837
MFloat m_timeSinceSOI
Definition: lptspray.h:149
void injection(const MFloat dt)
Perform a spray injection.
Definition: lptspray.cpp:672
MInt m_maxNoPrimParcels
Definition: lptspray.h:187
MFloat m_sprayAngleKH
Definition: lptspray.h:163
static MFloat s_lengthFactor
Definition: lptspray.h:67
MInt m_injectorType
Definition: lptspray.h:175
MFloat m_weberLimitKH
Definition: lptspray.h:156
MFloat m_injectionDistSigmaCoeff
Definition: lptspray.h:137
MFloat * m_injData
Definition: lptspray.h:39
MFloat m_Cbu
Definition: lptspray.h:161
MFloat m_RosinRammlerMax
Definition: lptspray.h:124
MFloat injectionSpeed() const
Definition: lptspray.h:36
MFloat m_primMinDropletSize
Definition: lptspray.h:93
MInt m_RTDiameterMode
Definition: lptspray.h:162
MBool m_predictivePRNG
Definition: lptspray.h:180
MInt m_maxRTChildParcels
Definition: lptspray.h:160
MFloat m_RosinRammlerMean
Definition: lptspray.h:121
MFloat m_injectorNozzleDiameter
Definition: lptspray.h:100
MFloat m_B0
Definition: lptspray.h:152
MBool m_singleHoleInjector
Definition: lptspray.h:177
MFloat m_injectorOrficeSize
Definition: lptspray.h:115
void primaryBreakUp(const MFloat dt)
Inject new particles from the injector exit.
Definition: lptspray.cpp:744
MFloat m_initialCad
Definition: lptspray.h:62
MInt m_noKHsecBreakUp
Definition: lptspray.h:243
void updateInjectionRate()
Update injection rate.
Definition: lptspray.cpp:1658
std::mt19937_64 m_PRNGPrimBreakUp
Definition: lptspray.h:231
void init(LPT< nDim > *_particle)
Spray model initialisation.
Definition: lptspray.cpp:29
void readSprayProperties()
MBool m_broadcastInjected
Definition: lptspray.h:41
MFloat m_RosinRammlerMin
Definition: lptspray.h:118
std::mt19937_64 m_PRNGSecBU
Definition: lptspray.h:191
MInt domainId() const
Definition: lptspray.h:69
MInt m_injStopTimeStep
Definition: lptspray.h:44
MInt m_injStartTimeStep
Definition: lptspray.h:45
static LPT< nDim > * s_backPtr
Definition: lptspray.h:66
MInt solverId() const
Definition: lptspray.h:70
MBool m_KHsecBreakUp
Definition: lptspray.h:182
MFloat m_massLimit
Definition: lptspray.h:157
MBool m_hollowConeInjector
Definition: lptspray.h:178
MBool m_primRosinRammler
Definition: lptspray.h:147
MBool m_RTsecBreakUp
Definition: lptspray.h:181
void initPRNG(const MInt seed, const MInt discard)
Definition: lptspray.h:220
MBool m_activeSecondaryBUp
Definition: lptspray.h:166
MInt m_PRNGPrimBreakUpCount
Definition: lptspray.h:232
MFloat m_B1
Definition: lptspray.h:153
MFloat m_sprayConeAngle
Definition: lptspray.h:144
void secondaryBreakUp(const MFloat dt)
Atomization of particles.
Definition: lptspray.cpp:1081
MFloat * m_injectorDiameter
Definition: lptspray.h:106
MFloat m_injDuration
Definition: lptspray.h:96
constexpr Real POW3(const Real x)
Definition: functions.h:123
MInt globalTimeStep
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
int64_t MLong
Definition: maiatypes.h:64
bool MBool
Definition: maiatypes.h:58
MFloat crankAngle(const MFloat time, const MFloat Strouhal, const MFloat offset, const MInt mode)
help-function for engine calculations which returns the crank-angle for a given time,...
Definition: maiamath.h:506