Exemplo n.º 1
0
SolidSolver::SolidSolver (
    string name,
    std::shared_ptr<argList> args,
    std::shared_ptr<Time> runTime,
    std::shared_ptr<rbf::RBFCoarsening> interpolator
    )
    :
    foamSolidSolver( name, args, runTime ),
    gradU( fvc::grad( U ) ),
    epsilon
    (
        IOobject
        (
            "epsilonGreen",
            runTime->timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedSymmTensor( "zero", dimless, symmTensor::zero )
    ),
    sigma
    (
        IOobject
        (
            "sigma",
            runTime->timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedSymmTensor( "zero", dimForce / dimArea, symmTensor::zero )
    ),
    rheology( sigma, U ),
    rho( rheology.rho() ),
    mu( rheology.mu() ),
    lambda( rheology.lambda() ),
    muf( fvc::interpolate( mu, "mu" ) ),
    lambdaf( fvc::interpolate( lambda, "lambda" ) ),
    n( mesh.Sf() / mesh.magSf() ),
    minIter( 0 ),
    maxIter( 0 ),
    absoluteTolerance( 0 ),
    relativeTolerance( 0 ),
    interpolator( interpolator )
{}
Exemplo n.º 2
0
NonLinEddyViscABL::NonLinEddyViscABL
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:

    GenEddyViscModel(U, phi, transport, turbulenceModelName, modelName),
    
    nonlinearStress_
    (
        IOobject
        (
            "nonlinearStress",
            runTime_.timeName(),
            mesh_
        ),
        mesh_,
        dimensionedSymmTensor
        (
            "nonlinearStress",
            sqr(dimVelocity),
            symmTensor::zero
        )
    )

{
//    printCoeffs();
}
Exemplo n.º 3
0
XPP_SE::XPP_SE
(
    const word& name,
    const volScalarField& alpha,
    const volVectorField& U,
    const surfaceScalarField& phi,
    const dictionary& dict
)
:
    viscoelasticLaw(name, alpha, U, phi),
    tau_
    (
        IOobject
        (
            "tau" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    I_
    (
        dimensionedSymmTensor
        (
            "I",
            dimensionSet(0, 0, 0, 0, 0, 0, 0),
            symmTensor
            (
                1, 0, 0,
                   1, 0,
                      1
            )
        )
    ),
    etaS1_(dict.subDict("phase1").lookup("etaS")),
    etaS2_(dict.subDict("phase2").lookup("etaS")),
    etaP1_(dict.subDict("phase1").lookup("etaP")),
    etaP2_(dict.subDict("phase2").lookup("etaP")),
    alpha1_(dict.subDict("phase1").lookup("alpha")),
    alpha2_(dict.subDict("phase2").lookup("alpha")),
    lambdaOb1_(dict.subDict("phase1").lookup("lambdaOb")),
    lambdaOb2_(dict.subDict("phase2").lookup("lambdaOb")),
    lambdaOs1_(dict.subDict("phase1").lookup("lambdaOs")),
    lambdaOs2_(dict.subDict("phase2").lookup("lambdaOs")),
    q1_(dict.subDict("phase1").lookup("q")),
    q2_(dict.subDict("phase2").lookup("q")),
    pt_
    (
        dimensionedScalar
        (
            "zero",
            lambdaOb1_.dimensions(),
            scalar( SMALL )
        )
    )
{}
dimensionedSymmTensor hinv(const dimensionedSymmTensor& dt)
{
    return dimensionedSymmTensor
           (
               "hinv("+dt.name()+')',
               dimless/dt.dimensions(),
               hinv(dt.value())
           );
}
dimensionedSymmTensor twoSymm(const dimensionedTensor& dt)
{
    return dimensionedSymmTensor
    (
        "twoSymm("+dt.name()+')',
        dt.dimensions(),
        twoSymm(dt.value())
    );
}
dimensionedSymmTensor sqr(const dimensionedVector& dv)
{
    return dimensionedSymmTensor
           (
               "sqr("+dv.name()+')',
               sqr(dv.dimensions()),
               sqr(dv.value())
           );
}
dimensionedSymmTensor dev(const dimensionedSymmTensor& dt)
{
    return dimensionedSymmTensor
           (
               "dev("+dt.name()+')',
               dt.dimensions(),
               dev(dt.value())
           );
}
dimensionedSymmTensor cof(const dimensionedSymmTensor& dt)
{
    return dimensionedSymmTensor
           (
               "cof("+dt.name()+')',
               dt.dimensions(),
               cof(dt.value())
           );
}
dimensionedSymmTensor dimensionedSymmTensor::T() const
{
    return dimensionedSymmTensor
           (
               name()+".T()",
               dimensions(),
               value().T()
           );
}
Exemplo n.º 10
0
tmp<volSymmTensorField>
generalizedNewtonian<BasicTurbulenceModel>::R() const
{
    return volSymmTensorField::New
    (
        IOobject::groupName("R", this->alphaRhoPhi_.group()),
        this->mesh_,
        dimensionedSymmTensor(sqr(this->U_.dimensions()), Zero)
    );
}
Foam::S_MDCPP::S_MDCPP
(
    const word& name,
    const volVectorField& U,
    const surfaceScalarField& phi,
    const dictionary& dict
)
    :
    viscoelasticLaw(name, U, phi),
    tau_
    (
       IOobject
       (
           "tau" + name,
           U.time().timeName(),
           U.mesh(),
           IOobject::MUST_READ,
           IOobject::AUTO_WRITE
       ),
       U.mesh()
    ),
    I_
    (
       dimensionedSymmTensor
       (
           "I",
           dimensionSet(0, 0, 0, 0, 0, 0, 0),
           symmTensor
           (
               1, 0, 0,
               1, 0,
               1
           )
       )
    ),
    rho_(dict.lookup("rho")),
    etaS_(dict.lookup("etaS")),
    etaP_(dict.lookup("etaP")),
    zeta_(dict.lookup("zeta")),
    lambdaOb_(dict.lookup("lambdaOb")),
    lambdaOs_(dict.lookup("lambdaOs")),
    q_(dict.lookup("q"))
{}
Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::nonlinearEddyViscosity
(
    const word& modelName,
    const alphaField& alpha,
    const rhoField& rho,
    const volVectorField& U,
    const surfaceScalarField& alphaRhoPhi,
    const surfaceScalarField& phi,
    const transportModel& transport,
    const word& propertiesName
)
:
    eddyViscosity<BasicTurbulenceModel>
    (
        modelName,
        alpha,
        rho,
        U,
        alphaRhoPhi,
        phi,
        transport,
        propertiesName
    ),

    nonlinearStress_
    (
        IOobject
        (
            IOobject::groupName("nonlinearStress", U.group()),
            this->runTime_.timeName(),
            this->mesh_
        ),
        this->mesh_,
        dimensionedSymmTensor
        (
            "nonlinearStress",
            sqr(dimVelocity),
            symmTensor::zero
        )
    )
{}
tmp<volSymmTensorField> laminar::R() const
{
    return tmp<volSymmTensorField>
    (
        new volSymmTensorField
        (
            IOobject
            (
                "R",
                runTime_.timeName(),
                U_.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh_,
            dimensionedSymmTensor
            (
                "R", sqr(U_.dimensions()), symmTensor::zero
            )
        )
    );
}
Exemplo n.º 14
0
Foam::tmp<Foam::volSymmTensorField>
Foam::laminarModel<BasicTurbulenceModel>::R() const
{
    return tmp<volSymmTensorField>
    (
        new volSymmTensorField
        (
            IOobject
            (
                IOobject::groupName("R", this->U_.group()),
                this->runTime_.timeName(),
                this->mesh_,
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            ),
            this->mesh_,
            dimensionedSymmTensor
            (
                "R", sqr(this->U_.dimensions()), Zero
            )
        )
    );
}
Exemplo n.º 15
0
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
{
    const fvMesh& mesh = Su_.mesh();
    const volVectorField& U = mesh.lookupObject<volVectorField>("U");

    const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
    const volSymmTensorField& nsv =
        mesh.lookupObject<volSymmTensorField>("nsv");

    volScalarField magU(mag(U));
    volVectorField Uhat
    (
        U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
    );

    const scalarField Cw = pow(mesh.V(), 2.0/3.0);

    tmp<volScalarField> tN
    (
        new volScalarField
        (
            IOobject
            (
                "tN",
                mesh.time().constant(),
                mesh,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh,
            dimensionedScalar("zero", Nv.dimensions(), 0.0),
            zeroGradientFvPatchVectorField::typeName
        )
    );

    volScalarField& N = tN();

    N.internalField() = Nv.internalField()*Cw;

    tmp<volSymmTensorField> tns
    (
        new volSymmTensorField
        (
            IOobject
            (
                "tns",
                U.mesh().time().timeName(),
                U.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            U.mesh(),
            dimensionedSymmTensor
            (
                "zero",
                nsv.dimensions(),
                pTraits<symmTensor>::zero
            ),
             zeroGradientFvPatchSymmTensorField::typeName
        )
    );

    volSymmTensorField& ns = tns();

    ns.internalField() = nsv.internalField()*Cw;

    volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));

    volScalarField b((Uhat & B_ & Uhat)/sqrt(n));

    volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));

    volScalarField XiSubEq
    (
        scalar(1)
      + max(2.2*sqrt(b), min(0.34*magU/up*sqrt(b), scalar(1.6)))
      * min(n, scalar(1))
    );

    return (XiSubEq*XiEqModel_->XiEq());
}
Exemplo n.º 16
0
tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U)
{
    // local reference to film model
    const kinematicSingleLayer& film =
        static_cast<const kinematicSingleLayer&>(owner_);

    // local references to film fields
    const volScalarField& mu = film.mu();
    const volVectorField& Uw = film.Uw();
    const volScalarField& delta = film.delta();
    const volVectorField& Up = film.UPrimary();

    // film surface linear coeff to apply to velocity
    tmp<volScalarField> tCs;

    typedef compressible::turbulenceModel turbModel;
    if (film.primaryMesh().foundObject<turbModel>("turbulenceProperties"))
    {
        // local reference to turbulence model
        const turbModel& turb =
            film.primaryMesh().lookupObject<turbModel>("turbulenceProperties");

        // calculate and store the stress on the primary region
        const volSymmTensorField primaryReff(turb.devRhoReff());

        // create stress field on film
        // - note boundary condition types (mapped)
        // - to map, the field name must be the same as the field on the
        //   primary region
        volSymmTensorField Reff
        (
            IOobject
            (
                primaryReff.name(),
                film.regionMesh().time().timeName(),
                film.regionMesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            film.regionMesh(),
            dimensionedSymmTensor
            (
                "zero",
                primaryReff.dimensions(),
                symmTensor::zero
            ),
            film.mappedFieldAndInternalPatchTypes<symmTensor>()
        );

        // map stress from primary region to film region
        Reff.correctBoundaryConditions();

        dimensionedScalar U0("SMALL", U.dimensions(), SMALL);
        tCs = Cf_*mag(-film.nHat() & Reff)/(mag(Up - U) + U0);
    }
    else
    {
        // laminar case - employ simple coeff-based model
        const volScalarField& rho = film.rho();
        tCs = Cf_*rho*mag(Up - U);
    }

    dimensionedScalar d0("SMALL", delta.dimensions(), SMALL);

    // linear coeffs to apply to velocity
    const volScalarField& Cs = tCs();
    volScalarField Cw("Cw", mu/(0.3333*(delta + d0)));
    Cw.min(1.0e+06);

    return
    (
       - fvm::Sp(Cs, U) + Cs*Up // surface contribution
       - fvm::Sp(Cw, U) + Cw*Uw // wall contribution
    );
}
Foam::relativeVelocityModel::relativeVelocityModel
(
    const dictionary& dict,
    const incompressibleTwoPhaseMixture& mixture
)
:
    mixture_(mixture),

    continuousPhaseName_(dict.lookup("continuousPhase")),

    alphaC_
    (
        mixture.phase1Name() == continuousPhaseName_
      ? mixture.alpha1()
      : mixture.alpha2()
    ),

    alphaD_
    (
        mixture.phase1Name() == continuousPhaseName_
      ? mixture.alpha2()
      : mixture.alpha1()
    ),

    rhoC_
    (
        mixture.phase1Name() == continuousPhaseName_
      ? mixture.rho1()
      : mixture.rho2()
    ),

    rhoD_
    (
        mixture.phase1Name() == continuousPhaseName_
      ? mixture.rho2()
      : mixture.rho1()
    ),

    Udm_
    (
        IOobject
        (
            "Udm",
            alphaC_.time().timeName(),
            alphaC_.mesh()
        ),
        alphaC_.mesh(),
        dimensionedVector("Udm", dimVelocity, vector::zero),
        mixture.U().boundaryField().types()
    ),

    tau_
    (
        IOobject
        (
            "Udm",
            alphaC_.time().timeName(),
            alphaC_.mesh()
        ),
        alphaC_.mesh(),
        dimensionedSymmTensor
        (
            "Udm",
            sqr(dimVelocity)*dimDensity,
            symmTensor::zero
        )
    )
{}
Foam::XPP_DE::XPP_DE
(
    const word& name,
    const volVectorField& U,
    const surfaceScalarField& phi,
    const dictionary& dict
)
:
    viscoelasticLaw(name, U, phi),
    S_
    (
        IOobject
        (
            "S" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    Lambda_
    (
        IOobject
        (
            "Lambda" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    tau_
    (
        IOobject
        (
            "tau" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh(),
        dimensionedSymmTensor
        (
            "zero",
            dimensionSet(1, -1, -2, 0, 0, 0, 0),
            symmTensor::zero
        )
    ),
    I_
    (
        dimensionedSymmTensor
        (
            "I",
            dimensionSet(0, 0, 0, 0, 0, 0, 0),
            symmTensor
            (
                1, 0, 0,
                   1, 0,
                      1
            )
        )
    ),
    rho_(dict.lookup("rho")),
    etaS_(dict.lookup("etaS")),
    etaP_(dict.lookup("etaP")),
    alpha_(dict.lookup("alpha")),
    lambdaOb_(dict.lookup("lambdaOb")),
    lambdaOs_(dict.lookup("lambdaOs")),
    q_(dict.lookup("q"))
{}
Exemplo n.º 19
0
Foam::Leonov::Leonov
(
    const word& name,
    const volScalarField& alpha,
    const volVectorField& U,
    const surfaceScalarField& phi,
    const dictionary& dict
)
:
    viscoelasticLaw(name, alpha, U, phi),
    sigma_
    (
        IOobject
        (
            "sigma" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    tau_
    (
        IOobject
        (
            "tau" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh(),
        dimensionedSymmTensor
        (
            "zero",
            dimensionSet(1, -1, -2, 0, 0, 0, 0),
            symmTensor::zero
        )
    ),
    I_
    (
        dimensionedSymmTensor
        (
            "I",
            dimensionSet(0, 0, 0, 0, 0, 0, 0),
            symmTensor
            (
                1, 0, 0,
                   1, 0,
                      1
            )
        )
    ),
    rho1_(dict.subDict("phase1").lookup("rho")),
    rho2_(dict.subDict("phase2").lookup("rho")),
    etaS1_(dict.subDict("phase1").lookup("etaS")),
    etaS2_(dict.subDict("phase2").lookup("etaS")),
    etaP1_(dict.subDict("phase1").lookup("etaP")),
    etaP2_(dict.subDict("phase2").lookup("etaP")),
    lambda1_(dict.subDict("phase1").lookup("lambda")),
    lambda2_(dict.subDict("phase2").lookup("lambda"))
{}
Foam::kineticTheoryModel::kineticTheoryModel
(
    const Foam::phaseModel& phasea,
    const Foam::volVectorField& Ub,
    const Foam::volScalarField& alpha,
    const Foam::dragModel& draga
)
:
    phasea_(phasea),
    Ua_(phasea.U()),
    Ub_(Ub),
    alpha_(alpha),
    phia_(phasea.phi()),
    draga_(draga),

    rhoa_(phasea.rho()),
    da_(phasea.d()),
    nua_(phasea.nu()),

    kineticTheoryProperties_
    (
        IOobject
        (
            "kineticTheoryProperties",
            Ua_.time().constant(),
            Ua_.mesh(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),
    kineticTheory_(kineticTheoryProperties_.lookup("kineticTheory")),
    equilibrium_(kineticTheoryProperties_.lookup("equilibrium")),

    viscosityModel_
    (
        kineticTheoryModels::viscosityModel::New
        (
            kineticTheoryProperties_
        )
    ),
    conductivityModel_
    (
        conductivityModel::New
        (
            kineticTheoryProperties_
        )
    ),
    radialModel_
    (
        radialModel::New
        (
            kineticTheoryProperties_
        )
    ),
    granularPressureModel_
    (
        granularPressureModel::New
        (
            kineticTheoryProperties_
        )
    ),
    frictionalStressModel_
    (
        frictionalStressModel::New
        (
            kineticTheoryProperties_
        )
    ),
    e_(kineticTheoryProperties_.lookup("e")),
    alphaMax_(kineticTheoryProperties_.lookup("alphaMax")),
    alphaMinFriction_(kineticTheoryProperties_.lookup("alphaMinFriction")),
    Fr_(kineticTheoryProperties_.lookup("Fr")),
    eta_(kineticTheoryProperties_.lookup("eta")),
    p_(kineticTheoryProperties_.lookup("p")),
    phi_(dimensionedScalar(kineticTheoryProperties_.lookup("phi"))*M_PI/180.0),
    Theta_
    (
        IOobject
        (
            "Theta",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh()
    ),
    mua_
    (
        IOobject
        (
            "mua",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
    ),
    lambda_
    (
        IOobject
        (
            "lambda",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
    ),
    pa_
    (
        IOobject
        (
            "pa",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
    ),
    ppMagf_
    (
        IOobject
        (
            "ppMagf",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
    ),
    kappa_
    (
        IOobject
        (
            "kappa",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
    ),
    gs0_
    (
        IOobject
        (
            "gs0",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 1.0)
    ),
    gs0Prime_
    (
        IOobject
        (
            "gs0prime",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 0.0)
    ),
//_AO_09/01/2014 
// Shear stress ratio eta (here, we call it as upsilon)    
    upsilon_
    (
        IOobject
        (
            "upsilon",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 0.0)
    ), 
    
//_AO_09/01/2014 
// Shear stress tau_ (here, we call it as upsilon)    
    tau_
    (
        IOobject
        (
            "tau",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedSymmTensor("zero", dimensionSet(1, -1, -2, 0, 0), symmTensor(0,0,0,0,0,0))
    ),
//_AO_09/01/2014 
// Effective restitution coefficient (function of e and mu (friction coefficient) )
    eEff_(0),
// Friction coefficient 
    muFric_(0),    	    
// Dilute inertial regime 0 < alpha < alphaf (p. 2) alphaf ~ 0.49
    alphaf_(0),
// Dense intertial regime
    alphac_(0),  
// YG 12/27/2014
    alphad_(0),   
// Yield stress ratio
    upsilons_(0), 
// Modified kinetic theory by Chialvo-Sundaresan on/off     
    mofidiedKineticTheoryPU_(kineticTheoryProperties_.lookup("modifiedKineticTheoryPU")),
 
//
    //-AO, YG - Decompose particle pressure, Sundar's idea
    decomposePp_(false),
    
    //The option to use Berzi's Model in the SKT implementation
    Berzi_(false),
    paStar_
    (
        IOobject
        (
            "paStar",
            Ua_.time().timeName(),
            Ua_.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        Ua_.mesh(),
        dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
    )    
    

	            
{
	
 if(kineticTheoryProperties_.found("Berzi"))
    {
            Berzi_ = true;
    }
    if(kineticTheoryProperties_.found("decomposePp"))
    {
            decomposePp_ = true;
    }       
}