bool Foam::functionObjects::yPlus::execute(const bool postProcess) { const fvMesh& mesh = refCast<const fvMesh>(obr_); volScalarField& yPlus = const_cast<volScalarField&> ( mesh.lookupObject<volScalarField>(type()) ); if (mesh.foundObject<turbulenceModel>(turbulenceModel::propertiesName)) { const turbulenceModel& model = mesh.lookupObject<turbulenceModel>(turbulenceModel::propertiesName); calcYPlus(model, mesh, yPlus); } else { FatalErrorInFunction << "Unable to find turbulence model in the " << "database" << exit(FatalError); } return true; }
void Foam::yPlus::execute() { typedef compressible::turbulenceModel cmpModel; typedef incompressible::turbulenceModel icoModel; if (active_) { functionObjectFile::write(); const fvMesh& mesh = refCast<const fvMesh>(obr_); volScalarField& yPlus = const_cast<volScalarField&> ( mesh.lookupObject<volScalarField>(type()) ); if (log_) Info<< type() << " " << name_ << " output:" << nl; tmp<volSymmTensorField> Reff; if (mesh.foundObject<cmpModel>(turbulenceModel::propertiesName)) { const cmpModel& model = mesh.lookupObject<cmpModel>(turbulenceModel::propertiesName); calcYPlus(model, mesh, yPlus); } else if (mesh.foundObject<icoModel>(turbulenceModel::propertiesName)) { const icoModel& model = mesh.lookupObject<icoModel>(turbulenceModel::propertiesName); calcYPlus(model, mesh, yPlus); } else { FatalErrorIn("void Foam::yPlus::write()") << "Unable to find turbulence model in the " << "database" << exit(FatalError); } } }
tmp<scalargpuField> nutURoughWallFunctionFvPatchScalarField::calcNut() const { const label patchi = patch().index(); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( turbulenceModel::propertiesName, dimensionedInternalField().group() ) ); const scalargpuField& y = turbModel.y()[patchi]; const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const tmp<scalargpuField> tnuw = turbModel.nu(patchi); const scalargpuField& nuw = tnuw(); // The flow velocity at the adjacent cell centre const scalargpuField magUp(mag(Uw.patchInternalField() - Uw)); tmp<scalargpuField> tyPlus = calcYPlus(magUp); scalargpuField& yPlus = tyPlus(); tmp<scalargpuField> tnutw(new scalargpuField(patch().size(), 0.0)); scalargpuField& nutw = tnutw(); thrust::transform ( y.begin(), y.end(), thrust::make_zip_iterator(thrust::make_tuple ( yPlus.begin(), nuw.begin(), magUp.begin() )), nutw.begin(), nutURoughCalcNutFunctor(yPlusLam_) ); /* forAll(yPlus, facei) { if (yPlus[facei] > yPlusLam_) { const scalar Re = magUp[facei]*y[facei]/nuw[facei] + ROOTVSMALL; nutw[facei] = nuw[facei]*(sqr(yPlus[facei])/Re - 1); } } */ return tnutw; }
tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const { const label patchi = patch().index(); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( turbulenceModel::propertiesName, dimensionedInternalField().group() ) ); const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); return calcYPlus(magUp); }
void calcCompressibleYPlus ( const fvMesh& mesh, const Time& runTime, const volVectorField& U, volScalarField& yPlus ) { IOobject rhoHeader ( "rho", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ); if (!rhoHeader.headerOk()) { Info<< " no rho field" << endl; return; } Info<< "Reading field rho\n" << endl; volScalarField rho(rhoHeader, mesh); #include "compressibleCreatePhi.H" autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh)); fluidThermo& thermo = pThermo(); autoPtr<compressible::turbulenceModel> turbulenceModel ( compressible::turbulenceModel::New ( rho, U, phi, thermo ) ); calcYPlus(turbulenceModel, mesh, U, yPlus); }
void calcIncompressibleYPlus ( const fvMesh& mesh, const Time& runTime, const volVectorField& U, volScalarField& yPlus ) { #include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulenceModel ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); calcYPlus(turbulenceModel, mesh, U, yPlus); }