mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
MRF: Separate MRF from fvOptions
fvOptions does not have the appropriate structure to support MRF as it is based on option selection by user-specified fields whereas MRF MUST be applied to all velocity fields in the particular solver. A consequence of the particular design choices in fvOptions made it difficult to support MRF for multiphase and it is easier to support frame-related and field related options separately. Currently the MRF functionality provided supports only rotations but the structure will be generalized to support other frame motions including linear acceleration, SRF rotation and 6DoF which will be run-time selectable.
This commit is contained in:
1
src/finiteVolume/cfdTools/general/include/createMRF.H
Normal file
1
src/finiteVolume/cfdTools/general/include/createMRF.H
Normal file
@ -0,0 +1 @@
|
||||
IOMRFZoneList MRF(mesh);
|
||||
@ -14,6 +14,7 @@
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "adjustPhi.H"
|
||||
#include "findRefCell.H"
|
||||
#include "IOMRFZoneList.H"
|
||||
#include "constants.H"
|
||||
|
||||
#include "OSspecific.H"
|
||||
|
||||
@ -14,7 +14,6 @@ derivedSources=sources/derived
|
||||
$(derivedSources)/actuationDiskSource/actuationDiskSource.C
|
||||
$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
|
||||
$(derivedSources)/explicitPorositySource/explicitPorositySource.C
|
||||
$(derivedSources)/MRFSource/MRFSource.C
|
||||
$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
|
||||
$(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -610,45 +610,4 @@ void Foam::fv::option::setValue(fvMatrix<tensor>& eqn, const label fieldI)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::option::makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -513,35 +513,6 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
virtual void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute boundary flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
virtual void makeAbsolute(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
virtual void makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write the source header information
|
||||
|
||||
@ -136,67 +136,6 @@ void Foam::fv::optionList::reset(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::optionList::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).makeRelative(phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::optionList::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).makeRelative(rho, phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::FieldField<Foam::fvsPatchField, Foam::scalar> >
|
||||
Foam::fv::optionList::relative
|
||||
(
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& phi
|
||||
) const
|
||||
{
|
||||
tmp<FieldField<fvsPatchField, scalar> > rphi(phi.ptr());
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
operator[](i).makeRelative(rphi());
|
||||
}
|
||||
|
||||
return rphi;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::optionList::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).makeAbsolute(phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::optionList::makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).makeAbsolute(rho, phi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::optionList::read(const dictionary& dict)
|
||||
{
|
||||
return readOptions(optionsDict(dict));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -175,35 +175,6 @@ public:
|
||||
void constrain(fvMatrix<Type>& eqn);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
void makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Return the given absolute boundary flux relative
|
||||
tmp<FieldField<fvsPatchField, scalar> > relative
|
||||
(
|
||||
const tmp<FieldField<fvsPatchField, scalar> >& tphi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
void makeAbsolute(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
void makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read dictionary
|
||||
|
||||
@ -1,195 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 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 "MRFSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "MRFZone.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fv
|
||||
{
|
||||
defineTypeNameAndDebug(MRFSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
option,
|
||||
MRFSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::MRFSource::initialise()
|
||||
{
|
||||
if (selectionMode_ != smCellZone)
|
||||
{
|
||||
FatalErrorIn("void Foam::MRFSource::initialise()")
|
||||
<< "The MRF region must be specified as a cellZone. Current "
|
||||
<< "selection mode is " << selectionModeTypeNames_[selectionMode_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
mrfPtr_.reset
|
||||
(
|
||||
new MRFZone
|
||||
(
|
||||
name_,
|
||||
mesh_,
|
||||
coeffs_,
|
||||
cellSetName_
|
||||
)
|
||||
);
|
||||
|
||||
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(U));
|
||||
|
||||
fieldNames_.setSize(1, UName_);
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::MRFSource::MRFSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
option(name, modelType, dict, mesh),
|
||||
mrfPtr_(NULL),
|
||||
UName_(coeffs_.lookupOrDefault<word>("UName", "U"))
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fv::MRFSource::addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
// Update the velocity boundary conditions for changes in rotation speed
|
||||
mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(eqn.psi()));
|
||||
|
||||
// Add to rhs of equation
|
||||
mrfPtr_->addCoriolis(eqn, true);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
// Update the velocity boundary conditions for changes in rotation speed
|
||||
mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(eqn.psi()));
|
||||
|
||||
// Add to rhs of equation
|
||||
mrfPtr_->addCoriolis(rho, eqn, true);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeRelative(surfaceScalarField& phi) const
|
||||
{
|
||||
mrfPtr_->makeRelative(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->makeRelative(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->makeRelative(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeAbsolute(surfaceScalarField& phi) const
|
||||
{
|
||||
mrfPtr_->makeAbsolute(phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
mrfPtr_->makeAbsolute(rho, phi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::MRFSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fv::MRFSource::read(const dictionary& dict)
|
||||
{
|
||||
if (option::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("UName", UName_);
|
||||
|
||||
initialise();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,194 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 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::fv::MRFSource
|
||||
|
||||
Description
|
||||
Multiple Reference Frame (MRF) source
|
||||
|
||||
\heading Source usage
|
||||
|
||||
Example usage:
|
||||
\verbatim
|
||||
MRFSourceCoeffs
|
||||
{
|
||||
origin (0 0 0);
|
||||
axis (0 0 1);
|
||||
omega 104.72;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
SourceFiles
|
||||
MRFSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MRFSource_H
|
||||
#define MRFSource_H
|
||||
|
||||
#include "fvOption.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class MRFZone;
|
||||
|
||||
namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class MRFSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class MRFSource
|
||||
:
|
||||
public option
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Run-time selectable MRF model
|
||||
autoPtr<MRFZone> mrfPtr_;
|
||||
|
||||
//- Velocity field name, default = U
|
||||
word UName_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise
|
||||
void initialise();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
MRFSource(const MRFSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const MRFSource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("MRFSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
MRFSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MRFSource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Add explicit and implicit contributions
|
||||
|
||||
//- Vector
|
||||
virtual void addSup
|
||||
(
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
|
||||
// Add explicit and implicit contributions to compressible equation
|
||||
|
||||
//- Vector
|
||||
virtual void addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<vector>& eqn,
|
||||
const label fieldI
|
||||
);
|
||||
|
||||
|
||||
// Flux manipulations
|
||||
|
||||
//- Make the given absolute flux relative
|
||||
virtual void makeRelative(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given absolute boundary flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
FieldField<fvsPatchField, scalar>& phi
|
||||
) const;
|
||||
|
||||
//- Make the given absolute mass-flux relative
|
||||
virtual void makeRelative
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Make the given relative flux absolute
|
||||
virtual void makeAbsolute(surfaceScalarField& phi) const;
|
||||
|
||||
//- Make the given relative mass-flux absolute
|
||||
virtual void makeAbsolute
|
||||
(
|
||||
const surfaceScalarField& rho,
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user