mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvm' of /home/noisy3/OpenFOAM/OpenFOAM-dev into cvm
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
volScalarField rAUrel = 1.0/UrelEqn().A();
|
volScalarField rAUrel(1.0/UrelEqn().A());
|
||||||
Urel = rAUrel*UrelEqn().H();
|
Urel = rAUrel*UrelEqn().H();
|
||||||
|
|
||||||
if (pimple.nCorr() <= 1)
|
if (pimple.nCorr() <= 1)
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -73,34 +73,23 @@ Foam::tmp<Foam::volScalarField> Foam::GidaspowErgunWenYu::K
|
|||||||
volScalarField bp(pow(beta, -2.65));
|
volScalarField bp(pow(beta, -2.65));
|
||||||
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
||||||
|
|
||||||
volScalarField Cds(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re);
|
volScalarField Cds
|
||||||
|
(
|
||||||
forAll(Re, celli)
|
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
|
||||||
{
|
+ pos(Re - 1000)*0.44
|
||||||
if (Re[celli] > 1000.0)
|
);
|
||||||
{
|
|
||||||
Cds[celli] = 0.44;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wen and Yu (1966)
|
// Wen and Yu (1966)
|
||||||
tmp<volScalarField> tKWenYu = 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d();
|
return
|
||||||
volScalarField& KWenYu = tKWenYu();
|
(
|
||||||
|
pos(beta - 0.8)
|
||||||
// Ergun
|
*(0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d())
|
||||||
forAll (beta, cellj)
|
+ neg(beta - 0.8)
|
||||||
{
|
*(
|
||||||
if (beta[cellj] <= 0.8)
|
150.0*alpha_*phaseb_.nu()*phaseb_.rho()/(sqr(beta*phasea_.d()))
|
||||||
{
|
+ 1.75*phaseb_.rho()*Ur/(beta*phasea_.d())
|
||||||
KWenYu[cellj] =
|
)
|
||||||
150.0*alpha_[cellj]*phaseb_.nu().value()*phaseb_.rho().value()
|
);
|
||||||
/sqr(beta[cellj]*phasea_.d().value())
|
|
||||||
+ 1.75*phaseb_.rho().value()*Ur[cellj]
|
|
||||||
/(beta[cellj]*phasea_.d().value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tKWenYu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -72,15 +72,12 @@ Foam::tmp<Foam::volScalarField> Foam::GidaspowSchillerNaumann::K
|
|||||||
volScalarField bp(pow(beta, -2.65));
|
volScalarField bp(pow(beta, -2.65));
|
||||||
|
|
||||||
volScalarField Re(max(beta*Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
volScalarField Re(max(beta*Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
||||||
volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re);
|
|
||||||
|
|
||||||
forAll(Re, celli)
|
volScalarField Cds
|
||||||
{
|
(
|
||||||
if (Re[celli] > 1000.0)
|
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
|
||||||
{
|
+ pos(Re - 1000)*0.44
|
||||||
Cds[celli] = 0.44;
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d();
|
return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -69,15 +69,12 @@ Foam::tmp<Foam::volScalarField> Foam::SchillerNaumann::K
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
||||||
volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re);
|
|
||||||
|
|
||||||
forAll(Re, celli)
|
volScalarField Cds
|
||||||
{
|
(
|
||||||
if (Re[celli] > 1000.0)
|
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
|
||||||
{
|
+ pos(Re - 1000)*0.44
|
||||||
Cds[celli] = 0.44;
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.75*Cds*phaseb_.rho()*Ur/phasea_.d();
|
return 0.75*Cds*phaseb_.rho()*Ur/phasea_.d();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,15 +70,11 @@ Foam::tmp<Foam::volScalarField> Foam::SyamlalOBrien::K
|
|||||||
{
|
{
|
||||||
volScalarField beta(max(scalar(1) - alpha_, scalar(1.0e-6)));
|
volScalarField beta(max(scalar(1) - alpha_, scalar(1.0e-6)));
|
||||||
volScalarField A(pow(beta, 4.14));
|
volScalarField A(pow(beta, 4.14));
|
||||||
volScalarField B(0.8*pow(beta, 1.28));
|
volScalarField B
|
||||||
|
(
|
||||||
forAll (beta, celli)
|
neg(beta - 0.85)*(0.8*pow(beta, 1.28))
|
||||||
{
|
+ pos(beta - 0.85)*(pow(beta, 2.65))
|
||||||
if (beta[celli] > 0.85)
|
);
|
||||||
{
|
|
||||||
B[celli] = pow(beta[celli], 2.65);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
||||||
|
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -72,15 +72,11 @@ Foam::tmp<Foam::volScalarField> Foam::WenYu::K
|
|||||||
volScalarField bp(pow(beta, -2.65));
|
volScalarField bp(pow(beta, -2.65));
|
||||||
|
|
||||||
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
volScalarField Re(max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3)));
|
||||||
volScalarField Cds(24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re);
|
volScalarField Cds
|
||||||
|
(
|
||||||
forAll(Re, celli)
|
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
|
||||||
{
|
+ pos(Re - 1000)*0.44
|
||||||
if (Re[celli] > 1000.0)
|
);
|
||||||
{
|
|
||||||
Cds[celli] = 0.44;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d();
|
return 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,7 @@ void drawHitProblem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalarField curvature(const triSurface& surf)
|
scalarField calcCurvature(const triSurface& surf)
|
||||||
{
|
{
|
||||||
scalarField k(surf.points().size(), 0);
|
scalarField k(surf.points().size(), 0);
|
||||||
|
|
||||||
@ -400,6 +400,16 @@ int main(int argc, char *argv[])
|
|||||||
"writeObj",
|
"writeObj",
|
||||||
"write extendedFeatureEdgeMesh obj files"
|
"write extendedFeatureEdgeMesh obj files"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"writeVTK",
|
||||||
|
"write extendedFeatureEdgeMesh vtk files"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"calcCurvature",
|
||||||
|
"calculate curvature and closeness fields"
|
||||||
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"closeness",
|
"closeness",
|
||||||
@ -427,7 +437,13 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
if (env("FOAM_SIGFPE"))
|
bool writeVTK = args.optionFound("writeVTK");
|
||||||
|
|
||||||
|
bool writeObj = args.optionFound("writeObj");
|
||||||
|
|
||||||
|
bool curvature = args.optionFound("curvature");
|
||||||
|
|
||||||
|
if (curvature && env("FOAM_SIGFPE"))
|
||||||
{
|
{
|
||||||
WarningIn(args.executable())
|
WarningIn(args.executable())
|
||||||
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
|
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
|
||||||
@ -441,10 +457,6 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Feature line extraction is only valid on closed manifold surfaces."
|
Info<< "Feature line extraction is only valid on closed manifold surfaces."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
bool writeVTK = args.optionFound("writeVTK");
|
|
||||||
|
|
||||||
bool writeObj = args.optionFound("writeObj");
|
|
||||||
|
|
||||||
const fileName surfFileName = args[1];
|
const fileName surfFileName = args[1];
|
||||||
const fileName outFileName = args[2];
|
const fileName outFileName = args[2];
|
||||||
|
|
||||||
@ -674,6 +686,13 @@ int main(int argc, char *argv[])
|
|||||||
surf
|
surf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!curvature)
|
||||||
|
{
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Find close features
|
// Find close features
|
||||||
|
|
||||||
// // Dummy trim operation to mark features
|
// // Dummy trim operation to mark features
|
||||||
@ -741,7 +760,8 @@ int main(int argc, char *argv[])
|
|||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// Examine curvature, feature proximity and internal and external closeness.
|
Info<< "Examine curvature, feature proximity and internal and "
|
||||||
|
<< "external closeness." << endl;
|
||||||
|
|
||||||
// Internal and external closeness
|
// Internal and external closeness
|
||||||
|
|
||||||
@ -935,7 +955,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
externalClosenessField.write();
|
externalClosenessField.write();
|
||||||
|
|
||||||
scalarField k = curvature(surf);
|
scalarField k = calcCurvature(surf);
|
||||||
|
|
||||||
// Modify the curvature values on feature edges and points to be zero.
|
// Modify the curvature values on feature edges and points to be zero.
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,10 @@ Description
|
|||||||
|
|
||||||
#ifdef USE_RANDOM
|
#ifdef USE_RANDOM
|
||||||
# include <climits>
|
# include <climits>
|
||||||
|
# if INT_MAX != 2147483647
|
||||||
|
# error "INT_MAX != 2147483647"
|
||||||
|
# error "The random number generator may not work!"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -1250,7 +1254,7 @@ Foam::label Foam::osRandomInteger()
|
|||||||
Foam::scalar Foam::osRandomDouble()
|
Foam::scalar Foam::osRandomDouble()
|
||||||
{
|
{
|
||||||
#ifdef USE_RANDOM
|
#ifdef USE_RANDOM
|
||||||
return (scalar)random();
|
return (scalar)random()/INT_MAX;
|
||||||
#else
|
#else
|
||||||
return drand48();
|
return drand48();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
global/global.Cver
|
global/global.Cver
|
||||||
global/constants/constants.C
|
/* global/constants/constants.C in global.Cver */
|
||||||
global/constants/dimensionedConstants.C
|
/* global/constants/dimensionedConstants.C in global.Cver */
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ $(StringStreams)/StringStreamsPrint.C
|
|||||||
Pstreams = $(Streams)/Pstreams
|
Pstreams = $(Streams)/Pstreams
|
||||||
$(Pstreams)/UIPstream.C
|
$(Pstreams)/UIPstream.C
|
||||||
$(Pstreams)/IPstream.C
|
$(Pstreams)/IPstream.C
|
||||||
$(Pstreams)/UPstream.C
|
/* $(Pstreams)/UPstream.C in global.Cver */
|
||||||
$(Pstreams)/UPstreamCommsStruct.C
|
$(Pstreams)/UPstreamCommsStruct.C
|
||||||
$(Pstreams)/Pstream.C
|
$(Pstreams)/Pstream.C
|
||||||
$(Pstreams)/UOPstream.C
|
$(Pstreams)/UOPstream.C
|
||||||
@ -181,7 +181,7 @@ $(IOobject)/IOobjectReadHeader.C
|
|||||||
$(IOobject)/IOobjectWriteHeader.C
|
$(IOobject)/IOobjectWriteHeader.C
|
||||||
|
|
||||||
regIOobject = db/regIOobject
|
regIOobject = db/regIOobject
|
||||||
$(regIOobject)/regIOobject.C
|
/* $(regIOobject)/regIOobject.C in global.Cver */
|
||||||
$(regIOobject)/regIOobjectRead.C
|
$(regIOobject)/regIOobjectRead.C
|
||||||
$(regIOobject)/regIOobjectWrite.C
|
$(regIOobject)/regIOobjectWrite.C
|
||||||
|
|
||||||
|
|||||||
@ -197,8 +197,22 @@ Foam::functionEntries::codeStream::getFunction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// all processes must wait for compile to finish
|
// all processes must wait for compile to finish - except if this
|
||||||
reduce(create, orOp<bool>());
|
// file is only read on the master
|
||||||
|
bool masterOnly =
|
||||||
|
(
|
||||||
|
regIOobject::fileModificationChecking
|
||||||
|
== regIOobject::timeStampMaster
|
||||||
|
)
|
||||||
|
|| (
|
||||||
|
regIOobject::fileModificationChecking
|
||||||
|
== regIOobject::inotifyMaster
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!masterOnly)
|
||||||
|
{
|
||||||
|
reduce(create, orOp<bool>());
|
||||||
|
}
|
||||||
|
|
||||||
if (isA<IOdictionary>(topDict(parentDict)))
|
if (isA<IOdictionary>(topDict(parentDict)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,6 +65,22 @@ bool Foam::JobInfo::constructed(false);
|
|||||||
|
|
||||||
#include "debug.C"
|
#include "debug.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Read file modification checking switches
|
||||||
|
|
||||||
|
#include "regIOobject.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Read parallel communication switches
|
||||||
|
|
||||||
|
#include "UPstream.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Read constants
|
||||||
|
|
||||||
|
#include "constants.C"
|
||||||
|
#include "dimensionedConstants.C"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Read and set cell models
|
// Read and set cell models
|
||||||
|
|
||||||
|
|||||||
@ -83,10 +83,8 @@ class fanPressureFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public totalPressureFvPatchScalarField
|
public totalPressureFvPatchScalarField
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Tabulated fan curve
|
public:
|
||||||
interpolationTable<scalar> fanCurve_;
|
|
||||||
|
|
||||||
//- Fan flow direction
|
//- Fan flow direction
|
||||||
enum fanFlowDirection
|
enum fanFlowDirection
|
||||||
@ -97,6 +95,13 @@ class fanPressureFvPatchScalarField
|
|||||||
|
|
||||||
static const NamedEnum<fanFlowDirection, 2> fanFlowDirectionNames_;
|
static const NamedEnum<fanFlowDirection, 2> fanFlowDirectionNames_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Tabulated fan curve
|
||||||
|
interpolationTable<scalar> fanCurve_;
|
||||||
|
|
||||||
//- Direction of flow through the fan relative to patch
|
//- Direction of flow through the fan relative to patch
|
||||||
fanFlowDirection direction_;
|
fanFlowDirection direction_;
|
||||||
|
|
||||||
|
|||||||
@ -1318,7 +1318,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< " Total number of vertices before redistribution "
|
Info<< " Total number of vertices before redistribution "
|
||||||
<< globalNRealVertices
|
<< returnReduce(label(number_of_vertices()), sumOp<label>())
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Pout<< " Real vertices before distribution "
|
// Pout<< " Real vertices before distribution "
|
||||||
@ -1446,9 +1446,8 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
|
|||||||
// processor each point should be on, so give distribute = false
|
// processor each point should be on, so give distribute = false
|
||||||
insertPoints(pointsToInsert, indices, types, false);
|
insertPoints(pointsToInsert, indices, types, false);
|
||||||
|
|
||||||
// Adjust by 8 because of insertion of bounding points by reset
|
|
||||||
Info<< " Total number of vertices after redistribution "
|
Info<< " Total number of vertices after redistribution "
|
||||||
<< returnReduce(label(number_of_vertices() - 8), sumOp<label>())
|
<< returnReduce(label(number_of_vertices()), sumOp<label>())
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Pout<< " Real vertices after distribution "
|
// Pout<< " Real vertices after distribution "
|
||||||
|
|||||||
@ -203,7 +203,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
// 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
|
||||||
|
|
||||||
motion_.updatePosition(t.deltaTValue());
|
motion_.updatePosition(t.deltaTValue(), t.deltaT0Value());
|
||||||
|
|
||||||
dictionary forcesDict;
|
dictionary forcesDict;
|
||||||
|
|
||||||
|
|||||||
@ -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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -174,6 +174,8 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
|||||||
initialQ_(I),
|
initialQ_(I),
|
||||||
momentOfInertia_(diagTensor::one*VSMALL),
|
momentOfInertia_(diagTensor::one*VSMALL),
|
||||||
mass_(VSMALL),
|
mass_(VSMALL),
|
||||||
|
cDamp_(0.0),
|
||||||
|
aLim_(VGREAT),
|
||||||
report_(false)
|
report_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -190,6 +192,8 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
const point& initialCentreOfMass,
|
const point& initialCentreOfMass,
|
||||||
const tensor& initialQ,
|
const tensor& initialQ,
|
||||||
const diagTensor& momentOfInertia,
|
const diagTensor& momentOfInertia,
|
||||||
|
scalar cDamp,
|
||||||
|
scalar aLim,
|
||||||
bool report
|
bool report
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -211,6 +215,8 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
initialQ_(initialQ),
|
initialQ_(initialQ),
|
||||||
momentOfInertia_(momentOfInertia),
|
momentOfInertia_(momentOfInertia),
|
||||||
mass_(mass),
|
mass_(mass),
|
||||||
|
cDamp_(cDamp),
|
||||||
|
aLim_(aLim),
|
||||||
report_(report)
|
report_(report)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -233,6 +239,8 @@ 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)),
|
||||||
|
aLim_(dict.lookupOrDefault<scalar>("accelerationLimit", VGREAT)),
|
||||||
report_(dict.lookupOrDefault<Switch>("report", false))
|
report_(dict.lookupOrDefault<Switch>("report", false))
|
||||||
{
|
{
|
||||||
addRestraints(dict);
|
addRestraints(dict);
|
||||||
@ -246,17 +254,19 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
const sixDoFRigidBodyMotion& sDoFRBM
|
const sixDoFRigidBodyMotion& sDoFRBM
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
motionState_(sDoFRBM.motionState()),
|
motionState_(sDoFRBM.motionState_),
|
||||||
restraints_(sDoFRBM.restraints()),
|
restraints_(sDoFRBM.restraints_),
|
||||||
restraintNames_(sDoFRBM.restraintNames()),
|
restraintNames_(sDoFRBM.restraintNames_),
|
||||||
constraints_(sDoFRBM.constraints()),
|
constraints_(sDoFRBM.constraints_),
|
||||||
constraintNames_(sDoFRBM.constraintNames()),
|
constraintNames_(sDoFRBM.constraintNames_),
|
||||||
maxConstraintIterations_(sDoFRBM.maxConstraintIterations()),
|
maxConstraintIterations_(sDoFRBM.maxConstraintIterations_),
|
||||||
initialCentreOfMass_(sDoFRBM.initialCentreOfMass()),
|
initialCentreOfMass_(sDoFRBM.initialCentreOfMass_),
|
||||||
initialQ_(sDoFRBM.initialQ()),
|
initialQ_(sDoFRBM.initialQ_),
|
||||||
momentOfInertia_(sDoFRBM.momentOfInertia()),
|
momentOfInertia_(sDoFRBM.momentOfInertia_),
|
||||||
mass_(sDoFRBM.mass()),
|
mass_(sDoFRBM.mass_),
|
||||||
report_(sDoFRBM.report())
|
cDamp_(sDoFRBM.cDamp_),
|
||||||
|
aLim_(sDoFRBM.aLim_),
|
||||||
|
report_(sDoFRBM.report_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -358,7 +368,8 @@ void Foam::sixDoFRigidBodyMotion::addConstraints
|
|||||||
|
|
||||||
void Foam::sixDoFRigidBodyMotion::updatePosition
|
void Foam::sixDoFRigidBodyMotion::updatePosition
|
||||||
(
|
(
|
||||||
scalar deltaT
|
scalar deltaT,
|
||||||
|
scalar deltaT0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// First leapfrog velocity adjust and motion part, required before
|
// First leapfrog velocity adjust and motion part, required before
|
||||||
@ -366,9 +377,32 @@ void Foam::sixDoFRigidBodyMotion::updatePosition
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
v() += 0.5*deltaT*a();
|
vector aClip = a();
|
||||||
|
scalar aMag = mag(aClip);
|
||||||
|
|
||||||
pi() += 0.5*deltaT*tau();
|
if (aMag > SMALL)
|
||||||
|
{
|
||||||
|
aClip /= aMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aMag > aLim_)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void Foam::sixDoFRigidBodyMotion::updatePosition"
|
||||||
|
"("
|
||||||
|
"scalar deltaT, "
|
||||||
|
"scalar deltaT0"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "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() += deltaT*v();
|
||||||
@ -401,9 +435,33 @@ void Foam::sixDoFRigidBodyMotion::updateForce
|
|||||||
|
|
||||||
applyConstraints(deltaT);
|
applyConstraints(deltaT);
|
||||||
|
|
||||||
v() += 0.5*deltaT*a();
|
vector aClip = a();
|
||||||
|
scalar aMag = mag(aClip);
|
||||||
|
|
||||||
pi() += 0.5*deltaT*tau();
|
if (aMag > SMALL)
|
||||||
|
{
|
||||||
|
aClip /= aMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aMag > aLim_)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void Foam::sixDoFRigidBodyMotion::updateForce"
|
||||||
|
"("
|
||||||
|
"const vector& fGlobal, "
|
||||||
|
"const vector& tauGlobal, "
|
||||||
|
"scalar deltaT"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "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_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -116,6 +116,15 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Mass of the body
|
//- Mass of the body
|
||||||
scalar mass_;
|
scalar mass_;
|
||||||
|
|
||||||
|
//- Acceleration damping coefficient. Modify applied acceleration:
|
||||||
|
// v1 = v0 + a*dt - cDamp*a*dt
|
||||||
|
// = 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_;
|
||||||
|
|
||||||
@ -235,6 +244,8 @@ public:
|
|||||||
const point& initialCentreOfMass,
|
const point& initialCentreOfMass,
|
||||||
const tensor& initialQ,
|
const tensor& initialQ,
|
||||||
const diagTensor& momentOfInertia,
|
const diagTensor& momentOfInertia,
|
||||||
|
scalar cDamp = 0.0,
|
||||||
|
scalar aLim = VGREAT,
|
||||||
bool report = false
|
bool report = false
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -260,10 +271,12 @@ public:
|
|||||||
void addConstraints(const dictionary& dict);
|
void addConstraints(const dictionary& dict);
|
||||||
|
|
||||||
//- First leapfrog velocity adjust and motion part, required
|
//- First leapfrog velocity adjust and motion part, required
|
||||||
// before force calculation
|
// before force calculation. Takes old timestep for variable
|
||||||
|
// timestep cases.
|
||||||
void updatePosition
|
void updatePosition
|
||||||
(
|
(
|
||||||
scalar deltaT
|
scalar deltaT,
|
||||||
|
scalar deltaT0
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Second leapfrog velocity adjust part, required after motion and
|
//- Second leapfrog velocity adjust part, required after motion and
|
||||||
|
|||||||
@ -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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,6 +40,10 @@ 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")
|
||||||
|
<< cDamp_ << 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;
|
||||||
|
|
||||||
|
|||||||
@ -83,15 +83,20 @@ Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::restrain
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
vector refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 1, 0);
|
vector refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 1, 0);
|
||||||
|
|
||||||
vector oldDir = refQ_ & refDir;
|
vector oldDir = refQ_ & refDir;
|
||||||
|
|
||||||
vector newDir = motion.orientation() & refDir;
|
vector newDir = motion.orientation() & refDir;
|
||||||
|
|
||||||
if (mag(oldDir & axis_) > 0.95 || mag(newDir & axis_) > 0.95)
|
if (mag(oldDir & axis_) > 0.95 || mag(newDir & axis_) > 0.95)
|
||||||
{
|
{
|
||||||
// Directions getting close to the axis, change reference
|
// Directions getting close to the axis, change reference
|
||||||
|
|
||||||
refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 0, 1);
|
refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 0, 1);
|
||||||
oldDir = refQ_ & refDir;
|
|
||||||
newDir = motion.orientation() & refDir;
|
vector oldDir = refQ_ & refDir;
|
||||||
|
|
||||||
|
vector newDir = motion.orientation() & refDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removing any axis component from oldDir and newDir and normalising
|
// Removing any axis component from oldDir and newDir and normalising
|
||||||
|
|||||||
@ -87,6 +87,7 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain
|
|||||||
vector refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 1, 0);
|
vector refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 1, 0);
|
||||||
|
|
||||||
vector oldDir = refQ_ & refDir;
|
vector oldDir = refQ_ & refDir;
|
||||||
|
|
||||||
vector newDir = motion.orientation() & refDir;
|
vector newDir = motion.orientation() & refDir;
|
||||||
|
|
||||||
if (mag(oldDir & axis_) > 0.95 || mag(newDir & axis_) > 0.95)
|
if (mag(oldDir & axis_) > 0.95 || mag(newDir & axis_) > 0.95)
|
||||||
@ -95,8 +96,9 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain
|
|||||||
|
|
||||||
refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 0, 1);
|
refDir = rotationTensor(vector(1, 0 ,0), axis_) & vector(0, 0, 1);
|
||||||
|
|
||||||
oldDir = refQ_ & refDir;
|
vector oldDir = refQ_ & refDir;
|
||||||
newDir = motion.orientation() & refDir;
|
|
||||||
|
vector newDir = motion.orientation() & refDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removing any axis component from oldDir and newDir and normalising
|
// Removing any axis component from oldDir and newDir and normalising
|
||||||
|
|||||||
@ -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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -147,7 +147,7 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||||
const Time& t = mesh.time();
|
const Time& t = mesh.time();
|
||||||
|
|
||||||
motion_.updatePosition(t.deltaTValue());
|
motion_.updatePosition(t.deltaTValue(), t.deltaT0Value());
|
||||||
|
|
||||||
vector gravity = vector::zero;
|
vector gravity = vector::zero;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user