const incompressible::turbulenceModel &swakIncompressibleTurbulencePluginFunction::turbInternal(
    const fvMesh &reg
)
{
    static HashPtrTable<incompressible::turbulenceModel> turb_;

    if(reg.foundObject<incompressible::turbulenceModel>("turbulenceProperties")) {
        if(debug) {
            Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: "
                << "turbulence model already in memory" << endl;
        }
        // Somebody else already registered this
        return reg.lookupObject<incompressible::turbulenceModel>("turbulenceProperties");
    }
    if(reg.foundObject<incompressible::LESModel>("LESProperties")) {
        if(debug) {
            Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: "
                << "LES already in memory" << endl;
        }
        // Somebody else already registered this
        return reg.lookupObject<incompressible::LESModel>("LESProperties");
    }
    if(reg.foundObject<incompressible::RASModel>("RASProperties")) {
        if(debug) {
            Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: "
                << "RAS already in memory" << endl;
        }
        // Somebody else already registered this
        return reg.lookupObject<incompressible::RASModel>("RASProperties");
    }

    if(!turb_.found(reg.name())) {
        if(debug) {
            Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: "
                << "not yet in memory for " << reg.name() << endl;
        }

        turb_.set(
            reg.name(),
            incompressible::turbulenceModel::New(
                reg.lookupObject<volVectorField>("U"),
                reg.lookupObject<surfaceScalarField>("phi"),
                const_cast<transportModel &>(transportInternal(reg))
            ).ptr()
        );
    }

    return *(turb_[reg.name()]);
}
예제 #2
0
Foam::tmp<GeoField> Foam::uniformInterpolate
(
    const HashPtrTable<GeoField, label, Hash<label>>& fields,
    const labelList& indices,
    const scalarField& weights
)
{
    const GeoField& field0 = *(*fields.begin());

    // Interpolate
    tmp<GeoField> tfld
    (
        new GeoField
        (
            IOobject
            (
                "uniformInterpolate(" + field0.name() + ')',
                field0.time().timeName(),
                field0.db(),
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            weights[0]*(*fields[indices[0]])
        )
    );
    GeoField& fld = tfld();

    for (label i = 1; i < indices.size(); ++i)
    {
        fld += weights[i]*(*fields[indices[i]]);
    }

    return tfld;
}
예제 #3
0
Foam::tmp<GeoField> Foam::uniformInterpolate
(
    const HashPtrTable<GeoField, label, Hash<label>>& fields,
    const labelList& indices,
    const scalarField& weights
)
{
    const GeoField& field0 = *(*fields.begin());

    // Interpolate
    tmp<GeoField> tfld
    (
        GeoField::New
        (
            "uniformInterpolate(" + field0.name() + ')',
            weights[0]*(*fields[indices[0]])
        )
    );
    GeoField& fld = tfld();

    for (label i = 1; i < indices.size(); ++i)
    {
        fld += weights[i]*(*fields[indices[i]]);
    }

    return tfld;
}
const basicThermo &swakThermophysicalPluginFunction::thermoInternal(
    const fvMesh &reg
)
{
    static HashPtrTable<basicThermo> thermo_;

    if(reg.foundObject<basicThermo>("thermophysicalProperties")) {
        if(debug) {
            Info << "swakThermophysicalPluginFunction::thermoInternal: "
                << "already in memory" << endl;
        }
        // Somebody else already registered this
        return reg.lookupObject<basicThermo>("thermophysicalProperties");
    }
    if(!thermo_.found(reg.name())) {
        if(debug) {
            Info << "swakThermophysicalPluginFunction::thermoInternal: "
                << "not yet in memory for " << reg.name() << endl;
        }

        bool usePsi=true;

        {
            // make sure it is gone before we create the object
            IOdictionary dict
                (
                    IOobject
                    (
                        "thermophysicalProperties",
                        reg.time().constant(),
                        reg,
                        IOobject::MUST_READ,
                        IOobject::NO_WRITE
                    )
                );

            word thermoTypeName=dict["thermoType"];

            basicRhoThermo::fvMeshConstructorTable::iterator cstrIter =
                basicRhoThermo::fvMeshConstructorTablePtr_->find(
                    thermoTypeName
                );
            if (cstrIter != basicRhoThermo::fvMeshConstructorTablePtr_->end())
            {
                if(debug) {
                    Info << thermoTypeName << " is a basicRhoThermo-type";
                }
                usePsi=false;
            } else if(debug) {
                Info << "No " << thermoTypeName << " in basicRhoThermo-types "
#ifdef FOAM_HAS_SORTED_TOC
                    << basicRhoThermo::fvMeshConstructorTablePtr_->sortedToc()
#else
                    << basicRhoThermo::fvMeshConstructorTablePtr_->toc()
#endif
                    << endl;
            }
            if(usePsi) {
                basicPsiThermo::fvMeshConstructorTable::iterator cstrIter =
                    basicPsiThermo::fvMeshConstructorTablePtr_->find(
                        thermoTypeName
                    );
                if(cstrIter != basicPsiThermo::fvMeshConstructorTablePtr_->end())
                {
                    if(debug) {
                        Info << thermoTypeName << " is a basicPsiThermo-type";
                    }
                } else if(debug) {
                    Info << "No " << thermoTypeName << " in basicPsiThermo-types "
#ifdef FOAM_HAS_SORTED_TOC
                    << basicPsiThermo::fvMeshConstructorTablePtr_->sortedToc()
#else
                    << basicPsiThermo::fvMeshConstructorTablePtr_->toc()
#endif
                        << endl;
                }
            }
        }

        // Create it ourself because nobody registered it
        if(usePsi) {
            thermo_.set(
                reg.name(),
                basicPsiThermo::New(reg).ptr()
            );
        } else {
            thermo_.set(
                reg.name(),
                basicRhoThermo::New(reg).ptr()
            );
        }
    }

    return *(thermo_[reg.name()]);
}