Пример #1
0
Foam::functionObjects::pressureTools::pressureTools
(
    const word& name,
    const Time& runTime,
    const dictionary& dict
)
:
    functionObject(name),
    obr_
    (
        runTime.lookupObject<objectRegistry>
        (
            dict.lookupOrDefault("region", polyMesh::defaultRegion)
        )
    ),
    pName_("p"),
    UName_("U"),
    rhoName_("rho"),
    calcTotal_(false),
    pRef_(0.0),
    calcCoeff_(false),
    pInf_(0.0),
    UInf_(Zero),
    rhoInf_(0.0)
{
    if (!isA<fvMesh>(obr_))
    {
        FatalErrorInFunction
            << "objectRegistry is not an fvMesh" << exit(FatalError);
    }

    read(dict);

    dimensionSet pDims(dimPressure);

    if (calcCoeff_)
    {
        pDims /= dimPressure;
    }

    const fvMesh& mesh = refCast<const fvMesh>(obr_);

    volScalarField* pPtr
    (
        new volScalarField
        (
            IOobject
            (
                pName(),
                mesh.time().timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh,
            dimensionedScalar("0", pDims, 0.0)
        )
    );

    mesh.objectRegistry::store(pPtr);
}
Пример #2
0
int main(int argc, char *argv[])
{
    #include "setRootCase.H"

    #include "createTime.H"
    #include "createMesh.H"
    #include "readMaterialProperties.H"
    #include "readPoroElasticControls.H"
    #include "createFields.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nCalculating displacement field\n" << endl;

    while (runTime.loop())
    {
        Info<< "Iteration: " << runTime.value() << nl << endl;

        #include "readPoroElasticControls.H"

        int iCorr = 0;
        scalar initialResidual = 0;
        scalar pResidual = 0;

        do
        {
			volScalarField& p = pPtr();
			fvScalarMatrix pEqn
			(
				fvm::ddt(p) == fvm::laplacian(Dp, p) - fvc::div(fvc::ddt(Dp2,D))
			);

			pResidual = pEqn.solve().initialResidual();

			fvVectorMatrix DEqn
			(
				fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
			  + divSigmaExp == fvc::grad(p)
			);

			//DEqn.setComponentReference(1, 0, vector::X, 0);
			//DEqn.setComponentReference(1, 0, vector::Z, 0);

			initialResidual = DEqn.solve().initialResidual();

			if (initialResidual < pResidual){initialResidual = pResidual;}

			volTensorField gradD = fvc::grad(D);
			sigmaD = mu*twoSymm(gradD) + (lambda*I)*tr(gradD);
			divSigmaExp = fvc::div(sigmaD - (2*mu + lambda)*gradD,"div(sigmaD)");

        } while (initialResidual > convergenceTolerance && ++iCorr < nCorr);

        #include "calculateStress.H"

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

    Info<< "End\n" << endl;

    return 0;
}