MRF: Further developed to replace SRF

MRF (multiple reference frames) can now be used to simulate SRF (single
reference frame) cases by defining the MRF zone to include all the cells is the
mesh and applying appropriate boundary conditions.  The huge advantage of this
is that MRF can easily be added to any solver by the addition of forcing terms
in the momentum equation and absolute velocity to relative flux conversions in
the formulation of the pressure equation rather than having to reformulate the
momentum and pressure system based on the relative velocity as in traditional
SRF.  Also most of the OpenFOAM solver applications and all the solver modules
already support MRF.

To enable this generalisation of MRF the transformations necessary on the
velocity boundary conditions in the MRF zone can no longer be handled by the
MRFZone class itself but special adapted fvPatchFields are required.  Although
this adds to the case setup it provides much greater flexibility and now complex
inlet/outlet conditions can be applied within the MRF zone, necessary for some
SRF case and which was not possible in the original MRF implementation.  Now for
walls rotating within the MRF zone the new 'MRFnoSlip' velocity boundary
conditions must be applied, e.g. in the
tutorials/modules/incompressibleFluid/mixerVessel2DMRF/constant/MRFProperties
case:

boundaryField
{
    rotor
    {
        type            MRFnoSlip;
    }

    stator
    {
        type            noSlip;
    }

    front
    {
        type            empty;
    }

    back
    {
        type            empty;
    }
}

similarly for SRF cases, e.g. in the
tutorials/modules/incompressibleFluid/mixerSRF case:

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (0 0 -10);
    }

    outlet
    {
        type            pressureInletOutletVelocity;
        value           $internalField;
    }

    rotor
    {
        type            MRFnoSlip;
    }

    outerWall
    {
        type            noSlip;
    }

    cyclic_half0
    {
        type            cyclic;
    }

    cyclic_half1
    {
        type            cyclic;
    }
}

For SRF case all the cells should be selected in the MRFproperties dictionary
which is achieved by simply setting the optional 'selectionMode' entry to all,
e.g.:

SRF
{
    selectionMode   all;

    origin      (0 0 0);
    axis        (0 0 1);

    rpm         1000;
}

In the above the rotational speed is set in RPM rather than rad/s simply by
setting the 'rpm' entry rather than 'omega'.

The tutorials/modules/incompressibleFluid/rotor2DSRF case is more complex and
demonstrates a transient SRF simulation of a rotor requiring the free-stream
velocity to rotate around the apparently stationary rotor which is achieved
using the new 'MRFFreestreamVelocity' velocity boundary condition.  The
equivalent simulation can be achieved by simply rotating the entire mesh and
keeping the free-stream flow stationary and this is demonstrated in the
tutorials/modules/incompressibleFluid/rotor2DRotating case for comparison.

The special SRFSimpleFoam and SRFPimpleFoam solvers are now redundant and have
been replaced by redirection scripts providing details of the case migration
process.
This commit is contained in:
Henry Weller
2022-08-11 18:23:15 +01:00
parent 9068d5cc9b
commit 160ee637f9
123 changed files with 1191 additions and 3300 deletions

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
betav*fvm::ddt(rho, U) + fvm::div(phi, U)

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(phi, U)

View File

@ -1,7 +1,5 @@
// Construct the Momentum equation
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)

View File

@ -1,3 +0,0 @@
SRFPimpleFoam.C
EXE = $(FOAM_APPBIN)/SRFPimpleFoam

View File

@ -1,17 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lphysicalProperties \
-lfiniteVolume \
-lmeshTools \
-lfvModels \
-lfvConstraints \
-lsampling

View File

@ -1,110 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
SRFPimpleFoam
Description
Large time-step transient solver for incompressible, turbulent flow in a
single rotating frame.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "viscosityModel.H"
#include "incompressibleMomentumTransportModels.H"
#include "pimpleControl.H"
#include "pressureReference.H"
#include "SRFModel.H"
#include "fvModels.H"
#include "fvConstraints.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
#include "initContinuityErrs.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (pimple.run(runTime))
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
fvModels.correct();
#include "UrelEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
// Update the absolute velocity
U = Urel + SRF->U();
if (pimple.turbCorr())
{
viscosity->correct();
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,19 +0,0 @@
// Relative momentum predictor
tmp<fvVectorMatrix> tUrelEqn
(
fvm::ddt(Urel)
+ fvm::div(phi, Urel)
+ turbulence->divDevSigma(Urel)
+ SRF->Su()
==
fvModels.source(Urel)
);
fvVectorMatrix& UrelEqn = tUrelEqn.ref();
UrelEqn.relax();
fvConstraints.constrain(UrelEqn);
solve(UrelEqn == -fvc::grad(p));
fvConstraints.constrain(Urel);

View File

@ -1,75 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field Urel\n" << endl;
volVectorField Urel
(
IOobject
(
"Urel",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading/calculating face flux field phi\n" << endl;
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(Urel) & mesh.Sf()
);
pressureReference pressureReference(p, pimple.dict());
mesh.schemes().setFluxRequired(p.name());
Info<< "Creating SRF model\n" << endl;
autoPtr<SRF::SRFModel> SRF
(
SRF::SRFModel::New(Urel)
);
// Create the absolute velocity
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Urel + SRF->U()
);
autoPtr<viscosityModel> viscosity(viscosityModel::New(mesh));
autoPtr<incompressible::momentumTransportModel> turbulence
(
incompressible::momentumTransportModel::New(U, phi, viscosity)
);
#include "createFvModels.H"
#include "createFvConstraints.H"

View File

@ -1,62 +0,0 @@
volScalarField rAUrel(1.0/UrelEqn.A());
volVectorField HbyA("HbyA", Urel);
HbyA = rAUrel*UrelEqn.H();
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rAUrel)*fvc::ddtCorr(Urel, phi)
);
adjustPhi(phiHbyA, Urel, p);
tmp<volScalarField> rAtUrel(rAUrel);
if (pimple.consistent())
{
rAtUrel = 1.0/max(1.0/rAUrel - UrelEqn.H1(), 0.1/rAUrel);
phiHbyA +=
fvc::interpolate(rAtUrel() - rAUrel)*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAUrel - rAtUrel())*fvc::grad(p);
}
if (pimple.nCorrPiso() <= 1)
{
tUrelEqn.clear();
}
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, Urel, phiHbyA, rAtUrel());
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
// Pressure corrector
fvScalarMatrix pEqn
(
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve();
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}
#include "continuityErrs.H"
p.relax();
// Momentum corrector
Urel = HbyA - rAtUrel()*fvc::grad(p);
Urel.correctBoundaryConditions();
fvConstraints.constrain(Urel);

View File

@ -1,3 +0,0 @@
SRFSimpleFoam.C
EXE = $(FOAM_APPBIN)/SRFSimpleFoam

View File

@ -1,17 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lphysicalProperties \
-lfiniteVolume \
-lmeshTools \
-lfvModels \
-lfvConstraints \
-lsampling

View File

@ -1,91 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
SRFSimpleFoam
Description
Steady-state solver for incompressible, turbulent flow of non-Newtonian
fluids in a single rotating frame.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "viscosityModel.H"
#include "incompressibleMomentumTransportModels.H"
#include "SRFModel.H"
#include "simpleControl.H"
#include "pressureReference.H"
#include "fvModels.H"
#include "fvConstraints.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createFields.H"
#include "initContinuityErrs.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (simple.loop(runTime))
{
Info<< "Time = " << runTime.userTimeName() << nl << endl;
fvModels.correct();
// --- Pressure-velocity SIMPLE corrector
{
#include "UrelEqn.H"
#include "pEqn.H"
}
U = Urel + SRF->U();
viscosity->correct();
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,22 +0,0 @@
// Relative momentum predictor
tmp<fvVectorMatrix> tUrelEqn
(
fvm::div(phi, Urel)
+ turbulence->divDevSigma(Urel)
+ SRF->Su()
==
fvModels.source(Urel)
);
fvVectorMatrix& UrelEqn = tUrelEqn.ref();
UrelEqn.relax();
fvConstraints.constrain(UrelEqn);
if (simple.momentumPredictor())
{
solve(UrelEqn == -fvc::grad(p));
fvConstraints.constrain(Urel);
}

View File

@ -1,73 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field Urel\n" << endl;
volVectorField Urel
(
IOobject
(
"Urel",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading/calculating face flux field phi\n" << endl;
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(Urel) & mesh.Sf()
);
pressureReference pressureReference(p, simple.dict());
mesh.schemes().setFluxRequired(p.name());
Info<< "Creating SRF model\n" << endl;
autoPtr<SRF::SRFModel> SRF(SRF::SRFModel::New(Urel));
// Construct the absolute velocity
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Urel + SRF->U()
);
autoPtr<viscosityModel> viscosity(viscosityModel::New(mesh));
autoPtr<incompressible::momentumTransportModel> turbulence
(
incompressible::momentumTransportModel::New(U, phi, viscosity)
);
#include "createFvModels.H"
#include "createFvConstraints.H"

View File

@ -1,55 +0,0 @@
{
volScalarField rAUrel(1.0/UrelEqn.A());
volVectorField HbyA("HbyA", Urel);
HbyA = rAUrel*UrelEqn.H();
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
adjustPhi(phiHbyA, Urel, p);
tmp<volScalarField> rAtUrel(rAUrel);
if (simple.consistent())
{
rAtUrel = 1.0/(1.0/rAUrel - UrelEqn.H1());
phiHbyA +=
fvc::interpolate(rAtUrel() - rAUrel)*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAUrel - rAtUrel())*fvc::grad(p);
}
tUrelEqn.clear();
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, Urel, phiHbyA, rAtUrel());
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
Urel = HbyA - rAtUrel()*fvc::grad(p);
Urel.correctBoundaryConditions();
fvConstraints.constrain(Urel);
}

View File

@ -1,7 +1,5 @@
// Construct the Momentum equation
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)

View File

@ -1,7 +1,5 @@
// Momentum predictor
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)

View File

@ -1,4 +1,4 @@
EXE_INC = -ggdb3 \
EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \

View File

@ -29,8 +29,6 @@ License
void Foam::solvers::incompressibleFluid::momentumPredictor()
{
MRF.correctBoundaryVelocity(U);
tUEqn =
(
fvm::ddt(U) + fvm::div(phi, U)

View File

@ -29,8 +29,6 @@ License
void Foam::solvers::isothermalFluid::momentumPredictor()
{
MRF.correctBoundaryVelocity(U);
tUEqn =
(
fvm::ddt(rho, U) + fvm::div(phi, U)

View File

@ -86,7 +86,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
alphaSolidT_(),
L_("L", dimEnergy/dimMass, NaN),
relax_(NaN),

View File

@ -224,7 +224,6 @@ Foam::incompressibleTwoPhaseInteractingMixture::divTauDm() const
void Foam::incompressibleTwoPhaseInteractingMixture::correct()
{
MRF_.correctBoundaryVelocity(U_);
mu_ = muModel_->mu(rhoc_*nucModel_->nu(), U_);
UdmModel_->correct();
}

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)

View File

@ -241,7 +241,6 @@ template<class BasePhaseModel>
void Foam::MovingPhaseModel<BasePhaseModel>::correct()
{
BasePhaseModel::correct();
this->fluid().MRF().correctBoundaryVelocity(U_);
}

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)

View File

@ -1,5 +1,3 @@
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::ddt(U) + fvm::div(phi, U)

61
bin/SRFPimpleFoam Executable file
View File

@ -0,0 +1,61 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# SRFPimpleFoam
#
# Description
# Script to inform the user that SRFPimpleFoam has been superseded
# and replaced by the more general incompressibleFluid solver module
# executed by the foamRun application.
#
#------------------------------------------------------------------------------
cat <<EOF
SRFPimpleFoam has been superseded and replaced by the more general
fluid solver module executed by the foamRun application:
foamRun -solver incompressibleFluid
The MRF functionality has been further developed to replace SRF, enabled by
setting the MRF zone to all the cells in the mesh using the optional
'selectionMode' entry to 'all' in the constant/MRFProperties dictionary, e.g.
SRF
{
selectionMode all;
origin (0 0 0);
axis (0 0 1);
rpm 60;
}
Additionally the new 'MRFnoSlip' velocity boundary condition should be applied to the
rotating wall patche in the MRF region.
EOF
#------------------------------------------------------------------------------

61
bin/SRFSimpleFoam Executable file
View File

@ -0,0 +1,61 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# SRFSimpleFoam
#
# Description
# Script to inform the user that SRFSimpleFoam has been superseded
# and replaced by the more general incompressibleFluid solver module
# executed by the foamRun application.
#
#------------------------------------------------------------------------------
cat <<EOF
SRFSimpleFoam has been superseded and replaced by the more general
fluid solver module executed by the foamRun application:
foamRun -solver incompressibleFluid
The MRF functionality has been further developed to replace SRF, enabled by
setting the MRF zone to all the cells in the mesh using the optional
'selectionMode' entry to 'all' in the constant/MRFProperties dictionary, e.g.
SRF
{
selectionMode all;
origin (0 0 0);
axis (0 0 1);
rpm 60;
}
Additionally the new 'MRFnoSlip' velocity boundary condition should be applied to the
rotating wall patche in the MRF region.
EOF
#------------------------------------------------------------------------------

View File

@ -101,7 +101,7 @@ ${typeName}FvModel${SourceType}
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh)
set_(mesh, coeffs())
{
if (${verbose:-false})
{

View File

@ -3527,56 +3527,6 @@ _splitMeshRegions_ ()
}
complete -o filenames -o nospace -F _splitMeshRegions_ splitMeshRegions
_SRFPimpleFoam_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvConstraints -listFvModels -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
for o in $used ; do opts="${opts/$o/}" ; done
extra=""
[ "$COMP_CWORD" = 1 ] || \
case "$prev" in
-case)
opts="" ; extra="-d" ;;
-fileHandler)
opts="uncollated collated masterUncollated" ; extra="" ;;
-hostRoots|-libs|-roots)
opts="" ; extra="" ;;
*) ;;
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _SRFPimpleFoam_ SRFPimpleFoam
_SRFSimpleFoam_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvConstraints -listFvModels -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
for o in $used ; do opts="${opts/$o/}" ; done
extra=""
[ "$COMP_CWORD" = 1 ] || \
case "$prev" in
-case)
opts="" ; extra="-d" ;;
-fileHandler)
opts="uncollated collated masterUncollated" ; extra="" ;;
-hostRoots|-libs|-roots)
opts="" ; extra="" ;;
*) ;;
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _SRFSimpleFoam_ SRFSimpleFoam
_star3ToFoam_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"

View File

@ -494,14 +494,9 @@ MRF = $(general)/MRF
$(MRF)/MRFZone.C
$(MRF)/MRFZoneList.C
$(MRF)/IOMRFZoneList.C
SRF = $(general)/SRF
$(SRF)/SRFModel/SRFModel/SRFModel.C
$(SRF)/SRFModel/SRFModel/SRFModelNew.C
$(SRF)/SRFModel/rpm/rpm.C
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
$(SRF)/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C
$(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
$(MRF)/derivedFvPatchFields/MRFPatchField/MRFPatchField.C
$(MRF)/derivedFvPatchFields/MRFnoSlip/MRFnoSlipFvPatchVectorField.C
$(MRF)/derivedFvPatchFields/MRFFreestreamVelocity/MRFFreestreamVelocityFvPatchVectorField.C
fvModels = $(general)/fvModels
$(fvModels)/fvModel.C

View File

@ -24,12 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "MRFZone.H"
#include "MRFPatchField.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatrices.H"
#include "faceSet.H"
#include "geometricOneField.H"
#include "Scale.H"
#include "faceSet.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -46,11 +47,10 @@ void Foam::MRFZone::setMRFFaces()
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Type per face:
// 0:not in zone
// 1:moving with frame
// 2:other
labelList faceType(mesh_.nFaces(), 0);
// Is face in MRF zone:
// false: not in MRF zone
// true: in MRF zone
boolList faceInMRF(mesh_.nFaces(), false);
// Determine faces in cell zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -62,35 +62,28 @@ void Foam::MRFZone::setMRFFaces()
// Cells in zone
boolList zoneCell(mesh_.nCells(), false);
if (cellZoneID_ != -1)
const labelList& cellLabels = cellSet_.cells();
forAll(cellLabels, i)
{
const labelList& cellLabels = mesh_.cellZones()[cellZoneID_];
forAll(cellLabels, i)
{
zoneCell[cellLabels[i]] = true;
}
zoneCell[cellLabels[i]] = true;
}
label nZoneFaces = 0;
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
if (zoneCell[own[facei]] || zoneCell[nei[facei]])
{
faceType[facei] = 1;
faceInMRF[facei] = true;
nZoneFaces++;
}
}
labelHashSet excludedPatches(excludedPatchLabels_);
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchi];
if (pp.coupled() || excludedPatches.found(patchi))
if (!isA<emptyPolyPatch>(pp))
{
forAll(pp, i)
{
@ -98,33 +91,15 @@ void Foam::MRFZone::setMRFFaces()
if (zoneCell[own[facei]])
{
faceType[facei] = 2;
nZoneFaces++;
}
}
}
else if (!isA<emptyPolyPatch>(pp))
{
forAll(pp, i)
{
const label facei = pp.start() + i;
if (zoneCell[own[facei]])
{
faceType[facei] = 1;
faceInMRF[facei] = true;
nZoneFaces++;
}
}
}
}
// Synchronise the faceType across processor patches
syncTools::syncFaceList(mesh_, faceType, maxEqOp<label>());
// Now we have for faceType:
// 0 : face not in cellZone
// 1 : internal face or normal patch face
// 2 : coupled patch face or excluded patch face
// Synchronise the faceInMRF across processor patches
syncTools::syncFaceList(mesh_, faceInMRF, orEqOp<bool>());
// Sort into lists per patch.
@ -133,15 +108,14 @@ void Foam::MRFZone::setMRFFaces()
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
if (faceType[facei] == 1)
if (faceInMRF[facei])
{
internalFaces_[nInternal++] = facei;
}
}
internalFaces_.setSize(nInternal);
labelList nIncludedFaces(patches.size(), 0);
labelList nExcludedFaces(patches.size(), 0);
labelList nPatchFaces(patches.size(), 0);
forAll(patches, patchi)
{
@ -151,26 +125,19 @@ void Foam::MRFZone::setMRFFaces()
{
const label facei = pp.start() + patchFacei;
if (faceType[facei] == 1)
if (faceInMRF[facei])
{
nIncludedFaces[patchi]++;
}
else if (faceType[facei] == 2)
{
nExcludedFaces[patchi]++;
nPatchFaces[patchi]++;
}
}
}
includedFaces_.setSize(patches.size());
excludedFaces_.setSize(patches.size());
forAll(nIncludedFaces, patchi)
patchFaces_.setSize(patches.size());
forAll(patchFaces_, patchi)
{
includedFaces_[patchi].setSize(nIncludedFaces[patchi]);
excludedFaces_[patchi].setSize(nExcludedFaces[patchi]);
patchFaces_[patchi].setSize(nPatchFaces[patchi]);
}
nIncludedFaces = 0;
nExcludedFaces = 0;
nPatchFaces = 0;
forAll(patches, patchi)
{
@ -180,13 +147,9 @@ void Foam::MRFZone::setMRFFaces()
{
const label facei = pp.start() + patchFacei;
if (faceType[facei] == 1)
if (faceInMRF[facei])
{
includedFaces_[patchi][nIncludedFaces[patchi]++] = patchFacei;
}
else if (faceType[facei] == 2)
{
excludedFaces_[patchi][nExcludedFaces[patchi]++] = patchFacei;
patchFaces_[patchi][nPatchFaces[patchi]++] = patchFacei;
}
}
}
@ -202,38 +165,48 @@ void Foam::MRFZone::setMRFFaces()
internalFaces.write();
faceSet MRFFaces(mesh_, "includedFaces", 100);
forAll(includedFaces_, patchi)
faceSet patchFaces(mesh_, "patchFaces", 100);
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
const label patchFacei = includedFaces_[patchi][i];
MRFFaces.insert(patches[patchi].start()+patchFacei);
const label patchFacei = patchFaces_[patchi][i];
patchFaces.insert(patches[patchi].start()+patchFacei);
}
}
Pout<< "Writing " << MRFFaces.size()
<< " patch faces in MRF zone to faceSet "
<< MRFFaces.name() << endl;
MRFFaces.write();
faceSet excludedFaces(mesh_, "excludedFaces", 100);
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
const label patchFacei = excludedFaces_[patchi][i];
excludedFaces.insert(patches[patchi].start()+patchFacei);
}
}
Pout<< "Writing " << excludedFaces.size()
Pout<< "Writing " << patchFaces.size()
<< " faces in MRF zone with special handling to faceSet "
<< excludedFaces.name() << endl;
<< patchFaces.name() << endl;
excludedFaces.write();
patchFaces.write();
}
}
void Foam::MRFZone::checkMRFBCs(const volVectorField& U) const
{
static bool checked = false;
if (!checked)
{
const volVectorField::Boundary& Ubf = U.boundaryField();
forAll(Ubf, patchi)
{
if (isA<MRFPatchField>(Ubf[patchi]))
{
return;
}
}
FatalErrorInFunction
<< "Field " << U.name()
<< " does not provide any MRF specific boundary conditions "
"for MRF region " << name() << nl
<< " Walls rotating in the MRF region should have the "
"MRFnoSlip boundary condition."
<< exit(FatalError);
}
}
@ -244,56 +217,36 @@ Foam::MRFZone::MRFZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict,
const word& cellZoneName
const dictionary& dict
)
:
mesh_(mesh),
name_(name),
coeffs_(dict),
cellZoneName_(cellZoneName),
cellZoneID_(),
excludedPatchNames_
(
wordReList(coeffs_.lookupOrDefault("nonRotatingPatches", wordReList()))
),
cellSet_(mesh, coeffs_, fvCellSet::selectionModeType::cellZone),
origin_(coeffs_.lookup("origin")),
axis_(coeffs_.lookup("axis")),
omega_(Function1<scalar>::New("omega", coeffs_))
{
if (cellZoneName_ == word::null)
{
coeffs_.lookup("cellZone") >> cellZoneName_;
}
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
axis_ = axis_/mag(axis_);
const labelHashSet excludedPatchSet
omega_
(
mesh_.boundaryMesh().patchSet(excludedPatchNames_)
);
excludedPatchLabels_.setSize(excludedPatchSet.size());
label i = 0;
forAllConstIter(labelHashSet, excludedPatchSet, iter)
{
excludedPatchLabels_[i++] = iter.key();
}
bool cellZoneFound = (cellZoneID_ != -1);
reduce(cellZoneFound, orOp<bool>());
if (!cellZoneFound)
{
FatalErrorInFunction
<< "cannot find MRF cellZone " << cellZoneName_
<< exit(FatalError);
}
coeffs_.found("omega")
? Function1<scalar>::New("omega", coeffs_)
: autoPtr<Function1<scalar>>
(
new Function1s::Scale<scalar>
(
"omega",
Function1s::Constant<scalar>
(
"piby30",
constant::mathematical::pi/30.0
),
Function1s::Constant<scalar>("1", 1),
Function1<scalar>::New("rpm", coeffs_)()
)
)
)
{
axis_ = axis_/mag(axis_);
setMRFFaces();
}
@ -312,12 +265,9 @@ void Foam::MRFZone::addCoriolis
volVectorField& ddtU
) const
{
if (cellZoneID_ == -1)
{
return;
}
checkMRFBCs(U);
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const labelList& cells = cellSet_.cells();
vectorField& ddtUc = ddtU.primitiveFieldRef();
const vectorField& Uc = U;
@ -331,88 +281,12 @@ void Foam::MRFZone::addCoriolis
}
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn, const bool rhs) const
{
if (cellZoneID_ == -1)
{
return;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
const vector Omega = this->Omega();
if (rhs)
{
forAll(cells, i)
{
const label celli = cells[i];
Usource[celli] += V[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
const label celli = cells[i];
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
}
}
}
void Foam::MRFZone::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn,
const bool rhs
) const
{
if (cellZoneID_ == -1)
{
return;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
const vector Omega = this->Omega();
if (rhs)
{
forAll(cells, i)
{
const label celli = cells[i];
Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
const label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
}
void Foam::MRFZone::addCentrifugalAcceleration
(
volVectorField& centrifugalAcceleration
) const
{
if (cellZoneID_ == -1)
{
return;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const labelList& cells = cellSet_.cells();
const volVectorField& C = mesh_.C();
vectorField& cac = centrifugalAcceleration.primitiveFieldRef();
@ -424,15 +298,13 @@ void Foam::MRFZone::addCentrifugalAcceleration
cac[celli] -= Omega ^ (Omega ^ (C[celli] - origin_));
}
// Included (rotating) patches
volVectorField::Boundary& caf = centrifugalAcceleration.boundaryFieldRef();
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
const label patchFacei = includedFaces_[patchi][i];
const label patchFacei = patchFaces_[patchi][i];
caf[patchi][patchFacei] -=
Omega
^ (Omega ^ (C.boundaryField()[patchi][patchFacei] - origin_));
@ -443,13 +315,8 @@ void Foam::MRFZone::addCentrifugalAcceleration
void Foam::MRFZone::makeRelative(volVectorField& U) const
{
if (cellZoneID_ == -1)
{
return;
}
const volVectorField& C = mesh_.C();
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const labelList& cells = cellSet_.cells();
const vector Omega = this->Omega();
@ -459,25 +326,13 @@ void Foam::MRFZone::makeRelative(volVectorField& U) const
U[celli] -= (Omega ^ (C[celli] - origin_));
}
// Included patches
volVectorField::Boundary& Ubf = U.boundaryFieldRef();
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
const label patchFacei = includedFaces_[patchi][i];
Ubf[patchi][patchFacei] = Zero;
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
const label patchFacei = excludedFaces_[patchi][i];
const label patchFacei = patchFaces_[patchi][i];
Ubf[patchi][patchFacei] -=
(Omega
^ (C.boundaryField()[patchi][patchFacei] - origin_));
@ -516,13 +371,8 @@ void Foam::MRFZone::makeRelative
void Foam::MRFZone::makeAbsolute(volVectorField& U) const
{
if (cellZoneID_ == -1)
{
return;
}
const volVectorField& C = mesh_.C();
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const labelList& cells = cellSet_.cells();
const vector Omega = this->Omega();
@ -532,25 +382,13 @@ void Foam::MRFZone::makeAbsolute(volVectorField& U) const
U[celli] += (Omega ^ (C[celli] - origin_));
}
// Included patches
volVectorField::Boundary& Ubf = U.boundaryFieldRef();
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
const label patchFacei = includedFaces_[patchi][i];
Ubf[patchi][patchFacei] =
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin_));
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
const label patchFacei = excludedFaces_[patchi][i];
const label patchFacei = patchFaces_[patchi][i];
Ubf[patchi][patchFacei] +=
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin_));
}
@ -574,56 +412,19 @@ void Foam::MRFZone::makeAbsolute
}
void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
void Foam::MRFZone::makeAbsolute(Field<vector>& Up, const label patchi) const
{
const vector Omega = this->Omega();
// Included patches
volVectorField::Boundary& Ubf = U.boundaryFieldRef();
forAll(includedFaces_, patchi)
{
const vectorField& patchC = mesh_.Cf().boundaryField()[patchi];
vectorField pfld(Ubf[patchi]);
forAll(includedFaces_[patchi], i)
{
const label patchFacei = includedFaces_[patchi][i];
pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin_));
}
Ubf[patchi] == pfld;
}
}
void Foam::MRFZone::writeData(Ostream& os) const
{
os << nl;
os.write(name_) << nl;
os << token::BEGIN_BLOCK << incrIndent << nl;
writeEntry(os, "cellZone", cellZoneName_);
writeEntry(os, "origin", origin_);
writeEntry(os, "axis", axis_);
omega_->write(os);
if (excludedPatchNames_.size())
{
writeEntry(os, "nonRotatingPatches", excludedPatchNames_);
}
os << decrIndent << token::END_BLOCK << nl;
Up += (Omega ^ (mesh_.Cf().boundaryField()[patchi] - origin_));
}
bool Foam::MRFZone::read(const dictionary& dict)
{
coeffs_ = dict;
coeffs_.lookup("cellZone") >> cellZoneName_;
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
cellSet_.read(coeffs_);
setMRFFaces();
return true;
}

View File

@ -39,17 +39,10 @@ SourceFiles
#ifndef MRFZone_H
#define MRFZone_H
#include "dictionary.H"
#include "wordList.H"
#include "labelList.H"
#include "dimensionedScalar.H"
#include "dimensionedVector.H"
#include "fvCellSet.H"
#include "volFieldsFwd.H"
#include "surfaceFields.H"
#include "fvMatricesFwd.H"
#include "polyTopoChangeMap.H"
#include "Function1.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,24 +66,14 @@ class MRFZone
//- Coefficients dictionary
dictionary coeffs_;
//- Name of cell zone
word cellZoneName_;
//- MRF zone cell set
fvCellSet cellSet_;
//- Cell zone ID
label cellZoneID_;
const wordReList excludedPatchNames_;
labelList excludedPatchLabels_;
//- Internal faces that are part of MRF
//- Internal faces that are in the MRF region
labelList internalFaces_;
//- Outside faces (per patch) that move with the MRF
labelListList includedFaces_;
//- Excluded faces (per patch) that do not move with the MRF
labelListList excludedFaces_;
//- Patch faces that are in the MRF region
labelListList patchFaces_;
//- Origin of the axis
const vector origin_;
@ -98,7 +81,7 @@ class MRFZone
//- Axis vector
vector axis_;
//- Angular velocity (rad/sec)
//- Angular velocity (rad/sec or rpm)
autoPtr<Function1<scalar>> omega_;
@ -107,6 +90,9 @@ class MRFZone
//- Divide faces in frame according to patch
void setMRFFaces();
//- Check that the case has been updated with correct MRF BCs
void checkMRFBCs(const volVectorField& U) const;
//- Make the given absolute mass/vol flux relative within the MRF region
template<class RhoFieldType>
void makeRelativeRhoFlux
@ -154,8 +140,7 @@ public:
(
const word& name,
const fvMesh& mesh,
const dictionary& dict,
const word& cellZoneName = word::null
const dictionary& dict
);
//- Disallow default bitwise copy construction
@ -184,23 +169,6 @@ public:
volVectorField& ddtU
) const;
//- Add the Coriolis force contribution to the momentum equation
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Add the Coriolis force contribution to the momentum equation
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Add the centrifugal acceleration
void addCentrifugalAcceleration
(
@ -241,8 +209,9 @@ public:
surfaceScalarField& phi
) const;
//- Correct the boundary velocity for the rotation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const;
//- Make the given relative patch velocity absolute
// within the MRF region
void makeAbsolute(Field<vector>& Up, const label patchi) const;
//- Zero the MRF region of the given field
template<class Type>
@ -254,9 +223,6 @@ public:
// I-O
//- Write
void writeData(Ostream& os) const;
//- Read MRF dictionary
bool read(const dictionary& dict);

View File

@ -95,53 +95,6 @@ bool Foam::MRFZoneList::read(const dictionary& dict)
}
bool Foam::MRFZoneList::writeData(Ostream& os) const
{
forAll(*this, i)
{
os << nl;
this->operator[](i).writeData(os);
}
return os.good();
}
void Foam::MRFZoneList::addCoriolis
(
const volVectorField& U,
volVectorField& ddtU
) const
{
forAll(*this, i)
{
operator[](i).addCoriolis(U, ddtU);
}
}
void Foam::MRFZoneList::addCoriolis(fvVectorMatrix& UEqn) const
{
forAll(*this, i)
{
operator[](i).addCoriolis(UEqn);
}
}
void Foam::MRFZoneList::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
) const
{
forAll(*this, i)
{
operator[](i).addCoriolis(rho, UEqn);
}
}
Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::DDt
(
const volVectorField& U
@ -378,15 +331,6 @@ void Foam::MRFZoneList::makeAbsolute
}
void Foam::MRFZoneList::correctBoundaryVelocity(volVectorField& U) const
{
forAll(*this, i)
{
operator[](i).correctBoundaryVelocity(U);
}
}
void Foam::MRFZoneList::update()
{
if (mesh_.topoChanged())
@ -399,17 +343,4 @@ void Foam::MRFZoneList::update()
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const MRFZoneList& models
)
{
models.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -84,23 +84,6 @@ public:
//- Reset the source list
void reset(const dictionary& dict);
//- Add the Coriolis acceleration
void addCoriolis
(
const volVectorField& U,
volVectorField& ddtU
) const;
//- Add the Coriolis acceleration to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;
//- Add the Coriolis acceleration to the momentum equation
void addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
) const;
//- Return the Coriolis acceleration
tmp<volVectorField> DDt
(
@ -170,8 +153,7 @@ public:
surfaceScalarField& phi
) const;
//- Correct the boundary velocity for the rotation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const;
void makeAbsolute(Field<vector>& Up, const label patchi) const;
//- Filter-out the MRF region contribution from the given field
// setting the corresponding values to zero
@ -190,16 +172,6 @@ public:
//- Read dictionary
bool read(const dictionary& dict);
//- Write data to Ostream
bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const MRFZoneList& models
);
// Member Operators

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ void Foam::MRFZone::makeRelativeRhoFlux
const surfaceVectorField& Cf = mesh_.Cf();
const surfaceVectorField& Sf = mesh_.Sf();
const vector Omega = omega_->value(mesh_.time().userTimeValue())*axis_;
const vector Omega = this->Omega();
const vectorField& Cfi = Cf;
const vectorField& Sfi = Sf;
@ -68,25 +68,13 @@ void Foam::MRFZone::makeRelativeRhoFlux
const surfaceVectorField& Cf = mesh_.Cf();
const surfaceVectorField& Sf = mesh_.Sf();
const vector Omega = omega_->value(mesh_.time().userTimeValue())*axis_;
const vector Omega = this->Omega();
// Included patches
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
label patchFacei = includedFaces_[patchi][i];
phi[patchi][patchFacei] = 0.0;
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
label patchFacei = excludedFaces_[patchi][i];
label patchFacei = patchFaces_[patchi][i];
phi[patchi][patchFacei] -=
rho[patchi][patchFacei]
@ -108,20 +96,11 @@ void Foam::MRFZone::makeRelativeRhoFlux
const surfaceVectorField& Cf = mesh_.Cf();
const surfaceVectorField& Sf = mesh_.Sf();
const vector Omega = omega_->value(mesh_.time().userTimeValue())*axis_;
const vector Omega = this->Omega();
// Included patches
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
label patchFacei = includedFaces_[patchi][i];
phi[patchFacei] = 0.0;
}
// Excluded patches
forAll(excludedFaces_[patchi], i)
{
label patchFacei = excludedFaces_[patchi][i];
label patchFacei = patchFaces_[patchi][i];
phi[patchFacei] -=
rho[patchFacei]
@ -141,7 +120,7 @@ void Foam::MRFZone::makeAbsoluteRhoFlux
const surfaceVectorField& Cf = mesh_.Cf();
const surfaceVectorField& Sf = mesh_.Sf();
const vector Omega = omega_->value(mesh_.time().userTimeValue())*axis_;
const vector Omega = this->Omega();
const vectorField& Cfi = Cf;
const vectorField& Sfi = Sf;
@ -156,27 +135,11 @@ void Foam::MRFZone::makeAbsoluteRhoFlux
surfaceScalarField::Boundary& phibf = phi.boundaryFieldRef();
// Included patches
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
label patchFacei = includedFaces_[patchi][i];
phibf[patchi][patchFacei] +=
rho.boundaryField()[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin_))
& Sf.boundaryField()[patchi][patchFacei];
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
label patchFacei = excludedFaces_[patchi][i];
label patchFacei = patchFaces_[patchi][i];
phibf[patchi][patchFacei] +=
rho.boundaryField()[patchi][patchFacei]
@ -203,19 +166,11 @@ void Foam::MRFZone::zero
typename GeometricField<Type, fvsPatchField, surfaceMesh>::Boundary& phibf =
phi.boundaryFieldRef();
forAll(includedFaces_, patchi)
forAll(patchFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
forAll(patchFaces_[patchi], i)
{
phibf[patchi][includedFaces_[patchi][i]] = Zero;
}
}
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
phibf[patchi][excludedFaces_[patchi][i]] = Zero;
phibf[patchi][patchFaces_[patchi][i]] = Zero;
}
}
}

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "MRFFreestreamVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MRFFreestreamVelocityFvPatchVectorField::
MRFFreestreamVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
freestreamVelocityFvPatchVectorField(p, iF),
freestreamValue0_(Zero)
{}
Foam::MRFFreestreamVelocityFvPatchVectorField::
MRFFreestreamVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
freestreamVelocityFvPatchVectorField(p, iF, dict),
MRFPatchField(dict),
freestreamValue0_(dict.lookup("freestreamValue0"))
{}
Foam::MRFFreestreamVelocityFvPatchVectorField::
MRFFreestreamVelocityFvPatchVectorField
(
const MRFFreestreamVelocityFvPatchVectorField& pvf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
freestreamVelocityFvPatchVectorField(pvf, p, iF, mapper),
MRFPatchField(pvf),
freestreamValue0_(pvf.freestreamValue0_)
{}
Foam::MRFFreestreamVelocityFvPatchVectorField::
MRFFreestreamVelocityFvPatchVectorField
(
const MRFFreestreamVelocityFvPatchVectorField& pvf,
const DimensionedField<vector, volMesh>& iF
)
:
freestreamVelocityFvPatchVectorField(pvf, iF),
MRFPatchField(pvf),
freestreamValue0_(pvf.freestreamValue0_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const scalar time = this->db().time().value();
const vector Omega = MRFzone(db()).Omega();
const scalar omega = mag(Omega);
const vector axis(Omega/omega);
const scalar theta = time*omega;
refValue() =
cos(theta)*freestreamValue0_
- sin(theta)*(axis ^ freestreamValue0_);
freestreamVelocityFvPatchVectorField::updateCoeffs();
}
void Foam::MRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry(os, "freestreamValue0", freestreamValue0_);
writeEntry(os, "freestreamValue", freestreamValue());
writeEntry(os, "value", *this);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
MRFFreestreamVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,62 +22,60 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRFFreestreamVelocityFvPatchVectorField
Foam::MRFFreestreamVelocityFvPatchVectorField
Description
Freestream velocity condition to be used in conjunction with the single
rotating frame (SRF) model (see: SRFModel class)
Freestream velocity condition to be used for a wall rotating with the
moving frame in an MRF (multi-reference frame) or SRF (single reference
frame) case.
Given the free stream velocity in the absolute frame, the condition
applies the appropriate rotation transformation in time and space to
determine the local velocity using:
Given the free stream velocity in the absolute frame at time 0, the
condition applies the appropriate rotation transformation in time and space
to determine the current freestream velocity using:
\f[
U_p = cos(\theta)*U_{Inf} + sin(theta) (n^UInf) - U_{p,srf}
U_{inf} = cos(\theta)*U_{inf}^{0} - sin(theta) (n^U_{inf}^{0})
\f]
where
\vartable
U_p = patch velocity [m/s]
U_{Inf} = free stream velocity in the absolute frame [m/s]
U_{inf} = patch freestream velocity at t [m/s]
U_{inf}^0 = free stream velocity in the absolute frame at t=0 [m/s]
theta = swept angle [rad]
n = axis direction of the SRF
U_{p,srf} = SRF velocity of the patch
n = axis of the MRF
\endvartable
Usage
\table
Property | Description | Required | Default value
UInf | freestream velocity | yes |
relative | UInf relative to the SRF? | no |
Property | Description | Required | Default value
freestreamValue0 | freestream velocity at t=0 | yes |
freestreamValue | freestream velocity at t | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type SRFFreestreamVelocity;
UInf uniform (0 0 0);
relative no;
value uniform (0 0 0); // initial value
type MRFFreestreamVelocity;
freestreamValue0 (1 0 0);
freestreamValue uniform (1 0 0);
}
\endverbatim
See also
Foam::freestreamFvPatchField
Foam::SRFVelocityFvPatchVectorField
Foam::MRFVelocityFvPatchVectorField
SourceFiles
SRFFreestreamVelocityFvPatchVectorField.C
MRFFreestreamVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef SRFFreestreamVelocityFvPatchVectorField_H
#define SRFFreestreamVelocityFvPatchVectorField_H
#ifndef MRFFreestreamVelocityFvPatchVectorField_H
#define MRFFreestreamVelocityFvPatchVectorField_H
#include "inletOutletFvPatchFields.H"
#include "Switch.H"
#include "freestreamVelocityFvPatchVectorField.H"
#include "MRFPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,65 +83,63 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SRFFreestreamVelocityFvPatchVectorField Declaration
Class MRFFreestreamVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class SRFFreestreamVelocityFvPatchVectorField
class MRFFreestreamVelocityFvPatchVectorField
:
public inletOutletFvPatchVectorField
public freestreamVelocityFvPatchVectorField,
public MRFPatchField
{
// Private Data
//- Is the supplied inlet value relative to the SRF
Switch relative_;
//- Velocity of the free stream in the absolute frame [m/s]
vector UInf_;
//- Velocity of the free stream at time = 0
vector freestreamValue0_;
public:
//- Runtime type information
TypeName("SRFFreestreamVelocity");
TypeName("MRFFreestreamVelocity");
// Constructors
//- Construct from patch and internal field
SRFFreestreamVelocityFvPatchVectorField
MRFFreestreamVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
SRFFreestreamVelocityFvPatchVectorField
MRFFreestreamVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given SRFFreestreamVelocityFvPatchVectorField
//- Construct by mapping given MRFFreestreamVelocityFvPatchVectorField
// onto a new patch
SRFFreestreamVelocityFvPatchVectorField
MRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&,
const MRFFreestreamVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
SRFFreestreamVelocityFvPatchVectorField
MRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&
const MRFFreestreamVelocityFvPatchVectorField&
) = delete;
//- Copy constructor setting internal field reference
SRFFreestreamVelocityFvPatchVectorField
MRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField&,
const MRFFreestreamVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -155,28 +151,13 @@ public:
{
return tmp<fvPatchVectorField>
(
new SRFFreestreamVelocityFvPatchVectorField(*this, iF)
new MRFFreestreamVelocityFvPatchVectorField(*this, iF)
);
}
// Member Functions
// Access
//- Return the velocity at infinity
const vector& UInf() const
{
return UInf_;
}
//- Return reference to the velocity at infinity to allow adjustment
vector& UInf()
{
return UInf_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,65 +23,78 @@ License
\*---------------------------------------------------------------------------*/
#include "rpm.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace SRF
{
defineTypeNameAndDebug(rpm, 0);
addToRunTimeSelectionTable
(
SRFModel,
rpm,
dictionary
);
}
}
#include "MRFPatchField.H"
#include "IOMRFZoneList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRF::rpm::rpm
(
const volVectorField& U
)
Foam::MRFPatchField::MRFPatchField()
{}
Foam::MRFPatchField::MRFPatchField(const dictionary& dict)
:
SRFModel(typeName, U),
rpm_(SRFModelCoeffs_.lookup<scalar>("rpm"))
{
// Initialise the angular velocity
omega_.value() = axis_*rpm_*constant::mathematical::twoPi/60.0;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::SRF::rpm::~rpm()
MRFZoneName_(dict.lookupOrDefault("MRFZoneName", word::null))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::SRF::rpm::read()
const Foam::MRFZone& Foam::MRFPatchField::MRFzone
(
const objectRegistry& obr
) const
{
if (SRFModel::read())
// Get reference to the MRF model
const MRFZoneList& mrf =
obr.lookupObject<IOMRFZoneList>("MRFProperties");
if (MRFZoneName_ != word::null)
{
// Re-read rpm
SRFModelCoeffs_.lookup("rpm") >> rpm_;
forAll(mrf, i)
{
if (mrf[i].name() == MRFZoneName_)
{
return mrf[i];
}
}
// Update angular velocity
omega_.value() = axis_*rpm_*(constant::mathematical::twoPi/60.0);
return true;
FatalErrorInFunction
<< "Cannot find MRF zone " << MRFZoneName_
<< exit(FatalError);
}
else if (mrf.size() == 1)
{
return mrf[0];
}
else if (mrf.size() == 0)
{
FatalErrorInFunction
<< "There are no MRF zones"
<< exit(FatalError);
}
else
{
return false;
FatalErrorInFunction
<< "MRFZoneName not specified"
<< exit(FatalError);
}
return mrf[0];
}
void Foam::MRFPatchField::makeAbsolute(fvPatchField<vector>& Up) const
{
MRFzone(Up.db()).makeAbsolute(Up, Up.patch().index());
}
void Foam::MRFPatchField::write(Ostream& os) const
{
if (MRFZoneName_ != word::null)
{
writeEntry(os, "MRFZoneName", MRFZoneName_);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,81 +22,63 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRF::rpm
Foam::MRFnoSlipFvPatchVectorField
Description
Basic SRF model whereby angular velocity is specified in terms of
a (global) axis and revolutions-per-minute [rpm]
See also
Foam::MRFZone
SourceFiles
rpm.C
MRFPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef rpm_H
#define rpm_H
#ifndef MRFPatchField_H
#define MRFPatchField_H
#include "SRFModel.H"
#include "fvPatchFields.H"
#include "MRFZone.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace SRF
{
/*---------------------------------------------------------------------------*\
Class rpm Declaration
Class MRFPatchField Declaration
\*---------------------------------------------------------------------------*/
class rpm
:
public SRFModel
class MRFPatchField
{
// Private data
// Private Data
//- Revolutions per minute
scalar rpm_;
word MRFZoneName_;
public:
//- Runtime type information
TypeName("rpm");
// Constructors
//- Construct from components
rpm(const volVectorField& U);
//- Construct null
MRFPatchField();
//- Disallow default bitwise copy construction
rpm(const rpm&) = delete;
//- Destructor
~rpm();
//- Construct from dictionary
MRFPatchField(const dictionary&);
// Member Functions
// I-O
const MRFZone& MRFzone(const objectRegistry& obr) const;
//- Read
bool read();
void makeAbsolute(fvPatchField<vector>& Up) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const rpm&) = delete;
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace SRF
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,15 +23,13 @@ License
\*---------------------------------------------------------------------------*/
#include "SRFWallVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "MRFnoSlipFvPatchVectorField.H"
#include "volFields.H"
#include "SRFModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
Foam::MRFnoSlipFvPatchVectorField::MRFnoSlipFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -41,95 +39,74 @@ Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
{}
Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
Foam::MRFnoSlipFvPatchVectorField::MRFnoSlipFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict)
{}
fixedValueFvPatchVectorField(p, iF, dict, false),
MRFPatchField(dict)
{
if (dict.found("value"))
{
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
}
else
{
fvPatchField<vector>::operator=(Zero);
}
}
Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
Foam::MRFnoSlipFvPatchVectorField::MRFnoSlipFvPatchVectorField
(
const SRFWallVelocityFvPatchVectorField& ptf,
const MRFnoSlipFvPatchVectorField& pvf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
fixedValueFvPatchVectorField(pvf, p, iF, mapper),
MRFPatchField(pvf)
{}
Foam::SRFWallVelocityFvPatchVectorField::SRFWallVelocityFvPatchVectorField
Foam::MRFnoSlipFvPatchVectorField::MRFnoSlipFvPatchVectorField
(
const SRFWallVelocityFvPatchVectorField& srfvpvf,
const MRFnoSlipFvPatchVectorField& pvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(srfvpvf, iF)
fixedValueFvPatchVectorField(pvf, iF),
MRFPatchField(pvf)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::SRFWallVelocityFvPatchVectorField::autoMap
(
const fvPatchFieldMapper& m
)
{
m(*this, *this);
}
void Foam::SRFWallVelocityFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
)
{
fixedValueFvPatchVectorField::rmap(ptf, addr);
}
void Foam::SRFWallVelocityFvPatchVectorField::reset
(
const fvPatchVectorField& ptf
)
{
fixedValueFvPatchVectorField::reset(ptf);
}
void Foam::SRFWallVelocityFvPatchVectorField::updateCoeffs()
void Foam::MRFnoSlipFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// Get reference to the SRF model
const SRF::SRFModel& srf =
db().lookupObject<SRF::SRFModel>("SRFProperties");
// Determine patch velocity due to SRF
const vectorField Up(-srf.velocity(patch().Cf()));
// Remove the component of Up normal to the wall
// just in case it is not exactly circular
const vectorField n(patch().nf());
vectorField::operator=(Up - n*(n & Up));
fvPatchField<vector>::operator=(Zero);
makeAbsolute(*this);
fixedValueFvPatchVectorField::updateCoeffs();
}
void Foam::SRFWallVelocityFvPatchVectorField::write(Ostream& os) const
void Foam::MRFnoSlipFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
MRFPatchField::write(os);
writeEntry(os, "value", *this);
}
@ -141,7 +118,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,54 +22,49 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRFWallVelocityFvPatchVectorField
Foam::MRFnoSlipFvPatchVectorField
Description
Wall-velocity condition to be used in conjunction with the single rotating
frame (SRF) model (see: FOAM::SRFModel)
Rotating wall-velocity condition to be used for a wall rotating with the
moving frame in an MRF (multi-reference frame) or SRF (single reference
frame) case.
The condition applies the appropriate rotation transformation in time and
space to determine the local SRF velocity of the wall.
\f[
U_p = - U_{p,srf}
\f]
where
\vartable
U_p = patch velocity [m/s]
U_{p,srf} = SRF velocity
\endvartable
The normal component of \f$ U_p \f$ is removed to ensure 0 wall-flux even
if the wall patch faces are irregular.
SRF cases are simply MRF cases with a single MRF zone which covers the
entire domain.
Usage
Example of the boundary condition specification:
Example of the boundary condition specification for an SRF case or MRF
case with a single zone:
\verbatim
<patchName>
{
type SRFWallVelocity;
value uniform (0 0 0); // Initial value
type MRFnoSlip;
}
\endverbatim
or if the case has several MRF zones the particular zone this patch is in
must be named explicitly, e.g.:
\verbatim
<patchName>
{
type MRFnoSlip;
MRFZoneName rotor;
}
See also
Foam::SRFModel
Foam::SRFVelocityFvPatchVectorField
Foam::fixedValueFvPatchField
Foam::MRFPatchField
Foam::MRFZone
Foam::noSlip
SourceFiles
SRFWallVelocityFvPatchVectorField.C
MRFnoSlipFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef SRFWallVelocityFvPatchVectorField_H
#define SRFWallVelocityFvPatchVectorField_H
#ifndef MRFnoSlipFvPatchVectorField_H
#define MRFnoSlipFvPatchVectorField_H
#include "fvPatchFields.H"
#include "MRFPatchField.H"
#include "fixedValueFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,57 +72,58 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SRFWallVelocityFvPatchVectorField Declaration
Class MRFnoSlipFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class SRFWallVelocityFvPatchVectorField
class MRFnoSlipFvPatchVectorField
:
public fixedValueFvPatchVectorField
public fixedValueFvPatchVectorField,
public MRFPatchField
{
public:
//- Runtime type information
TypeName("SRFWallVelocity");
TypeName("MRFnoSlip");
// Constructors
//- Construct from patch and internal field
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given SRFWallVelocityFvPatchVectorField
//- Construct by mapping given MRFnoSlipFvPatchVectorField
// onto a new patch
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
(
const SRFWallVelocityFvPatchVectorField&,
const MRFnoSlipFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
(
const SRFWallVelocityFvPatchVectorField&
const MRFnoSlipFvPatchVectorField&
) = delete;
//- Copy constructor setting internal field reference
SRFWallVelocityFvPatchVectorField
MRFnoSlipFvPatchVectorField
(
const SRFWallVelocityFvPatchVectorField&,
const MRFnoSlipFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -139,28 +135,13 @@ public:
{
return tmp<fvPatchVectorField>
(
new SRFWallVelocityFvPatchVectorField(*this, iF)
new MRFnoSlipFvPatchVectorField(*this, iF)
);
}
// Member Functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchVectorField&, const labelList&);
//- Reset the fvPatchField to the given fvPatchField
// Used for mesh to mesh mapping
virtual void reset(const fvPatchVectorField&);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -1,217 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFModel.H"
#include "SRFVelocityFvPatchVectorField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace SRF
{
defineTypeNameAndDebug(SRFModel, 0);
defineRunTimeSelectionTable(SRFModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRF::SRFModel::SRFModel
(
const word& type,
const volVectorField& Urel
)
:
IOdictionary
(
IOobject
(
"SRFProperties",
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
Urel_(Urel),
mesh_(Urel_.mesh()),
origin_("origin", dimLength, lookup("origin")),
axis_(lookup("axis")),
SRFModelCoeffs_(optionalSubDict(type + "Coeffs")),
omega_(dimensionedVector("omega", dimless/dimTime, Zero))
{
// Normalise the axis
axis_ /= mag(axis_);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::SRF::SRFModel::~SRFModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::SRF::SRFModel::read()
{
if (regIOobject::read())
{
// Re-read origin
lookup("origin") >> origin_;
// Re-read axis
lookup("axis") >> axis_;
axis_ /= mag(axis_);
// Re-read sub-model coeffs
SRFModelCoeffs_ = optionalSubDict(type() + "Coeffs");
return true;
}
else
{
return false;
}
}
const Foam::dimensionedVector& Foam::SRF::SRFModel::origin() const
{
return origin_;
}
const Foam::vector& Foam::SRF::SRFModel::axis() const
{
return axis_;
}
const Foam::dimensionedVector& Foam::SRF::SRFModel::omega() const
{
return omega_;
}
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>>
Foam::SRF::SRFModel::Fcoriolis() const
{
return volVectorField::Internal::New
(
"Fcoriolis",
2.0*omega_ ^ Urel_
);
}
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>>
Foam::SRF::SRFModel::Fcentrifugal() const
{
return volVectorField::Internal::New
(
"Fcentrifugal",
omega_ ^ (omega_ ^ (mesh_.C() - origin_))
);
}
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>>
Foam::SRF::SRFModel::Su() const
{
return Fcoriolis() + Fcentrifugal();
}
Foam::vectorField Foam::SRF::SRFModel::velocity
(
const vectorField& positions
) const
{
tmp<vectorField> tfld =
omega_.value()
^ (
(positions - origin_.value())
- axis_*(axis_ & (positions - origin_.value()))
);
return tfld();
}
Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
{
return volVectorField::New
(
"Usrf",
omega_ ^ ((mesh_.C() - origin_) - axis_*(axis_ & (mesh_.C() - origin_)))
);
}
Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const
{
tmp<volVectorField> Usrf = U();
tmp<volVectorField> tUabs
(
volVectorField::New("Uabs", Usrf)
);
volVectorField& Uabs = tUabs.ref();
// Add SRF contribution to internal field
Uabs.primitiveFieldRef() += Urel_.primitiveField();
// Add Urel boundary contributions
volVectorField::Boundary& Uabsbf = Uabs.boundaryFieldRef();
const volVectorField::Boundary& bvf = Urel_.boundaryField();
forAll(bvf, i)
{
if (isA<SRFVelocityFvPatchVectorField>(bvf[i]))
{
// Only include relative contributions from
// SRFVelocityFvPatchVectorField's
const SRFVelocityFvPatchVectorField& UrelPatch =
refCast<const SRFVelocityFvPatchVectorField>(bvf[i]);
if (UrelPatch.relative())
{
Uabsbf[i] += Urel_.boundaryField()[i];
}
}
else
{
Uabsbf[i] += Urel_.boundaryField()[i];
}
}
return tUabs;
}
// ************************************************************************* //

View File

@ -1,191 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::SRF
Description
Namespace for single rotating frame (SRF) models
Class
Foam::SRF::SRFModel
Description
Top level model for single rotating frame
- Steady state only - no time derivatives included
SourceFiles
SRFModel.C
\*---------------------------------------------------------------------------*/
#ifndef SRFModel_H
#define SRFModel_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "fvMesh.H"
#include "volFields.H"
#include "vectorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace SRF
{
/*---------------------------------------------------------------------------*\
Class SRFModel Declaration
\*---------------------------------------------------------------------------*/
class SRFModel
:
public IOdictionary
{
protected:
// Protected data
//- Reference to the relative velocity field
const volVectorField& Urel_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Origin of the axis
dimensionedVector origin_;
//- Axis of rotation, a direction vector which passes through the origin
vector axis_;
//- SRF model coefficients dictionary
dictionary SRFModelCoeffs_;
//- Angular velocity of the frame (rad/s)
dimensionedVector omega_;
public:
//- Runtime type information
TypeName("SRFModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
SRFModel,
dictionary,
(
const volVectorField& Urel
),
(Urel)
);
// Constructors
//- Construct from components
SRFModel
(
const word& type,
const volVectorField& Urel
);
//- Disallow default bitwise copy construction
SRFModel(const SRFModel&) = delete;
// Selectors
//- Return a reference to the selected SRF model
static autoPtr<SRFModel> New
(
const volVectorField& Urel
);
//- Destructor
virtual ~SRFModel();
// Member Functions
// Edit
//- Read SRFProperties dictionary
virtual bool read();
// Access
//- Return the origin of rotation
const dimensionedVector& origin() const;
//- Return the axis of rotation
const vector& axis() const;
//- Return the angular velocity field [rad/s]
const dimensionedVector& omega() const;
//- Return the coriolis force
tmp<volVectorField::Internal> Fcoriolis() const;
//- Return the centrifugal force
tmp<volVectorField::Internal> Fcentrifugal() const;
//- Source term component for momentum equation
tmp<volVectorField::Internal> Su() const;
//- Return velocity vector from positions
vectorField velocity(const vectorField& positions) const;
//- Return velocity of SRF for complete mesh
tmp<volVectorField> U() const;
//- Return absolute velocity for complete mesh
tmp<volVectorField> Uabs() const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const SRFModel&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace SRF
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,72 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::SRF::SRFModel> Foam::SRF::SRFModel::New
(
const volVectorField& Urel
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
"SRFProperties",
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("SRFModel")
);
Info<< "Selecting SRFModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown SRFModel type "
<< modelType << nl << nl
<< "Valid SRFModel types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<SRFModel>(cstrIter()(Urel));
}
// ************************************************************************* //

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFFreestreamVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "SRFModel.H"
#include "steadyStateDdtScheme.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
inletOutletFvPatchVectorField(p, iF),
relative_(false),
UInf_(Zero)
{}
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::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
inletOutletFvPatchVectorField(ptf, p, iF, mapper),
relative_(ptf.relative_),
UInf_(ptf.UInf_)
{}
Foam::SRFFreestreamVelocityFvPatchVectorField::
SRFFreestreamVelocityFvPatchVectorField
(
const SRFFreestreamVelocityFvPatchVectorField& srfvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
inletOutletFvPatchVectorField(srfvpvf, iF),
relative_(srfvpvf.relative_),
UInf_(srfvpvf.UInf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// Get reference to the SRF model
const SRF::SRFModel& srf =
db().lookupObject<SRF::SRFModel>("SRFProperties");
word ddtScheme
(
this->internalField().mesh()
.schemes().ddt(this->internalField().name())
);
if (ddtScheme == fv::steadyStateDdtScheme<scalar>::typeName)
{
// If not relative to the SRF include the effect of the SRF
if (!relative_)
{
refValue() = UInf_ - srf.velocity(patch().Cf());
}
// If already relative to the SRF simply supply the inlet value
// as a fixed value
else
{
refValue() = UInf_;
}
}
else
{
scalar time = this->db().time().value();
scalar theta = time*mag(srf.omega().value());
refValue() =
cos(theta)*UInf_ + sin(theta)*(srf.axis() ^ UInf_)
- srf.velocity(patch().Cf());
}
// Set the inlet-outlet choice based on the direction of the freestream
valueFraction() = neg(refValue() & patch().Sf());
mixedFvPatchField<vector>::updateCoeffs();
}
void Foam::SRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry(os, "relative", relative_);
writeEntry(os, "UInf", UInf_);
writeEntry(os, "phi", this->phiName_);
writeEntry(os, "value", *this);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
SRFFreestreamVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -1,176 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "SRFModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF),
relative_(0),
inletValue_(p.size(), Zero)
{}
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict),
relative_(dict.lookup("relative")),
inletValue_("inletValue", dict, p.size())
{}
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
(
const SRFVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
relative_(ptf.relative_),
inletValue_(mapper(ptf.inletValue_))
{}
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
(
const SRFVelocityFvPatchVectorField& srfvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(srfvpvf, iF),
relative_(srfvpvf.relative_),
inletValue_(srfvpvf.inletValue_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::SRFVelocityFvPatchVectorField::autoMap
(
const fvPatchFieldMapper& m
)
{
m(*this, *this);
m(inletValue_, inletValue_);
}
void Foam::SRFVelocityFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
)
{
fixedValueFvPatchVectorField::rmap(ptf, addr);
const SRFVelocityFvPatchVectorField& tiptf =
refCast<const SRFVelocityFvPatchVectorField>(ptf);
inletValue_.rmap(tiptf.inletValue_, addr);
}
void Foam::SRFVelocityFvPatchVectorField::reset
(
const fvPatchVectorField& ptf
)
{
fixedValueFvPatchVectorField::reset(ptf);
const SRFVelocityFvPatchVectorField& tiptf =
refCast<const SRFVelocityFvPatchVectorField>(ptf);
inletValue_.reset(tiptf.inletValue_);
}
void Foam::SRFVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// If not relative to the SRF include the effect of the SRF
if (!relative_)
{
// Get reference to the SRF model
const SRF::SRFModel& srf =
db().lookupObject<SRF::SRFModel>("SRFProperties");
// Determine patch velocity due to SRF
const vectorField SRFVelocity(srf.velocity(patch().Cf()));
operator==(-SRFVelocity + inletValue_);
}
// If already relative to the SRF simply supply the inlet value as a fixed
// value
else
{
operator==(inletValue_);
}
fixedValueFvPatchVectorField::updateCoeffs();
}
void Foam::SRFVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntry(os, "relative", relative_);
writeEntry(os, "inletValue", inletValue_);
writeEntry(os, "value", *this);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
SRFVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -1,219 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRFVelocityFvPatchVectorField
Description
Velocity condition to be used in conjunction with the single
rotating frame (SRF) model (see: SRFModel class)
Given the free stream velocity in the absolute frame, the condition
applies the appropriate rotation transformation in time and space to
determine the local velocity.
The optional \c relative flag switches the behaviour of the patch
such that:
- relative = yes: inlet velocity applied 'as is':
\f[
U_p = U_{in}
\f]
- relative = no : SRF velocity is subtracted from the inlet velocity:
\f[
U_p = U_{in} - U_{p,srf}
\f]
where
\vartable
U_p = patch velocity [m/s]
U_{in} = user-specified inlet velocity
U_{p,srf} = SRF velocity
\endvartable
Usage
\table
Property | Description | Required | Default value
inletValue | inlet velocity | yes |
relative | inletValue relative motion to the SRF? | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type SRFVelocity;
inletValue uniform (0 0 0);
relative yes;
value uniform (0 0 0); // initial value
}
\endverbatim
See also
Foam::fixedValueFvPatchField
SourceFiles
SRFVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef SRFVelocityFvPatchVectorField_H
#define SRFVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SRFVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class SRFVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private Data
//- Is the supplied inlet value relative to the SRF
Switch relative_;
//- Inlet value [m/s]
vectorField inletValue_;
public:
//- Runtime type information
TypeName("SRFVelocity");
// Constructors
//- Construct from patch and internal field
SRFVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
SRFVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given SRFVelocityFvPatchVectorField
// onto a new patch
SRFVelocityFvPatchVectorField
(
const SRFVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Disallow copy without setting internal field reference
SRFVelocityFvPatchVectorField
(
const SRFVelocityFvPatchVectorField&
) = delete;
//- Copy constructor setting internal field reference
SRFVelocityFvPatchVectorField
(
const SRFVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new SRFVelocityFvPatchVectorField(*this, iF)
);
}
// Member Functions
// Access
//- Return const access to the relative flag
const Switch& relative() const
{
return relative_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchVectorField&, const labelList&);
//- Reset the fvPatchField to the given fvPatchField
// Used for mesh to mesh mapping
virtual void reset(const fvPatchVectorField&);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -142,12 +142,50 @@ void Foam::fvCellSet::setV()
}
void Foam::fvCellSet::setSet(const dictionary& dict)
{
switch (selectionMode_)
{
case selectionModeType::points:
{
dict.lookup("points") >> points_;
break;
}
case selectionModeType::cellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case selectionModeType::cellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case selectionModeType::all:
{
break;
}
default:
{
FatalErrorInFunction
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
setCells();
setV();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvCellSet::fvCellSet
(
const dictionary& dict,
const fvMesh& mesh
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
@ -159,6 +197,22 @@ Foam::fvCellSet::fvCellSet
}
Foam::fvCellSet::fvCellSet
(
const fvMesh& mesh,
const dictionary& dict,
const selectionModeType defaultSelectionMode
)
:
mesh_(mesh),
selectionMode_(defaultSelectionMode),
cellSetName_(word::null),
V_(NaN)
{
read(dict, defaultSelectionMode);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fvCellSet::~fvCellSet()
@ -203,39 +257,28 @@ bool Foam::fvCellSet::read(const dictionary& dict)
selectionMode_ =
selectionModeTypeNames_.read(dict.lookup("selectionMode"));
switch (selectionMode_)
{
case selectionModeType::points:
{
dict.lookup("points") >> points_;
break;
}
case selectionModeType::cellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case selectionModeType::cellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case selectionModeType::all:
{
break;
}
default:
{
FatalErrorInFunction
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
setSet(dict);
setCells();
setV();
return true;
}
bool Foam::fvCellSet::read
(
const dictionary& dict,
const selectionModeType defaultSelectionMode
)
{
selectionMode_ = selectionModeTypeNames_
[
dict.lookupOrDefault<word>
(
"selectionMode",
selectionModeTypeNames_[defaultSelectionMode]
)
];
setSet(dict);
return true;
}

View File

@ -130,16 +130,27 @@ private:
//- Set the sum of scalar volumes
void setV();
//- Set the set for the selectionMode
void setSet(const dictionary& dict);
public:
// Constructors
//- Construct from components
//- Construct from mesh and dictionary
fvCellSet
(
const fvMesh& mesh,
const dictionary& dict
);
//- Construct from mesh, dictionary and default selectionMode
fvCellSet
(
const fvMesh& mesh,
const dictionary& dict,
const fvMesh& mesh
const selectionModeType defaultSelectionMode
);
@ -184,6 +195,13 @@ public:
//- Read coefficients dictionary
bool read(const dictionary& dict);
//- Read coefficients dictionary and default selectionMode
bool read
(
const dictionary& dict,
const selectionModeType defaultSelectionMode
);
};

View File

@ -100,7 +100,7 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
)
:
fvConstraint(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
mode_(temperatureMode::uniform),
TValue_(nullptr),
TName_(word::null),

View File

@ -116,7 +116,7 @@ Foam::fv::fixedValueConstraint::fixedValueConstraint
)
:
fvConstraint(name, modelType, dict, mesh),
set_(coeffs(), mesh)
set_(mesh, coeffs())
{
readCoeffs();
}

View File

@ -117,7 +117,7 @@ Foam::fv::limitMag::limitMag
)
:
fvConstraint(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
fieldName_(word::null),
max_(vGreat)
{

View File

@ -66,7 +66,7 @@ Foam::fv::limitTemperature::limitTemperature
)
:
fvConstraint(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
Tmin_(-vGreat),
Tmax_(vGreat),
fieldName_(word::null),

View File

@ -95,7 +95,7 @@ Foam::fv::meanVelocityForce::meanVelocityForce
)
:
fvConstraint(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
UName_(word::null),
Ubar_(vector::uniform(NaN)),
relaxation_(NaN),

View File

@ -62,7 +62,7 @@ Foam::fv::accelerationSource::accelerationSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
UName_(word::null),
velocity_(nullptr)
{

View File

@ -106,7 +106,7 @@ Foam::fv::actuationDiskSource::actuationDiskSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
phaseName_(word::null),
UName_(word::null),
diskDir_(vector::uniform(NaN)),

View File

@ -176,7 +176,7 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
secondaryMassFlowRate_(NaN),
secondaryInletT_(NaN),
primaryInletT_(NaN),

View File

@ -84,7 +84,7 @@ Foam::fv::explicitPorositySource::explicitPorositySource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
UNames_(),
porosityPtr_(nullptr)
{

View File

@ -97,7 +97,7 @@ Foam::fv::heatSource::heatSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
q_(nullptr)
{
readCoeffs();

View File

@ -73,7 +73,7 @@ Foam::fv::heatTransfer::heatTransfer
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
semiImplicit_(false),
TName_(word::null),
Ta_("Ta", dimTemperature, NaN),

View File

@ -208,7 +208,7 @@ Foam::fv::massSource::massSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
phaseName_(),
rhoName_(),
heName_(),

View File

@ -514,7 +514,7 @@ Foam::fv::rotorDiskSource::rotorDiskSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
UName_(word::null),
omega_(0),
nBlades_(0),

View File

@ -225,7 +225,7 @@ Foam::fv::solidificationMeltingSource::solidificationMeltingSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
Tsol_(NaN),
Tliq_(NaN),
alpha1e_(NaN),

View File

@ -200,7 +200,7 @@ Foam::fv::semiImplicitSource::semiImplicitSource
)
:
fvModel(name, modelType, dict, mesh),
set_(coeffs(), mesh),
set_(mesh, coeffs()),
volumeMode_(volumeMode::absolute)
{
readCoeffs();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,7 +42,6 @@ License
#include "NonInertialFrameForce.H"
#include "ParamagneticForce.H"
#include "PressureGradientForce.H"
#include "SRFForce.H"
#include "VirtualMassForce.H"
#include "ScaledForce.H"
@ -64,7 +63,6 @@ License
makeParticleForceModelType(NonInertialFrameForce, CloudType); \
makeParticleForceModelType(ParamagneticForce, CloudType); \
makeParticleForceModelType(PressureGradientForce, CloudType); \
makeParticleForceModelType(SRFForce, CloudType); \
makeParticleForceModelType(VirtualMassForce, CloudType); \
makeParticleForceModelType(ScaledForce, CloudType);

View File

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SRFForce.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SRFForce<CloudType>::SRFForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict
)
:
ParticleForce<CloudType>(owner, mesh, dict, typeName, false),
srfPtr_(nullptr)
{}
template<class CloudType>
Foam::SRFForce<CloudType>::SRFForce
(
const SRFForce& srff
)
:
ParticleForce<CloudType>(srff),
srfPtr_(nullptr)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SRFForce<CloudType>::~SRFForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::SRFForce<CloudType>::cacheFields(const bool store)
{
if (store)
{
const typename SRF::SRFModel& model = this->mesh().template
lookupObject<SRF::SRFModel>("SRFProperties");
srfPtr_ = &model;
}
else
{
srfPtr_ = nullptr;
}
}
template<class CloudType>
Foam::forceSuSp Foam::SRFForce<CloudType>::calcNonCoupled
(
const typename CloudType::parcelType& p,
const typename CloudType::parcelType::trackingData& td,
const scalar dt,
const scalar mass,
const scalar Re,
const scalar muc
) const
{
forceSuSp value(Zero, 0.0);
const typename SRF::SRFModel& srf = *srfPtr_;
const vector& omega = srf.omega().value();
const vector& r = p.position();
// Coriolis and centrifugal acceleration terms
value.Su() =
mass*(1.0 - td.rhoc()/p.rho())
*(2.0*(p.U() ^ omega) + (omega ^ (r ^ omega)));
return value;
}
// ************************************************************************* //

View File

@ -1,130 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SRFForce
Description
Calculates particle SRF reference frame force
SourceFiles
SRFForce.C
\*---------------------------------------------------------------------------*/
#ifndef SRFForce_H
#define SRFForce_H
#include "ParticleForce.H"
#include "SRFModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class SRFForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class SRFForce
:
public ParticleForce<CloudType>
{
// Private Data
//- Pointer to the SRF model
const typename SRF::SRFModel* srfPtr_;
public:
//- Runtime type information
TypeName("SRF");
// Constructors
//- Construct from mesh
SRFForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict
);
//- Construct copy
SRFForce(const SRFForce& srff);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType>> clone() const
{
return autoPtr<ParticleForce<CloudType>>
(
new ParticleForce<CloudType>(*this)
);
}
//- Destructor
virtual ~SRFForce();
// Member Functions
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcNonCoupled
(
const typename CloudType::parcelType& p,
const typename CloudType::parcelType::trackingData& td,
const scalar dt,
const scalar mass,
const scalar Re,
const scalar muc
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "SRFForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,12 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=$(getApplication)
runApplication blockMesh
runApplication $application
#------------------------------------------------------------------------------

View File

@ -1,57 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
location "0";
object Urel;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 -10);
boundaryField
{
inlet
{
type SRFVelocity;
inletValue uniform (0 0 -10);
relative no;
value uniform (0 0 0);
}
outlet
{
type pressureInletOutletVelocity;
value $internalField;
}
innerWall
{
type noSlip;
}
outerWall
{
type SRFVelocity;
inletValue uniform (0 0 0);
relative no;
value uniform (0 0 0);
}
cyclic_half0
{
type cyclic;
}
cyclic_half1
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -1,56 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 3.5;
boundaryField
{
inlet
{
type fixedValue;
value uniform 3.5;
}
outlet
{
type inletOutlet;
inletValue uniform 3.5;
}
innerWall
{
type omegaWallFunction;
value uniform 3.5;
}
outerWall
{
type omegaWallFunction;
value uniform 3.5;
}
cyclic_half0
{
type cyclic;
value uniform 3.5;
}
cyclic_half1
{
type cyclic;
value uniform 3.5;
}
}
// ************************************************************************* //

View File

@ -1,152 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
( 0.500 0.000 0.000)
( 0.369 0.338 0.000)
( 0.338 0.369 0.000)
( 0.000 0.500 0.000)
( 0.737 0.676 0.000)
( 0.074 0.068 0.000)
( 0.676 0.737 0.000)
( 0.068 0.074 0.000)
( 0.000 1.000 0.000)
( 1.000 0.000 0.000)
( 0.100 0.000 0.000)
( 0.000 0.100 0.000)
( 0.500 0.000 2.000)
( 0.369 0.338 2.000)
( 0.338 0.369 2.000)
( 0.000 0.500 2.000)
( 0.737 0.676 2.000)
( 0.074 0.068 2.000)
( 0.676 0.737 2.000)
( 0.068 0.074 2.000)
( 0.000 1.000 2.000)
( 1.000 0.000 2.000)
( 0.100 0.000 2.000)
( 0.000 0.100 2.000)
);
blocks
(
hex (1 0 9 4 13 12 21 16) (10 20 40) simpleGrading (1 1 1)
hex (2 1 4 6 14 13 16 18) (2 20 40) simpleGrading (1 1 1)
hex (3 2 6 8 15 14 18 20) (10 20 40) simpleGrading (1 1 1)
hex (5 10 0 1 17 22 12 13) (10 20 40) simpleGrading (1 1 1)
hex (11 7 2 3 23 19 14 15) (10 20 40) simpleGrading (1 1 1)
);
edges
(
arc 0 1 ( 0.470 0.171 0.000 )
arc 12 13 ( 0.470 0.171 2.000 )
arc 2 3 ( 0.171 0.470 0.000 )
arc 14 15 ( 0.171 0.470 2.000 )
arc 9 4 ( 0.940 0.342 0.000 )
arc 21 16 ( 0.940 0.342 2.000 )
arc 5 10 ( 0.094 0.034 0.000 )
arc 17 22 ( 0.094 0.034 2.000 )
arc 6 8 ( 0.342 0.940 0.000 )
arc 18 20 ( 0.342 0.940 2.000 )
arc 11 7 ( 0.034 0.094 0.000 )
arc 23 19 ( 0.034 0.094 2.000 )
);
boundary
(
inlet
{
type patch;
faces
(
(13 12 21 16)
(14 13 16 18)
(15 14 18 20)
(17 22 12 13)
(23 19 14 15)
);
}
outlet
{
type patch;
faces
(
(1 4 9 0)
(2 6 4 1)
(3 8 6 2)
(5 1 0 10)
(11 3 2 7)
);
}
innerWall
{
type wall;
faces
(
(2 1 13 14)
(5 10 22 17)
(5 17 13 1)
(11 7 19 23)
(7 2 14 19)
);
}
outerWall
{
type wall;
faces
(
(4 16 21 9)
(6 18 16 4)
(8 20 18 6)
);
}
cyclic_half0
{
type cyclic;
neighbourPatch cyclic_half1;
transformType rotational;
rotationAxis (0 0 1);
rotationCentre (0 0 0);
faces
(
(0 9 21 12)
(10 0 12 22)
);
}
cyclic_half1
{
type cyclic;
neighbourPatch cyclic_half0;
transformType rotational;
rotationAxis (0 0 1);
rotationCentre (0 0 0);
faces
(
(3 15 20 8)
(11 23 15 3)
);
}
);
mergeMatchPairs
(
);
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.01;
}
"(Urel|k|epsilon|omega|R|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-6;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
}
relaxationFactors
{
equations
{
".*" 0.9;
}
}
// ************************************************************************* //

View File

@ -40,8 +40,7 @@ boundaryField
blades
{
type fixedValue;
value uniform (0 0 0);
type MRFnoSlip;
}
}

View File

@ -14,16 +14,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
MRF1
MRF
{
cellZone rotor;
// Fixed patches (by default they 'move' with the MRF zone)
nonRotatingPatches ();
origin (0.25 0.25 0.25);
axis (0 0 1);
origin (0.25 0.25 0.25);
axis (0 0 1);
omega 47.7; // 50 rpm
rpm 500;
}

View File

@ -21,8 +21,7 @@ boundaryField
{
rotor
{
type fixedValue;
value uniform (0 0 0);
type MRFnoSlip;
}
stator

View File

@ -14,16 +14,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
MRF1
MRF
{
cellZone rotor;
// Fixed patches (by default they 'move' with the MRF zone)
nonRotatingPatches ();
origin (0 0 0);
axis (0 0 1);
omega constant 1047.2;
rpm 10000;
}

View File

@ -32,10 +32,9 @@ boundaryField
value $internalField;
}
innerWall
rotor
{
type fixedValue;
value uniform (0 0 0);
type MRFnoSlip;
}
outerWall

View File

@ -30,7 +30,7 @@ boundaryField
type inletOutlet;
inletValue uniform 14.855;
}
innerWall
rotor
{
type epsilonWallFunction;
value uniform 14.855;

View File

@ -30,7 +30,7 @@ boundaryField
type inletOutlet;
inletValue uniform 0.375;
}
innerWall
rotor
{
type kqRWallFunction;
value uniform 0.375;

View File

@ -30,7 +30,7 @@ boundaryField
type calculated;
value uniform 0;
}
innerWall
rotor
{
type nutkWallFunction;
value uniform 0;

View File

@ -30,7 +30,7 @@ boundaryField
type inletOutlet;
inletValue uniform 3.5;
}
innerWall
rotor
{
type omegaWallFunction;
value uniform 3.5;

View File

@ -29,7 +29,7 @@ boundaryField
type fixedValue;
value uniform 0;
}
innerWall
rotor
{
type zeroGradient;
}

View File

@ -14,17 +14,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
MRF
SRF
{
cellZone all;
selectionMode all;
// Fixed patches (by default they 'move' with the MRF zone)
nonRotatingPatches (inlet outlet outerWall);
origin (0 0 0);
axis (0 0 1);
origin (0 0 0);
axis (0 0 1);
omega 104.72;
rpm 1000;
}
// ************************************************************************* //

View File

@ -18,39 +18,39 @@ convertToMeters 0.1;
vertices
(
( 0.500 0.000 0.000)
( 0.369 0.338 0.000)
( 0.338 0.369 0.000)
( 0.000 0.500 0.000)
( 0.737 0.676 0.000)
( 0.074 0.068 0.000)
( 0.676 0.737 0.000)
( 0.068 0.074 0.000)
( 0.000 1.000 0.000)
( 1.000 0.000 0.000)
( 0.100 0.000 0.000)
( 0.000 0.100 0.000)
( 0.500 0.000 2.000)
( 0.369 0.338 2.000)
( 0.338 0.369 2.000)
( 0.000 0.500 2.000)
( 0.737 0.676 2.000)
( 0.074 0.068 2.000)
( 0.676 0.737 2.000)
( 0.068 0.074 2.000)
( 0.000 1.000 2.000)
( 1.000 0.000 2.000)
( 0.100 0.000 2.000)
( 0.000 0.100 2.000)
(0.500 0.000 0.000)
(0.369 0.338 0.000)
(0.338 0.369 0.000)
(0.000 0.500 0.000)
(0.737 0.676 0.000)
(0.074 0.068 0.000)
(0.676 0.737 0.000)
(0.068 0.074 0.000)
(0.000 1.000 0.000)
(1.000 0.000 0.000)
(0.100 0.000 0.000)
(0.000 0.100 0.000)
(0.500 0.000 2.000)
(0.369 0.338 2.000)
(0.338 0.369 2.000)
(0.000 0.500 2.000)
(0.737 0.676 2.000)
(0.074 0.068 2.000)
(0.676 0.737 2.000)
(0.068 0.074 2.000)
(0.000 1.000 2.000)
(1.000 0.000 2.000)
(0.100 0.000 2.000)
(0.000 0.100 2.000)
);
blocks
(
hex (1 0 9 4 13 12 21 16) all (10 20 40) simpleGrading (1 1 1)
hex (2 1 4 6 14 13 16 18) all (2 20 40) simpleGrading (1 1 1)
hex (3 2 6 8 15 14 18 20) all (10 20 40) simpleGrading (1 1 1)
hex (5 10 0 1 17 22 12 13) all (10 20 40) simpleGrading (1 1 1)
hex (11 7 2 3 23 19 14 15) all (10 20 40) simpleGrading (1 1 1)
hex (1 0 9 4 13 12 21 16) (10 20 40) simpleGrading (1 1 1)
hex (2 1 4 6 14 13 16 18) (2 20 40) simpleGrading (1 1 1)
hex (3 2 6 8 15 14 18 20) (10 20 40) simpleGrading (1 1 1)
hex (5 10 0 1 17 22 12 13) (10 20 40) simpleGrading (1 1 1)
hex (11 7 2 3 23 19 14 15) (10 20 40) simpleGrading (1 1 1)
);
edges
@ -97,7 +97,7 @@ boundary
);
}
innerWall
rotor
{
type wall;
faces

View File

@ -21,8 +21,7 @@ boundaryField
{
rotor
{
type fixedValue;
value uniform (0 0 0);
type MRFnoSlip;
}
stator

View File

@ -14,16 +14,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
MRF1
MRF
{
cellZone rotor;
// Fixed patches (by default they 'move' with the MRF zone)
nonRotatingPatches ();
origin (0 0 0);
axis (0 0 1);
origin (0 0 0);
axis (0 0 1);
omega 104.72;
rpm 1000;
}
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (1 0 0);
boundaryField
{
rotor
{
type movingWallVelocity;
value $internalField;
}
freestream
{
type freestreamVelocity;
freestreamValue $internalField;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //

View File

@ -26,7 +26,8 @@ boundaryField
freestream
{
type zeroGradient;
type freestreamPressure;
freestreamValue $internalField;
}
front

View File

@ -10,18 +10,23 @@ FoamFile
format ascii;
class dictionary;
location "constant";
object SRFProperties;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SRFModel rpm;
origin (0 0 0);
axis (0 0 1);
rpmCoeffs
mover
{
rpm 60;
type motionSolver;
libs ("libfvMeshMovers.so" "libfvMotionSolvers.so");
motionSolver solidBody;
solidBodyMotionFunction rotatingMotion;
origin (0 0 0);
axis (0 0 1);
omega 6.2832; // rad/s
}

View File

@ -0,0 +1,185 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1.0;
hub 0.005;
rotorBlades 0.02;
freestream 0.1;
halfDepth 0.005;
angle 90;
nRadialRotorCells 6;
nRadialOuterCells 24;
nCircCells 24;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
vertices #codeStream
{
codeInclude
#{
#include "pointField.H"
#include "transformField.H"
#};
code
#{
const pointField initPoints
({
point(-$freestream, 0, -$halfDepth),
point(-$rotorBlades, 0, -$halfDepth),
point(-$hub, 0, -$halfDepth),
point(-$hub, 0, -$halfDepth),
});
pointField points;
// Rotate points around z-axis and append
for (label i = 0; i < 4; i++)
{
points.append(transform(Rz(degToRad(i*$angle)), initPoints));
}
// Duplicate z points
points.append(points + vector(0, 0, 2*$halfDepth));
os << points;
#};
};
rotorBlock all ($nCircCells $nRadialRotorCells 1) simpleGrading (1 1 1);
outerBlock all ($nCircCells $nRadialOuterCells 1) simpleGrading (1 1 1);
blocks
(
hex (6 2 1 5 22 18 17 21) $rotorBlock
hex (10 7 5 9 26 23 21 25) $rotorBlock
hex (14 11 9 13 30 27 25 29) $rotorBlock
hex (3 15 13 1 19 31 29 17) $rotorBlock
hex (5 1 0 4 21 17 16 20) $outerBlock
hex (9 5 4 8 25 21 20 24) $outerBlock
hex (13 9 8 12 29 25 24 28) $outerBlock
hex (1 13 12 0 17 29 28 16) $outerBlock
);
circle $angle (0 0 1);
edges
(
arc 2 6 $circle
arc 7 10 $circle
arc 11 14 $circle
arc 15 3 $circle
arc 18 22 $circle
arc 23 26 $circle
arc 27 30 $circle
arc 31 19 $circle
arc 1 5 $circle
arc 5 9 $circle
arc 9 13 $circle
arc 13 1 $circle
arc 17 21 $circle
arc 21 25 $circle
arc 25 29 $circle
arc 29 17 $circle
arc 0 4 $circle
arc 4 8 $circle
arc 8 12 $circle
arc 12 0 $circle
arc 16 20 $circle
arc 20 24 $circle
arc 24 28 $circle
arc 28 16 $circle
);
defaultPatch
{
name walls;
type wall;
}
boundary
(
rotor
{
type wall;
faces
(
(2 18 22 6)
(7 23 26 10)
(11 27 30 14)
(15 31 19 3)
(1 17 18 2)
(17 1 3 19)
(5 21 22 6)
(21 5 7 23)
(26 10 9 25)
(11 27 25 9)
(30 14 13 29)
(29 13 15 31)
);
}
freestream
{
type patch;
faces
(
(16 0 4 20)
(20 4 8 24)
(24 8 12 28)
(28 12 0 16)
);
}
front
{
type empty;
faces
(
(17 21 22 18)
(21 25 26 23)
(25 29 30 27)
(29 17 19 31)
(16 20 21 17)
(20 24 25 21)
(25 24 28 29)
(29 28 16 17)
);
}
back
{
type empty;
faces
(
(5 1 2 6)
(5 7 10 9)
(9 11 14 13)
(15 3 1 13)
(0 1 5 4)
(4 5 9 8)
(8 9 13 12)
(12 13 1 0)
);
}
);
// ************************************************************************* //

View File

@ -14,7 +14,9 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application SRFPimpleFoam;
application foamRun;
solver incompressibleFluid;
startFrom startTime;

View File

@ -27,10 +27,10 @@ gradSchemes
divSchemes
{
default none;
div(phi,Urel) Gauss limitedLinearV 1;
div(phi,U) Gauss limitedLinearV 1;
div(phi,k) Gauss limitedLinear 1;
div(phi,epsilon) Gauss limitedLinear 1;
div((nuEff*dev2(T(grad(Urel))))) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes

View File

@ -0,0 +1,85 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-8;
relTol 0.05;
smoother GaussSeidel;
nCellsInCoarsestLevel 20;
}
pFinal
{
$p;
relTol 0;
}
pcorr
{
$p;
tolerance 1e-3;
relTol 0;
}
"U.*"
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-07;
relTol 0.1;
}
"k.*"
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-7;
relTol 0.1;
}
"epsilon.*"
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-7;
relTol 0.1;
}
}
PIMPLE
{
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More