44 "Compressible Synthetic Eddy Turbulence Forcing (Generation)");
48 const std::weak_ptr<EquationSystem> &pEquation)
70 int nVars = pFields.size();
72 unsigned int nqTot = pFields[0]->GetTotPoints();
82 for (
size_t i = 0; i < nVars; ++i)
107 int nVars = fields.size();
109 unsigned int nCoeff = fields[0]->GetNcoeffs();
120 for (
size_t i = 0; i < nVars; ++i)
122 fields[i]->FwdTrans(
m_Forcing[i], forcingCoeff);
123 Vmath::Vadd(nCoeff, forcingCoeff, 1, outarray[i], 1, outarray[i], 1);
143 int nqTot = pFields[0]->GetTotPoints();
145 int nVars = pFields.size();
159 std::pair<NekDouble, NekDouble> rhoMachMean;
180 for (
size_t i = 0; i < nVars; ++i)
182 physFields[i] = pFields[i]->GetPhys();
186 m_varConv->GetTemperature(physFields, temperature);
203 for (
size_t i = 0; i < nqTot; ++i)
209 (rhoFluc[n][i] * smoothFac[0][i]) / convTurbTime[0][i];
216 (rho[i] * velFluc[n][j * nqTot + i] *
224 velFluc[n][i] * velFluc[n][i] +
225 velFluc[n][nqTot + i] * velFluc[n][nqTot + i] +
226 velFluc[n][2 * nqTot + i] * velFluc[n][2 * nqTot + i];
229 (0.5 * rho[i] * velFlucMod * smoothFac[0][i]) /
255 std::pair<NekDouble, NekDouble> rhoMachMean)
258 int nqTot = pFields[0]->GetTotPoints();
266 for (
size_t i = 0; i < nqTot; ++i)
271 rhoFluc[n][i] = rhoMachMean.first * (
m_gamma - 1) *
272 rhoMachMean.second * rhoMachMean.second *
273 (velFluc[n][i] /
m_Ub);
292 int nqTot = pFields[0]->GetTotPoints();
294 int nVars = pFields.size();
302 for (
size_t i = 0; i < nVars; ++i)
304 physFields[i] = pFields[i]->GetPhys();
309 temperature(nqTot),
pressure(nqTot);
312 m_varConv->GetTemperature(physFields, temperature);
315 m_varConv->GetSoundSpeed(physFields, soundSpeed);
316 m_varConv->GetMach(physFields, soundSpeed, mach);
319 for (
size_t i = 0; i < nqTot; ++i)
330 rhoMean = rhoMean / count;
332 machMean = machMean / count;
334 return std::make_pair(rhoMean, machMean);
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void v_ApplyCoeff(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time) override
Apply forcing term if an eddy left the box of eddies and update the eddies positions.
void CalculateForcing(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Calculate Forcing.
std::pair< NekDouble, NekDouble > ComputeRhoMachMean(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Compute rho and mach mean.
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
void v_Apply(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time) override
Apply forcing term if an eddy left the box of eddies and update the eddies positions.
ForcingCFSSyntheticEddy(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
Array< OneD, Array< OneD, NekDouble > > ComputeDensityFluctuation(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &velFLuc, std::pair< NekDouble, NekDouble > rhoMachMean)
Compute Velocity Fluctuation.
static ForcingSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Creates an instance of this class.
static std::string className
Name of the class.
Defines a forcing term to be explicitly applied.
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
NekDouble m_Ub
Bulk velocity.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > ComputeSmoothingFactor(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, Array< OneD, Array< OneD, NekDouble > > convTurb)
Compute Smoothing Factor.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_ForcingEddy
Forcing for each eddy.
int m_N
Number of eddies in the box.
int m_spacedim
Space dimension.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > ComputeStochasticSignal(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Compute Stochastic Signal.
NekDouble m_currTime
Current time.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > ComputeVelocityFluctuation(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, Array< OneD, Array< OneD, NekDouble > > stochasticSignal)
Compute Velocity Fluctuation.
SOLVER_UTILS_EXPORT void UpdateEddiesPositions()
Update positions of the eddies inside the box.
std::vector< unsigned int > m_eddiesIDForcing
Eddies that add to the domain.
bool m_calcForcing
Check when the forcing should be applied.
SOLVER_UTILS_EXPORT void RemoveEddiesFromForcing(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Remove eddy from forcing term.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > ComputeCharConvTurbTime(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Compute Characteristic Convective Turbulent Time.
Array< OneD, int > m_mask
Box of eddies mask.
NekDouble m_gamma
Ration of specific heats.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.