コード例 #1
0
ファイル: foamFluidSolver.C プロジェクト: BijanZarif/FOAM-FSI
    forAll( movingPatchIDs, patchI )
    {
        int size = mesh.boundaryMesh()[movingPatchIDs[patchI]].faceCentres().size();

        movingPatchesDispl[movingPatchIDs[patchI]] = vectorField( size, Foam::vector::zero );
        movingPatchesDisplOld[movingPatchIDs[patchI]] = vectorField( size, Foam::vector::zero );
    }
コード例 #2
0
ファイル: foamFluidSolver.C プロジェクト: BijanZarif/FOAM-FSI
foamFluidSolver::foamFluidSolver(
    std::string name,
    shared_ptr<argList> args,
    shared_ptr<Time> runTime
    )
    :
    BaseMultiLevelSolver( 5, 3 ),
    name( name ),
    args( args ),
    runTime( runTime ),
    meshPtr
    (
        dynamicFvMesh::New
        (
            IOobject
            (
                name,
                runTime->timeName(),
                *runTime,
                IOobject::MUST_READ
            )
        )
    ),
    mesh( meshPtr() ),
    couplingProperties
    (
        IOobject
        (
            "couplingProperties",
            runTime->constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),
    movingPatches( couplingProperties.lookup( "movingFluidPatches" ) ),
    movingPatchIDs( movingPatches.size() ),
    movingPatchesDispl( mesh.boundaryMesh().size(), vectorField( 0 ) ),
    movingPatchesDisplOld( mesh.boundaryMesh().size(), vectorField( 0 ) ),
    nPoints( Pstream::nProcs(), 0 ),
    nGlobalPoints( Pstream::nProcs(), 0 ),
    nGlobalCenters( Pstream::nProcs(), 0 ),
    globalPointsUnique( 1, -1 ),
    globalPointsNonUnique( 1, -1 ),
    totalRunTime( 0 ),
    totalNbIterations( 0 )
{
    // Find IDs of staticPatches_
    forAll( movingPatches, patchI )
    {
        label patchIndex = mesh.boundaryMesh().findPatchID( movingPatches[patchI] );

        assert( patchIndex >= 0 );

        movingPatchIDs[patchI] = patchIndex;
    }
コード例 #3
0
Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFixedValueSlipFvPatchVectorField(p, iF),
    TName_(dict.lookupOrDefault<word>("T", "T")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
    psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
    muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
    tauMCName_(dict.lookupOrDefault<word>("tauMC", "tauMC")),
    accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
    Uwall_("Uwall", dict, p.size()),
    thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
    curvature_(dict.lookupOrDefault("curvature", true))
{
    if
    (
        mag(accommodationCoeff_) < SMALL
     || mag(accommodationCoeff_) > 2.0
    )
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "unphysical accommodationCoeff_ specified"
            << "(0 < accommodationCoeff_ <= 1)" << endl
            << exit(FatalIOError);
    }

    if (dict.found("value"))
    {
        fvPatchField<vector>::operator=
        (
            vectorField("value", dict, p.size())
        );

        if (dict.found("refValue") && dict.found("valueFraction"))
        {
            this->refValue() = vectorField("refValue", dict, p.size());
            this->valueFraction() =
                scalarField("valueFraction", dict, p.size());
        }
        else
        {
            this->refValue() = *this;
            this->valueFraction() = scalar(1.0);
        }
    }
}
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    partialSlipFvPatchVectorField(p, iF),
    specularityCoefficient_
    (
        "specularityCoefficient",
        dimless,
        dict.lookup("specularityCoefficient")
    )
{
    if
    (
        (specularityCoefficient_.value() < 0)
     || (specularityCoefficient_.value() > 1)
    )
    {
        FatalErrorInFunction
            << "The specularity coefficient has to be between 0 and 1"
            << abort(FatalError);
    }

    fvPatchVectorField::operator=
    (
        vectorField("value", dict, p.size())
    );
}
oscillatingVelocityPointPatchVectorField::
oscillatingVelocityPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchVectorField(p, iF, dict),
    amplitude_(dict.lookup("amplitude")),
    omega_(readScalar(dict.lookup("omega")))
{
    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("p0"))
    {
        p0_ = vectorField("p0", dict , p.size());
    }
    else
    {
        p0_ = p.localPoints();
    }
}
angularOscillatingDisplacementPointPatchVectorField::
angularOscillatingDisplacementPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchVectorField(p, iF, dict),
    axis_(dict.lookup("axis")),
    origin_(dict.lookup("origin")),
    angle0_(readScalar(dict.lookup("angle0"))),
    amplitude_(readScalar(dict.lookup("amplitude"))),
    omega_(readScalar(dict.lookup("omega")))
{
    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("p0"))
    {
        p0_ = vectorField("p0", dict , p.size());
    }
    else
    {
        p0_ = p.localPoints();
    }
}
コード例 #7
0
ファイル: user_fun.cpp プロジェクト: nuraiman/lifev
Real MyFun::eval ( const UInt& iElem, const point_Type& P, const Real& time ) const
{
    const Real scalar1 = scalarField(0).eval( iElem, P, time );
    const Real scalar2 = scalarField(1).eval( iElem, P, time );

    const Vector vector = vectorField(0).eval( iElem, P, time );

    return ( std::sin(scalar1) + scalar2*scalar2 ) /  vector(0);
}
コード例 #8
0
Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF)
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
コード例 #9
0
Foam::FASNumericFlux<Flux>::FASNumericFlux
(
    mgMeshLevel const& meshLevel,
    mgFieldLevel const& fieldLevel
)
:
    meshLevel_(meshLevel),
    fieldLevel_(fieldLevel),
    p_(fieldLevel.pVar()),
    U_(fieldLevel.UVar()),
    T_(fieldLevel.TVar()),
    fineRhoFlux_(fieldLevel.rhoFlux()),
    fineRhoUFlux_(fieldLevel.rhoUFlux()),
    fineRhoEFlux_(fieldLevel.rhoEFlux()),
    rhoFlux_(scalarField(meshLevel.nInternalFaces())),
    rhoUFlux_(vectorField(meshLevel.nInternalFaces())),
    rhoEFlux_(scalarField(meshLevel.nInternalFaces())),
    rhoResidual_(scalarField(meshLevel.nCells())),
    rhoUResidual_(vectorField(meshLevel.nCells())),
    rhoEResidual_(scalarField(meshLevel.nCells()))
{
    rhoFlux_ = 0;
    rhoUFlux_ = vector::zero;
    rhoEFlux_ = 0;
    rhoResidual_ = 0;
    rhoUResidual_ = vector::zero;
    rhoEResidual_ = 0;
    Info<< "mgLevel = " << fieldLevel.level() << endl;
    Info<< "p_ size = " << p_.size() << endl;
    Info<< "U_ size = " << U_.size() << endl;
    Info<< "T_ size = " << T_.size() << endl;
    Info<< "fineRhoFlux_ size = " << fineRhoFlux_.size() << endl;
    Info<< "fineRhoUFlux_ size = " << fineRhoUFlux_.size() << endl;
    Info<< "fineRhoEFlux_ size = " << fineRhoEFlux_.size() << endl;
    Info<< "rhoFlux_ size = " << rhoFlux_.size() << endl;
    Info<< "rhoUFlux_ size = " << rhoUFlux_.size() << endl;
    Info<< "rhoEFlux_ size = " << rhoEFlux_.size() << endl;
    Info<< "rhoResidual_ size = " << rhoResidual_.size() << endl;
    Info<< "rhoUResidual_ size = " << rhoUResidual_.size() << endl;
    Info<< "rhoEResidual_ size = " << rhoEResidual_.size() << endl;
}
Foam::tractionForceAdjointUWallFvPatchVectorField::
tractionForceAdjointUWallFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF)
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
コード例 #11
0
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
    :
    inletOutletFvPatchVectorField(p, iF),
    UInf_(dict.lookup("UInf"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
コード例 #12
0
Foam::movingWallVelocityFvPatchVectorField::
movingWallVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    UName_(dict.lookupOrDefault<word>("U", "U"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
コード例 #13
0
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    relative_(dict.lookup("relative")),
    inletValue_("inletValue", dict, p.size())
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::timeVaryingMappedPressureDirectedInletVelocityFvPatchVectorField::
timeVaryingMappedPressureDirectedInletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    timeVaryingMappedFixedValueFvPatchVectorField(p, iF),
    phiName_(dict.lookupOrDefault<word>("phi", "phi")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
void timeVaryingFixedDisplacementZeroShearFvPatchVectorField::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    // set refValue
    vectorField disp
    (
        patch().size(),
        timeSeries_(this->db().time().timeOutputValue())
    );

    if (fieldName_ == "DU")
    {
          const fvPatchField<vector>& U =
              patch().lookupPatchField<volVectorField, vector>("U");
          disp -= U;
    }
    else if (fieldName_ != "U")
    {
        FatalError
            << "The displacement field should be U or DU"
            << exit(FatalError);
    }
    this->refValue() = disp;

    // set value fraction to fix reference patch normal
    // only done at initialisation above
    //vectorField n = patch().nf();
    //this->valueFraction() = sqr(n);

    bool incremental(fieldName_ == "DU");

    refGrad() = tractionBoundaryGradient::snGrad
    (
        vectorField(patch().size(), vector::zero),
        scalarField(patch().size(), 0),
        fieldName_,
        "U",
        patch(),
        orthotropic_,
        nonLinear_,
        incremental
    );

    directionMixedFvPatchVectorField::updateCoeffs();
}
Foam::flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchField<vector>(p, iF),
    rhoInlet_(dict.lookupOrDefault<scalar>("rhoInlet", -VGREAT))
{
    if (dict.found("volumetricFlowRate"))
    {
        volumetric_ = true;
        flowRate_ = DataEntry<scalar>::New("volumetricFlowRate", dict);
        rhoName_ = "rho";
    }
    else if (dict.found("massFlowRate"))
    {
        volumetric_ = false;
        flowRate_ = DataEntry<scalar>::New("massFlowRate", dict);
        rhoName_ = word(dict.lookupOrDefault<word>("rho", "rho"));
    }
    else
    {
        FatalIOErrorIn
        (
            "flowRateInletVelocityFvPatchVectorField::"
            "flowRateInletVelocityFvPatchVectorField"
            "(const fvPatch&, const DimensionedField<vector, volMesh>&,"
            " const dictionary&)",
            dict
        )   << "Please supply either 'volumetricFlowRate' or"
            << " 'massFlowRate' and 'rho'" << exit(FatalIOError);
    }

    // Value field require if mass based
    if (dict.found("value"))
    {
        fvPatchField<vector>::operator=
        (
            vectorField("value", dict, p.size())
        );
    }
    else
    {
        evaluate(Pstream::blocking);
    }
}
Foam::filmHeightInletVelocityFvPatchVectorField::
filmHeightInletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    phiName_(dict.lookupOrDefault<word>("phi", "phi")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
    deltafName_(dict.lookupOrDefault<word>("deltaf", "deltaf"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
コード例 #18
0
ファイル: magnusBlade.C プロジェクト: rlee32/upcoming
Foam::magnusBlade::
magnusBlade
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    UName_(dict.lookupOrDefault<word>("U", "U")),
    axis_(dict.lookup("axis")),
    tipV_(DataEntry<scalar>::New("tipV", dict))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::
inclinedFilmNusseltInletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    GammaMean_(Function1<scalar>::New("GammaMean", dict)),
    a_(Function1<scalar>::New("a", dict)),
    omega_(Function1<scalar>::New("omega", dict))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    inletOutletFvPatchVectorField(p, iF),
    relative_(dict.lookupOrDefault("relative", false)),
    UInf_(dict.lookup("UInf"))
{
    this->phiName_ = dict.lookupOrDefault<word>("phi","phi");

    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFvPatchVectorField(p, iF),
    phiName_(dict.lookupOrDefault<word>("phi", "phi")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
    refValue() = *this;
    refGrad() = Zero;
    valueFraction() = 0.0;
}
Foam::supersonicFreestreamFvPatchVectorField::
supersonicFreestreamFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFvPatchVectorField(p, iF),
    UInf_(dict.lookup("UInf")),
    pInf_(readScalar(dict.lookup("pInf"))),
    TInf_(readScalar(dict.lookup("TInf"))),
    gamma_(readScalar(dict.lookup("gamma")))
{
    if (dict.found("value"))
    {
        fvPatchField<vector>::operator=
        (
            vectorField("value", dict, p.size())
        );
    }
    else
    {
        fvPatchField<vector>::operator=(patchInternalField());
    }

    refValue() = *this;
    refGrad() = vector::zero;
    valueFraction() = 1;

    if (pInf_ < SMALL)
    {
        FatalIOErrorIn
        (
            "supersonicFreestreamFvPatchVectorField::"
            "supersonicFreestreamFvPatchVectorField"
            "(const fvPatch&, const vectorField&, const dictionary&)",
            dict
        )   << "    unphysical pInf specified (pInf <= 0.0)"
            << "\n    on patch " << this->patch().name()
            << " of field " << this->dimensionedInternalField().name()
            << " in file " << this->dimensionedInternalField().objectPath()
            << exit(FatalIOError);
    }
}
コード例 #23
0
    myMovingWallVelocityFvPatchVectorField::myMovingWallVelocityFvPatchVectorField(
        const fvPatch & p,
        const DimensionedField<vector, volMesh> & iF,
        const dictionary & dict
        )
        :
        fixedValueFvPatchVectorField( p, iF ),
        myTimeIndex_( dimensionedInternalField().mesh().time().timeIndex() ),
        Fc_( p.patch().size(), vector::zero ),
        oldFc_( p.patch().size(), vector::zero ),
        oldoldFc_( p.patch().size(), vector::zero )
    {
        fvPatchVectorField::operator=( vectorField( "value", dict, p.size() ) );

        Fc_ = p.patch().faceCentres();
        oldFc_ = p.patch().faceCentres();
        oldoldFc_ = p.patch().faceCentres();
    }
// Update the coefficients associated with the patch field
void solidTractionFreeFvPatchVectorField::updateCoeffs()
{
    if (updated())
    {
        return;
    }

    gradient() = tractionBoundaryGradient()
    (
        vectorField(patch().size(), vector::zero),
        scalarField(patch().size(), 0.0),
        word(fieldName_),
        patch(),
        orthotropic_,
        nonLinearGeometry::nonLinearNames_[nonLinear_]
       )();

    fixedGradientFvPatchVectorField::updateCoeffs();
}
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::
inclinedFilmNusseltInletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    filmRegionName_
    (
        dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
    ),
    GammaMean_(DataEntry<scalar>::New("GammaMean", dict)),
    a_(DataEntry<scalar>::New("a", dict)),
    omega_(DataEntry<scalar>::New("omega", dict))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchField<vector>(p, iF, dict),
    motion_(dict),
    rhoInf_(1.0),
    rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
    lookupGravity_(-1),
    g_(vector::zero),
    relaxationFactor_(dict.lookupOrDefault<scalar>("relaxationFactor", 1))
{
    if (rhoName_ == "rhoInf")
    {
        rhoInf_ = readScalar(dict.lookup("rhoInf"));
    }

    if (dict.readIfPresent("g", g_))
    {
        lookupGravity_ = -2;
    }

    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("initialPoints"))
    {
        initialPoints_ = vectorField("initialPoints", dict , p.size());
    }
    else
    {
        initialPoints_ = p.localPoints();
    }
}
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
filmPyrolysisVelocityCoupledFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    filmRegionName_
    (
        dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
    ),
    pyrolysisRegionName_
    (
        dict.lookupOrDefault<word>("pyrolysisRegion", "pyrolysisProperties")
    ),
    phiName_(dict.lookupOrDefault<word>("phi", "phi")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
Foam::temperatureDirectedInletOutletVelocityFvPatchVectorField::
temperatureDirectedInletOutletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    mixedFvPatchVectorField(p, iF),
    phiName_("phi"),
    TName_("T"),
    T0_("T0", dict, p.size()),
    inletDir_("inletDirection", dict, p.size()),
    cylindricalCCS_(dict.lookup("cylindricalCCS")),
    omega_(dict.lookup("omega"))
{
    fvPatchVectorField::operator=(vectorField("value", dict, p.size()));

    if (dict.found("phi"))
    {
        dict.lookup("phi") >> phiName_;
    }
Foam::surfaceNormalFixedValueFvPatchVectorField::
surfaceNormalFixedValueFvPatchVectorField
(
    const surfaceNormalFixedValueFvPatchVectorField& ptf,
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    fixedValueFvPatchVectorField(p, iF),
    refValue_(ptf.refValue_, mapper)
{
    // Note: calculate product only on ptf to avoid multiplication on
    // unset values in reconstructPar.
    fixedValueFvPatchVectorField::operator=
    (
        vectorField
        (
            ptf.refValue_*ptf.patch().nf(),
            mapper
        )
    );
}
Foam::myHeatFluxFvPatchVectorField::
myHeatFluxFvPatchVectorField
(
    const myHeatFluxFvPatchVectorField& ptf,
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    fixedValueFvPatchVectorField(p, iF),
    alpha(ptf.alpha, mapper)
{
    // Note: calculate product only on ptf to avoid multiplication on
    // unset values in reconstructPar.
    fixedValueFvPatchVectorField::operator=
    (
        vectorField
        (
            ptf.alpha*ptf.patch().nf(),
            mapper
        )
    );
}