void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { Info<< "Reading velocity field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Info<< "Reading/calculating face flux field phi\n" << endl; surfaceScalarField phi ( IOobject ( "phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ), linearInterpolate(U) & mesh.Sf() ); Info<< "Creating LES filter width field LESdelta\n" << endl; volScalarField LESdelta ( IOobject ( "LESdelta", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("LESdelta", dimLength, SMALL) ); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::LESModel> sgsModel ( incompressible::LESModel::New(U, phi, laminarTransport) ); LESdelta.internalField() = sgsModel->delta(); LESdelta.write(); Info<< "End" << endl; }
void calcIncompressibleYPlus ( const fvMesh& mesh, const Time& runTime, const volVectorField& U, volScalarField& yPlus ) { typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField wallFunctionPatchField; #include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::RASModel> RASModel ( incompressible::RASModel::New(U, phi, laminarTransport) ); const volScalarField::GeometricBoundaryField nutPatches = RASModel->nut()().boundaryField(); bool foundNutPatch = false; forAll(nutPatches, patchi) { if (isA<wallFunctionPatchField>(nutPatches[patchi])) { foundNutPatch = true; const wallFunctionPatchField& nutPw = dynamic_cast<const wallFunctionPatchField&> (nutPatches[patchi]); yPlus.boundaryField()[patchi] = nutPw.yPlus(); const scalarField& Yp = yPlus.boundaryField()[patchi]; Info<< "Patch " << patchi << " named " << nutPw.patch().name() << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) << " average: " << gAverage(Yp) << nl << endl; } } if (!foundNutPatch) { Info<< " no " << wallFunctionPatchField::typeName << " patches" << endl; } }
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); }
int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Info<< "Time = " << runTime.timeName() << endl; fvMesh::readUpdateState state = mesh.readUpdate(); // Wall distance if (timeI == 0 || state != fvMesh::UNCHANGED) { Info<< "Calculating wall distance\n" << endl; wallDist y(mesh, true); Info<< "Writing wall distance to field " << y.name() << nl << endl; y.write(); } volScalarField yPlus ( IOobject ( "yPlus", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("yPlus", dimless, 0.0) ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); # include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::LESModel> sgsModel ( incompressible::LESModel::New(U, phi, laminarTransport) ); volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); volScalarField nuEff = sgsModel->nuEff(); const fvPatchList& patches = mesh.boundary(); forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; if (isA<wallFvPatch>(currPatch)) { yPlus.boundaryField()[patchi] = d[patchi] *sqrt ( nuEff.boundaryField()[patchi] *mag(U.boundaryField()[patchi].snGrad()) ) /sgsModel->nu().boundaryField()[patchi]; const scalarField& Yp = yPlus.boundaryField()[patchi]; Info<< "Patch " << patchi << " named " << currPatch.name() << " y : min: " << min(d) << " max: " << max(d) << " average: " << average(d) << nl << " y+ : min: " << min(Yp) << " max: " << max(Yp) << " average: " << average(Yp) << nl << endl; } } Info<< "Writing yPlus to field " << yPlus.name() << nl << endl; yPlus.write(); }
int main(int argc, char *argv[]) { argList::addNote ( "apply a simplified boundary-layer model to the velocity and\n" "turbulence fields based on the 1/7th power-law." ); argList::addOption ( "ybl", "scalar", "specify the boundary-layer thickness" ); argList::addOption ( "Cbl", "scalar", "boundary-layer thickness as Cbl * mean distance to wall" ); argList::addBoolOption ( "writenut", "write nut field" ); #include "setRootCase.H" if (!args.optionFound("ybl") && !args.optionFound("Cbl")) { FatalErrorIn(args.executable()) << "Neither option 'ybl' or 'Cbl' have been provided to calculate " << "the boundary-layer thickness.\n" << "Please choose either 'ybl' OR 'Cbl'." << exit(FatalError); } else if (args.optionFound("ybl") && args.optionFound("Cbl")) { FatalErrorIn(args.executable()) << "Both 'ybl' and 'Cbl' have been provided to calculate " << "the boundary-layer thickness.\n" << "Please choose either 'ybl' OR 'Cbl'." << exit(FatalError); } #include "createTime.H" #include "createMesh.H" #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Modify velocity by applying a 1/7th power law boundary-layer // u/U0 = (y/ybl)^(1/7) // assumes U0 is the same as the current cell velocity Info<< "Setting boundary layer velocity" << nl << endl; scalar yblv = ybl.value(); forAll(U, cellI) { if (y[cellI] <= yblv) { mask[cellI] = 1; U[cellI] *= ::pow(y[cellI]/yblv, (1.0/7.0)); } } mask.correctBoundaryConditions(); Info<< "Writing U\n" << endl; U.write(); // Update/re-write phi #include "createPhi.H" phi.write(); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); if (isA<incompressible::RASModel>(turbulence())) { // Calculate nut - reference nut is calculated by the turbulence model // on its construction tmp<volScalarField> tnut = turbulence->nut(); volScalarField& nut = tnut(); volScalarField S(mag(dev(symm(fvc::grad(U))))); nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S; // do not correct BC - wall functions will 'undo' manipulation above // by using nut from turbulence model if (args.optionFound("writenut")) { Info<< "Writing nut" << endl; nut.write(); } //--- Read and modify turbulence fields // Turbulence k tmp<volScalarField> tk = turbulence->k(); volScalarField& k = tk(); scalar ck0 = pow025(Cmu)*kappa; k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl))); // do not correct BC - operation may use inconsistent fields wrt these // local manipulations // k.correctBoundaryConditions(); Info<< "Writing k\n" << endl; k.write(); // Turbulence epsilon tmp<volScalarField> tepsilon = turbulence->epsilon(); volScalarField& epsilon = tepsilon(); scalar ce0 = ::pow(Cmu, 0.75)/kappa; epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl); // do not correct BC - wall functions will use non-updated k from // turbulence model // epsilon.correctBoundaryConditions(); Info<< "Writing epsilon\n" << endl; epsilon.write(); // Turbulence omega IOobject omegaHeader ( "omega", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false ); if (omegaHeader.headerOk()) { volScalarField omega(omegaHeader, mesh); dimensionedScalar k0("VSMALL", k.dimensions(), VSMALL); omega = (1 - mask)*omega + mask*epsilon/(Cmu*k + k0); // do not correct BC - wall functions will use non-updated k from // turbulence model // omega.correctBoundaryConditions(); Info<< "Writing omega\n" << endl; omega.write(); } // Turbulence nuTilda IOobject nuTildaHeader ( "nuTilda", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false ); if (nuTildaHeader.headerOk()) { volScalarField nuTilda(nuTildaHeader, mesh); nuTilda = nut; // do not correct BC // nuTilda.correctBoundaryConditions(); Info<< "Writing nuTilda\n" << endl; nuTilda.write(); } } Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; Info<< "End\n" << endl; return 0; }
void calcIncompressibleR ( const fvMesh& mesh, const Time& runTime, const volVectorField& U ) { #include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> model ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); Info<< "Getting R and k fields" << nl << endl; volSymmTensorField& R = model->R()(); volScalarField& k = model->k()(); //normalize R field volSymmTensorField B = R/(2.0*k) - 1.0/3.0*I; //get the eigen values of the normalized B field volVectorField B_eigenValues ( IOobject ( "eigenValues", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), eigenValues(B) ); //calculate the second and third invariants (the first = 0) volScalarField IIs ( IOobject ( "IIs", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), B_eigenValues.component(vector::X)* B_eigenValues.component(vector::Y)+ B_eigenValues.component(vector::Y)* B_eigenValues.component(vector::Z)+ B_eigenValues.component(vector::X)* B_eigenValues.component(vector::Z) ); volScalarField IIIs ( IOobject ( "IIIs", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), B_eigenValues.component(vector::X)* B_eigenValues.component(vector::Y)* B_eigenValues.component(vector::Z) ); Info<< " Writing IIs and IIIs" << endl; IIs.write(); IIIs.write(); }
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { bool writeResults = !args.optionFound("noWrite"); IOobject phiHeader ( "phi", runTime.timeName(), mesh, IOobject::MUST_READ ); if (phiHeader.headerOk()) { autoPtr<surfaceScalarField> PePtr; Info<< " Reading phi" << endl; surfaceScalarField phi(phiHeader, mesh); volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ ), mesh ); IOobject turbulencePropertiesHeader ( "turbulenceProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ); Info<< " Calculating Pe" << endl; if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) { if (turbulencePropertiesHeader.headerOk()) { singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulenceModel ( incompressible::turbulenceModel::New ( U, phi, laminarTransport ) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pef", runTime.timeName(), mesh ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(turbulenceModel->nuEff()) ) ) ); } else { IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); dimensionedScalar nu(transportProperties.lookup("nu")); PePtr.set ( new surfaceScalarField ( IOobject ( "Pef", runTime.timeName(), mesh ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * nu ) ) ); } } else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) { if (turbulencePropertiesHeader.headerOk()) { autoPtr<fluidThermo> thermo(fluidThermo::New(mesh)); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh ), thermo->rho() ); autoPtr<compressible::turbulenceModel> turbulenceModel ( compressible::turbulenceModel::New ( rho, U, phi, thermo() ) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pef", runTime.timeName(), mesh ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(turbulenceModel->muEff()) ) ) ); } else { IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); dimensionedScalar mu(transportProperties.lookup("mu")); PePtr.set ( new surfaceScalarField ( IOobject ( "Pef", runTime.timeName(), mesh ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * mu ) ) ); } } else { FatalErrorInFunction << "Incorrect dimensions of phi: " << phi.dimensions() << abort(FatalError); } Info<< " Pe max : " << max(PePtr()).value() << endl; if (writeResults) { Info<< " Writing surfaceScalarField : " << PePtr().name() << endl; PePtr().write(); volScalarField Pe ( IOobject ( "Pe", runTime.timeName(), mesh ), fvc::average(PePtr()) ); Info<< " Writing volScalarField : " << Pe.name() << endl; Pe.write(); } } else { Info<< " No phi" << endl; } }
int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read in the existing solution files. Info << "Reading field U" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Info << "Reading field T" << endl; volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Info << "Reading field p_rgh" << endl; volScalarField p_rgh ( IOobject ( "p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); // Compute the velocity flux at the faces. This is needed // by the laminar transport model. Info<< "Creating/Calculating face flux field, phi..." << endl; surfaceScalarField phi ( IOobject ( "phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), linearInterpolate(U) & mesh.Sf() ); // Read the gravitational acceleration. This is needed // for calculating dp/dn on boundaries. Info << "Reading gravitational acceleration..." << endl; uniformDimensionedVectorField g ( IOobject ( "g", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); // Read the value of TRef in the transportProperties file. singlePhaseTransportModel laminarTransport(U, phi); dimensionedScalar TRef(laminarTransport.lookup("TRef")); // Use Tref and the T field to compute rhok, which is needed // to calculate dp/dn on boundaries. Info<< "Creating the kinematic density field, rhok..." << endl; volScalarField rhok ( IOobject ( "rhok", runTime.timeName(), mesh ), 1.0 - (T - TRef)/TRef ); // Get access to the input dictionary. IOdictionary setFieldsABLDict ( IOobject ( "setFieldsABLDict", runTime.time().system(), runTime, IOobject::MUST_READ, IOobject::NO_WRITE ) ); // Read in the setFieldsABLDict entries. word velocityInitType(setFieldsABLDict.lookup("velocityInitType")); word temperatureInitType(setFieldsABLDict.lookup("temperatureInitType")); word tableInterpTypeU(setFieldsABLDict.lookupOrDefault<word>("tableInterpTypeU","linear")); word tableInterpTypeT(setFieldsABLDict.lookupOrDefault<word>("tableInterpTypeT","linear")); scalar deltaU(setFieldsABLDict.lookupOrDefault<scalar>("deltaU",1.0)); scalar deltaV(setFieldsABLDict.lookupOrDefault<scalar>("deltaV",1.0)); scalar zPeak(setFieldsABLDict.lookupOrDefault<scalar>("zPeak",0.03)); scalar Uperiods(setFieldsABLDict.lookupOrDefault<scalar>("Uperiods",4)); scalar Vperiods(setFieldsABLDict.lookupOrDefault<scalar>("Vperiods",4)); scalar xMin(setFieldsABLDict.lookupOrDefault<scalar>("xMin",0.0)); scalar yMin(setFieldsABLDict.lookupOrDefault<scalar>("yMin",0.0)); scalar zMin(setFieldsABLDict.lookupOrDefault<scalar>("zMin",0.0)); scalar xMax(setFieldsABLDict.lookupOrDefault<scalar>("xMax",3000.0)); scalar yMax(setFieldsABLDict.lookupOrDefault<scalar>("yMax",3000.0)); scalar zMax(setFieldsABLDict.lookupOrDefault<scalar>("zMax",1000.0)); scalar zRef(setFieldsABLDict.lookupOrDefault<scalar>("zRef",600.0)); bool useWallDistZ(setFieldsABLDict.lookupOrDefault<bool>("useWallDistZ",false)); bool scaleVelocityWithHeight(setFieldsABLDict.lookupOrDefault<bool>("scaleVelocityWithHeight",false)); scalar zInversion(setFieldsABLDict.lookupOrDefault<scalar>("zInversion",600.0)); scalar Ug(setFieldsABLDict.lookupOrDefault<scalar>("Ug",15.0)); scalar UgDir(setFieldsABLDict.lookupOrDefault<scalar>("UgDir",270.0)); scalar Tbottom(setFieldsABLDict.lookupOrDefault<scalar>("Tbottom",300.0)); scalar Ttop(setFieldsABLDict.lookupOrDefault<scalar>("Ttop",304.0)); scalar dTdz(setFieldsABLDict.lookupOrDefault<scalar>("dTdz",0.003)); scalar widthInversion(setFieldsABLDict.lookupOrDefault<scalar>("widthInversion",80.0)); scalar TPrimeScale(setFieldsABLDict.lookupOrDefault<scalar>("TPrimeScale",0.0)); scalar z0(setFieldsABLDict.lookupOrDefault<scalar>("z0",0.016)); scalar kappa(setFieldsABLDict.lookupOrDefault<scalar>("kappa",0.40)); List<List<scalar> > profileTable(setFieldsABLDict.lookup("profileTable")); bool updateInternalFields(setFieldsABLDict.lookupOrDefault<bool>("updateInternalFields",true)); bool updateBoundaryFields(setFieldsABLDict.lookupOrDefault<bool>("updateBoundaryFields",true)); // Change the table profiles from scalar lists to scalar fields scalarField zProfile(profileTable.size(),0.0); scalarField UProfile(profileTable.size(),0.0); scalarField VProfile(profileTable.size(),0.0); scalarField TProfile(profileTable.size(),0.0); forAll(zProfile,i) { zProfile[i] = profileTable[i][0]; UProfile[i] = profileTable[i][1]; VProfile[i] = profileTable[i][2]; TProfile[i] = profileTable[i][3]; }
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { bool writeResults = !args.optionFound("noWrite"); IOobject phiHeader ( "phi", runTime.timeName(), mesh, IOobject::MUST_READ ); if (phiHeader.headerOk()) { autoPtr<surfaceScalarField> PePtr; Info<< " Reading phi" << endl; surfaceScalarField phi(phiHeader, mesh); volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ ), mesh ); IOobject RASPropertiesHeader ( "RASProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ); IOobject LESPropertiesHeader ( "LESProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ); Info<< " Calculating Pe" << endl; if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) { if (RASPropertiesHeader.headerOk()) { IOdictionary RASProperties(RASPropertiesHeader); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::RASModel> RASModel ( incompressible::RASModel::New ( U, phi, laminarTransport ) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(RASModel->nuEff()) ) ) ); } else if (LESPropertiesHeader.headerOk()) { IOdictionary LESProperties(LESPropertiesHeader); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::LESModel> sgsModel ( incompressible::LESModel::New(U, phi, laminarTransport) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(sgsModel->nuEff()) ) ) ); } else { IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar nu(transportProperties.lookup("nu")); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mesh.surfaceInterpolation::deltaCoeffs() * (mag(phi)/mesh.magSf())*(runTime.deltaT()/nu) ) ); } } else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) { if (RASPropertiesHeader.headerOk()) { IOdictionary RASProperties(RASPropertiesHeader); autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh)); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh ), thermo->rho() ); autoPtr<compressible::RASModel> RASModel ( compressible::RASModel::New ( rho, U, phi, thermo() ) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(RASModel->muEff()) ) ) ); } else if (LESPropertiesHeader.headerOk()) { IOdictionary LESProperties(LESPropertiesHeader); autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh)); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh ), thermo->rho() ); autoPtr<compressible::LESModel> sgsModel ( compressible::LESModel::New(rho, U, phi, thermo()) ); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mag(phi) /( mesh.magSf() * mesh.surfaceInterpolation::deltaCoeffs() * fvc::interpolate(sgsModel->muEff()) ) ) ); } else { IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar mu(transportProperties.lookup("mu")); PePtr.set ( new surfaceScalarField ( IOobject ( "Pe", runTime.timeName(), mesh, IOobject::NO_READ ), mesh.surfaceInterpolation::deltaCoeffs() * (mag(phi)/(mesh.magSf()))*(runTime.deltaT()/mu) ) ); } } else { FatalErrorIn(args.executable()) << "Incorrect dimensions of phi: " << phi.dimensions() << abort(FatalError); } // can also check how many cells exceed a particular Pe limit /* { label count = 0; label PeLimit = 200; forAll(PePtr(), i) { if (PePtr()[i] > PeLimit) { count++; } } Info<< "Fraction > " << PeLimit << " = " << scalar(count)/Pe.size() << endl; } */ Info << "Pe max : " << max(PePtr()).value() << endl; if (writeResults) { PePtr().write(); } } else { Info<< " No phi" << endl; } Info<< "\nEnd\n" << endl; }