void Foam::InjectionModel<CloudType>::writeProps()
{
    if (owner_.db().time().outputTime())
    {
        IOdictionary propsDict
        (
            IOobject
            (
                "injectionProperties",
                owner_.db().time().timeName(),
                "uniform"/cloud::prefix/owner_.name(),
                owner_.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            )
        );

        propsDict.add("massInjected", massInjected_);
        propsDict.add("nInjections", nInjections_);
        propsDict.add("parcelsAddedTotal", parcelsAddedTotal_);
        propsDict.add("timeStep0", timeStep0_);

        propsDict.regIOobject::write();
    }
}
Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
(
    const fvMesh& mesh
)
{
    IOdictionary chemistryPropertiesDict
    (
        IOobject
        (
            "chemistryProperties",
            mesh.time().constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));

    wordList models = fvMeshConstructorTablePtr_->sortedToc();
    wordHashSet validModels;
    forAll(models, i)
    {
        label delim = models[i].find('<');
        validModels.insert(models[i](0, delim));
    }
int main(int argc, char *argv[])
{
    // Create global variable for the run
    #include "setRootCase.H"
    #include "createTime.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    IOdictionary nestingControlDict
    (
         IOobject
         (
              "nestingControlDict",
              runTime.system(),
              runTime,
              IOobject::MUST_READ,
              IOobject::NO_WRITE,
              true
         )
    );

    // load the master case
    word masterName(Foam::fvMesh::defaultRegion);
    Info << nl << "Load case: " << masterName << nl << endl;
    masterPimpleSolver masterSolver(masterName,runTime);

    // load the nested cases
    wordList allNestedCases(nestingControlDict.lookup("allNestedCases"));
    List< nestedBlendDsPimpleSolver* > allNestedSolvers(allNestedCases.size());
    forAll (allNestedCases,i)
    {
        word namei = allNestedCases[i];
        Info << nl << "Load case: " << namei << nl << endl;
        allNestedSolvers[i] = new nestedBlendDsPimpleSolver(namei,runTime,true);
    };
int main(int argc, char *argv[])
{
#   include "setRootCase.H"
#   include "createTime.H"

    IOdictionary meshDict
    (
        IOobject
        (
            "meshDict",
            runTime.system(),
            runTime,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    IOdictionary decomposeParDict
    (
        IOobject
        (
            "decomposeParDict",
            runTime.system(),
            runTime,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    const label nProcessors
    (
        readLabel(decomposeParDict.lookup("numberOfSubdomains"))
    );

    for(label procI=0;procI<nProcessors;++procI)
    {
        fileName file("processor");
        std::ostringstream ss;
        ss << procI;
        file += ss.str();
        Info << "Creating " << file << endl;

        // create a directory for processor data
        mkDir(runTime.path()/file);

        // generate constant directories
        mkDir(runTime.path()/"constant");

        // copy the contents of the const directory into processor*
        cp(runTime.path()/"constant", runTime.path()/file);

        // generate 0 directories
        mkDir(runTime.path()/file/"0");
    }

    Info << "End\n" << endl;
    return 0;
}
Foam::monitorFunctionFromVorticity::monitorFunctionFromVorticity
(
    const IOdictionary& dict
)
:
    monitorFunctionFrom(dict),
    monBaseMin_(dict.lookup("monitorBaseMin")),
    monBaseMax_(dict.lookup("monitorBaseMax")),
    monitorMax_(readScalar(dict.lookup("monitorMax")))
{}
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
    // Enclose the creation of the dynamicMesh to ensure it is
    // deleted before the dynamicFvMesh is created otherwise the dictionary
    // is entered in the database twice
    IOdictionary dynamicMeshDict
    (
        IOobject
        (
            "dynamicMeshDict",
            io.time().constant(),
            io.db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );
    
    word dynamicFvMeshTypeName(dynamicMeshDict.lookup("dynamicFvMesh"));

    Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;

    dlLibraryTable::open
    (
        dynamicMeshDict,
        "dynamicFvMeshLibs",
        IOobjectConstructorTablePtr_
    );

    if (!IOobjectConstructorTablePtr_)
    {
        FatalErrorIn
        (
            "dynamicFvMesh::New(const IOobject&)"
        )   << "dynamicFvMesh table is empty"
            << exit(FatalError);
    }

    IOobjectConstructorTable::iterator cstrIter =
        IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName);

    if (cstrIter == IOobjectConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "dynamicFvMesh::New(const IOobject&)"
        )   << "Unknown dynamicFvMesh type " << dynamicFvMeshTypeName
            << endl << endl
            << "Valid dynamicFvMesh types are :" << endl
            << IOobjectConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
{
    IOdictionary solverDict
    (
        IOobject
        (
            "dynamicMeshDict",
            mesh.time().constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    Istream& msData = solverDict.lookup("solver");

    word solverTypeName(msData);

    Info << "Selecting motion solver: " << solverTypeName << endl;

    dlLibraryTable::open
    (
        solverDict,
        "motionSolverLibs",
        dictionaryConstructorTablePtr_
    );

    if (!dictionaryConstructorTablePtr_)
    {
        FatalErrorIn
        (
            "motionSolver::New(const polyMesh& mesh)"
        )   << "solver table is empty"
            << exit(FatalError);
    }

    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(solverTypeName);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "motionSolver::New(const polyMesh& mesh)"
        )   << "Unknown solver type " << solverTypeName
            << endl << endl
            << "Valid solver types are: " << endl
            << dictionaryConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    return autoPtr<motionSolver>(cstrIter()(mesh, msData));
}
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
    // Note: - do not register the dictionary since dynamicFvMeshes themselves
    // do this.
    // - defaultRegion (region0) gets loaded from constant, other ones
    //   get loaded from constant/<regionname>. Normally we'd use
    //   polyMesh::dbDir() but we haven't got a polyMesh yet ...
    IOdictionary dict
    (
        IOobject
        (
            "dynamicMeshDict",
            io.time().constant(),
            (io.name() == polyMesh::defaultRegion ? "" : io.name()),
            io.db(),
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE,
            false
        )
    );

    const word dynamicFvMeshTypeName(dict.lookup("dynamicFvMesh"));

    Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;

    const_cast<Time&>(io.time()).libs().open
    (
        dict,
        "dynamicFvMeshLibs",
        IOobjectConstructorTablePtr_
    );

    if (!IOobjectConstructorTablePtr_)
    {
        FatalErrorInFunction
            << "dynamicFvMesh table is empty"
            << exit(FatalError);
    }

    IOobjectConstructorTable::iterator cstrIter =
        IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName);

    if (cstrIter == IOobjectConstructorTablePtr_->end())
    {
        FatalErrorInFunction
            << "Unknown dynamicFvMesh type "
            << dynamicFvMeshTypeName << nl << nl
            << "Valid dynamicFvMesh types are :" << endl
            << IOobjectConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
void Foam::moleculeCloud::buildConstProps()
{
    Info<< nl << "Reading moleculeProperties dictionary." << endl;

    const List<word>& idList(pot_.idList());

    constPropList_.setSize(idList.size());

    const List<word>& siteIdList(pot_.siteIdList());

    IOdictionary moleculePropertiesDict
    (
        IOobject
        (
            "moleculeProperties",
            mesh_.time().constant(),
            mesh_,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    forAll(idList, i)
    {
        const word& id(idList[i]);

        const dictionary& molDict(moleculePropertiesDict.subDict(id));

        List<word> siteIdNames = molDict.lookup("siteIds");

        List<label> siteIds(siteIdNames.size());

        forAll(siteIdNames, sI)
        {
            const word& siteId = siteIdNames[sI];

            siteIds[sI] = findIndex(siteIdList, siteId);

            if (siteIds[sI] == -1)
            {
                FatalErrorIn("moleculeCloud.C") << nl
                    << siteId << " site not found."
                    << nl << abort(FatalError);
            }
        }

        molecule::constantProperties& constProp = constPropList_[i];

        constProp = molecule::constantProperties(molDict);

        constProp.siteIds() = siteIds;
    }
}
Exemple #10
0
int main(int argc, char *argv[])
{
#   include "setRootCase.H"
#   include "createTime.H"
#   include "createMesh.H"

    // Reading faMeshDefinition dictionary
    IOdictionary faMeshDefinition
    (
        IOobject
        (
            "faMeshDefinition",
            runTime.constant(),
            "faMesh",
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    wordList polyMeshPatches
    (
        faMeshDefinition.lookup("polyMeshPatches")
    );

    dictionary bndDict = faMeshDefinition.subDict("boundary");

    wordList faPatchNames = bndDict.toc();

    List<faPatchData> faPatches(faPatchNames.size()+1);

    forAll (faPatchNames, patchI)
    {
        dictionary curPatchDict =
            bndDict.subDict(faPatchNames[patchI]);

        faPatches[patchI].name_ = faPatchNames[patchI];

        faPatches[patchI].type_ = 
            word(curPatchDict.lookup("type"));

        faPatches[patchI].ownPolyPatchID_ =
            mesh.boundaryMesh().findPatchID
            (
                word(curPatchDict.lookup("ownerPolyPatch"))
            );

        faPatches[patchI].ngbPolyPatchID_  =
            mesh.boundaryMesh().findPatchID
            (
                word(curPatchDict.lookup("neighbourPolyPatch"))
            );
    }
void Foam::reducedUnits::setRefValues
(
    const IOdictionary& reducedUnitsDict
)
{
    refLength_ = readScalar(reducedUnitsDict.lookup("refLength"));

    refTime_ = readScalar(reducedUnitsDict.lookup("refTime"));

    refMass_  = readScalar(reducedUnitsDict.lookup("refMass"));

    calcRefValues();
}
Foam::coalCloudList::coalCloudList
(
    const volScalarField& rho,
    const volVectorField& U,
    const dimensionedVector& g,
    const SLGThermo& slgThermo
)
:
    PtrList<coalCloud>(),
    mesh_(rho.mesh())
{
    IOdictionary props
    (
        IOobject
        (
            "coalCloudList",
            mesh_.time().constant(),
            mesh_,
            IOobject::MUST_READ
        )
    );

    const wordHashSet cloudNames(wordList(props.lookup("clouds")));

    setSize(cloudNames.size());

    label i = 0;
    forAllConstIter(wordHashSet, cloudNames, iter)
    {
        const word& name = iter.key();

        Info<< "creating cloud: " << name << endl;

        set
        (
            i++,
            new coalCloud
            (
                name,
                rho,
                U,
                g,
                slgThermo
            )
        );

        Info<< endl;
    }
}
Exemple #13
0
int main(int argc, char* argv[])
{

	// ------
	//  create PtrList from dictionary
	// ------
	
	#include "setRootCase.H"
	#include "createTime.H"
	#include "createMesh.H"

	IOdictionary dict
	(
		IOobject
		(
			"testDict",
			runTime.constant(),
			mesh,
			IOobject::MUST_READ,
			IOobject::NO_WRITE,
			true
		)
	);

	PtrList<myLib> ptl3
	(
		dict.lookup("group"),
		myLib::iNew()
	);

	Info << ptl3 << endl;

	Info << nl <<  "Display member name:" << endl;

	forAll(ptl3, i)
	{
		Info << ptl3[i].name() << endl;
	}

	Info << nl << "Display member ID:" << endl;

	forAll(ptl3, i)
	{
		Info << ptl3[i].ID() << endl;
	}

    return 0;
}
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
(
    const polyMesh& mesh,
    const IOdictionary& dict
)
:
    displacementMotionSolver(mesh, dict, dict.lookup("solver")),
    fvMotionSolver(mesh),
    cellDisplacement_
    (
        IOobject
        (
            "cellDisplacement",
            mesh.time().timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        fvMesh_,
        dimensionedVector
        (
            "cellDisplacement",
            pointDisplacement().dimensions(),
            Zero
        ),
        cellMotionBoundaryTypes<vector>(pointDisplacement().boundaryField())
    ),
    diffusivityPtr_
    (
        motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
    )
{}
Exemple #15
0
Foam::autoPtr<Foam::flameletModel> Foam::flameletModel::New
(
    volScalarField& rho,
    volVectorField& U,
    volScalarField& Su,
    volScalarField& Sigma,
    volScalarField& b,
    psiuReactionThermo& thermo,
    compressible::turbulenceModel& turbulence,
    IOdictionary& mdData
)
{
    const word flameletType(mdData.lookup("flameletModel"));

    Info<< "Selecting flamelet diffusion: " << flameletType << endl;

    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(flameletType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "flameletModel::New("
            "const IOdictionary& dict)"
        )   << "Unknown diffusion type "
            << flameletType << nl << nl
            << "Valid diffusion types are :" << endl
            << dictionaryConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    return autoPtr<flameletModel>
      (cstrIter()(rho, U, Su, Sigma, b, thermo, turbulence, mdData));
}
Foam::flameletModelA::flameletModelA
(   
    volScalarField& rho,
    volVectorField& U,
    volScalarField& Su,
    volScalarField& Sigma,
    volScalarField& b,
    psiuReactionThermo& thermo,
    compressible::turbulenceModel& turbulence,
    IOdictionary& mdData
)
:
    flameletModel
    (
        rho
    ),
    dictionary_(mdData.subDict("flameletModelACoeffs")),
    alphaSigma_(readScalar(dictionary_.lookup("alphaSigma"))),
    GammaK_(readScalar(dictionary_.lookup("GammaK"))),
    betaSigma_(readScalar(dictionary_.lookup("betaSigma"))),
	rho_(rho),	
	U_(U),
	Su_(Su),
	Sigma_(Sigma),
	b_(b),
        thermo_(thermo),
	turbulence_(turbulence)
{}
Foam::autoPtr<Foam::phaseChangeTwoPhaseMixture>
Foam::phaseChangeTwoPhaseMixture::New
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    const word& alpha1Name
)
{
    IOdictionary transportPropertiesDict
    (
        IOobject
        (
            "transportProperties",
            U.time().constant(),
            U.db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    word phaseChangeTwoPhaseMixtureTypeName
    (
        transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture")
    );

    Info<< "Selecting phaseChange model "
        << phaseChangeTwoPhaseMixtureTypeName << endl;

    componentsConstructorTable::iterator cstrIter =
        componentsConstructorTablePtr_
            ->find(phaseChangeTwoPhaseMixtureTypeName);

    if (cstrIter == componentsConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "phaseChangeTwoPhaseMixture::New"
        )   << "Unknown phaseChangeTwoPhaseMixture type "
            << phaseChangeTwoPhaseMixtureTypeName << endl << endl
            << "Valid  phaseChangeTwoPhaseMixtures are : " << endl
            << componentsConstructorTablePtr_->toc()
            << exit(FatalError);
    }

    return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi, alpha1Name));
}
Exemple #18
0
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
:
    blockPointField_(dict.lookup("vertices")),
    scaleFactor_(1.0),
    topologyPtr_(createTopology(dict, regionName))
{
    calcMergeInfo();
}
void saveTurbulenceParameters(const IOdictionary& RASProperties,
                              pt::ptree& settings)
{
    std::string dictName = "kOmegaSSTCoeffs";
    dictionary kOmegaSSTCoeffsDict
            (RASProperties.subOrEmptyDict(dictName));

    scalar alphaK1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK1", 0.85034);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K1, alphaK1);

    scalar alphaK2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaK2", 1.0);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_K2, alphaK2);

    scalar alphaOmega1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega1", 0.5);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA1, alphaOmega1);

    scalar alphaOmega2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("alphaOmega2", 0.85616);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_ALPHA_OMEGA2, alphaOmega2);

    scalar gamma1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma1", 0.5532);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA1, gamma1);

    scalar gamma2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("gamma2", 0.4403);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_GAMMA2, gamma2);

    scalar beta1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta1", 0.0750);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA1, beta1);

    scalar beta2 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("beta2", 0.0828);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETA2, beta2);

    scalar betaStar = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("betaStar", 0.09);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_BETASTAR, betaStar);

    scalar a1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("a1", 0.31);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_A1, a1);

    scalar c1 = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("c1", 10);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_C1, c1);

    scalar Cmu = kOmegaSSTCoeffsDict.lookupOrDefault<scalar>("Cmu", 0.09);
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_CMU, Cmu);

    scalar kappa = 0.41;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_KAPPA, kappa);

    scalar E = 9.8;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_E, E);

    scalar ypl = 11.0;
    for (int i = 0; i < 10; i++)
    {
        ypl = ::log(E*ypl)/kappa;
    }
    scalar yPlusLam = ypl;
    settings.put(dictName + "." + speeditcl::io::TURBULENCE_KOMEGASST_YPLUS_LAM, yPlusLam);

}
autoPtr<scalarTransportModel> scalarTransportModel::New
(
    const dictionary& dict, //Not used at the moment
    cfdemCloud& sm
)
{
    IOdictionary tempDict
    (
        IOobject
        (
            "scalarTransportProperties",
            sm.mesh().time().constant(),
            sm.mesh(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    word scalarTransportModelType
    (
        tempDict.lookup("scalarTransportModel")
    );

    Info<< "Selecting scalarTransportModel "
		 << scalarTransportModelType << endl;

    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(scalarTransportModelType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalError
            << "scalarTransportModel::New(const dictionary&, const spray&) : "
            << endl
            << "    unknown scalarTransportModelType type "
            << scalarTransportModelType
            << ", constructor not in hash table" << endl << endl
            << "    Valid scalarTransportModel types are :"
            << endl;
        Info<< dictionaryConstructorTablePtr_->toc()
            << abort(FatalError);
    }

    return autoPtr<scalarTransportModel>(cstrIter()(tempDict,sm));
}
Foam::autoPtr<Foam::laminarFlameSpeed> Foam::laminarFlameSpeed::New
(
    const hhuCombustionThermo& ct
)
{
    IOdictionary laminarFlameSpeedDict
    (
        IOobject
        (
            "combustionProperties",
            ct.T().time().constant(),
            ct.T().db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    word laminarFlameSpeedType
    (
        laminarFlameSpeedDict.lookup("laminarFlameSpeedCorrelation")
    );

    Info<< "Selecting laminar flame speed correlation "
        << laminarFlameSpeedType << endl;

    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(laminarFlameSpeedType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalIOErrorIn
        (
            "laminarFlameSpeed::New(const hhuCombustionThermo&)",
            laminarFlameSpeedDict
        )   << "Unknown laminarFlameSpeed type "
            << laminarFlameSpeedType << endl << endl
            << "Valid laminarFlameSpeed types are :" << endl
            << dictionaryConstructorTablePtr_->sortedToc()
            << exit(FatalIOError);
    }

    return autoPtr<laminarFlameSpeed>(cstrIter()(laminarFlameSpeedDict, ct));
}
tmp<volScalarField> laminarFlux::DEff() const
{
    IOdictionary transportProperties
    (
        IOobject
        (
            "transportProperties",
            runTime_.constant(),
            mesh_,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );

    dimensionedScalar D
    (
        transportProperties.lookup("D")
    );

   // Info<<"Reading diffusivity "<< D << endl;

    //return tmp<volScalarField>(new volScalarField("DEff", D.value()));

    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                "DEff",
                runTime_.timeName(),
                mesh_,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh_,
            dimensionedScalar("DEff", dimensionSet(0,2,-1,0,0,0,0), D.value())
        )
    );

}
interfaceProperties::interfaceProperties
(
    const volScalarField& gamma,
    const volVectorField& U,
    const IOdictionary& dict
)
:
    transportPropertiesDict_(dict),
    cGamma_
    (
        readScalar
        (
            gamma.mesh().solutionDict().subDict("PISO").lookup("cGamma")
        )
    ),
    sigma_(dict.lookup("sigma")),

    deltaN_
    (
        "deltaN",
        1e-8/pow(average(gamma.mesh().V()), 1.0/3.0)
    ),

    gamma_(gamma),
    U_(U),

    nHatf_
    (
        IOobject
        (
            "nHatf",
            gamma_.time().timeName(),
            gamma_.mesh()
        ),
        gamma_.mesh(),
        dimensionedScalar("nHatf", dimArea, 0.0)
    ),

    K_
    (
        IOobject
        (
            "K",
            gamma_.time().timeName(),
            gamma_.mesh()
        ),
        gamma_.mesh(),
        dimensionedScalar("K", dimless/dimLength, 0.0)
    )
{
    calculateK();
}
void postProcessingWaves::writeNameDict
(
    const scalar& dt,
    const wordList& names
)
{
    IOdictionary xyz
    (
        IOobject
        (
            callName_ + "_dict",
            rT_.constant(),
            addDir_,
            rT_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        )
    );

    // Adding deltaT information to the dictionary
    xyz.add("deltaT", dt, true);

    // Adding indexing to the dictionary
    labelList index( names.size(), 0 );

    forAll (index, indexi)
    {
        index[indexi] = indexi;
    }

    xyz.add("index", index, true);

    // Adding the names
    xyz.add("names", names, true);

    // Write the dictionary
    xyz.regIOobject::write();
}
Exemple #25
0
Foam::CantPopeBray::CantPopeBray
(   
	volScalarField& rho,
	volVectorField& U,
	volScalarField& Su,
	volScalarField& Sigma,
	volScalarField& b,
	psiuReactionThermo& thermo,
	compressible::turbulenceModel& turbulence,
	IOdictionary& mdData
)
:
    flameletModel
    (
        rho
    ),
    dictionary_(mdData.subDict("CantPopeBrayCoeffs")),
    alphaSigma_
    (
        dictionary_.lookupOrDefault
	(
	    "alphaSigma",
	    0.28
	)
    ),
    betaSigma_
    (
        dictionary_.lookupOrDefault
	(
	    "betaSigma",
	    1.0
	)
    ),
    aCoeff_
    (
        dictionary_.lookupOrDefault
	(
	    "aCoeff",
	    10.0
	)
     ),
     rho_(rho),	
     U_(U),
     Su_(Su),
     Sigma_(Sigma),
     b_(b),
     thermo_(thermo),
     turbulence_(turbulence)
{}
void postProcessingWaves::writeXYZDict
(
    const scalar& dt,
    const scalarField& x,
    const scalarField& y,
    const scalarField& z
)
{
    // Open a dictionary used for outputting data
    IOdictionary xyz
    (
        IOobject
        (
            callName_ + "_dict",
            rT_.constant(),
            addDir_,
            rT_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        )
    );

    // Adding deltaT information to the dictionary
    xyz.add("deltaT", dt, true);

    // Adding indexing to the dictionary
    labelList index( x.size(), 0 );

    forAll (index, indexi)
    {
        index[indexi] = indexi;
    }

    xyz.add("index", index, true);

    // Adding the point locations to the dictionary
    xyz.add("x", x, true);

    xyz.add("y", y, true);

    xyz.add("z", z, true);

    // Write the dictionary
    xyz.regIOobject::write();
}
void Foam::StandardWallInteraction<CloudType>::writeProps
(
    const label nEscape,
    const scalar massEscape,
    const label nStick,
    const scalar massStick
) const
{
    if (!this->owner().solution().transient())
    {
        return;
    }

    if (this->owner().db().time().outputTime())
    {
        IOdictionary propsDict
        (
            IOobject
            (
                "standardWallInteractionProperties",
                this->owner().db().time().timeName(),
                "uniform"/cloud::prefix/this->owner().name(),
                this->owner().db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            )
        );

        propsDict.add("nEscape", nEscape);
        propsDict.add("massEscape", massEscape);
        propsDict.add("nStick", nStick);
        propsDict.add("massStick", massStick);

        propsDict.writeObject
        (
            IOstream::ASCII,
            IOstream::currentVersion,
            this->owner().db().time().writeCompression()
        );
    }
}
Exemple #28
0
int main(int argc, char *argv[])
{
    Foam::argList::addBoolOption
    (
        "checkGeometry",
        "check all surface geometry for quality"
    );

    Foam::argList::addBoolOption
    (
        "conformationOnly",
        "conform to the initial points without any point motion"
    );

    #include "setRootCase.H"
    #include "createTime.H"

    runTime.functionObjects().off();

    const bool checkGeometry = args.optionFound("checkGeometry");
    const bool conformationOnly = args.optionFound("conformationOnly");

    IOdictionary foamyHexMeshDict
    (
        IOobject
        (
            args.executable() + "Dict",
            runTime.system(),
            runTime,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );


    if (checkGeometry)
    {
        const searchableSurfaces allGeometry
        (
            IOobject
            (
                "cvSearchableSurfaces",
                runTime.constant(),
                "triSurface",
                runTime,
                IOobject::MUST_READ,
                IOobject::NO_WRITE
            ),
            foamyHexMeshDict.subDict("geometry"),
            foamyHexMeshDict.lookupOrDefault("singleRegionName", true)
        );

        // Write some stats
        allGeometry.writeStats(List<wordList>(0), Info);
        // Check topology
        allGeometry.checkTopology(true);
        // Check geometry
        allGeometry.checkGeometry
        (
            100.0,      // max size ratio
            1e-9,       // intersection tolerance
            autoPtr<writer<scalar>>(new vtkSetWriter<scalar>()),
            0.01,       // min triangle quality
            true
        );

        return 0;
    }


    conformalVoronoiMesh::debug = true;

    Info<< "Create mesh for time = " << runTime.timeName() << nl << endl;

    conformalVoronoiMesh mesh(runTime, foamyHexMeshDict);


    if (conformationOnly)
    {
        mesh.initialiseForConformation();

        runTime++;

        mesh.writeMesh(runTime.timeName());
    }
    else
    {
        mesh.initialiseForMotion();

        while (runTime.run())
        {
            runTime++;

            Info<< nl << "Time = " << runTime.timeName() << endl;

            mesh.move();

            Info<< nl
                << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
                << "  ClockTime = " << runTime.elapsedClockTime() << " s"
                << nl << endl;
        }
    }


    Info<< nl << "End" << nl << endl;

    return 0;
}
Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
(
    const fvMesh& mesh
)
{
    IOdictionary chemistryPropertiesDict
    (
        IOobject
        (
            "chemistryProperties",
            mesh.time().constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    const word userModel(chemistryPropertiesDict.lookup("solidChemistryModel"));

    const word ODEModelName(chemistryPropertiesDict.lookup("chemistrySolver"));
    const word gasThermoName(chemistryPropertiesDict.lookup("gasThermoModel"));

    // construct chemistry model type name by inserting first template argument
    const label tempOpen = userModel.find('<');
    const label tempClose = userModel.find('>');

    const word className = userModel(0, tempOpen);
    const word thermoTypeName =
        userModel(tempOpen + 1, tempClose - tempOpen - 1);

    const word modelType =
        ODEModelName + '<' + className
      + '<' + typeName + ',' + thermoTypeName + ',' + gasThermoName + ">>";


    if (debug)
    {
        Info<< "Selecting solidChemistryModel " << modelType << endl;
    }
    else
    {
        Info<< "Selecting solidChemistryModel " << userModel + gasThermoName
            << endl;
    }

    fvMeshConstructorTable::iterator cstrIter =
        fvMeshConstructorTablePtr_->find(modelType);

    if (cstrIter == fvMeshConstructorTablePtr_->end())
    {
        if (debug)
        {
            FatalErrorIn("solidChemistryModel::New(const mesh&)")
                << "Unknown solidChemistryModel type "
                << modelType << nl << nl
                << "Valid solidChemistryModel types are:" << nl
                << fvMeshConstructorTablePtr_->sortedToc() << nl
                << exit(FatalError);
        }
        else
        {
            wordList models = fvMeshConstructorTablePtr_->sortedToc();
            forAll(models, i)
            {
                models[i] = models[i].replace(typeName + ',', "");
            }

            FatalErrorIn("solidChemistryModel::New(const mesh&)")
                << "Unknown solidChemistryModel type "
                << userModel << nl << nl
                << "Valid solidChemistryModel types are:" << nl
                << models << nl
                << exit(FatalError);
        }
    }
Foam::autoPtr<Foam::laminarModel<BasicTurbulenceModel>>
Foam::laminarModel<BasicTurbulenceModel>::New
(
    const alphaField& alpha,
    const rhoField& rho,
    const volVectorField& U,
    const surfaceScalarField& alphaRhoPhi,
    const surfaceScalarField& phi,
    const transportModel& transport,
    const word& propertiesName
)
{
    IOdictionary modelDict
    (
        IOobject
        (
            IOobject::groupName(propertiesName, U.group()),
            U.time().constant(),
            U.db(),
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE,
            false
        )
    );

    if (modelDict.found("laminar"))
    {
        // get model name, but do not register the dictionary
        // otherwise it is registered in the database twice
        const word modelType
        (
            modelDict.subDict("laminar").lookup("laminarModel")
        );

        Info<< "Selecting laminar stress model " << modelType << endl;

        typename dictionaryConstructorTable::iterator cstrIter =
            dictionaryConstructorTablePtr_->find(modelType);

        if (cstrIter == dictionaryConstructorTablePtr_->end())
        {
            FatalErrorInFunction
                << "Unknown laminarModel type "
                << modelType << nl << nl
                << "Valid laminarModel types:" << endl
                << dictionaryConstructorTablePtr_->sortedToc()
                << exit(FatalError);
        }

        return autoPtr<laminarModel>
        (
            cstrIter()
            (
                alpha,
                rho,
                U,
                alphaRhoPhi,
                phi,
                transport, propertiesName)
        );
    }
    else
    {
        Info<< "Selecting laminar stress model "
            << laminarModels::Stokes<BasicTurbulenceModel>::typeName << endl;

        return autoPtr<laminarModel>
        (
            new laminarModels::Stokes<BasicTurbulenceModel>
            (
                alpha,
                rho,
                U,
                alphaRhoPhi,
                phi,
                transport,
                propertiesName
            )
        );
    }
}