Example #1
0
tmp<GeometricField<Type, faPatchField, areaMesh> >
laplacian
(
    const edgeScalarField& gamma,
    const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
    return fac::laplacian
    (
        gamma,
        vf,
        "laplacian(" + gamma.name() + ',' + vf.name() + ')'
    );
}
Example #2
0
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
Foam::fv::correctedSnGrad<Type>::fullGradCorrection
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
    const fvMesh& mesh = this->mesh();

    // construct GeometricField<Type, fvsPatchField, surfaceMesh>
    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tssf =
        linear<typename outerProduct<vector, Type>::type>(mesh).dotInterpolate
        (
            mesh.nonOrthCorrectionVectors(),
            gradScheme<Type>::New
            (
                mesh,
                mesh.gradScheme("grad(" + vf.name() + ')')
            )().grad(vf, "grad(" + vf.name() + ')')
        );
    tssf.ref().rename("snGradCorr(" + vf.name() + ')');

    return tssf;
}
Example #3
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
laplacian
(
    const GeometricField<GType, fvPatchField, volMesh>& gamma,
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    return fvc::laplacian
    (
        gamma,
        tvf,
        "laplacian(" + gamma.name() + ',' + tvf().name() + ')'
    );
}
Example #4
0
tmp<faMatrix<Type> >
laplacian
(
    const dimensionedScalar& gamma,
    GeometricField<Type, faPatchField, areaMesh>& vf,
    const word& name
)
{
    edgeScalarField Gamma
    (
        IOobject
        (
            gamma.name(),
            vf.instance(),
            vf.db(),
            IOobject::NO_READ
        ),
        vf.mesh(),
        gamma
    );

    return fam::laplacian(Gamma, vf, name);
}
Example #5
0
tmp
<
    GeometricField
    <
        typename outerProduct<vector, Type>::type, fvPatchField, volMesh
    >
>
grad
(
    const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
)
{
    return fv::gaussGrad<Type>::gradf(ssf, "grad(" + ssf.name() + ')');
}
Example #6
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
laplacian
(
    const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fvc::laplacian
    (
        tgamma,
        vf,
        "laplacian(" + tgamma().name() + ',' + vf.name() + ')'
    );
}
Example #7
0
Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp
(
    const DimensionedField<scalar, volMesh>& sp,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    const fvMesh& mesh = vf.mesh();

    tmp<fvMatrix<Type> > tfvm
    (
        new fvMatrix<Type>
        (
            vf,
            dimVol*sp.dimensions()*vf.dimensions()
        )
    );
    fvMatrix<Type>& fvm = tfvm();

    fvm.diag() += mesh.V()*sp.field();

    return tfvm;
}
tmp<fvMatrix<Type> >
laplacian
(
    const dimensioned<GType>& gamma,
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
    (
        IOobject
        (
            gamma.name(),
            vf.instance(),
            vf.mesh(),
            IOobject::NO_READ
        ),
        vf.mesh(),
        gamma
    );

    return fvm::laplacian(Gamma, vf, name);
}
Example #9
0
tmp<GeometricField<Type, faPatchField, areaMesh> >
laplacian
(
    const tmp<areaScalarField>& tgamma,
    const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
    return fac::laplacian
    (
        tgamma,
        vf,
        "laplacian(" + tgamma().name() + ',' + vf.name() + ')'
    );
}
Example #10
0
tmp
<
    GeometricField
    <
        typename innerProduct<vector, Type>::type, fvPatchField, volMesh
    >
>
div
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fvc::div(vf, "div("+vf.name()+')');
}
tmp
<
    BlockLduSystem<vector, typename outerProduct<vector, Type>::type>
> grad
(
    GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fvm::grad
    (
        vf,
        "grad(" + vf.name() + ')'
    );
}
Example #12
0
tmp<faMatrix<Type> >
laplacian
(
    const areaScalarField& gamma,
    GeometricField<Type, faPatchField, areaMesh>& vf
)
{
    return fam::laplacian
    (
        gamma,
        vf,
        "laplacian(" + gamma.name() + ',' + vf.name() + ')'
    );
}
Example #13
0
tmp
<
    GeometricField
    <
        typename outerProduct<vector,Type>::type, fvPatchField, volMesh
    >
>
grad
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fvc::grad(vf, "grad(" + vf.name() + ')');
}
tmp<faMatrix<Type> >
laplacian
(
    const edgeTensorField& gamma,
    GeometricField<Type, faPatchField, areaMesh>& vf
)
{
    const faMesh& mesh = vf.mesh();

    return fam::laplacian
    (
        (mesh.Le() & gamma & mesh.Le())/sqr(mesh.magLe()),
        vf
    );
}
Example #15
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
div
(
    const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
)
{
    return tmp<GeometricField<Type, fvPatchField, volMesh> >
    (
        new GeometricField<Type, fvPatchField, volMesh>
        (
            "div("+ssf.name()+')',
            fvc::surfaceIntegrate(ssf)
        )
    );
}
Foam::tmp<Foam::Field<Type>>
Foam::sampledPatch::sampleField
(
    const GeometricField<Type, fvPatchField, volMesh>& vField
) const
{
    // One value per face
    tmp<Field<Type>> tvalues(new Field<Type>(patchFaceLabels_.size()));
    Field<Type>& values = tvalues();
    forAll(patchFaceLabels_, i)
    {
        label patchI = patchIDs_[patchIndex_[i]];
        const Field<Type>& bField = vField.boundaryField()[patchI];
        values[i] = bField[patchFaceLabels_[i]];
    }
Example #17
0
void transform
(
    GeometricField<Type, PatchField, GeoMesh>& rtf,
    const GeometricField<tensor, PatchField, GeoMesh>& trf,
    const GeometricField<Type, PatchField, GeoMesh>& tf
)
{
    transform(rtf.internalField(), trf.internalField(), tf.internalField());
    transform(rtf.boundaryField(), trf.boundaryField(), tf.boundaryField());
}
Example #18
0
Foam::tmp
<
    Foam::GeometricField
    <
        typename Foam::outerProduct<Foam::vector, Type>::type,
        Foam::fvPatchField,
        Foam::volMesh
    >
>
Foam::fv::gradScheme<Type>::grad
(
    const GeometricField<Type, fvPatchField, volMesh>& vsf
) const
{
    return grad(vsf, "grad(" + vsf.name() + ')');
}
Example #19
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    if (surfaceInterpolation::debug)
    {
        Info<< "interpolate"
            << "(const GeometricField<Type, fvPatchField, volMesh>&) : "
            << "interpolating GeometricField<Type, fvPatchField, volMesh> "
            << "using run-time selected scheme"
            << endl;
    }

    return interpolate(vf, "interpolate(" + vf.name() + ')');
}
tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    tmp<fvMatrix<Type> > tfvm
    (
        new fvMatrix<Type>
        (
            vf,
            vf.dimensions()*dimVol/dimTime
        )
    );

    return tfvm;
}
Example #21
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    Istream& schemeData
)
{
    if (surfaceInterpolation::debug)
    {
        Info<< "interpolate"
            << "(const GeometricField<Type, fvPatchField, volMesh>&, "
            << "Istream&) : "
            << "interpolating GeometricField<Type, fvPatchField, volMesh> "
            << endl;
    }

    return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf);
}
tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2
(
    const volScalarField& rho,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    tmp<fvMatrix<Type> > tfvm
    (
        new fvMatrix<Type>
        (
            vf,
            rho.dimensions()*vf.dimensions()*dimVol/dimTime/dimTime
        )
    );

    return tfvm;
}
void surfaceIntegrate
(
    Field<Type>& ivf,
    const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
)
{
    const fvMesh& mesh = ssf.mesh();

    const labelUList& owner = mesh.owner();
    const labelUList& neighbour = mesh.neighbour();

    const Field<Type>& issf = ssf;

    forAll(owner, facei)
    {
        ivf[owner[facei]] += issf[facei];
        ivf[neighbour[facei]] -= issf[facei];
    }
Example #24
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
noConvectionScheme<Type>::fvcDiv
(
    const surfaceScalarField& faceFlux,
    const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > tConvection
    (
        fvc::surfaceIntegrate(flux(faceFlux, vf))
    );

    tConvection().rename
    (
        "convection(" + faceFlux.name() + ',' + vf.name() + ')'
    );

    return tConvection;
}
Example #25
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    if (surfaceInterpolation::debug)
    {
        Info<< "interpolate"
            << "(const GeometricField<Type, fvPatchField, volMesh>&, "
            << "const word&) : "
            << "interpolating GeometricField<Type, fvPatchField, volMesh> "
            << "using " << name
            << endl;
    }

    return scheme<Type>(vf.mesh(), name)().interpolate(vf);
}
Example #26
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
curl
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    word nameCurlVf = "curl(" + vf.name() + ')';

    // Gausses theorem curl
    // tmp<GeometricField<Type, fvPatchField, volMesh> > tcurlVf = 
    //     fvc::surfaceIntegrate(vf.mesh().Sf() ^ fvc::interpolate(vf));

    // Calculate curl as the Hodge dual of the skew-symmetric part of grad
    tmp<GeometricField<Type, fvPatchField, volMesh> > tcurlVf = 
        2.0*(*skew(fvc::grad(vf, nameCurlVf)));

    tcurlVf().rename(nameCurlVf);

    return tcurlVf;
}
Example #27
0
tmp<fvMatrix<Type> >
noConvectionScheme<Type>::fvmDiv
(
    const surfaceScalarField& faceFlux,
    GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
    tmp<fvMatrix<Type> > tfvm
    (
        new fvMatrix<Type>
        (
            vf,
            faceFlux.dimensions()*vf.dimensions()
        )
    );

    // Touch diagonal for consistency
    tfvm().diag() = 0;

    return tfvm;
}
Foam::autoPtr<Foam::interpolation<Type>> Foam::interpolation<Type>::New
(
    const word& interpolationType,
    const GeometricField<Type, fvPatchField, volMesh>& psi
)
{
    typename dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(interpolationType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalErrorInFunction
            << "Unknown interpolation type " << interpolationType
            << " for field " << psi.name() << nl << nl
            << "Valid interpolation types : " << endl
            << dictionaryConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    return autoPtr<interpolation<Type>>(cstrIter()(psi));
}
tmp<tetFemMatrix<Type> > tetFem::smoother
(
    GeometricField<Type, tetPolyPatchField, tetPointMesh>& vf
)
{
    tmp<tetFemMatrix<Type> > tfem
    (
        new tetFemMatrix<Type>
        (
            vf,
            vf.dimensions()
        )
    );
    tetFemMatrix<Type>& fem = tfem();

    fem.upper() = 1.0;

    fem.negSumDiag();

    return tfem;
}
Example #30
0
tmp<GeometricField<Type, fvPatchField, volMesh>>
volField
(
    const fvMeshSubset& meshSubsetter,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    if (meshSubsetter.hasSubMesh())
    {
        tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
        (
            meshSubsetter.interpolate(vf)
        );
        tfld.ref().checkOut();
        tfld.ref().rename(vf.name());
        return tfld;
    }
    else
    {
        return vf;
    }
}