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() + ')'
    );
}
const tmp<surfaceScalarField> interpolWeights(GeometricField<type, fvPatchField, volMesh>& vf, const word& name){

    //vf.boundaryField().updateCoeffs();
    const objectRegistry& db = vf.db();

    //const volVectorField& u = db.lookupObject<volVectorField>("vc");
    const volVectorField& u = db.lookupObject<volVectorField>("u");
    //const volVectorField& u = db.lookupObject<volVectorField>("s");

    surfaceScalarField phi
    (
        IOobject
        (
            "phi",
            vf.time().timeName(),
            vf.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        linearInterpolate(u) & vf.mesh().Sf()
    );

    tmp<surfaceInterpolationScheme<type> > tinterpScheme;
    tinterpScheme = fvc::scheme<type>(phi, vf.mesh().schemesDict().interpolationScheme(name));

    const surfaceInterpolationScheme<type>& interpolationScheme = tinterpScheme();

    tmp<surfaceScalarField> tweights = interpolationScheme.weights(vf);

    //Info << "weights[15]:" << tweights()[15] << endl;

    return tweights;

}
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
d2dt2
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::d2dt2Scheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().ddtScheme("d2dt2(" + vf.name() + ')')
    )().fvcD2dt2(vf);
}
Ejemplo n.º 5
0
tmp<fvMatrix<Type> >
d2dt2
(
    GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::d2dt2Scheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().d2dt2Scheme("d2dt2(" + vf.name() + ')')
    )().fvmD2dt2(vf);
}
Ejemplo n.º 6
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
ddt
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::ddtScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().ddtScheme("ddt(" + vf.name() + ')')
    )().fvcDdt(vf);
}
Ejemplo n.º 7
0
tmp<faMatrix<Type> >
ddt
(
    GeometricField<Type, faPatchField, areaMesh>& vf
)
{
    return fa::faDdtScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().ddtScheme("ddt(" + vf.name() + ')')
    )().famDdt(vf);
}
Ejemplo n.º 8
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
snGrad
(
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::snGradScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().snGradScheme(name)
    )().snGrad(vf);
}
Ejemplo n.º 9
0
tmp<fvMatrix<Type> >
d2dt2
(
    const volScalarField& rho,
    GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::d2dt2Scheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().d2dt2Scheme("d2dt2(" + rho.name() + ',' + vf.name() + ')')
    )().fvmD2dt2(rho, vf);
}
Ejemplo n.º 10
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
ddt
(
    const dimensionedScalar& rho,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::ddtScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().ddtScheme("ddt(" + rho.name() + ',' + vf.name() + ')')
    )().fvcDdt(rho, vf);
}
tmp<fvMatrix<Type> >
ddt
(
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::ddtScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().ddtScheme(name)
    )().fvmDdt(vf);
}
Ejemplo n.º 12
0
tmp<GeometricField<Type, faPatchField, areaMesh> >
laplacian
(
    const GeometricField<Type, faPatchField, areaMesh>& vf,
    const word& name
)
{
    return fa::laplacianScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().laplacianScheme(name)
    )().facLaplacian(vf);
}
Ejemplo n.º 13
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
laplacian
(
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::laplacianScheme<Type, scalar>::New
    (
        vf.mesh(),
        vf.mesh().laplacianScheme(name)
    )().fvcLaplacian(vf);
}
Ejemplo n.º 14
0
tmp<GeometricField<Type, fvPatchField, volMesh>>
d2dt2
(
    const volScalarField& rho,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    return fv::d2dt2Scheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().ddtScheme("d2dt2(" + rho.name() + ',' + vf.name() + ')')
    ).ref().fvcD2dt2(rho, vf);
}
Ejemplo n.º 15
0
tmp<faMatrix<Type> >
laplacian
(
    const edgeScalarField& gamma,
    GeometricField<Type, faPatchField, areaMesh>& vf,
    const word& name
)
{
    return fa::laplacianScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().laplacianScheme(name)
    )().famLaplacian(gamma, vf);
}
Ejemplo n.º 16
0
tmp<fvMatrix<Type> >
laplacian
(
    const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::laplacianScheme<Type, GType>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().laplacianScheme(name)
    )().fvmLaplacian(gamma, vf);
}
Ejemplo n.º 17
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
div
(
    const surfaceScalarField& flux,
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::convectionScheme<Type>::New
    (
        vf.mesh(),
        flux,
        vf.mesh().schemesDict().divScheme(name)
    )().fvcDiv(flux, vf);
}
Ejemplo n.º 18
0
tmp<GeometricField<Type, faPatchField, areaMesh> >
div
(
    const edgeScalarField& flux,
    const GeometricField<Type, faPatchField, areaMesh>& vf,
    const word& name
)
{
    return fa::convectionScheme<Type>::New
    (
        vf.mesh(),
        flux,
        vf.mesh().schemesDict().divScheme(name)
    )().facDiv(flux, vf);
}
Ejemplo n.º 19
0
tmp<fvMatrix<Type> >
adjDiv
(
    const surfaceScalarField& flux,
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::adjointConvectionScheme<Type>::New
    (
        vf.mesh(),
        flux,
        vf.mesh().divScheme(name)
    )().fvmAdjDiv(flux, vf);
}
Ejemplo n.º 20
0
tmp<fvMatrix<Type> >
adjDiv
(
    const volVectorField& Up,
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::adjConvectionScheme<Type>::New
           (
               vf.mesh(),
               Up,
               vf.mesh().schemesDict().divScheme(name)
           )().fvmAdjDiv(Up, vf);
}
Ejemplo n.º 21
0
tmp
<
    BlockLduSystem<vector, typename outerProduct<vector, Type>::type>
> grad
(
    GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::gradScheme<Type>::New
    (
        vf.mesh(),
        vf.mesh().schemesDict().gradScheme(name)
    )().fvmGrad(vf);
}
Ejemplo n.º 22
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
flux
(
    const surfaceScalarField& phi,
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    const word& name
)
{
    return fv::convectionScheme<Type>::New
    (
        vf.mesh(),
        phi,
        vf.mesh().divScheme(name)
    )().flux(phi, vf);
}
Ejemplo n.º 23
0
Foam::tmp<Foam::fvMatrix<Type>>
Foam::fvm::SuSp
(
    const DimensionedField<scalar, volMesh>& susp,
    const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
    const fvMesh& mesh = vf.mesh();

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

    fvm.diag() += mesh.V()*max(susp.field(), scalar(0));

    fvm.source() -= mesh.V()*min(susp.field(), scalar(0))
        *vf.primitiveField();

    return tfvm;
}
void Foam::motionSmootherAlgo::checkConstraints
(
    GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
    typedef GeometricField<Type, pointPatchField, pointMesh> FldType;

    const polyMesh& mesh = pf.mesh();

    const polyBoundaryMesh& bm = mesh.boundaryMesh();

    // first count the total number of patch-patch points

    label nPatchPatchPoints = 0;

    forAll(bm, patchi)
    {
        if (!isA<emptyPolyPatch>(bm[patchi]))
        {
            nPatchPatchPoints += bm[patchi].boundaryPoints().size();
        }
    }


    typename FldType::GeometricBoundaryField& bFld = pf.boundaryField();


    // Evaluate in reverse order

    forAllReverse(bFld, patchi)
    {
        bFld[patchi].initEvaluate(Pstream::blocking);   // buffered
    }
Ejemplo n.º 25
0
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
            )
        )
    );
}
Foam::tmp<Field<Type> > Foam::tecplotWriter::getFaceField
(
    const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld,
    const labelList& faceLabels
) const
{
    const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();

    tmp<Field<Type> > tfld(new Field<Type>(faceLabels.size()));
    Field<Type>& fld = tfld();

    forAll(faceLabels, i)
    {
        label faceI = faceLabels[i];

        label patchI = patches.whichPatch(faceI);

        if (patchI == -1)
        {
            fld[i] = sfld[faceI];
        }
        else
        {
            label localFaceI = faceI - patches[patchI].start();
            fld[i] = sfld.boundaryField()[patchI][localFaceI];
        }
    }
Ejemplo n.º 27
0
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;
}
Ejemplo n.º 28
0
tmp
<
BlockLduSystem<vector, typename outerProduct<vector, Type>::type>
>
gradScheme<Type>::fvmGrad
(
    const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
    FatalErrorIn
    (
        "tmp<BlockLduSystem> gradScheme<Type>::fvmGrad\n"
        "(\n"
        "    GeometricField<Type, fvPatchField, volMesh>&"
        ")\n"
    )   << "Implicit gradient operator currently defined only for Gauss linear "
        << "and leastSquares (cell and face limiters are optional)."
        << abort(FatalError);

    typedef typename outerProduct<vector, Type>::type GradType;

    tmp<BlockLduSystem<vector, GradType> > tbs
    (
        new BlockLduSystem<vector, GradType>(vf.mesh())
    );

    return tbs;
}
Type Foam::interpolatePointToCell
(
    const GeometricField<Type, pointPatchField, pointMesh>& ptf,
    const label celli
)
{
    const primitiveMesh& mesh = ptf.mesh()();

    const cell& cFaces = mesh.cells()[celli];

    labelHashSet pointHad(10*cFaces.size());

    Type sum(pTraits<Type>::zero);

    forAll(cFaces, i)
    {
        const face& f = mesh.faces()[cFaces[i]];

        forAll(f, fp)
        {
            label v = f[fp];

            if (pointHad.insert(v))
            {
                sum += ptf[v];
            }
        }
    }
Ejemplo n.º 30
0
void volPointInterpolation::interpolateInternalField
(
    const GeometricField<Type, fvPatchField, volMesh>& vf,
    GeometricField<Type, pointPatchField, pointMesh>& pf
) const
{
    if (debug)
    {
        Info<< "volPointInterpolation::interpolateInternalField("
            << "const GeometricField<Type, fvPatchField, volMesh>&, "
            << "GeometricField<Type, pointPatchField, pointMesh>&) : "
            << "interpolating field from cells to points"
            << endl;
    }

    const labelListList& pointCells = vf.mesh().pointCells();

    // Multiply volField by weighting factor matrix to create pointField
    forAll(pointCells, pointi)
    {
        const scalarList& pw = pointWeights_[pointi];
        const labelList& ppc = pointCells[pointi];

        pf[pointi] = pTraits<Type>::zero;

        forAll(ppc, pointCelli)
        {
            pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
        }
    }