mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
adding SRF library, and tutorial with demonstration solver
This commit is contained in:
@ -259,6 +259,10 @@ cfdTools/general/porousMedia/porousZones.C
|
||||
cfdTools/general/MRF/MRFZone.C
|
||||
cfdTools/general/MRF/MRFZones.C
|
||||
cfdTools/general/fieldSources/timeActivatedExplicitSource/timeActivatedExplicitSource.C
|
||||
cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C
|
||||
cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C
|
||||
cfdTools/general/SRF/SRFModel/rpm/rpm.C
|
||||
cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
||||
|
||||
fvMeshCutSurface = fvMesh/fvMeshCutSurface
|
||||
|
||||
|
||||
@ -0,0 +1,193 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
Formulation based on relative velocities
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SRFModel.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.mesh().time().constant(),
|
||||
Urel.mesh().db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
Urel_(Urel),
|
||||
mesh_(Urel_.mesh()),
|
||||
axis_(lookup("axis")),
|
||||
SRFModelCoeffs_(subDict(type + "Coeffs")),
|
||||
omega_(dimensionedVector("omega", dimless/dimTime, vector::zero))
|
||||
{
|
||||
// Normalise the axis
|
||||
axis_ /= mag(axis_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::SRF::SRFModel::~SRFModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::SRF::SRFModel::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
// Re-read axis
|
||||
SRFModelCoeffs_.lookup("axis") >> axis_;
|
||||
axis_ /= mag(axis_);
|
||||
|
||||
// Re-read sub-model coeffs
|
||||
SRFModelCoeffs_ = subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 tmp<DimensionedField<vector, volMesh> >
|
||||
(
|
||||
new DimensionedField<vector, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Fcoriolis",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
2.0*omega_ ^ Urel_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
|
||||
Foam::SRF::SRFModel::Fcentrifugal() const
|
||||
{
|
||||
return tmp<DimensionedField<vector, volMesh> >
|
||||
(
|
||||
new DimensionedField<vector, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Fcentrifugal",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
omega_ ^ (omega_ ^ mesh_.C())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
return -omega_.value() ^ (positions - axis_*(axis_ & positions));
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
|
||||
{
|
||||
return tmp<volVectorField>
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Usrf",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
-omega_ ^ (mesh_.C() - axis_*(axis_ & mesh_.C()))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
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_;
|
||||
|
||||
//- Axis of rotation
|
||||
vector axis_;
|
||||
|
||||
//- SRF model coeficients dictionary
|
||||
dictionary SRFModelCoeffs_;
|
||||
|
||||
//- Angular velocity of the frame (rad/s)
|
||||
dimensionedVector omega_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
SRFModel(const SRFModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const SRFModel&);
|
||||
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected SRF model
|
||||
static autoPtr<SRFModel> New
|
||||
(
|
||||
const volVectorField& Urel
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~SRFModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Edit
|
||||
|
||||
//- Read radiationProperties dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- 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<DimensionedField<vector, volMesh> > Fcoriolis() const;
|
||||
|
||||
//- Return the centrifugal force
|
||||
tmp<DimensionedField<vector, volMesh> > Fcentrifugal() const;
|
||||
|
||||
//- Source term component for momentum equation
|
||||
tmp<DimensionedField<vector, volMesh> > Su() const;
|
||||
|
||||
//- Return velocity vector from positions
|
||||
vectorField velocity(const vectorField& positions) const;
|
||||
|
||||
//- Return velocity of SRF for complete mesh
|
||||
tmp<volVectorField> U() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace SRF
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SRFModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace SRF
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<SRFModel> SRFModel::New
|
||||
(
|
||||
const volVectorField& Urel
|
||||
)
|
||||
{
|
||||
word SRFModelTypeName;
|
||||
|
||||
// Enclose the creation of the SRFPropertiesDict to ensure it is
|
||||
// deleted before the SRFModel is created - otherwise the dictionary
|
||||
// is entered in the database twice
|
||||
{
|
||||
IOdictionary SRFPropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"SRFProperties",
|
||||
Urel.mesh().time().constant(),
|
||||
Urel.mesh().db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
SRFPropertiesDict.lookup("SRFModel") >> SRFModelTypeName;
|
||||
}
|
||||
|
||||
Info<< "Selecting SRFModel " << SRFModelTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(SRFModelTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"SRFModel::New(const fvMesh&)"
|
||||
) << "Unknown SRFModel type " << SRFModelTypeName
|
||||
<< nl << nl
|
||||
<< "Valid SRFModel types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<SRFModel>(cstrIter()(Urel));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace SRF
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
92
src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C
Normal file
92
src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C
Normal file
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rpm.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace SRF
|
||||
{
|
||||
defineTypeNameAndDebug(rpm, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
SRFModel,
|
||||
rpm,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::SRF::rpm::rpm
|
||||
(
|
||||
const volVectorField& U
|
||||
)
|
||||
:
|
||||
SRFModel(typeName, U),
|
||||
rpm_(readScalar(SRFModelCoeffs_.lookup("rpm")))
|
||||
{
|
||||
// Initialise the angular velocity
|
||||
omega_.value() = axis_*rpm_*2.0*mathematicalConstant::pi/60.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::SRF::rpm::~rpm()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::SRF::rpm::read()
|
||||
{
|
||||
if (SRFModel::read())
|
||||
{
|
||||
// Re-read rpm
|
||||
SRFModelCoeffs_.lookup("rpm") >> rpm_;
|
||||
|
||||
// Update angular velocity
|
||||
omega_.value() = axis_*rpm_*(2.0*mathematicalConstant::pi/60.0);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
107
src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H
Normal file
107
src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H
Normal file
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::SRF::rpm
|
||||
|
||||
Description
|
||||
Basic SRF model whereby angular velocity is specified in terms of
|
||||
a (global) axis and revolutions-per-minute [rpm]
|
||||
|
||||
SourceFiles
|
||||
rpm.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SRFModelRpm_H
|
||||
#define SRFModelRpm_H
|
||||
|
||||
#include "SRFModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace SRF
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rpm Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rpm
|
||||
:
|
||||
public SRFModel
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Revolutions per minute
|
||||
scalar rpm_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
rpm(const rpm&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const rpm&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("rpm");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
rpm(const volVectorField& U);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~rpm();
|
||||
|
||||
// Member functions
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read
|
||||
bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace SRF
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SRFVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
#include "SRFModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
relative_(0),
|
||||
inletValue_(p.size(), vector::zero)
|
||||
{}
|
||||
|
||||
|
||||
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_(ptf.inletValue_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
relative_(dict.lookup("relative")),
|
||||
inletValue_("inletValue", dict, p.size())
|
||||
{
|
||||
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
|
||||
(
|
||||
const SRFVelocityFvPatchVectorField& srfvpvf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(srfvpvf),
|
||||
relative_(srfvpvf.relative_),
|
||||
inletValue_(srfvpvf.inletValue_)
|
||||
{}
|
||||
|
||||
|
||||
SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
|
||||
(
|
||||
const SRFVelocityFvPatchVectorField& srfvpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(srfvpvf, iF),
|
||||
relative_(srfvpvf.relative_),
|
||||
inletValue_(srfvpvf.inletValue_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void SRFVelocityFvPatchVectorField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
vectorField::autoMap(m);
|
||||
inletValue_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void 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 SRFVelocityFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If relative, 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 absolute, simply supply the inlet value as a fixed value
|
||||
else
|
||||
{
|
||||
operator==(inletValue_);
|
||||
}
|
||||
|
||||
fixedValueFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void SRFVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
|
||||
inletValue_.writeEntry("inletValue", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
SRFVelocityFvPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,172 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::SRFVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
Velocity patch to be used with SRF model
|
||||
|
||||
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
|
||||
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&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
SRFVelocityFvPatchVectorField
|
||||
(
|
||||
const SRFVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new SRFVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy 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
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user