tmp<GeometricField<Type, PatchField, GeoMesh> > transform ( const GeometricField<tensor, PatchField, GeoMesh>& trf, const GeometricField<Type, PatchField, GeoMesh>& tf ) { tmp<GeometricField<Type, PatchField, GeoMesh> > tranf ( new GeometricField<Type, PatchField, GeoMesh> ( IOobject ( "transform(" + trf.name() + ',' + tf.name() + ')', tf.instance(), tf.db(), IOobject::NO_READ, IOobject::NO_WRITE ), tf.mesh(), tf.dimensions() ) ); transform(tranf(), trf, tf); return tranf; }
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::linearUpwind<Type>::correction ( const GeometricField<Type, fvPatchField, volMesh>& vf ) const { const fvMesh& mesh = this->mesh(); tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( IOobject ( "linearUpwind::correction(" + vf.name() + ')', mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensioned<Type>(vf.name(), vf.dimensions(), pTraits<Type>::zero) ) ); GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr(); const surfaceScalarField& faceFlux = this->faceFlux_; const labelList& owner = mesh.owner(); const labelList& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); tmp < GeometricField < typename outerProduct<vector, Type>::type, fvPatchField, volMesh > > tgradVf = gradScheme_().grad(vf, gradSchemeName_); const GeometricField < typename outerProduct<vector, Type>::type, fvPatchField, volMesh >& gradVf = tgradVf(); forAll(faceFlux, facei) { label celli = (faceFlux[facei] > 0) ? owner[facei] : neighbour[facei]; sfCorr[facei] = (Cf[facei] - C[celli]) & gradVf[celli]; }
Foam::tmp < Foam::GeometricField < typename Foam::outerProduct<WeightType, Type>::type, Foam::fvPatchField, Foam::volMesh > > Foam::extendedCellToCellStencil::weightedSum ( const mapDistribute& map, const labelListList& stencil, const GeometricField<Type, fvPatchField, volMesh>& fld, const List<List<WeightType> >& stencilWeights ) { typedef typename outerProduct<WeightType, Type>::type WeightedType; typedef GeometricField<WeightedType, fvPatchField, volMesh> WeightedFieldType; const fvMesh& mesh = fld.mesh(); // Collect internal and boundary values List<List<Type> > stencilFld; extendedCellToFaceStencil::collectData(map, stencil, fld, stencilFld); tmp<WeightedFieldType> twf ( new WeightedFieldType ( IOobject ( fld.name(), mesh.time().timeName(), mesh ), mesh, dimensioned<WeightedType> ( fld.name(), fld.dimensions(), pTraits<WeightedType>::zero ) ) ); WeightedFieldType& wf = twf(); forAll(wf, celli) { const List<Type>& stField = stencilFld[celli]; const List<WeightType>& stWeight = stencilWeights[celli]; forAll(stField, i) { wf[celli] += stWeight[i]*stField[i]; } }
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::extendedUpwindCellToFaceStencil::weightedSum ( const surfaceScalarField& phi, const GeometricField<Type, fvPatchField, volMesh>& fld, const List<List<scalar> >& ownWeights, const List<List<scalar> >& neiWeights ) const { const fvMesh& mesh = fld.mesh(); // Collect internal and boundary values List<List<Type> > ownFld; collectData(ownMap(), ownStencil(), fld, ownFld); List<List<Type> > neiFld; collectData(neiMap(), neiStencil(), fld, neiFld); tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( IOobject ( fld.name(), mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensioned<Type> ( fld.name(), fld.dimensions(), pTraits<Type>::zero ) ) ); GeometricField<Type, fvsPatchField, surfaceMesh>& sf = tsfCorr(); // Internal faces for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) { if (phi[faceI] > 0) { // Flux out of owner. Use upwind (= owner side) stencil. const List<Type>& stField = ownFld[faceI]; const List<scalar>& stWeight = ownWeights[faceI]; forAll(stField, i) { sf[faceI] += stField[i]*stWeight[i]; } } else {
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::CLUST<Type>::correction ( const GeometricField<Type, fvPatchField, volMesh>& vf ) const { const fvMesh& mesh = this->mesh(); tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( IOobject ( "CLUST::correction(" + vf.name() + ')', mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensioned<Type>(vf.name(), vf.dimensions(), pTraits<Type>::zero) ) ); GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr(); const surfaceVectorField& Uf = this->Uf_; //const GeometricField<Type,fvsPatchField,surfaceMesh> gradf=fvc::snGrad(vf); const GeometricField < typename outerProduct<vector, Type>::type, fvPatchField, volMesh > Grad = fvc::grad(vf); forAll(sfCorr, facei) { const scalar un = (Uf[facei] & mesh.Sf()[facei])/mesh.magSf()[facei]; const scalar ub = mag(un)/max(SMALL, mag(Uf[facei])); label celli = un > 0 ? mesh.owner()[facei] : mesh.neighbour()[facei]; label cellj = celli == mesh.owner()[facei] ? mesh.neighbour()[facei] : mesh.owner()[facei]; sfCorr[facei] = 0.5*b_*ub* ( ((mesh.C()[cellj] - mesh.C()[celli]) & Grad[celli]) + vf[celli] - vf[cellj] ); } return tsfCorr; }
tmp<fvMatrix<Type> > laplacian ( const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma, GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvm::laplacian ( gamma, vf, "laplacian(" + gamma.name() + ',' + vf.name() + ')' ); }
tmp<GeometricField<Type, fvPatchField, volMesh> > laplacian ( const GeometricField<GType, fvPatchField, volMesh>& gamma, const GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvc::laplacian ( gamma, vf, "laplacian(" + gamma.name() + ',' + vf.name() + ')' ); }
tmp<GeometricField<Type, fvPatchField, volMesh> > steadyStateDdtScheme<Type>::fvcDdt ( const GeometricField<Type, fvPatchField, volMesh>& vf ) { return tmp<GeometricField<Type, fvPatchField, volMesh> > ( new GeometricField<Type, fvPatchField, volMesh> ( IOobject ( "ddt("+vf.name()+')', mesh().time().timeName(), mesh() ), mesh(), dimensioned<Type> ( "0", vf.dimensions()/dimTime, pTraits<Type>::zero ) ) ); }
Foam::tmp<Foam::surfaceScalarField> Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter ( const GeometricField<Type, fvPatchField, volMesh>& phi ) const { const fvMesh& mesh = this->mesh(); tmp<surfaceScalarField> tLimiter ( new surfaceScalarField ( IOobject ( type() + "Limiter(" + phi.name() + ')', mesh.time().timeName(), mesh ), mesh, dimless ) ); surfaceScalarField& lim = tLimiter(); tmp<GeometricField<typename Limiter::phiType, fvPatchField, volMesh> > tlPhi = LimitFunc<Type>()(phi); const GeometricField<typename Limiter::phiType, fvPatchField, volMesh>& lPhi = tlPhi(); tmp<GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh> > tgradc(fvc::grad(lPhi)); const GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>& gradc = tgradc(); const surfaceScalarField& CDweights = mesh.surfaceInterpolation::weights(); const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); const vectorField& C = mesh.C(); scalarField& pLim = lim.internalField(); forAll(pLim, face) { label own = owner[face]; label nei = neighbour[face]; pLim[face] = Limiter::limiter ( CDweights[face], this->faceFlux_[face], lPhi[own], lPhi[nei], gradc[own], gradc[nei], C[nei] - C[own] ); }
tmp<GeometricField<Type, fvPatchField, volMesh> > steadyStateD2dt2Scheme<Type>::fvcD2dt2 ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf ) { return tmp<GeometricField<Type, fvPatchField, volMesh> > ( new GeometricField<Type, fvPatchField, volMesh> ( IOobject ( "d2dt2("+rho.name()+','+vf.name()+')', mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), mesh(), dimensioned<Type> ( "0", rho.dimensions()*vf.dimensions()/dimTime/dimTime, pTraits<Type>::zero ) ) ); }
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField ( const GeometricField<Type, fvPatchField, volMesh>& field, const bool applyOrientation ) const { tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size())); Field<Type>& values = tvalues(); forAll(values, i) { label faceI = faceId_[i]; label patchI = facePatchId_[i]; if (patchI >= 0) { values[i] = field.boundaryField()[patchI][faceI]; } else { FatalErrorIn ( "fieldValues::faceSource::filterField" "(" "const GeometricField<Type, fvPatchField, volMesh>&" ") const" ) << type() << " " << name_ << ": " << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl << " Unable to process internal faces for volume field " << field.name() << nl << abort(FatalError); } }
Foam::autoPtr<Foam::interpolation<Type> > Foam::interpolation<Type>::New ( const word& interpolationType, const volPointInterpolation& pInterp, const GeometricField<Type, fvPatchField, volMesh>& psi ) { typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_ ->find(interpolationType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( "interpolation::New(const word&, " "const GeometricField<Type, fvPatchField, volMesh>&)" ) << "Unknown interpolation type " << interpolationType << " for field " << psi.name() << nl << nl << "Valid interpolation types : " << endl << dictionaryConstructorTablePtr_->toc() << exit(FatalError); } return autoPtr<interpolation<Type> >(cstrIter()(pInterp, psi)); }
tmp<typename steadyStateDdtScheme<Type>::fluxFieldType> steadyStateDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& U, const fluxFieldType& phi ) { return tmp<fluxFieldType> ( new fluxFieldType ( IOobject ( "ddtPhiCorr(" + rA.name() + ',' + rho.name() + ',' + U.name() + ',' + phi.name() + ')', mesh().time().timeName(), mesh() ), mesh(), dimensioned<typename flux<Type>::type> ( "0", rA.dimensions()*rho.dimensions()*phi.dimensions()/dimTime, pTraits<typename flux<Type>::type>::zero ) ) ); }
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > noConvectionScheme<Type>::interpolate ( const surfaceScalarField&, const GeometricField<Type, fvPatchField, volMesh>& vf ) const { return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( IOobject ( "interpolate("+vf.name()+')', vf.instance(), vf.db() ), vf.mesh(), dimensioned<Type> ( "0", vf.dimensions(), pTraits<Type>::zero ) ) ); }
tmp<fvMatrix<Type> > laplacian ( GeometricField<Type, fvPatchField, volMesh>& vf ) { surfaceScalarField Gamma ( IOobject ( "1", vf.time().constant(), vf.mesh(), IOobject::NO_READ ), vf.mesh(), dimensionedScalar("1", dimless, 1.0) ); return fvm::laplacian ( Gamma, vf, "laplacian(" + vf.name() + ')' ); }
tmp<GeometricField<Type, fvPatchField, volMesh> > EulerLocalDdtScheme<Type>::fvcDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf ) { const objectRegistry& registry = this->mesh(); // get access to the scalar beta[i] const scalarField& beta = registry.lookupObject<scalarField>(deltaTName_); volScalarField rDeltaT = 1.0/(beta[0]*registry.lookupObject<volScalarField>(deltaTauName_)); IOobject ddtIOobject ( "ddt("+rho.name()+','+vf.name()+')', mesh().time().timeName(), mesh() ); if (mesh().moving()) { return tmp<GeometricField<Type, fvPatchField, volMesh> > ( new GeometricField<Type, fvPatchField, volMesh> ( ddtIOobject, mesh(), rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(), rDeltaT.internalField()* ( rho.internalField()*vf.internalField() - rho.oldTime().internalField() *vf.oldTime().internalField()*mesh().V0()/mesh().V() ), rDeltaT.boundaryField()* ( rho.boundaryField()*vf.boundaryField() - rho.oldTime().boundaryField() *vf.oldTime().boundaryField() ) ) ); } else { return tmp<GeometricField<Type, fvPatchField, volMesh> > ( new GeometricField<Type, fvPatchField, volMesh> ( ddtIOobject, rDeltaT*(rho*vf - rho.oldTime()*vf.oldTime()) ) ); } }
tmp<GeometricField<Type, fvPatchField, volMesh> > laplacian ( const GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvc::laplacian(vf, "laplacian(" + vf.name() + ')'); }
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> snGrad ( const GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvc::snGrad(vf, "snGrad(" + vf.name() + ')'); }
tmp<GeometricField<Type, faPatchField, areaMesh> > laplacian ( const GeometricField<Type, faPatchField, areaMesh>& vf ) { return fac::laplacian(vf, "laplacian(" + vf.name() + ')'); }
Foam::autoPtr<Foam::interpolation<Type>> Foam::interpolation<Type>::New ( const dictionary& interpolationSchemes, const GeometricField<Type, fvPatchField, volMesh>& psi ) { return New(word(interpolationSchemes.lookup(psi.name())), psi); }
tmp<fvMatrix<Type> > ddt ( GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvm::ddt(vf, "ddt(" + vf.name() + ')'); }
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::APVM<Type>::correction ( const GeometricField<Type, fvPatchField, volMesh>& vf ) const { const fvMesh& mesh = this->mesh(); tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( IOobject ( "APVM::correction(" + vf.name() + ')', mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh, dimensioned<Type>(vf.name(), vf.dimensions(), pTraits<Type>::zero) ) ); GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr.ref(); const dimensionedScalar& dt = mesh.time().deltaT(); const surfaceVectorField& Uf = this->Uf_; const GeometricField<Type, fvsPatchField, surfaceMesh> gradf = fvc::snGrad(vf); const GeometricField < typename outerProduct<vector, Type>::type, fvsPatchField, surfaceMesh > GradF = fvc::interpolate(fvc::reconstruct(gradf*mesh.magSf())); sfCorr = -0.5*dt*(Uf & GradF); return tsfCorr; }
tmp<fvMatrix<Type> > ddt ( const volScalarField& rho, GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvm::ddt(rho, vf, "ddt(" + rho.name() + ',' + vf.name() + ')'); }
tmp<fvMatrix<Type> > adjDiv ( const volVectorField& Up, GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvm::adjDiv(Up, vf, "adjDiv("+Up.name()+','+vf.name()+')'); }
tmp<typename EulerLocalDdtScheme<Type>::fluxFieldType> EulerLocalDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const GeometricField<Type, fvPatchField, volMesh>& U, const fluxFieldType& phi ) { IOobject ddtIOobject ( "ddtPhiCorr(" + rA.name() + ',' + U.name() + ',' + phi.name() + ')', mesh().time().timeName(), mesh() ); if (mesh().moving()) { return tmp<fluxFieldType> ( new fluxFieldType ( ddtIOobject, mesh(), dimensioned<typename flux<Type>::type> ( "0", rA.dimensions()*phi.dimensions()/dimTime, pTraits<typename flux<Type>::type>::zero ) ) ); } else { const objectRegistry& registry = this->mesh(); // get access to the scalar beta[i] const scalarField& beta = registry.lookupObject<scalarField>(deltaTName_); volScalarField rDeltaT = 1.0/(beta[0]*registry.lookupObject<volScalarField>(deltaTauName_)); return tmp<fluxFieldType> ( new fluxFieldType ( ddtIOobject, fvcDdtPhiCoeff(U.oldTime(), phi.oldTime())* ( fvc::interpolate(rDeltaT*rA)*phi.oldTime() - (fvc::interpolate(rDeltaT*rA*U.oldTime()) & mesh().Sf()) ) ) ); } }
tmp<fvMatrix<Type> > div ( const surfaceScalarField& flux, const GeometricField<Type, fvPatchField, volMesh>& vf ) { return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')'); }
tmp < GeometricField < typename outerProduct<vector,Type>::type, fvPatchField, volMesh > > reconstruct ( const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf ) { typedef typename outerProduct<vector, Type>::type GradType; const fvMesh& mesh = ssf.mesh(); const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); tmp<GeometricField<GradType, fvPatchField, volMesh>> treconField ( new GeometricField<GradType, fvPatchField, volMesh> ( IOobject ( "reconstruct("+ssf.name()+')', ssf.instance(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensioned<GradType> ( "0", ssf.dimensions()/dimArea, Zero ), extrapolatedCalculatedFvPatchField<GradType>::typeName ) ); Field<GradType>& rf = treconField(); forAll(owner, facei) { label own = owner[facei]; label nei = neighbour[facei]; rf[own] += (Cf[facei] - C[own])*ssf[facei]; rf[nei] -= (Cf[facei] - C[nei])*ssf[facei]; }
tmp<fvMatrix<typename outerProduct<vector, Type>::type> > grad ( GeometricField<Type, fvPatchField, volMesh>& vf ) { return fv::gradScheme<Type>::New ( vf.mesh(), vf.mesh().schemesDict().gradScheme(vf.name()) )().fvmGrad(vf); }
tmp < GeometricField < typename outerProduct<vector, Type>::type, fvPatchField, volMesh > > gaussGrad<Type>::grad ( const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf ) { typedef typename outerProduct<vector, Type>::type GradType; const fvMesh& mesh = ssf.mesh(); tmp<GeometricField<GradType, fvPatchField, volMesh> > tgGrad ( new GeometricField<GradType, fvPatchField, volMesh> ( IOobject ( "grad("+ssf.name()+')', ssf.instance(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensioned<GradType> ( "0", ssf.dimensions()/dimLength, pTraits<GradType>::zero ), zeroGradientFvPatchField<GradType>::typeName ) ); GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad(); const unallocLabelList& owner = mesh.owner(); const unallocLabelList& neighbour = mesh.neighbour(); const vectorField& Sf = mesh.Sf(); Field<GradType>& igGrad = gGrad; const Field<Type>& issf = ssf; forAll(owner, facei) { GradType Sfssf = Sf[facei]*issf[facei]; igGrad[owner[facei]] += Sfssf; igGrad[neighbour[facei]] -= Sfssf; }
tmp<GeometricField<Type, faPatchField, areaMesh> > div ( const edgeScalarField& flux, const GeometricField<Type, faPatchField, areaMesh>& vf ) { return fac::div ( flux, vf, "div("+flux.name()+','+vf.name()+')' ); }