示例#1
0
Foam::foamChemistryReader<ThermoType>::foamChemistryReader
(
    const fileName& reactionsFileName,
    const fileName& thermoFileName
)
:
    chemistryReader<ThermoType>(),
    chemDict_
    (
        IFstream
        (
            fileName(reactionsFileName).expand()
        )()
    ),
    thermoDict_
    (
        IFstream
        (
            fileName(thermoFileName).expand()
        )()
    ),
    speciesThermo_(thermoDict_),
    speciesTable_(chemDict_.lookup("species")),
    reactions_(speciesTable_, speciesThermo_, chemDict_)
{}
Foam::foamChemistryReader<ThermoType>::foamChemistryReader
(
    const dictionary& thermoDict
)
:
    chemistryReader<ThermoType>(),
    speciesThermo_
    (
        IFstream
        (
            fileName(thermoDict.lookup("foamChemistryThermoFile")).expand()
        )()
    ),
    speciesTable_
    (
        dictionary
        (
            IFstream
            (
                fileName(thermoDict.lookup("foamChemistryFile")).expand()
            )()
        ).lookup("species")
    ),
    reactions_
    (
        dictionary
        (
            IFstream
            (
                fileName(thermoDict.lookup("foamChemistryFile")).expand()
            )()
        ).lookup("reactions"),
        typename Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
    )
{}
Foam::foamChemistryReader<ThermoType>::foamChemistryReader
(
    const fileName& reactionsFileName,
    const fileName& thermoFileName
)
:
    chemistryReader<ThermoType>(),
    speciesThermo_(IFstream(thermoFileName)()),
    speciesTable_(dictionary(IFstream(reactionsFileName)()).lookup("species")),
    reactions_
    (
        dictionary(IFstream(reactionsFileName)()).lookup("reactions"),
        Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
    )
{}
示例#4
0
bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
(
    const fileName& filename
)
{
    const bool mustTriangulate = this->isTri();
    this->clear();

    fileName baseName = filename.lessExt();

    // STAR-CD index of points
    List<label> pointId;

    // read points from .vrt file
    readPoints
    (
        IFstream(baseName + ".vrt")(),
        this->storedPoints(),
        pointId
    );

    // Build inverse mapping (STAR-CD pointId -> index)
    Map<label> mapPointId(2*pointId.size());
    forAll(pointId, i)
    {
        mapPointId.insert(pointId[i], i);
    }
示例#5
0
// Construct from dictionary
Foam::thoboisValve::thoboisValve
(
    const word& name,
    const polyMesh& mesh,
    const dictionary& dict
)
:
    name_(name),
    mesh_(mesh),
    engineDB_(refCast<const engineTime>(mesh_.time())),
    csPtr_
    (
        coordinateSystem::New
        (
            "coordinateSystem",
            dict.subDict("coordinateSystem")
        )
    ),
    bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()),
    poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()),
    sidePatch_(dict.lookup("sidePatch"), mesh.boundaryMesh()),
    stemPatch_(dict.lookup("stemPatch"), mesh.boundaryMesh()),
    detachInCylinderPatch_
    (
        dict.lookup("detachInCylinderPatch"),
        mesh.boundaryMesh()
    ),
    detachInPortPatch_
    (
        dict.lookup("detachInPortPatch"),
        mesh.boundaryMesh()
    ),
    detachFacesName_(dict.lookup("detachFaces")),
    liftProfile_
    (
        "theta",
        "lift",
        name_,
        IFstream
        (
            mesh.time().path()/mesh.time().constant()/
            word(dict.lookup("liftProfileFile"))
        )()
    ),
    liftProfileStart_(min(liftProfile_.x())),
    liftProfileEnd_(max(liftProfile_.x())),
    minLift_(readScalar(dict.lookup("minLift"))),
    diameter_(readScalar(dict.lookup("diameter"))),
    staticPointsName_(dict.lookup("staticPoints")),
    movingPointsName_(dict.lookup("movingPoints")),
    movingInternalPointsName_(dict.lookup("movingInternalPoints")),
    staticCellsName_(dict.lookup("staticCells")),
    movingCellsName_(dict.lookup("movingCells"))
{}
示例#6
0
Foam::dictionary& Foam::debug::controlDict()
{
    if (!controlDictPtr_)
    {
        fileNameList controlDictFiles = findEtcFiles("controlDict", true);
        controlDictPtr_ = new dictionary();
        forAllReverse(controlDictFiles, cdfi)
        {
            controlDictPtr_->merge
            (
                dictionary(IFstream(controlDictFiles[cdfi])())
            );
        }
Foam::laminarFlameSpeedModels::SCOPE::SCOPE
(
    const dictionary& dict,
    const hhuCombustionThermo& ct
)
:
    laminarFlameSpeed(dict, ct),

    coeffsDict_
    (
        dictionary
        (
          IFstream
          (
              fileName
              (
                  dict.lookup("fuelFile")
              )
          )()
        ).subDict(typeName + "Coeffs")
    ),
    LFL_(readScalar(coeffsDict_.lookup("lowerFlamabilityLimit"))),
    UFL_(readScalar(coeffsDict_.lookup("upperFlamabilityLimit"))),
    SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")),
    SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")),
    Texp_(readScalar(coeffsDict_.lookup("Texp"))),
    pexp_(readScalar(coeffsDict_.lookup("pexp"))),
    MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")),
    MaPolyU_(coeffsDict_.subDict("upperMaPolynomial"))
{
    SuPolyL_.ll = max(SuPolyL_.ll, LFL_) + SMALL;
    SuPolyU_.ul = min(SuPolyU_.ul, UFL_) - SMALL;

    SuPolyL_.lu = 0.5*(SuPolyL_.ul + SuPolyU_.ll);
    SuPolyU_.lu = SuPolyL_.lu - SMALL;

    MaPolyL_.lu = 0.5*(MaPolyL_.ul + MaPolyU_.ll);
    MaPolyU_.lu = MaPolyL_.lu - SMALL;

    if (debug)
    {
        Info<< "phi     Su  (T = Tref, p = pref)" << endl;
        label n = 200;
        for (int i=0; i<n; i++)
        {
            scalar phi = (2.0*i)/n;
            Info<< phi << token::TAB << SuRef(phi) << endl;
        }
    }
}
示例#8
0
Foam::ReactionList<ThermoType>::ReactionList
(
    const speciesTable& species,
    const HashPtrTable<ThermoType>& thermoDb,
    const fileName& fName
)
:
    SLPtrList<Reaction<ThermoType>>
    (
        dictionary(IFstream(fName)()).lookup("reactions"),
        Reaction<ThermoType>::iNew(species, thermoDb)
    ),
    species_(species),
    thermoDb_(thermoDb),
    dict_(dictionary::null)
{}
Foam::dictionary& Foam::debug::controlDict()
{
    if (!controlDictPtr_)
    {
        // Allow users to override the location of the global controlDict
        // dictionary using an environment variable. Using this environment
        // variable, one can assign a different global controlDict for each
        // case, without having to modify the "default" ones.
        fileName globControlDictFileName = getEnv("FOAM_GLOBAL_CONTROLDICT");

        // Fallback to default locations if filename is empty or not valid
        if( ! isFile(globControlDictFileName) )
            globControlDictFileName = findEtcFile("controlDict", true);

        controlDictPtr_ = new dictionary
        (
            IFstream(globControlDictFileName)()
        );
    }

    return *controlDictPtr_;
}
void engineTimeVaryingTotalPressureFvPatchScalarField::checkTable()
{
    if (!timeDataPtr_.valid())
    {
        timeDataPtr_.reset
        (
            new graph("title", "x", "y", IFstream(timeDataFileName_)())
        );
    }

//    if (this->db().time().value() < min(timeDataPtr_().x()))
    if (engineDB_.theta() < min(timeDataPtr_().x()))
    {
        WarningIn
        (
            "engineTimeVaryingTotalPressureFvPatchScalarField::updateCoeffs()"
        )   << "current time (" << engineDB_.theta()
            << ") is less than the minimum in the data table ("
            << min(timeDataPtr_().x()) << ')' << endl
            << "    Continuing with the value for the smallest time"
            << endl;
    }

//    if (this->db().time().value() > max(timeDataPtr_().x()))
    if (engineDB_.theta() < min(timeDataPtr_().x()))
    {
        WarningIn
        (
            "engineTimeVaryingTotalPressureFvPatchScalarField<Type>::updateCoeffs()"
        )   << "current time (" << engineDB_.theta()
            << ") is greater than the maximum in the data table ("
            << max(timeDataPtr_().x()) << ')' << endl
            << "    Continuing with the value for the largest time"
            << endl;
    }
}