28 m_pointData->setInputOutputProperties();
34 m_pointData->save(m_finalTimeStep);
41 m_surfaceData->setInputOutputProperties();
42 m_surfaceData->init();
47 m_surfaceData->save(m_finalTimeStep);
54 m_volumeData->setInputOutputProperties();
60 m_volumeData->save(m_finalTimeStep);
71 if(solver().domainId() == 0) {
73 ofl.open(
"IsoTurbulenceStatistics.log", ios::app);
74 ofl << std::setw(5) <<
"t"
75 <<
"\t" << std::setw(8) <<
"ReLambda"
76 <<
"\t" << std::setw(8) <<
"lambda"
77 <<
"\t" << std::setw(8) <<
"Eta"
78 <<
"\t" << std::setw(8) <<
"tau_eta"
79 <<
"\t" << std::setw(8) <<
"skewness" << endl;
100 if((solver().m_fftInterval > 0 &&
globalTimeStep % solver().m_fftInterval == 0) || m_finalTimeStep) {
101 const MInt fftLevel = solver().grid().maxUniformRefinementLevel();
102 const MFloat DX = solver().c_cellLengthAtLevel(fftLevel);
104 MFloat urms[6] = {F0, F0, F0, F0, F0, F0};
105 MFloat dudx[3] = {F0, F0, F0};
106 MFloat skew[4] = {F0, F0, F0, F0};
107 MFloat lambda[3] = {F0, F0, F0};
115 for(
MInt cellId = 0; cellId < solver().a_noCells(); cellId++) {
116 if(solver().a_isHalo(cellId))
continue;
117 if(solver().a_isBndryGhostCell(cellId))
continue;
118 if(solver().a_level(cellId) != fftLevel)
continue;
119 MFloat u = solver().a_variable(cellId, solver().PV->U);
120 MFloat v = solver().a_variable(cellId, solver().PV->V);
121 MFloat w = solver().a_variable(cellId, solver().PV->W);
122 for(
MInt i = 0; i < nDim; i++) {
123 MInt n0 = (solver().a_hasNeighbor(cellId, 2 * i) > 0) ? solver().c_neighborId(cellId, 2 * i) : cellId;
124 MInt n1 = (solver().a_hasNeighbor(cellId, 2 * i + 1) > 0) ? solver().c_neighborId(cellId, 2 * i + 1) : cellId;
125 if(n0 == n1)
continue;
126 dudx[i] +=
POW2((solver().a_variable(n1, solver().PV->VV[i]) - solver().a_variable(n0, solver().PV->VV[i]))
127 / ((solver().a_coordinate(n1, i) - solver().a_coordinate(n0, i)) / DX));
128 skew[i] +=
POW3((solver().a_variable(n1, solver().PV->VV[i]) - solver().a_variable(n0, solver().PV->VV[i]))
129 / ((solver().a_coordinate(n1, i) - solver().a_coordinate(n0, i)) / DX));
140 MPI_Allreduce(MPI_IN_PLACE, &cnt, 1, MPI_DOUBLE, MPI_SUM, solver().mpiComm(), AT_,
"MPI_IN_PLACE",
"cnt");
141 MPI_Allreduce(MPI_IN_PLACE, &urms[0], 6, MPI_DOUBLE, MPI_SUM, solver().mpiComm(), AT_,
"MPI_IN_PLACE",
"urms[0]");
142 MPI_Allreduce(MPI_IN_PLACE, &dudx[0], 3, MPI_DOUBLE, MPI_SUM, solver().mpiComm(), AT_,
"MPI_IN_PLACE",
"dudx[0]");
143 MPI_Allreduce(MPI_IN_PLACE, &skew[0], 3, MPI_DOUBLE, MPI_SUM, solver().mpiComm(), AT_,
"MPI_IN_PLACE",
"skew[0]");
144 skew[3] = ((skew[0] + skew[1] + skew[2]) / (F3 * cnt)) / pow((dudx[0] + dudx[1] + dudx[2]) / (F3 * cnt), 1.5);
145 for(
MInt i = 0; i < 3; i++)
146 skew[i] = (skew[i] / cnt) / pow(dudx[i] / cnt, 1.5);
147 for(
MInt i = 0; i < 6; i++)
148 urms[i] = sqrt(fabs(urms[i]) / cnt);
149 for(
MInt i = 0; i < 3; i++)
151 for(
MInt i = 0; i < 3; i++)
152 lambda[i] = urms[i] / sqrt(dudx[i]);
154 lambdaAvg = F1B3 * (lambda[0] + lambda[1] + lambda[2]);
155 ReLambda = F1B3 * (urms[0] + urms[1] + urms[2]) * lambdaAvg / solver().m_nu;
159 for(
MInt i = 0; i < 3; i++) {
160 eps[i] = 15.0 * solver().m_nu *
POW2(urms[i] / lambda[i]);
162 eta = pow(solver().m_nu, 0.75)
163 / pow(F1B3 * (eps[0] + eps[1] + eps[2]), 0.25);
164 m_tau_eta = pow(solver().m_nu / (F1B3 * (eps[0] + eps[1] + eps[2])), 0.5);
166 if(solver().domainId() == 0) {
168 ofl.open(
"IsoTurbulenceStatistics.log", ios::app);
169 ofl << std::setw(5) <<
globalTimeStep <<
"\t" << std::setw(8) << ReLambda <<
"\t" << std::setw(8) << lambdaAvg
170 <<
"\t" << std::setw(8) << eta <<
"\t" << std::setw(8) << m_tau_eta <<
"\t" << std::setw(8) << skewness
This class is responsible for the point data feature. It records the state of all sampling variables ...
void initPointSamplingData() override
void computeIsoTurbulenceStatistics() override
write data for isotropic Turbulence (single phase and particle-laden)
void savePointSamplingData() override
void initVolumeSamplingData() override
void initSurfaceSamplingData() override
void initIsoTurbulenceStatistics() override
init function for Isotropic Turbulence Statistics
PostProcessingLb(MInt postprocessingId_, PostData< nDim > *data, SolverType *ppSolver_)
virtual ~PostProcessingLb()
void saveSurfaceSamplingData() override
void saveVolumeSamplingData() override
Surface data sampling class. Records all sampling variables on all surface elements and outputs addit...
Class to handle sampling of volume data.
constexpr Real POW3(const Real x)
constexpr Real POW2(const Real x)
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce