void RHSStencil::apply(FlowField& flowField, int i, int j, int k) { // loadLocalNu3D(_parameters, flowField, _localNu, i, j, k); loadLocalVelocity3D(flowField, _localVelocity, i, j, k); loadLocalMeshsize3D(_parameters, _localMeshsize, i, j, k); // load TKE loadLocal3D([&flowField](FLOAT* local, int ii, int jj, int kk) mutable { *(local + 0) = flowField.getTke(ii, jj, kk); }, _localTKE, i, j, k); // load epsilon loadLocal3D([&flowField](FLOAT* local, int ii, int jj, int kk) mutable { *(local + 0) = flowField.getEpsilon(ii, jj, kk); }, _localEpsilon, i, j, k); // load Fmu*Nut loadLocal3D([&flowField](FLOAT* local, int ii, int jj, int kk) mutable { *(local + 0) = flowField.getFmu(ii, jj, kk) * flowField.getNu(ii, jj, kk); // *(local+0) = 0; }, _localFmuNut, i, j, k); const FLOAT sijsij = computeSijSij3D(_localVelocity, _localMeshsize); const FLOAT f1 = flowField.getF1(i, j, k); const FLOAT f2 = flowField.getF2(i, j, k); const FLOAT f3 = flowField.getF3(i, j, k); const FLOAT D = flowField.getD(i, j, k); const FLOAT E = flowField.getE(i, j, k); const FLOAT nut = flowField.getNu(i, j, k); flowField.getsijsij(i, j, k) = sijsij; // load nu + nut/sigmaK loadLocal3D([&flowField, this](FLOAT* local, int ii, int jj, int kk) mutable { *(local + 0) = this->_parameters.flow.visc + flowField.getNu(ii, jj, kk) / this->_parameters.kEpsilon.sigmaK; }, _localNu, i, j, k); flowField.getRHSTke(i, j, k) = computeRHStke(_parameters, _localVelocity, _localMeshsize, _localNu, _localTKE, _localEpsilon, nut, sijsij, f3, D); // load nu + nut/sigmaE loadLocal3D([&flowField, this](FLOAT* local, int ii, int jj, int kk) mutable { *(local + 0) = this->_parameters.flow.visc + flowField.getNu(ii, jj, kk) / this->_parameters.kEpsilon.sigmaE; }, _localNu, i, j, k); flowField.getRHSEpsilon(i, j, k) = computeRHSepsilon(_parameters, _localVelocity, _localMeshsize, _localNu, _localTKE, _localEpsilon, nut, sijsij, f1, f2, E); }
void KEStencilF::apply(FlowField& flowField, int i, int j, int k) { // turbulent kinetic energy wip.tke = flowField.getTke(i, j, k); wip.tkes = (wip.tke > 0) - (wip.tke < 0); wip.tke = fabs(wip.tke); // dissipation rate wip.epsilon = flowField.getEpsilon(i, j, k); wip.epsilons = (wip.epsilon > 0) - (wip.epsilon < 0); wip.epsilon = fabs(wip.epsilon); // closest wall distance wip.delta = flowField.getH(i, j, k); // turbulent Reynolds numbers wip.Rt = wip.tke * wip.tke * wip.Re / max(wip.epsilon, err); wip.Rd = sqrt(wip.tke) * wip.delta * wip.Re; // dimensionless wall distance FLOAT uTau = pow(cmu, 0.25) * sqrt(wip.tke); wip.yplus = uTau * wip.delta * wip.Re; // calculate factors calc(); // limitation for diffusion and reaction terms // FLOAT gamma = flowField.getEpsilon(i,j,k)/max(1e-8, flowField.getTke(i,j,k)); // wop.f2 *= (wop.f2*gamma> 0.0) ? 1.0 : 0.0; // wop.f3 = ( gamma> 0.0) ? 1.0 : 0.0; // write factors flowField.getFmu(i, j, k) = wop.fmu; flowField.getF1(i, j, k) = wop.f1; flowField.getF2(i, j, k) = wop.f2; flowField.getF3(i, j, k) = wop.f3; flowField.getD(i, j, k) = wop.D; flowField.getE(i, j, k) = wop.E; }