Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
154a0d9e73
@ -6,7 +6,8 @@
|
|||||||
phic = min(interface.cAlpha()*phic, max(phic));
|
phic = min(interface.cAlpha()*phic, max(phic));
|
||||||
surfaceScalarField phir(phic*interface.nHatf());
|
surfaceScalarField phir(phic*interface.nHatf());
|
||||||
|
|
||||||
if (pimple.firstIter() && MULESCorr)
|
//***HGW if (pimple.firstIter() && MULESCorr)
|
||||||
|
if (MULESCorr)
|
||||||
{
|
{
|
||||||
fvScalarMatrix alpha1Eqn
|
fvScalarMatrix alpha1Eqn
|
||||||
(
|
(
|
||||||
|
@ -27,7 +27,7 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "ODE.H"
|
#include "ODESystem.H"
|
||||||
#include "ODESolver.H"
|
#include "ODESolver.H"
|
||||||
#include "RK.H"
|
#include "RK.H"
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
class testODE
|
class testODE
|
||||||
:
|
:
|
||||||
public ODE
|
public ODESystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -107,9 +107,13 @@ int main(int argc, char *argv[])
|
|||||||
argList::validArgs.append("ODESolver");
|
argList::validArgs.append("ODESolver");
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
// Create the ODE system
|
||||||
testODE ode;
|
testODE ode;
|
||||||
|
|
||||||
|
// Create the selected ODE system solver
|
||||||
autoPtr<ODESolver> odeSolver = ODESolver::New(args[1], ode);
|
autoPtr<ODESolver> odeSolver = ODESolver::New(args[1], ode);
|
||||||
|
|
||||||
|
// Initialise the ODE system fields
|
||||||
scalar xStart = 1.0;
|
scalar xStart = 1.0;
|
||||||
scalarField yStart(ode.nEqns());
|
scalarField yStart(ode.nEqns());
|
||||||
yStart[0] = ::Foam::j0(xStart);
|
yStart[0] = ::Foam::j0(xStart);
|
||||||
@ -117,6 +121,7 @@ int main(int argc, char *argv[])
|
|||||||
yStart[2] = ::Foam::jn(2, xStart);
|
yStart[2] = ::Foam::jn(2, xStart);
|
||||||
yStart[3] = ::Foam::jn(3, xStart);
|
yStart[3] = ::Foam::jn(3, xStart);
|
||||||
|
|
||||||
|
// Print the evolution of the solution and the time-step
|
||||||
scalarField dyStart(ode.nEqns());
|
scalarField dyStart(ode.nEqns());
|
||||||
ode.derivatives(xStart, yStart, dyStart);
|
ode.derivatives(xStart, yStart, dyStart);
|
||||||
|
|
||||||
|
@ -1253,6 +1253,9 @@ int main(int argc, char *argv[])
|
|||||||
// Snap parameters
|
// Snap parameters
|
||||||
const snapParameters snapParams(snapDict);
|
const snapParameters snapParams(snapDict);
|
||||||
|
|
||||||
|
// Layer addition parameters
|
||||||
|
const layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
||||||
|
|
||||||
|
|
||||||
if (wantRefine)
|
if (wantRefine)
|
||||||
{
|
{
|
||||||
@ -1346,9 +1349,6 @@ int main(int argc, char *argv[])
|
|||||||
globalToSlavePatch
|
globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
// Layer addition parameters
|
|
||||||
layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
|
||||||
|
|
||||||
// Use the maxLocalCells from the refinement parameters
|
// Use the maxLocalCells from the refinement parameters
|
||||||
bool preBalance = returnReduce
|
bool preBalance = returnReduce
|
||||||
(
|
(
|
||||||
|
@ -304,11 +304,13 @@ addLayersControls
|
|||||||
// size of the refined cell outside layer (true) or absolute sizes (false).
|
// size of the refined cell outside layer (true) or absolute sizes (false).
|
||||||
relativeSizes true;
|
relativeSizes true;
|
||||||
|
|
||||||
// Layer thickness specification. This can be specified in one of four ways
|
// Layer thickness specification. This can be specified in one of following
|
||||||
|
// ways:
|
||||||
// - expansionRatio and finalLayerThickness (cell nearest internal mesh)
|
// - expansionRatio and finalLayerThickness (cell nearest internal mesh)
|
||||||
// - expansionRatio and firstLayerThickness (cell on surface)
|
// - expansionRatio and firstLayerThickness (cell on surface)
|
||||||
// - overall thickness and firstLayerThickness
|
// - overall thickness and firstLayerThickness
|
||||||
// - overall thickness and finalLayerThickness
|
// - overall thickness and finalLayerThickness
|
||||||
|
// - overall thickness and expansionRatio
|
||||||
|
|
||||||
// Expansion factor for layer mesh
|
// Expansion factor for layer mesh
|
||||||
expansionRatio 1.0;
|
expansionRatio 1.0;
|
||||||
|
@ -720,6 +720,20 @@ int main(int argc, char *argv[])
|
|||||||
PtrList<faceSet> faceSets(fSetNames.size());
|
PtrList<faceSet> faceSets(fSetNames.size());
|
||||||
PtrList<pointSet> pointSets(pSetNames.size());
|
PtrList<pointSet> pointSets(pSetNames.size());
|
||||||
|
|
||||||
|
Info<< "Reconstructing sets:" << endl;
|
||||||
|
if (cSetNames.size())
|
||||||
|
{
|
||||||
|
Info<< " cellSets " << cSetNames.sortedToc() << endl;
|
||||||
|
}
|
||||||
|
if (fSetNames.size())
|
||||||
|
{
|
||||||
|
Info<< " faceSets " << fSetNames.sortedToc() << endl;
|
||||||
|
}
|
||||||
|
if (pSetNames.size())
|
||||||
|
{
|
||||||
|
Info<< " pointSets " << pSetNames.sortedToc() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Load sets
|
// Load sets
|
||||||
forAll(procMeshes.meshes(), procI)
|
forAll(procMeshes.meshes(), procI)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ const scalar
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::KRR4::KRR4(const ODE& ode)
|
Foam::KRR4::KRR4(const ODESystem& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
yTemp_(n_, 0.0),
|
yTemp_(n_, 0.0),
|
||||||
@ -76,7 +76,7 @@ Foam::KRR4::KRR4(const ODE& ode)
|
|||||||
|
|
||||||
void Foam::KRR4::solve
|
void Foam::KRR4::solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
@ -168,7 +168,7 @@ void Foam::KRR4::solve
|
|||||||
(
|
(
|
||||||
"void Foam::KRR4::solve"
|
"void Foam::KRR4::solve"
|
||||||
"("
|
"("
|
||||||
"const ODE&, "
|
"const ODESystem&, "
|
||||||
"scalar&, "
|
"scalar&, "
|
||||||
"scalarField&, "
|
"scalarField&, "
|
||||||
"scalarField&, "
|
"scalarField&, "
|
||||||
@ -206,7 +206,7 @@ void Foam::KRR4::solve
|
|||||||
(
|
(
|
||||||
"void Foam::KRR4::solve"
|
"void Foam::KRR4::solve"
|
||||||
"("
|
"("
|
||||||
"const ODE&, "
|
"const ODESystem&, "
|
||||||
"scalar&, "
|
"scalar&, "
|
||||||
"scalarField&, "
|
"scalarField&, "
|
||||||
"scalarField&, "
|
"scalarField&, "
|
||||||
|
@ -88,14 +88,14 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from ODE
|
//- Construct from ODE
|
||||||
KRR4(const ODE& ode);
|
KRR4(const ODESystem& ode);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
void solve
|
void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
|
@ -36,7 +36,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ODESolver::ODESolver(const ODE& ode)
|
Foam::ODESolver::ODESolver(const ODESystem& ode)
|
||||||
:
|
:
|
||||||
n_(ode.nEqns()),
|
n_(ode.nEqns()),
|
||||||
yScale_(n_),
|
yScale_(n_),
|
||||||
@ -48,7 +48,7 @@ Foam::ODESolver::ODESolver(const ODE& ode)
|
|||||||
|
|
||||||
void Foam::ODESolver::solve
|
void Foam::ODESolver::solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar xStart,
|
const scalar xStart,
|
||||||
const scalar xEnd,
|
const scalar xEnd,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
@ -102,7 +102,7 @@ void Foam::ODESolver::solve
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"ODESolver::solve"
|
"ODESolver::solve"
|
||||||
"(const ODE& ode, const scalar xStart, const scalar xEnd,"
|
"(const ODESystem& ode, const scalar xStart, const scalar xEnd,"
|
||||||
"scalarField& yStart, const scalar eps, scalar& hEst) const"
|
"scalarField& yStart, const scalar eps, scalar& hEst) const"
|
||||||
) << "Too many integration steps"
|
) << "Too many integration steps"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::ODESolver
|
Foam::ODESolver
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Selection for ODE solver
|
Abstract base-class for ODE system solvers
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ODESolver.C
|
ODESolver.C
|
||||||
@ -35,7 +35,7 @@ SourceFiles
|
|||||||
#ifndef ODESolver_H
|
#ifndef ODESolver_H
|
||||||
#define ODESolver_H
|
#define ODESolver_H
|
||||||
|
|
||||||
#include "ODE.H"
|
#include "ODESystem.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
autoPtr,
|
autoPtr,
|
||||||
ODESolver,
|
ODESolver,
|
||||||
ODE,
|
ODE,
|
||||||
(const ODE& ode),
|
(const ODESystem& ode),
|
||||||
(ode)
|
(ode)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given ODE
|
//- Construct for given ODE
|
||||||
ODESolver(const ODE& ode);
|
ODESolver(const ODESystem& ode);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
@ -99,7 +99,7 @@ public:
|
|||||||
static autoPtr<ODESolver> New
|
static autoPtr<ODESolver> New
|
||||||
(
|
(
|
||||||
const word& ODESolverTypeName,
|
const word& ODESolverTypeName,
|
||||||
const ODE& ode
|
const ODESystem& ode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
virtual void solve
|
virtual void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
virtual void solve
|
virtual void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar xStart,
|
const scalar xStart,
|
||||||
const scalar xEnd,
|
const scalar xEnd,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,7 +30,7 @@ License
|
|||||||
Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
||||||
(
|
(
|
||||||
const Foam::word& ODESolverTypeName,
|
const Foam::word& ODESolverTypeName,
|
||||||
const Foam::ODE& ode
|
const Foam::ODESystem& ode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Selecting ODE solver " << ODESolverTypeName << endl;
|
Info<< "Selecting ODE solver " << ODESolverTypeName << endl;
|
||||||
@ -42,7 +42,8 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"ODESolver::New(const word& ODESolverTypeName, const ODE& ode)"
|
"ODESolver::New"
|
||||||
|
"(const word& ODESolverTypeName, const ODESystem& ode)"
|
||||||
) << "Unknown ODESolver type "
|
) << "Unknown ODESolver type "
|
||||||
<< ODESolverTypeName << nl << nl
|
<< ODESolverTypeName << nl << nl
|
||||||
<< "Valid ODESolvers are : " << endl
|
<< "Valid ODESolvers are : " << endl
|
||||||
|
@ -54,7 +54,7 @@ const scalar
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::RK::RK(const ODE& ode)
|
Foam::RK::RK(const ODESystem& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
yTemp_(n_, 0.0),
|
yTemp_(n_, 0.0),
|
||||||
@ -72,7 +72,7 @@ Foam::RK::RK(const ODE& ode)
|
|||||||
|
|
||||||
void Foam::RK::solve
|
void Foam::RK::solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar x,
|
const scalar x,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
const scalarField& dydx,
|
const scalarField& dydx,
|
||||||
@ -142,7 +142,7 @@ void Foam::RK::solve
|
|||||||
|
|
||||||
void Foam::RK::solve
|
void Foam::RK::solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
|
@ -81,14 +81,14 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from ODE
|
//- Construct from ODE
|
||||||
RK(const ODE& ode);
|
RK(const ODESystem& ode);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
void solve
|
void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar x,
|
const scalar x,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
const scalarField& dydx,
|
const scalarField& dydx,
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
|
|
||||||
void solve
|
void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
|
@ -47,7 +47,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::SIBS::SIBS(const ODE& ode)
|
Foam::SIBS::SIBS(const ODESystem& ode)
|
||||||
:
|
:
|
||||||
ODESolver(ode),
|
ODESolver(ode),
|
||||||
a_(iMaxX_, 0.0),
|
a_(iMaxX_, 0.0),
|
||||||
@ -70,7 +70,7 @@ Foam::SIBS::SIBS(const ODE& ode)
|
|||||||
|
|
||||||
void Foam::SIBS::solve
|
void Foam::SIBS::solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
|
@ -78,7 +78,7 @@ class SIBS
|
|||||||
|
|
||||||
void SIMPR
|
void SIMPR
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar xStart,
|
const scalar xStart,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
const scalarField& dydx,
|
const scalarField& dydx,
|
||||||
@ -110,14 +110,14 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from ODE
|
//- Construct from ODE
|
||||||
SIBS(const ODE& ode);
|
SIBS(const ODESystem& ode);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
void solve
|
void solve
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
scalar& x,
|
scalar& x,
|
||||||
scalarField& y,
|
scalarField& y,
|
||||||
scalarField& dydx,
|
scalarField& dydx,
|
||||||
|
@ -29,7 +29,7 @@ License
|
|||||||
|
|
||||||
void Foam::SIBS::SIMPR
|
void Foam::SIBS::SIMPR
|
||||||
(
|
(
|
||||||
const ODE& ode,
|
const ODESystem& ode,
|
||||||
const scalar xStart,
|
const scalar xStart,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
const scalarField& dydx,
|
const scalarField& dydx,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,15 +22,15 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::ODE
|
Foam::ODESystem
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Abstract base class for the ODE solvers.
|
Abstract base class for the systems of ordinary differential equations.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ODE_H
|
#ifndef ODESystem_H
|
||||||
#define ODE_H
|
#define ODESystem_H
|
||||||
|
|
||||||
#include "scalarField.H"
|
#include "scalarField.H"
|
||||||
#include "scalarMatrices.H"
|
#include "scalarMatrices.H"
|
||||||
@ -41,30 +41,32 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ODE Declaration
|
Class ODESystem Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class ODE
|
class ODESystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null8
|
||||||
ODE()
|
ODESystem()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~ODE()
|
virtual ~ODESystem()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the number of equations in the system
|
||||||
virtual label nEqns() const = 0;
|
virtual label nEqns() const = 0;
|
||||||
|
|
||||||
|
//- Calculate the derivatives in dydx
|
||||||
virtual void derivatives
|
virtual void derivatives
|
||||||
(
|
(
|
||||||
const scalar x,
|
const scalar x,
|
||||||
@ -72,7 +74,8 @@ public:
|
|||||||
scalarField& dydx
|
scalarField& dydx
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
//- Calculate the Jacobian of the system
|
||||||
|
// Need by the stiff-system solvers
|
||||||
virtual void jacobian
|
virtual void jacobian
|
||||||
(
|
(
|
||||||
const scalar x,
|
const scalar x,
|
@ -542,8 +542,11 @@ public:
|
|||||||
//- Compact maps. Gets per field a bool whether it is used (locally)
|
//- Compact maps. Gets per field a bool whether it is used (locally)
|
||||||
// and works out itself what this side and sender side can remove
|
// and works out itself what this side and sender side can remove
|
||||||
// from maps.
|
// from maps.
|
||||||
void compact(const boolList& elemIsUsed, const int tag);
|
void compact
|
||||||
|
(
|
||||||
|
const boolList& elemIsUsed,
|
||||||
|
const int tag = UPstream::msgType()
|
||||||
|
);
|
||||||
|
|
||||||
//- Distribute data. Note:schedule only used for Pstream::scheduled
|
//- Distribute data. Note:schedule only used for Pstream::scheduled
|
||||||
// for now, all others just use send-to-all, receive-from-all.
|
// for now, all others just use send-to-all, receive-from-all.
|
||||||
|
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::Tuple2
|
Foam::Tuple2
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A 2-tuple.
|
A 2-tuple for storing two objects of different types.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::Pair for storing two objects of identical types.
|
Foam::Pair for storing two objects of identical types.
|
||||||
|
@ -52,6 +52,7 @@ Description
|
|||||||
#include "fixedValuePointPatchFields.H"
|
#include "fixedValuePointPatchFields.H"
|
||||||
#include "calculatedPointPatchFields.H"
|
#include "calculatedPointPatchFields.H"
|
||||||
#include "cyclicSlipPointPatchFields.H"
|
#include "cyclicSlipPointPatchFields.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -110,6 +111,31 @@ void Foam::autoLayerDriver::dumpDisplacement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::scalarField> Foam::autoLayerDriver::avgPointData
|
||||||
|
(
|
||||||
|
const indirectPrimitivePatch& pp,
|
||||||
|
const scalarField& pointFld
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<scalarField> tfaceFld(new scalarField(pp.size(), 0.0));
|
||||||
|
scalarField& faceFld = tfaceFld();
|
||||||
|
|
||||||
|
forAll(pp.localFaces(), faceI)
|
||||||
|
{
|
||||||
|
const face& f = pp.localFaces()[faceI];
|
||||||
|
if (f.size())
|
||||||
|
{
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
faceFld[faceI] += pointFld[f[fp]];
|
||||||
|
}
|
||||||
|
faceFld[faceI] /= f.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tfaceFld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check that primitivePatch is not multiply connected. Collect non-manifold
|
// Check that primitivePatch is not multiply connected. Collect non-manifold
|
||||||
// points in pointSet.
|
// points in pointSet.
|
||||||
void Foam::autoLayerDriver::checkManifold
|
void Foam::autoLayerDriver::checkManifold
|
||||||
@ -2391,19 +2417,21 @@ Foam::label Foam::autoLayerDriver::countExtrusion
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Collect layer faces and layer cells into bools for ease of handling
|
// Collect layer faces and layer cells into mesh fields for ease of handling
|
||||||
void Foam::autoLayerDriver::getLayerCellsFaces
|
void Foam::autoLayerDriver::getLayerCellsFaces
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const addPatchCellLayer& addLayer,
|
const addPatchCellLayer& addLayer,
|
||||||
boolList& flaggedCells,
|
const scalarField& oldRealThickness,
|
||||||
boolList& flaggedFaces
|
|
||||||
|
labelList& cellNLayers,
|
||||||
|
scalarField& faceRealThickness
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
flaggedCells.setSize(mesh.nCells());
|
cellNLayers.setSize(mesh.nCells());
|
||||||
flaggedCells = false;
|
cellNLayers = 0;
|
||||||
flaggedFaces.setSize(mesh.nFaces());
|
faceRealThickness.setSize(mesh.nFaces());
|
||||||
flaggedFaces = false;
|
faceRealThickness = 0;
|
||||||
|
|
||||||
// Mark all faces in the layer
|
// Mark all faces in the layer
|
||||||
const labelListList& layerFaces = addLayer.layerFaces();
|
const labelListList& layerFaces = addLayer.layerFaces();
|
||||||
@ -2415,27 +2443,195 @@ void Foam::autoLayerDriver::getLayerCellsFaces
|
|||||||
{
|
{
|
||||||
const labelList& added = addedCells[oldPatchFaceI];
|
const labelList& added = addedCells[oldPatchFaceI];
|
||||||
|
|
||||||
forAll(added, i)
|
const labelList& layer = layerFaces[oldPatchFaceI];
|
||||||
|
|
||||||
|
if (layer.size())
|
||||||
{
|
{
|
||||||
flaggedCells[added[i]] = true;
|
forAll(added, i)
|
||||||
|
{
|
||||||
|
cellNLayers[added[i]] = layer.size()-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(layerFaces, oldPatchFaceI)
|
forAll(layerFaces, oldPatchFaceI)
|
||||||
{
|
{
|
||||||
const labelList& layer = layerFaces[oldPatchFaceI];
|
const labelList& layer = layerFaces[oldPatchFaceI];
|
||||||
|
const scalar realThickness = oldRealThickness[oldPatchFaceI];
|
||||||
|
|
||||||
if (layer.size())
|
if (layer.size())
|
||||||
{
|
{
|
||||||
for (label i = 1; i < layer.size()-1; i++)
|
// Layer contains both original boundary face and new boundary
|
||||||
|
// face so is nLayers+1
|
||||||
|
forAll(layer, i)
|
||||||
{
|
{
|
||||||
flaggedFaces[layer[i]] = true;
|
faceRealThickness[layer[i]] = realThickness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::autoLayerDriver::writeLayerData
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& patchIDs,
|
||||||
|
const labelList& cellNLayers,
|
||||||
|
const scalarField& faceWantedThickness,
|
||||||
|
const scalarField& faceRealThickness
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
bool allOk = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
label nAdded = 0;
|
||||||
|
forAll(cellNLayers, cellI)
|
||||||
|
{
|
||||||
|
if (cellNLayers[cellI] > 0)
|
||||||
|
{
|
||||||
|
nAdded++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cellSet addedCellSet(mesh, "addedCells", nAdded);
|
||||||
|
forAll(cellNLayers, cellI)
|
||||||
|
{
|
||||||
|
if (cellNLayers[cellI] > 0)
|
||||||
|
{
|
||||||
|
addedCellSet.insert(cellI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addedCellSet.instance() = meshRefiner_.timeName();
|
||||||
|
Info<< "Writing "
|
||||||
|
<< returnReduce(addedCellSet.size(), sumOp<label>())
|
||||||
|
<< " added cells to cellSet "
|
||||||
|
<< addedCellSet.name() << endl;
|
||||||
|
bool ok = addedCellSet.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
label nAdded = 0;
|
||||||
|
forAll(faceRealThickness, faceI)
|
||||||
|
{
|
||||||
|
if (faceRealThickness[faceI] > 0)
|
||||||
|
{
|
||||||
|
nAdded++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
faceSet layerFacesSet(mesh, "layerFaces", nAdded);
|
||||||
|
forAll(faceRealThickness, faceI)
|
||||||
|
{
|
||||||
|
if (faceRealThickness[faceI] > 0)
|
||||||
|
{
|
||||||
|
layerFacesSet.insert(faceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
layerFacesSet.instance() = meshRefiner_.timeName();
|
||||||
|
Info<< "Writing "
|
||||||
|
<< returnReduce(layerFacesSet.size(), sumOp<label>())
|
||||||
|
<< " faces inside added layer to faceSet "
|
||||||
|
<< layerFacesSet.name() << endl;
|
||||||
|
bool ok = layerFacesSet.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
volScalarField fld
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nSurfaceLayers",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0),
|
||||||
|
fixedValueFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
const labelList& faceCells = pp.faceCells();
|
||||||
|
scalarField pfld(faceCells.size());
|
||||||
|
forAll(faceCells, i)
|
||||||
|
{
|
||||||
|
pfld[i] = cellNLayers[faceCells[i]];
|
||||||
|
}
|
||||||
|
fld.boundaryField()[patchI] == pfld;
|
||||||
|
}
|
||||||
|
Info<< "Writing volScalarField " << fld.name()
|
||||||
|
<< " with actual number of layers" << endl;
|
||||||
|
bool ok = fld.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
volScalarField fld
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"wantedThickness",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0),
|
||||||
|
fixedValueFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
fld.boundaryField()[patchI] == pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceWantedThickness
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Info<< "Writing volScalarField " << fld.name()
|
||||||
|
<< " with wanted thickness" << endl;
|
||||||
|
bool ok = fld.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
volScalarField fld
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"thickness",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0),
|
||||||
|
fixedValueFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
fld.boundaryField()[patchI] == pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceRealThickness
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Info<< "Writing volScalarField " << fld.name()
|
||||||
|
<< " with layer thickness" << endl;
|
||||||
|
bool ok = fld.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
return allOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoLayerDriver::autoLayerDriver
|
Foam::autoLayerDriver::autoLayerDriver
|
||||||
@ -2618,7 +2814,7 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
labelList patchNLayers(pp().nPoints(), 0);
|
labelList patchNLayers(pp().nPoints(), 0);
|
||||||
|
|
||||||
// Ideal number of cells added
|
// Ideal number of cells added
|
||||||
label nIdealAddedCells = 0;
|
label nIdealTotAddedCells = 0;
|
||||||
|
|
||||||
// Whether to add edge for all pp.localPoints.
|
// Whether to add edge for all pp.localPoints.
|
||||||
List<extrudeMode> extrudeStatus(pp().nPoints(), EXTRUDE);
|
List<extrudeMode> extrudeStatus(pp().nPoints(), EXTRUDE);
|
||||||
@ -2637,7 +2833,7 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
patchDisp,
|
patchDisp,
|
||||||
patchNLayers,
|
patchNLayers,
|
||||||
extrudeStatus,
|
extrudeStatus,
|
||||||
nIdealAddedCells
|
nIdealTotAddedCells
|
||||||
);
|
);
|
||||||
|
|
||||||
// Precalculate mesh edge labels for patch edges
|
// Precalculate mesh edge labels for patch edges
|
||||||
@ -2835,11 +3031,20 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
// Saved old points
|
// Saved old points
|
||||||
pointField oldPoints(mesh.points());
|
pointField oldPoints(mesh.points());
|
||||||
|
|
||||||
// Last set of topology changes. (changing mesh clears out polyTopoChange)
|
// Current set of topology changes. (changing mesh clears out
|
||||||
|
// polyTopoChange)
|
||||||
polyTopoChange savedMeshMod(mesh.boundaryMesh().size());
|
polyTopoChange savedMeshMod(mesh.boundaryMesh().size());
|
||||||
|
// Per cell 0 or number of layers in the cell column it is part of
|
||||||
|
labelList cellNLayers;
|
||||||
|
// Per face actual overall layer thickness
|
||||||
|
scalarField faceRealThickness;
|
||||||
|
// Per face wanted overall layer thickness
|
||||||
|
scalarField faceWantedThickness(mesh.nFaces(), 0.0);
|
||||||
|
{
|
||||||
|
UIndirectList<scalar>(faceWantedThickness, pp().addressing()) =
|
||||||
|
avgPointData(pp, thickness);
|
||||||
|
}
|
||||||
|
|
||||||
boolList flaggedCells;
|
|
||||||
boolList flaggedFaces;
|
|
||||||
|
|
||||||
for (label iteration = 0; iteration < layerParams.nLayerIter(); iteration++)
|
for (label iteration = 0; iteration < layerParams.nLayerIter(); iteration++)
|
||||||
{
|
{
|
||||||
@ -3088,35 +3293,52 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
(
|
(
|
||||||
newMesh,
|
newMesh,
|
||||||
addLayer,
|
addLayer,
|
||||||
flaggedCells,
|
avgPointData(pp, mag(patchDisp))(), // current thickness
|
||||||
flaggedFaces
|
|
||||||
|
cellNLayers,
|
||||||
|
faceRealThickness
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Count number of added cells
|
||||||
|
label nAddedCells = 0;
|
||||||
|
forAll(cellNLayers, cellI)
|
||||||
|
{
|
||||||
|
if (cellNLayers[cellI] > 0)
|
||||||
|
{
|
||||||
|
nAddedCells++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&meshRefinement::MESH)
|
||||||
{
|
{
|
||||||
Info<< "Writing layer mesh to time " << meshRefiner_.timeName()
|
Info<< "Writing layer mesh to time " << meshRefiner_.timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
newMesh.write();
|
newMesh.write();
|
||||||
cellSet addedCellSet
|
|
||||||
(
|
cellSet addedCellSet(newMesh," addedCells", nAddedCells);
|
||||||
newMesh,
|
forAll(cellNLayers, cellI)
|
||||||
"addedCells",
|
{
|
||||||
findIndices(flaggedCells, true)
|
if (cellNLayers[cellI] > 0)
|
||||||
);
|
{
|
||||||
|
addedCellSet.insert(cellI);
|
||||||
|
}
|
||||||
|
}
|
||||||
addedCellSet.instance() = meshRefiner_.timeName();
|
addedCellSet.instance() = meshRefiner_.timeName();
|
||||||
Info<< "Writing "
|
Info<< "Writing "
|
||||||
<< returnReduce(addedCellSet.size(), sumOp<label>())
|
<< returnReduce(addedCellSet.size(), sumOp<label>())
|
||||||
<< " added cells to cellSet "
|
<< " added cells to cellSet " << addedCellSet.name() << endl;
|
||||||
<< addedCellSet.name() << endl;
|
|
||||||
addedCellSet.write();
|
addedCellSet.write();
|
||||||
|
|
||||||
faceSet layerFacesSet
|
faceSet layerFacesSet(newMesh, "layerFaces", newMesh.nFaces()/100);
|
||||||
(
|
forAll(faceRealThickness, faceI)
|
||||||
newMesh,
|
{
|
||||||
"layerFaces",
|
if (faceRealThickness[faceI] > 0)
|
||||||
findIndices(flaggedCells, true)
|
{
|
||||||
);
|
layerFacesSet.insert(faceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
layerFacesSet.instance() = meshRefiner_.timeName();
|
layerFacesSet.instance() = meshRefiner_.timeName();
|
||||||
Info<< "Writing "
|
Info<< "Writing "
|
||||||
<< returnReduce(layerFacesSet.size(), sumOp<label>())
|
<< returnReduce(layerFacesSet.size(), sumOp<label>())
|
||||||
@ -3140,26 +3362,17 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
extrudeStatus
|
extrudeStatus
|
||||||
);
|
);
|
||||||
|
|
||||||
label nExtruded = countExtrusion(pp, extrudeStatus);
|
label nTotExtruded = countExtrusion(pp, extrudeStatus);
|
||||||
label nTotFaces = returnReduce(pp().size(), sumOp<label>());
|
label nTotFaces = returnReduce(pp().size(), sumOp<label>());
|
||||||
label nAddedCells = 0;
|
label nTotAddedCells = returnReduce(nAddedCells, sumOp<label>());
|
||||||
{
|
|
||||||
forAll(flaggedCells, cellI)
|
Info<< "Extruding " << nTotExtruded
|
||||||
{
|
|
||||||
if (flaggedCells[cellI])
|
|
||||||
{
|
|
||||||
nAddedCells++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reduce(nAddedCells, sumOp<label>());
|
|
||||||
}
|
|
||||||
Info<< "Extruding " << nExtruded
|
|
||||||
<< " out of " << nTotFaces
|
<< " out of " << nTotFaces
|
||||||
<< " faces (" << 100.0*nExtruded/nTotFaces << "%)."
|
<< " faces (" << 100.0*nTotExtruded/nTotFaces << "%)."
|
||||||
<< " Removed extrusion at " << nTotChanged << " faces."
|
<< " Removed extrusion at " << nTotChanged << " faces."
|
||||||
<< endl
|
<< endl
|
||||||
<< "Added " << nAddedCells << " out of " << nIdealAddedCells
|
<< "Added " << nTotAddedCells << " out of " << nIdealTotAddedCells
|
||||||
<< " cells (" << 100.0*nAddedCells/nIdealAddedCells << "%)."
|
<< " cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells << "%)."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
if (nTotChanged == 0)
|
if (nTotChanged == 0)
|
||||||
@ -3217,6 +3430,8 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
|
|
||||||
meshRefiner_.updateMesh(map, labelList(0));
|
meshRefiner_.updateMesh(map, labelList(0));
|
||||||
|
|
||||||
|
// Update numbering of faceWantedThickness
|
||||||
|
meshRefinement::updateList(map().faceMap(), 0.0, faceWantedThickness);
|
||||||
|
|
||||||
// Update numbering on baffles
|
// Update numbering on baffles
|
||||||
forAll(baffles, i)
|
forAll(baffles, i)
|
||||||
@ -3237,8 +3452,9 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
|
|
||||||
autoPtr<mapPolyMesh> map = meshRefiner_.mergeBaffles(baffles);
|
autoPtr<mapPolyMesh> map = meshRefiner_.mergeBaffles(baffles);
|
||||||
|
|
||||||
inplaceReorder(map().reverseCellMap(), flaggedCells);
|
inplaceReorder(map().reverseCellMap(), cellNLayers);
|
||||||
inplaceReorder(map().reverseFaceMap(), flaggedFaces);
|
inplaceReorder(map().reverseFaceMap(), faceWantedThickness);
|
||||||
|
inplaceReorder(map().reverseFaceMap(), faceRealThickness);
|
||||||
|
|
||||||
Info<< "Converted baffles in = "
|
Info<< "Converted baffles in = "
|
||||||
<< meshRefiner_.mesh().time().cpuTimeIncrement()
|
<< meshRefiner_.mesh().time().cpuTimeIncrement()
|
||||||
@ -3272,29 +3488,23 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Re-distribute flag of layer faces and cells
|
// Re-distribute flag of layer faces and cells
|
||||||
map().distributeCellData(flaggedCells);
|
map().distributeCellData(cellNLayers);
|
||||||
map().distributeFaceData(flaggedFaces);
|
map().distributeFaceData(faceWantedThickness);
|
||||||
|
map().distributeFaceData(faceRealThickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write mesh
|
// Write mesh data
|
||||||
// ~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
cellSet addedCellSet(mesh, "addedCells", findIndices(flaggedCells, true));
|
writeLayerData
|
||||||
addedCellSet.instance() = meshRefiner_.timeName();
|
(
|
||||||
Info<< "Writing "
|
mesh,
|
||||||
<< returnReduce(addedCellSet.size(), sumOp<label>())
|
patchIDs,
|
||||||
<< " added cells to cellSet "
|
cellNLayers,
|
||||||
<< addedCellSet.name() << endl;
|
faceWantedThickness,
|
||||||
addedCellSet.write();
|
faceRealThickness
|
||||||
|
);
|
||||||
faceSet layerFacesSet(mesh, "layerFaces", findIndices(flaggedFaces, true));
|
|
||||||
layerFacesSet.instance() = meshRefiner_.timeName();
|
|
||||||
Info<< "Writing "
|
|
||||||
<< returnReduce(layerFacesSet.size(), sumOp<label>())
|
|
||||||
<< " faces inside added layer to faceSet "
|
|
||||||
<< layerFacesSet.name() << endl;
|
|
||||||
layerFacesSet.write();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,6 +120,13 @@ class autoLayerDriver
|
|||||||
const List<extrudeMode>&
|
const List<extrudeMode>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Average point wise data to face wise
|
||||||
|
static tmp<scalarField> avgPointData
|
||||||
|
(
|
||||||
|
const indirectPrimitivePatch&,
|
||||||
|
const scalarField& pointFld
|
||||||
|
);
|
||||||
|
|
||||||
//- Check that primitivePatch is not multiply connected.
|
//- Check that primitivePatch is not multiply connected.
|
||||||
// Collect non-manifold points in pointSet.
|
// Collect non-manifold points in pointSet.
|
||||||
static void checkManifold
|
static void checkManifold
|
||||||
@ -367,10 +374,23 @@ class autoLayerDriver
|
|||||||
(
|
(
|
||||||
const polyMesh&,
|
const polyMesh&,
|
||||||
const addPatchCellLayer&,
|
const addPatchCellLayer&,
|
||||||
boolList&,
|
const scalarField& oldRealThickness,
|
||||||
boolList&
|
|
||||||
|
labelList& cellStatus,
|
||||||
|
scalarField& faceRealThickness
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Write cellSet,faceSet for layers
|
||||||
|
bool writeLayerData
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& patchIDs,
|
||||||
|
const labelList& cellNLayers,
|
||||||
|
const scalarField& faceWantedThickness,
|
||||||
|
const scalarField& faceRealThickness
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Mesh shrinking (to create space for layers)
|
// Mesh shrinking (to create space for layers)
|
||||||
|
|
||||||
//- Average field (over all subset of mesh points) by
|
//- Average field (over all subset of mesh points) by
|
||||||
|
@ -235,6 +235,12 @@ Foam::layerParameters::layerParameters
|
|||||||
Info<< "Layer thickness specified as final layer and expansion ratio."
|
Info<< "Layer thickness specified as final layer and expansion ratio."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
else if (haveTotal && haveExp)
|
||||||
|
{
|
||||||
|
layerSpec_ = TOTAL_AND_EXPANSION;
|
||||||
|
Info<< "Layer thickness specified as overall thickness"
|
||||||
|
<< " and expansion ratio." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (layerSpec_ == ILLEGAL || nSpec != 2)
|
if (layerSpec_ == ILLEGAL || nSpec != 2)
|
||||||
@ -253,7 +259,9 @@ Foam::layerParameters::layerParameters
|
|||||||
<< " final layer thickness ('finalLayerThickness')"
|
<< " final layer thickness ('finalLayerThickness')"
|
||||||
<< " and expansion ratio ('expansionRatio') or" << nl
|
<< " and expansion ratio ('expansionRatio') or" << nl
|
||||||
<< " final layer thickness ('finalLayerThickness')"
|
<< " final layer thickness ('finalLayerThickness')"
|
||||||
<< " and overall thickness ('thickness')"
|
<< " and overall thickness ('thickness') or" << nl
|
||||||
|
<< " overall thickness ('thickness')"
|
||||||
|
<< " and expansion ratio ('expansionRatio'"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +362,19 @@ Foam::layerParameters::layerParameters
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOTAL_AND_EXPANSION:
|
||||||
|
layerDict.readIfPresent
|
||||||
|
(
|
||||||
|
"thickness",
|
||||||
|
thickness_[patchI]
|
||||||
|
);
|
||||||
|
layerDict.readIfPresent
|
||||||
|
(
|
||||||
|
"expansionRatio",
|
||||||
|
expansionRatio_[patchI]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
@ -390,6 +411,7 @@ Foam::scalar Foam::layerParameters::layerThickness
|
|||||||
{
|
{
|
||||||
case FIRST_AND_TOTAL:
|
case FIRST_AND_TOTAL:
|
||||||
case FINAL_AND_TOTAL:
|
case FINAL_AND_TOTAL:
|
||||||
|
case TOTAL_AND_EXPANSION:
|
||||||
{
|
{
|
||||||
return totalThickness;
|
return totalThickness;
|
||||||
}
|
}
|
||||||
@ -450,6 +472,7 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
|
|||||||
{
|
{
|
||||||
case FIRST_AND_EXPANSION:
|
case FIRST_AND_EXPANSION:
|
||||||
case FINAL_AND_EXPANSION:
|
case FINAL_AND_EXPANSION:
|
||||||
|
case TOTAL_AND_EXPANSION:
|
||||||
{
|
{
|
||||||
return expansionRatio;
|
return expansionRatio;
|
||||||
}
|
}
|
||||||
@ -524,6 +547,18 @@ Foam::scalar Foam::layerParameters::firstLayerThickness
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOTAL_AND_EXPANSION:
|
||||||
|
{
|
||||||
|
scalar r = finalLayerThicknessRatio
|
||||||
|
(
|
||||||
|
nLayers,
|
||||||
|
expansionRatio
|
||||||
|
);
|
||||||
|
scalar finalThickness = r*totalThickness;
|
||||||
|
return finalThickness/pow(expansionRatio, nLayers-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("layerParameters::layerThickness(..)")
|
FatalErrorIn("layerParameters::layerThickness(..)")
|
||||||
|
@ -64,13 +64,15 @@ public:
|
|||||||
// - first and expansion ratio specified
|
// - first and expansion ratio specified
|
||||||
// - final and total thickness specified
|
// - final and total thickness specified
|
||||||
// - final and expansion ratio specified
|
// - final and expansion ratio specified
|
||||||
|
// - total thickness and expansion ratio specified
|
||||||
enum layerSpecification
|
enum layerSpecification
|
||||||
{
|
{
|
||||||
ILLEGAL,
|
ILLEGAL,
|
||||||
FIRST_AND_TOTAL,
|
FIRST_AND_TOTAL,
|
||||||
FIRST_AND_EXPANSION,
|
FIRST_AND_EXPANSION,
|
||||||
FINAL_AND_TOTAL,
|
FINAL_AND_TOTAL,
|
||||||
FINAL_AND_EXPANSION
|
FINAL_AND_EXPANSION,
|
||||||
|
TOTAL_AND_EXPANSION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,6 +31,15 @@ License
|
|||||||
|
|
||||||
void Foam::processorMeshes::read()
|
void Foam::processorMeshes::read()
|
||||||
{
|
{
|
||||||
|
forAll(databases_, procI)
|
||||||
|
{
|
||||||
|
meshes_.set(procI, NULL);
|
||||||
|
pointProcAddressing_.set(procI, NULL);
|
||||||
|
faceProcAddressing_.set(procI, NULL);
|
||||||
|
cellProcAddressing_.set(procI, NULL);
|
||||||
|
boundaryProcAddressing_.set(procI, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
forAll(databases_, procI)
|
forAll(databases_, procI)
|
||||||
{
|
{
|
||||||
meshes_.set
|
meshes_.set
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -53,7 +53,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
lookupGravity_(-1),
|
lookupGravity_(-1),
|
||||||
g_(vector::zero),
|
g_(vector::zero),
|
||||||
relaxationFactor_(1)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
|
rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
|
||||||
lookupGravity_(-1),
|
lookupGravity_(-1),
|
||||||
g_(vector::zero),
|
g_(vector::zero),
|
||||||
relaxationFactor_(dict.lookupOrDefault<scalar>("relaxationFactor", 1))
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
lookupGravity_(ptf.lookupGravity_),
|
lookupGravity_(ptf.lookupGravity_),
|
||||||
g_(ptf.g_),
|
g_(ptf.g_),
|
||||||
relaxationFactor_(ptf.relaxationFactor_)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
lookupGravity_(ptf.lookupGravity_),
|
lookupGravity_(ptf.lookupGravity_),
|
||||||
g_(ptf.g_),
|
g_(ptf.g_),
|
||||||
relaxationFactor_(ptf.relaxationFactor_)
|
curTimeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -203,6 +203,13 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
const Time& t = mesh.time();
|
const Time& t = mesh.time();
|
||||||
const pointPatch& ptPatch = this->patch();
|
const pointPatch& ptPatch = this->patch();
|
||||||
|
|
||||||
|
// Store the motion state at the beginning of the time-step
|
||||||
|
if (curTimeIndex_ != this->db().time().timeIndex())
|
||||||
|
{
|
||||||
|
motion_.newTime();
|
||||||
|
curTimeIndex_ = this->db().time().timeIndex();
|
||||||
|
}
|
||||||
|
|
||||||
// Patch force data is valid for the current positions, so
|
// Patch force data is valid for the current positions, so
|
||||||
// calculate the forces on the motion object from this data, then
|
// calculate the forces on the motion object from this data, then
|
||||||
// update the positions
|
// update the positions
|
||||||
@ -231,7 +238,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
g_ = g.value();
|
g_ = g.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
motion_.updateForce
|
motion_.updateAcceleration
|
||||||
(
|
(
|
||||||
f.forceEff() + g_*motion_.mass(),
|
f.forceEff() + g_*motion_.mass(),
|
||||||
f.momentEff(),
|
f.momentEff(),
|
||||||
@ -240,11 +247,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
|
|
||||||
Field<vector>::operator=
|
Field<vector>::operator=
|
||||||
(
|
(
|
||||||
relaxationFactor_
|
motion_.currentPosition(initialPoints_) - initialPoints_
|
||||||
*(
|
|
||||||
motion_.currentPosition(initialPoints_)
|
|
||||||
- initialPoints_
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
@ -267,9 +270,6 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const
|
|||||||
os.writeKeyword("g") << g_ << token::END_STATEMENT << nl;
|
os.writeKeyword("g") << g_ << token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.writeKeyword("relaxationFactor")
|
|
||||||
<< relaxationFactor_ << token::END_STATEMENT << nl;
|
|
||||||
|
|
||||||
motion_.write(os);
|
motion_.write(os);
|
||||||
|
|
||||||
initialPoints_.writeEntry("initialPoints", os);
|
initialPoints_.writeEntry("initialPoints", os);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -84,8 +84,8 @@ class sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
//- Gravity vector to store when not available from the db
|
//- Gravity vector to store when not available from the db
|
||||||
vector g_;
|
vector g_;
|
||||||
|
|
||||||
//- Optional under-relaxation factor for the motion
|
//- Current time index (used for updating)
|
||||||
scalar relaxationFactor_;
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -164,6 +164,7 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
|||||||
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
||||||
:
|
:
|
||||||
motionState_(),
|
motionState_(),
|
||||||
|
motionState0_(),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
restraintNames_(),
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
@ -173,8 +174,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
|||||||
initialQ_(I),
|
initialQ_(I),
|
||||||
momentOfInertia_(diagTensor::one*VSMALL),
|
momentOfInertia_(diagTensor::one*VSMALL),
|
||||||
mass_(VSMALL),
|
mass_(VSMALL),
|
||||||
cDamp_(0.0),
|
aRelax_(1.0),
|
||||||
aLim_(VGREAT),
|
|
||||||
report_(false)
|
report_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -191,8 +191,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
const point& initialCentreOfMass,
|
const point& initialCentreOfMass,
|
||||||
const tensor& initialQ,
|
const tensor& initialQ,
|
||||||
const diagTensor& momentOfInertia,
|
const diagTensor& momentOfInertia,
|
||||||
scalar cDamp,
|
scalar aRelax,
|
||||||
scalar aLim,
|
|
||||||
bool report
|
bool report
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -205,6 +204,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
pi,
|
pi,
|
||||||
tau
|
tau
|
||||||
),
|
),
|
||||||
|
motionState0_(motionState_),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
restraintNames_(),
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
@ -214,8 +214,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
initialQ_(initialQ),
|
initialQ_(initialQ),
|
||||||
momentOfInertia_(momentOfInertia),
|
momentOfInertia_(momentOfInertia),
|
||||||
mass_(mass),
|
mass_(mass),
|
||||||
cDamp_(cDamp),
|
aRelax_(aRelax),
|
||||||
aLim_(aLim),
|
|
||||||
report_(report)
|
report_(report)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -223,6 +222,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
||||||
:
|
:
|
||||||
motionState_(dict),
|
motionState_(dict),
|
||||||
|
motionState0_(motionState_),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
restraintNames_(),
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
@ -238,8 +238,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
|||||||
),
|
),
|
||||||
momentOfInertia_(dict.lookup("momentOfInertia")),
|
momentOfInertia_(dict.lookup("momentOfInertia")),
|
||||||
mass_(readScalar(dict.lookup("mass"))),
|
mass_(readScalar(dict.lookup("mass"))),
|
||||||
cDamp_(dict.lookupOrDefault<scalar>("accelerationDampingCoeff", 0.0)),
|
aRelax_(dict.lookupOrDefault<scalar>("accelerationRelaxation", 1.0)),
|
||||||
aLim_(dict.lookupOrDefault<scalar>("accelerationLimit", VGREAT)),
|
|
||||||
report_(dict.lookupOrDefault<Switch>("report", false))
|
report_(dict.lookupOrDefault<Switch>("report", false))
|
||||||
{
|
{
|
||||||
addRestraints(dict);
|
addRestraints(dict);
|
||||||
@ -254,6 +253,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
motionState_(sDoFRBM.motionState_),
|
motionState_(sDoFRBM.motionState_),
|
||||||
|
motionState0_(sDoFRBM.motionState0_),
|
||||||
restraints_(sDoFRBM.restraints_),
|
restraints_(sDoFRBM.restraints_),
|
||||||
restraintNames_(sDoFRBM.restraintNames_),
|
restraintNames_(sDoFRBM.restraintNames_),
|
||||||
constraints_(sDoFRBM.constraints_),
|
constraints_(sDoFRBM.constraints_),
|
||||||
@ -263,8 +263,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
initialQ_(sDoFRBM.initialQ_),
|
initialQ_(sDoFRBM.initialQ_),
|
||||||
momentOfInertia_(sDoFRBM.momentOfInertia_),
|
momentOfInertia_(sDoFRBM.momentOfInertia_),
|
||||||
mass_(sDoFRBM.mass_),
|
mass_(sDoFRBM.mass_),
|
||||||
cDamp_(sDoFRBM.cDamp_),
|
aRelax_(sDoFRBM.aRelax_),
|
||||||
aLim_(sDoFRBM.aLim_),
|
|
||||||
report_(sDoFRBM.report_)
|
report_(sDoFRBM.report_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -376,91 +375,59 @@ void Foam::sixDoFRigidBodyMotion::updatePosition
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
vector aClip = a();
|
v() = v0() + 0.5*deltaT0*a();
|
||||||
scalar aMag = mag(aClip);
|
pi() = pi0() + 0.5*deltaT0*tau();
|
||||||
|
|
||||||
if (aMag > SMALL)
|
|
||||||
{
|
|
||||||
aClip /= aMag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aMag > aLim_)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"void Foam::sixDoFRigidBodyMotion::updatePosition"
|
|
||||||
"("
|
|
||||||
"scalar, "
|
|
||||||
"scalar"
|
|
||||||
")"
|
|
||||||
)
|
|
||||||
<< "Limited acceleration " << a()
|
|
||||||
<< " to " << aClip*aLim_
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
v() += 0.5*(1 - cDamp_)*deltaT0*aClip*min(aMag, aLim_);
|
|
||||||
|
|
||||||
pi() += 0.5*(1 - cDamp_)*deltaT0*tau();
|
|
||||||
|
|
||||||
// Leapfrog move part
|
// Leapfrog move part
|
||||||
centreOfMass() += deltaT*v();
|
centreOfMass() = centreOfMass0() + deltaT*v();
|
||||||
|
|
||||||
// Leapfrog orientation adjustment
|
// Leapfrog orientation adjustment
|
||||||
rotate(Q(), pi(), deltaT);
|
Tuple2<tensor, vector> Qpi = rotate(Q0(), pi(), deltaT);
|
||||||
|
Q() = Qpi.first();
|
||||||
|
pi() = Qpi.second();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pstream::scatter(motionState_);
|
Pstream::scatter(motionState_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sixDoFRigidBodyMotion::updateForce
|
void Foam::sixDoFRigidBodyMotion::updateAcceleration
|
||||||
(
|
(
|
||||||
const vector& fGlobal,
|
const vector& fGlobal,
|
||||||
const vector& tauGlobal,
|
const vector& tauGlobal,
|
||||||
scalar deltaT
|
scalar deltaT
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
static bool first = true;
|
||||||
|
|
||||||
// Second leapfrog velocity adjust part, required after motion and
|
// Second leapfrog velocity adjust part, required after motion and
|
||||||
// force calculation
|
// acceleration calculation
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
// Save the previous iteration accelerations for relaxation
|
||||||
|
vector aPrevIter = a();
|
||||||
|
vector tauPrevIter = tau();
|
||||||
|
|
||||||
|
// Calculate new accelerations
|
||||||
a() = fGlobal/mass_;
|
a() = fGlobal/mass_;
|
||||||
|
|
||||||
tau() = (Q().T() & tauGlobal);
|
tau() = (Q().T() & tauGlobal);
|
||||||
|
|
||||||
applyRestraints();
|
applyRestraints();
|
||||||
|
|
||||||
|
// Relax accelerations on all but first iteration
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
|
a() = aRelax_*a() + (1 - aRelax_)*aPrevIter;
|
||||||
|
tau() = aRelax_*tau() + (1 - aRelax_)*tauPrevIter;
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
|
||||||
|
// Apply constraints after relaxation
|
||||||
applyConstraints(deltaT);
|
applyConstraints(deltaT);
|
||||||
|
|
||||||
vector aClip = a();
|
// Correct velocities
|
||||||
scalar aMag = mag(aClip);
|
v() += 0.5*deltaT*a();
|
||||||
|
pi() += 0.5*deltaT*tau();
|
||||||
if (aMag > SMALL)
|
|
||||||
{
|
|
||||||
aClip /= aMag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aMag > aLim_)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"void Foam::sixDoFRigidBodyMotion::updateForce"
|
|
||||||
"("
|
|
||||||
"const vector&, "
|
|
||||||
"const vector&, "
|
|
||||||
"scalar"
|
|
||||||
")"
|
|
||||||
)
|
|
||||||
<< "Limited acceleration " << a()
|
|
||||||
<< " to " << aClip*aLim_
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
v() += 0.5*(1 - cDamp_)*deltaT*aClip*min(aMag, aLim_);
|
|
||||||
|
|
||||||
pi() += 0.5*(1 - cDamp_)*deltaT*tau();
|
|
||||||
|
|
||||||
if (report_)
|
if (report_)
|
||||||
{
|
{
|
||||||
@ -472,7 +439,27 @@ void Foam::sixDoFRigidBodyMotion::updateForce
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sixDoFRigidBodyMotion::updateForce
|
void Foam::sixDoFRigidBodyMotion::updateVelocity(scalar deltaT)
|
||||||
|
{
|
||||||
|
// Second leapfrog velocity adjust part, required after motion and
|
||||||
|
// acceleration calculation
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
v() += 0.5*deltaT*a();
|
||||||
|
pi() += 0.5*deltaT*tau();
|
||||||
|
|
||||||
|
if (report_)
|
||||||
|
{
|
||||||
|
status();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::scatter(motionState_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotion::updateAcceleration
|
||||||
(
|
(
|
||||||
const pointField& positions,
|
const pointField& positions,
|
||||||
const vectorField& forces,
|
const vectorField& forces,
|
||||||
@ -493,7 +480,7 @@ void Foam::sixDoFRigidBodyMotion::updateForce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateForce(fGlobal, tauGlobal, deltaT);
|
updateAcceleration(fGlobal, tauGlobal, deltaT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -506,19 +493,14 @@ Foam::point Foam::sixDoFRigidBodyMotion::predictedPosition
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector vTemp = v() + deltaT*(a() + deltaForce/mass_);
|
vector vTemp = v() + deltaT*(a() + deltaForce/mass_);
|
||||||
|
|
||||||
vector piTemp = pi() + deltaT*(tau() + (Q().T() & deltaMoment));
|
vector piTemp = pi() + deltaT*(tau() + (Q().T() & deltaMoment));
|
||||||
|
point centreOfMassTemp = centreOfMass0() + deltaT*vTemp;
|
||||||
point centreOfMassTemp = centreOfMass() + deltaT*vTemp;
|
Tuple2<tensor, vector> QpiTemp = rotate(Q0(), piTemp, deltaT);
|
||||||
|
|
||||||
tensor QTemp = Q();
|
|
||||||
|
|
||||||
rotate(QTemp, piTemp, deltaT);
|
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
centreOfMassTemp
|
centreOfMassTemp
|
||||||
+ (QTemp & initialQ_.T() & (pInitial - initialCentreOfMass_))
|
+ (QpiTemp.first() & initialQ_.T() & (pInitial - initialCentreOfMass_))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,12 +513,9 @@ Foam::vector Foam::sixDoFRigidBodyMotion::predictedOrientation
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector piTemp = pi() + deltaT*(tau() + (Q().T() & deltaMoment));
|
vector piTemp = pi() + deltaT*(tau() + (Q().T() & deltaMoment));
|
||||||
|
Tuple2<tensor, vector> QpiTemp = rotate(Q0(), piTemp, deltaT);
|
||||||
|
|
||||||
tensor QTemp = Q();
|
return (QpiTemp.first() & initialQ_.T() & vInitial);
|
||||||
|
|
||||||
rotate(QTemp, piTemp, deltaT);
|
|
||||||
|
|
||||||
return (QTemp & initialQ_.T() & vInitial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -59,7 +59,7 @@ SourceFiles
|
|||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "sixDoFRigidBodyMotionRestraint.H"
|
#include "sixDoFRigidBodyMotionRestraint.H"
|
||||||
#include "sixDoFRigidBodyMotionConstraint.H"
|
#include "sixDoFRigidBodyMotionConstraint.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -87,6 +87,9 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Motion state data object
|
//- Motion state data object
|
||||||
sixDoFRigidBodyMotionState motionState_;
|
sixDoFRigidBodyMotionState motionState_;
|
||||||
|
|
||||||
|
//- Motion state data object for previous time-step
|
||||||
|
sixDoFRigidBodyMotionState motionState0_;
|
||||||
|
|
||||||
//- Restraints on the motion
|
//- Restraints on the motion
|
||||||
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
|
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
|
||||||
|
|
||||||
@ -116,14 +119,8 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Mass of the body
|
//- Mass of the body
|
||||||
scalar mass_;
|
scalar mass_;
|
||||||
|
|
||||||
//- Acceleration damping coefficient. Modify applied acceleration:
|
//- Acceleration relaxation coefficient
|
||||||
// v1 = v0 + a*dt - cDamp*a*dt
|
scalar aRelax_;
|
||||||
// = v0 + dt*f*(1 - cDamp)/m
|
|
||||||
// Increases effective mass by 1/(1 - cDamp).
|
|
||||||
scalar cDamp_;
|
|
||||||
|
|
||||||
//- Acceleration magnitude limit - clips large accelerations
|
|
||||||
scalar aLim_;
|
|
||||||
|
|
||||||
//- Switch to turn reporting of motion data on and off
|
//- Switch to turn reporting of motion data on and off
|
||||||
Switch report_;
|
Switch report_;
|
||||||
@ -143,8 +140,14 @@ class sixDoFRigidBodyMotion
|
|||||||
// frame z-axis by the given angle
|
// frame z-axis by the given angle
|
||||||
inline tensor rotationTensorZ(scalar deltaT) const;
|
inline tensor rotationTensorZ(scalar deltaT) const;
|
||||||
|
|
||||||
//- Apply rotation tensors to Q for the given torque (pi) and deltaT
|
//- Apply rotation tensors to Q0 for the given torque (pi) and deltaT
|
||||||
inline void rotate(tensor& Q, vector& pi, scalar deltaT) const;
|
// and return the rotated Q and pi as a tuple
|
||||||
|
inline Tuple2<tensor, vector> rotate
|
||||||
|
(
|
||||||
|
const tensor& Q0,
|
||||||
|
const vector& pi,
|
||||||
|
const scalar deltaT
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Apply the restraints to the object
|
//- Apply the restraints to the object
|
||||||
void applyRestraints();
|
void applyRestraints();
|
||||||
@ -152,6 +155,7 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Apply the constraints to the object
|
//- Apply the constraints to the object
|
||||||
void applyConstraints(scalar deltaT);
|
void applyConstraints(scalar deltaT);
|
||||||
|
|
||||||
|
|
||||||
// Access functions retained as private because of the risk of
|
// Access functions retained as private because of the risk of
|
||||||
// confusion over what is a body local frame vector and what is global
|
// confusion over what is a body local frame vector and what is global
|
||||||
|
|
||||||
@ -199,6 +203,21 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Return access to torque
|
//- Return access to torque
|
||||||
inline const vector& tau() const;
|
inline const vector& tau() const;
|
||||||
|
|
||||||
|
//- Return access to the orientation at previous time-step
|
||||||
|
inline const tensor& Q0() const;
|
||||||
|
|
||||||
|
//- Return access to velocity at previous time-step
|
||||||
|
inline const vector& v0() const;
|
||||||
|
|
||||||
|
//- Return access to acceleration at previous time-step
|
||||||
|
inline const vector& a0() const;
|
||||||
|
|
||||||
|
//- Return access to angular momentum at previous time-step
|
||||||
|
inline const vector& pi0() const;
|
||||||
|
|
||||||
|
//- Return access to torque at previous time-step
|
||||||
|
inline const vector& tau0() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
@ -244,8 +263,7 @@ public:
|
|||||||
const point& initialCentreOfMass,
|
const point& initialCentreOfMass,
|
||||||
const tensor& initialQ,
|
const tensor& initialQ,
|
||||||
const diagTensor& momentOfInertia,
|
const diagTensor& momentOfInertia,
|
||||||
scalar cDamp = 0.0,
|
scalar aRelax = 1.0,
|
||||||
scalar aLim = VGREAT,
|
|
||||||
bool report = false
|
bool report = false
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -279,18 +297,22 @@ public:
|
|||||||
scalar deltaT0
|
scalar deltaT0
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Second leapfrog velocity adjust part, required after motion and
|
//- Second leapfrog velocity adjust part
|
||||||
// force calculation
|
// required after motion and force calculation
|
||||||
void updateForce
|
void updateAcceleration
|
||||||
(
|
(
|
||||||
const vector& fGlobal,
|
const vector& fGlobal,
|
||||||
const vector& tauGlobal,
|
const vector& tauGlobal,
|
||||||
scalar deltaT
|
scalar deltaT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Second leapfrog velocity adjust part
|
||||||
|
// required after motion and force calculation
|
||||||
|
void updateVelocity(scalar deltaT);
|
||||||
|
|
||||||
//- Global forces supplied at locations, calculating net force
|
//- Global forces supplied at locations, calculating net force
|
||||||
// and moment
|
// and moment
|
||||||
void updateForce
|
void updateAcceleration
|
||||||
(
|
(
|
||||||
const pointField& positions,
|
const pointField& positions,
|
||||||
const vectorField& forces,
|
const vectorField& forces,
|
||||||
@ -354,6 +376,9 @@ public:
|
|||||||
//- Return const access to the centre of mass
|
//- Return const access to the centre of mass
|
||||||
inline const point& centreOfMass() const;
|
inline const point& centreOfMass() const;
|
||||||
|
|
||||||
|
//- Return const access to the centre of mass at previous time-step
|
||||||
|
inline const point& centreOfMass0() const;
|
||||||
|
|
||||||
//- Return access to the inertia tensor
|
//- Return access to the inertia tensor
|
||||||
inline const diagTensor& momentOfInertia() const;
|
inline const diagTensor& momentOfInertia() const;
|
||||||
|
|
||||||
@ -366,6 +391,9 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
//- Store the motion state at the beginning of the time-step
|
||||||
|
inline void newTime();
|
||||||
|
|
||||||
//- Return non-const access to the centre of mass
|
//- Return non-const access to the centre of mass
|
||||||
inline point& centreOfMass();
|
inline point& centreOfMass();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -61,16 +61,19 @@ Foam::sixDoFRigidBodyMotion::rotationTensorZ(scalar phi) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::sixDoFRigidBodyMotion::rotate
|
inline Foam::Tuple2<Foam::tensor, Foam::vector>
|
||||||
|
Foam::sixDoFRigidBodyMotion::rotate
|
||||||
(
|
(
|
||||||
tensor& Q,
|
const tensor& Q0,
|
||||||
vector& pi,
|
const vector& pi0,
|
||||||
scalar deltaT
|
const scalar deltaT
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tensor R;
|
Tuple2<tensor, vector> Qpi(Q0, pi0);
|
||||||
|
tensor& Q = Qpi.first();
|
||||||
|
vector& pi = Qpi.second();
|
||||||
|
|
||||||
R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
|
tensor R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
|
||||||
pi = pi & R;
|
pi = pi & R;
|
||||||
Q = Q & R;
|
Q = Q & R;
|
||||||
|
|
||||||
@ -89,6 +92,8 @@ inline void Foam::sixDoFRigidBodyMotion::rotate
|
|||||||
R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
|
R = rotationTensorX(0.5*deltaT*pi.x()/momentOfInertia_.xx());
|
||||||
pi = pi & R;
|
pi = pi & R;
|
||||||
Q = Q & R;
|
Q = Q & R;
|
||||||
|
|
||||||
|
return Qpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,6 +181,36 @@ inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::tensor& Foam::sixDoFRigidBodyMotion::Q0() const
|
||||||
|
{
|
||||||
|
return motionState0_.Q();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::v0() const
|
||||||
|
{
|
||||||
|
return motionState0_.v();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::a0() const
|
||||||
|
{
|
||||||
|
return motionState0_.a();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::pi0() const
|
||||||
|
{
|
||||||
|
return motionState0_.pi();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau0() const
|
||||||
|
{
|
||||||
|
return motionState0_.tau();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::point& Foam::sixDoFRigidBodyMotion::initialCentreOfMass()
|
inline Foam::point& Foam::sixDoFRigidBodyMotion::initialCentreOfMass()
|
||||||
{
|
{
|
||||||
return initialCentreOfMass_;
|
return initialCentreOfMass_;
|
||||||
@ -281,6 +316,12 @@ inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass0() const
|
||||||
|
{
|
||||||
|
return motionState0_.centreOfMass();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::diagTensor&
|
inline const Foam::diagTensor&
|
||||||
Foam::sixDoFRigidBodyMotion::momentOfInertia() const
|
Foam::sixDoFRigidBodyMotion::momentOfInertia() const
|
||||||
{
|
{
|
||||||
@ -300,6 +341,12 @@ inline bool Foam::sixDoFRigidBodyMotion::report() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::sixDoFRigidBodyMotion::newTime()
|
||||||
|
{
|
||||||
|
motionState0_ = motionState_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass()
|
inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass()
|
||||||
{
|
{
|
||||||
return motionState_.centreOfMass();
|
return motionState_.centreOfMass();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,10 +40,8 @@ void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const
|
|||||||
<< momentOfInertia_ << token::END_STATEMENT << nl;
|
<< momentOfInertia_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("mass")
|
os.writeKeyword("mass")
|
||||||
<< mass_ << token::END_STATEMENT << nl;
|
<< mass_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("accelerationDampingCoeff")
|
os.writeKeyword("accelerationRelaxation")
|
||||||
<< cDamp_ << token::END_STATEMENT << nl;
|
<< aRelax_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("accelerationLimit")
|
|
||||||
<< aLim_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("report")
|
os.writeKeyword("report")
|
||||||
<< report_ << token::END_STATEMENT << nl;
|
<< report_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -160,7 +160,11 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do not modify the accelerations, except with gravity, where available
|
// Do not modify the accelerations, except with gravity, where available
|
||||||
motion_.updateForce(gravity*motion_.mass(), vector::zero, t.deltaTValue());
|
motion_.updateAcceleration
|
||||||
|
(
|
||||||
|
gravity*motion_.mass(),
|
||||||
|
vector::zero, t.deltaTValue()
|
||||||
|
);
|
||||||
|
|
||||||
Field<vector>::operator=
|
Field<vector>::operator=
|
||||||
(
|
(
|
||||||
|
@ -36,7 +36,7 @@ Foam::chemistryModel<CompType, ThermoType>::chemistryModel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
CompType(mesh),
|
CompType(mesh),
|
||||||
ODE(),
|
ODESystem(),
|
||||||
Y_(this->thermo().composition().Y()),
|
Y_(this->thermo().composition().Y()),
|
||||||
reactions_
|
reactions_
|
||||||
(
|
(
|
||||||
|
@ -39,7 +39,7 @@ SourceFiles
|
|||||||
#define chemistryModel_H
|
#define chemistryModel_H
|
||||||
|
|
||||||
#include "Reaction.H"
|
#include "Reaction.H"
|
||||||
#include "ODE.H"
|
#include "ODESystem.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "simpleMatrix.H"
|
#include "simpleMatrix.H"
|
||||||
#include "DimensionedField.H"
|
#include "DimensionedField.H"
|
||||||
@ -60,7 +60,7 @@ template<class CompType, class ThermoType>
|
|||||||
class chemistryModel
|
class chemistryModel
|
||||||
:
|
:
|
||||||
public CompType,
|
public CompType,
|
||||||
public ODE
|
public ODESystem
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ solidChemistryModel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
CompType(mesh),
|
CompType(mesh),
|
||||||
ODE(),
|
ODESystem(),
|
||||||
Ys_(this->solidThermo().composition().Y()),
|
Ys_(this->solidThermo().composition().Y()),
|
||||||
reactions_
|
reactions_
|
||||||
(
|
(
|
||||||
|
@ -40,7 +40,7 @@ SourceFiles
|
|||||||
#define solidChemistryModel_H
|
#define solidChemistryModel_H
|
||||||
|
|
||||||
#include "Reaction.H"
|
#include "Reaction.H"
|
||||||
#include "ODE.H"
|
#include "ODESystem.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "DimensionedField.H"
|
#include "DimensionedField.H"
|
||||||
#include "simpleMatrix.H"
|
#include "simpleMatrix.H"
|
||||||
@ -61,7 +61,7 @@ template<class CompType, class SolidThermo>
|
|||||||
class solidChemistryModel
|
class solidChemistryModel
|
||||||
:
|
:
|
||||||
public CompType,
|
public CompType,
|
||||||
public ODE
|
public ODESystem
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application interDyMFoam;
|
application interDyMFoam;
|
||||||
|
|
||||||
startFrom latestTime;
|
startFrom startTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ deltaT 0.01;
|
|||||||
|
|
||||||
writeControl adjustableRunTime;
|
writeControl adjustableRunTime;
|
||||||
|
|
||||||
writeInterval 0.1;
|
writeInterval 0.2;
|
||||||
|
|
||||||
purgeWrite 0;
|
purgeWrite 0;
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ runTimeModifiable yes;
|
|||||||
|
|
||||||
adjustTimeStep yes;
|
adjustTimeStep yes;
|
||||||
|
|
||||||
maxCo 0.5;
|
maxCo 5;
|
||||||
maxAlphaCo 0.5;
|
maxAlphaCo 5;
|
||||||
maxDeltaT 0.01;
|
maxDeltaT 1;
|
||||||
|
|
||||||
libs
|
libs
|
||||||
(
|
(
|
||||||
|
@ -27,7 +27,7 @@ gradSchemes
|
|||||||
|
|
||||||
divSchemes
|
divSchemes
|
||||||
{
|
{
|
||||||
div(rho*phi,U) Gauss vanLeerV;
|
div(rhoPhi,U) Gauss vanLeerV;
|
||||||
div(phi,alpha) Gauss vanLeer;
|
div(phi,alpha) Gauss vanLeer;
|
||||||
div(phirb,alpha) Gauss interfaceCompression;
|
div(phirb,alpha) Gauss interfaceCompression;
|
||||||
div(phi,k) Gauss upwind;
|
div(phi,k) Gauss upwind;
|
||||||
@ -55,7 +55,7 @@ fluxRequired
|
|||||||
default no;
|
default no;
|
||||||
p_rgh;
|
p_rgh;
|
||||||
pcorr;
|
pcorr;
|
||||||
alpha;
|
alpha.water;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
cellDisplacement
|
"cellDisplacement.*"
|
||||||
{
|
{
|
||||||
solver GAMG;
|
solver GAMG;
|
||||||
tolerance 1e-5;
|
tolerance 1e-5;
|
||||||
@ -29,14 +29,24 @@ solvers
|
|||||||
mergeLevels 1;
|
mergeLevels 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpha.water
|
"alpha.water.*"
|
||||||
{
|
{
|
||||||
nAlphaCorr 1;
|
nAlphaCorr 1;
|
||||||
nAlphaSubCycles 3;
|
nAlphaSubCycles 1;
|
||||||
cAlpha 1;
|
cAlpha 1;
|
||||||
|
|
||||||
|
alphaOuterCorrectors yes;
|
||||||
|
|
||||||
|
MULESCorr yes;
|
||||||
|
nLimiterIter 5;
|
||||||
|
|
||||||
|
solver PBiCG;
|
||||||
|
preconditioner DILU;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcorr
|
"pcorr.*"
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner
|
preconditioner
|
||||||
@ -120,9 +130,11 @@ solvers
|
|||||||
PIMPLE
|
PIMPLE
|
||||||
{
|
{
|
||||||
momentumPredictor no;
|
momentumPredictor no;
|
||||||
nCorrectors 2;
|
nOuterCorrectors 6;
|
||||||
|
nCorrectors 1;
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
correctPhi yes;
|
correctPhi yes;
|
||||||
|
moveMeshOuterCorrectors yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
@ -132,7 +144,7 @@ relaxationFactors
|
|||||||
}
|
}
|
||||||
equations
|
equations
|
||||||
{
|
{
|
||||||
"(U|k|epsilon|omega|R|nuTilda).*" 1;
|
".*" 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user