mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
volVectorField force =
|
volVectorField force =
|
||||||
U/dimensionedScalar("dt", dimTime, runTime.deltaT().value());
|
U/dimensionedScalar("dt", dimTime, runTime.deltaTValue());
|
||||||
|
|
||||||
Kmesh K(mesh);
|
Kmesh K(mesh);
|
||||||
UOprocess forceGen(K, runTime.deltaT().value(), turbulenceProperties);
|
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
|
||||||
|
|||||||
@ -41,11 +41,11 @@ Description
|
|||||||
|
|
||||||
StCoNum =
|
StCoNum =
|
||||||
max(SfUfbyDelta/mesh.magSf()).value()
|
max(SfUfbyDelta/mesh.magSf()).value()
|
||||||
*runTime.deltaT().value();
|
*runTime.deltaTValue();
|
||||||
|
|
||||||
meanStCoNum =
|
meanStCoNum =
|
||||||
(sum(SfUfbyDelta)/sum(mesh.magSf())).value()
|
(sum(SfUfbyDelta)/sum(mesh.magSf())).value()
|
||||||
*runTime.deltaT().value();
|
*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "St courant Number mean: " << meanStCoNum
|
Info<< "St courant Number mean: " << meanStCoNum
|
||||||
|
|||||||
@ -41,12 +41,12 @@ if (adjustTimeStep)
|
|||||||
(
|
(
|
||||||
min
|
min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaT().value(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if (ign.ignited())
|
|||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
*mag(phiSt)/(fvc::interpolate(rho)*mesh.magSf())
|
*mag(phiSt)/(fvc::interpolate(rho)*mesh.magSf())
|
||||||
).value()*runTime.deltaT().value();
|
).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
Info<< "Max St-Courant Number = " << StCoNum << endl;
|
Info<< "Max St-Courant Number = " << StCoNum << endl;
|
||||||
|
|
||||||
|
|||||||
@ -89,8 +89,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -80,8 +80,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -38,11 +38,11 @@ if (mesh.nInternalFaces())
|
|||||||
surfaceScalarField amaxSfbyDelta =
|
surfaceScalarField amaxSfbyDelta =
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
|
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
|
||||||
|
|
||||||
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaT().value();
|
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum =
|
meanCoNum =
|
||||||
(sum(amaxSfbyDelta)/sum(mesh.magSf())).value()
|
(sum(amaxSfbyDelta)/sum(mesh.magSf())).value()
|
||||||
*runTime.deltaT().value();
|
*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Mean and max Courant Numbers = "
|
Info<< "Mean and max Courant Numbers = "
|
||||||
|
|||||||
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
*mag(phiv)/mesh.magSf()
|
*mag(phiv)/mesh.magSf()
|
||||||
).value()*runTime.deltaT().value();
|
).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
Info<< "\nMax Courant Number = " << CoNum << endl;
|
Info<< "\nMax Courant Number = " << CoNum << endl;
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
*mag(phiv)/mesh.magSf()
|
*mag(phiv)/mesh.magSf()
|
||||||
).value()*runTime.deltaT().value();
|
).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
Info<< "Max Courant Number = " << CoNum << endl;
|
Info<< "Max Courant Number = " << CoNum << endl;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Info<< "magnetic flux divergence error = "
|
Info<< "magnetic flux divergence error = "
|
||||||
<< runTime.deltaT().value()
|
<< runTime.deltaTValue()
|
||||||
*mag(fvc::div(phiB))().weightedAverage(mesh.V()).value()
|
*mag(fvc::div(phiB))().weightedAverage(mesh.V()).value()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -47,10 +47,10 @@ Foam::scalar Foam::compressibleCourantNo
|
|||||||
/ fvc::interpolate(rho);
|
/ fvc::interpolate(rho);
|
||||||
|
|
||||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum
|
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum
|
||||||
|
|||||||
@ -42,10 +42,10 @@ if (mesh.nInternalFaces())
|
|||||||
*mag(phi)/fvc::interpolate(h);
|
*mag(phi)/fvc::interpolate(h);
|
||||||
|
|
||||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
// Gravity wave Courant number
|
// Gravity wave Courant number
|
||||||
waveCoNum =
|
waveCoNum =
|
||||||
@ -53,7 +53,7 @@ if (mesh.nInternalFaces())
|
|||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
*sqrt(fvc::interpolate(h))
|
*sqrt(fvc::interpolate(h))
|
||||||
).value()*sqrt(magg).value()*runTime.deltaT().value();
|
).value()*sqrt(magg).value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Courant number mean: " << meanCoNum
|
Info<< "Courant number mean: " << meanCoNum
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
chemistry.solve
|
chemistry.solve
|
||||||
(
|
(
|
||||||
runTime.value() - runTime.deltaT().value(),
|
runTime.value() - runTime.deltaTValue(),
|
||||||
runTime.deltaT().value()
|
runTime.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// turbulent time scale
|
// turbulent time scale
|
||||||
|
|||||||
@ -40,15 +40,15 @@ if (mesh.nInternalFaces())
|
|||||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
|
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
|
||||||
|
|
||||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
acousticCoNum = max
|
acousticCoNum = max
|
||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
|
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
|
||||||
).value()*runTime.deltaT().value();
|
).value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "phiv Courant Number mean: " << meanCoNum
|
Info<< "phiv Courant Number mean: " << meanCoNum
|
||||||
|
|||||||
@ -43,12 +43,12 @@ if (adjustTimeStep)
|
|||||||
(
|
(
|
||||||
min
|
min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaT().value(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -44,7 +44,7 @@ if (adjustTimeStep)
|
|||||||
(
|
(
|
||||||
min
|
min
|
||||||
(
|
(
|
||||||
maxDeltaTFact*runTime.deltaT().value(),
|
maxDeltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
scalar sumLocalContErr =
|
scalar sumLocalContErr =
|
||||||
runTime.deltaT().value()*
|
runTime.deltaTValue()*
|
||||||
mag
|
mag
|
||||||
(
|
(
|
||||||
fvc::ddt(rho)
|
fvc::ddt(rho)
|
||||||
@ -7,7 +7,7 @@
|
|||||||
)().weightedAverage(rho*mesh.V()).value();
|
)().weightedAverage(rho*mesh.V()).value();
|
||||||
|
|
||||||
scalar globalContErr =
|
scalar globalContErr =
|
||||||
runTime.deltaT().value()*
|
runTime.deltaTValue()*
|
||||||
(
|
(
|
||||||
fvc::ddt(rho)
|
fvc::ddt(rho)
|
||||||
+ fvc::div(phi)
|
+ fvc::div(phi)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phia - phib)
|
mesh.surfaceInterpolation::deltaCoeffs()*mag(phia - phib)
|
||||||
/mesh.magSf()
|
/mesh.magSf()
|
||||||
).value()*runTime.deltaT().value();
|
).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
||||||
|
|
||||||
|
|||||||
3
applications/test/fieldDependency/Make/files
Normal file
3
applications/test/fieldDependency/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fieldDependency.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/fieldDependency
|
||||||
5
applications/test/fieldDependency/Make/options
Normal file
5
applications/test/fieldDependency/Make/options
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume
|
||||||
102
applications/test/fieldDependency/fieldDependency.C
Normal file
102
applications/test/fieldDependency/fieldDependency.C
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test field dependencies.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
Info<< "Creating field T\n" << endl;
|
||||||
|
volScalarField T
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"T",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating field p\n" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||||
|
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||||
|
|
||||||
|
// Change T and mark as uptodate.
|
||||||
|
Info<< "Changing T" << endl;
|
||||||
|
T = 0.0;
|
||||||
|
T.setUpToDate();
|
||||||
|
Info<< "T.eventNo:" << T.eventNo() << endl;
|
||||||
|
|
||||||
|
// Check p dependency:
|
||||||
|
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||||
|
|
||||||
|
// Change p and mark as uptodate.
|
||||||
|
Info<< "Changing p." << endl;
|
||||||
|
p.setUpToDate();
|
||||||
|
Info<< "p.uptodate:" << p.upToDate(T)<< endl;
|
||||||
|
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -53,7 +53,7 @@ Description
|
|||||||
#include "removePoints.H"
|
#include "removePoints.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -445,12 +445,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
scalar concaveAngle = defaultConcaveAngle;
|
scalar concaveAngle = defaultConcaveAngle;
|
||||||
args.optionReadIfPresent("concaveAngle", concaveAngle);
|
args.optionReadIfPresent("concaveAngle", concaveAngle);
|
||||||
|
|
||||||
scalar concaveSin = Foam::sin(concaveAngle*constant::mathematical::pi/180.0);
|
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
|
||||||
|
|
||||||
bool snapMeshDict = args.optionFound("snapMesh");
|
bool snapMeshDict = args.optionFound("snapMesh");
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Description
|
|||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "meshCutter.H"
|
#include "meshCutter.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "geomCellLooper.H"
|
#include "geomCellLooper.H"
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "edgeVertex.H"
|
#include "edgeVertex.H"
|
||||||
@ -539,9 +539,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar radAngle = featureAngle*constant::mathematical::pi/180.0;
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
scalar minCos = Foam::cos(radAngle);
|
scalar minSin = Foam::sin(degToRad(featureAngle));
|
||||||
scalar minSin = Foam::sin(radAngle);
|
|
||||||
|
|
||||||
bool readSet = args.optionFound("set");
|
bool readSet = args.optionFound("set");
|
||||||
bool geometry = args.optionFound("geometry");
|
bool geometry = args.optionFound("geometry");
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Description
|
|||||||
#include "symmetryPolyPatch.H"
|
#include "symmetryPolyPatch.H"
|
||||||
#include "wedgePolyPatch.H"
|
#include "wedgePolyPatch.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
|
|||||||
@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
|
|||||||
{
|
{
|
||||||
// Distribute the points to be +/- 2.5deg from the x-z plane
|
// Distribute the points to be +/- 2.5deg from the x-z plane
|
||||||
|
|
||||||
scalar tanTheta = Foam::tan(2.5*constant::mathematical::pi/180.0);
|
scalar tanTheta = Foam::tan(degToRad(2.5));
|
||||||
|
|
||||||
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
|
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
|
||||||
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Usage
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "timeSelector.H"
|
#include "timeSelector.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
#include "PackedBoolList.H"
|
#include "PackedBoolList.H"
|
||||||
@ -91,7 +91,7 @@ void simpleMarkFeatures
|
|||||||
labelList& multiCellFeaturePoints
|
labelList& multiCellFeaturePoints
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
Info<< "Feature:" << featureAngle << endl
|
Info<< "Feature:" << featureAngle << endl
|
||||||
<< "minCos :" << minCos << endl
|
<< "minCos :" << minCos << endl
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Description
|
|||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
|
|||||||
<< coupleI << ". STAR couple ID: "
|
<< coupleI << ". STAR couple ID: "
|
||||||
<< couples_[coupleI].coupleID() << endl
|
<< couples_[coupleI].coupleID() << endl
|
||||||
<< "The angle between face normals is "
|
<< "The angle between face normals is "
|
||||||
<< Foam::acos(faceAreaAngle)/constant::mathematical::pi*180
|
<< radToDeg(Foam::acos(faceAreaAngle))
|
||||||
<< " deg." << endl
|
<< " deg." << endl
|
||||||
<< "master cell: " << fp.masterCell()
|
<< "master cell: " << fp.masterCell()
|
||||||
<< " STAR number: " << starCellID_[fp.masterCell()]
|
<< " STAR number: " << starCellID_[fp.masterCell()]
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
|
|
||||||
#include "wedge.H"
|
#include "wedge.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict)
|
|||||||
axis_(coeffDict_.lookup("axis")),
|
axis_(coeffDict_.lookup("axis")),
|
||||||
angle_
|
angle_
|
||||||
(
|
(
|
||||||
readScalar(coeffDict_.lookup("angle"))
|
degToRad(readScalar(coeffDict_.lookup("angle")))
|
||||||
*constant::mathematical::pi/180.0
|
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Description
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "boundaryMesh.H"
|
#include "boundaryMesh.H"
|
||||||
#include "repatchPolyTopoChanger.H"
|
#include "repatchPolyTopoChanger.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
|||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
Info<< "Feature:" << featureAngle << endl
|
Info<< "Feature:" << featureAngle << endl
|
||||||
<< "minCos :" << minCos << endl
|
<< "minCos :" << minCos << endl
|
||||||
|
|||||||
@ -38,8 +38,6 @@ wmake libso sampling
|
|||||||
wmake libso dynamicMesh
|
wmake libso dynamicMesh
|
||||||
wmake libso dynamicFvMesh
|
wmake libso dynamicFvMesh
|
||||||
wmake libso topoChangerFvMesh
|
wmake libso topoChangerFvMesh
|
||||||
wmake libso fvMotionSolver
|
|
||||||
wmake libso engine
|
|
||||||
|
|
||||||
wmake libso ODE
|
wmake libso ODE
|
||||||
wmake libso randomProcesses
|
wmake libso randomProcesses
|
||||||
@ -56,4 +54,7 @@ wmake libso errorEstimation
|
|||||||
|
|
||||||
fvAgglomerationMethods/Allwmake
|
fvAgglomerationMethods/Allwmake
|
||||||
|
|
||||||
|
wmake libso fvMotionSolver
|
||||||
|
wmake libso engine
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
global/global.Cver
|
global/global.Cver
|
||||||
global/dimensionedConstants/dimensionedConstants.C
|
global/constants/constants.C
|
||||||
global/dimensionedConstants/constants/constants.C
|
global/constants/dimensionedConstants.C
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
|
|
||||||
|
|||||||
@ -72,10 +72,8 @@ public:
|
|||||||
TimeState();
|
TimeState();
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
|
virtual ~TimeState();
|
||||||
//- Virtual destructor
|
|
||||||
virtual ~TimeState();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
@ -89,22 +87,34 @@ public:
|
|||||||
virtual scalar timeToUserTime(const scalar t) const;
|
virtual scalar timeToUserTime(const scalar t) const;
|
||||||
|
|
||||||
//- Return current time value
|
//- Return current time value
|
||||||
virtual scalar timeOutputValue() const;
|
scalar timeOutputValue() const;
|
||||||
|
|
||||||
//- Return current time index
|
//- Return current time index
|
||||||
virtual label timeIndex() const;
|
label timeIndex() const;
|
||||||
|
|
||||||
|
//- Return time step value
|
||||||
|
inline scalar deltaTValue() const
|
||||||
|
{
|
||||||
|
return deltaT_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return old time step value
|
||||||
|
inline scalar deltaT0Value() const
|
||||||
|
{
|
||||||
|
return deltaT0_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return time step
|
//- Return time step
|
||||||
virtual dimensionedScalar deltaT() const;
|
dimensionedScalar deltaT() const;
|
||||||
|
|
||||||
//- Return old time step
|
//- Return old time step
|
||||||
virtual dimensionedScalar deltaT0() const;
|
dimensionedScalar deltaT0() const;
|
||||||
|
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Return true if this is an output time
|
//- Return true if this is an output time
|
||||||
virtual bool outputTime() const;
|
bool outputTime() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -173,9 +173,9 @@ bool Foam::regIOobject::checkOut()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::regIOobject::upToDate(const word& a) const
|
bool Foam::regIOobject::upToDate(const regIOobject& a) const
|
||||||
{
|
{
|
||||||
if (db().lookupObject<regIOobject>(a).eventNo() >= eventNo_)
|
if (a.eventNo() >= eventNo_)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -186,12 +186,16 @@ bool Foam::regIOobject::upToDate(const word& a) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::regIOobject::upToDate(const word& a, const word& b) const
|
bool Foam::regIOobject::upToDate
|
||||||
|
(
|
||||||
|
const regIOobject& a,
|
||||||
|
const regIOobject& b
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
a.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
|| b.eventNo() >= eventNo_
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -205,16 +209,16 @@ bool Foam::regIOobject::upToDate(const word& a, const word& b) const
|
|||||||
|
|
||||||
bool Foam::regIOobject::upToDate
|
bool Foam::regIOobject::upToDate
|
||||||
(
|
(
|
||||||
const word& a,
|
const regIOobject& a,
|
||||||
const word& b,
|
const regIOobject& b,
|
||||||
const word& c
|
const regIOobject& c
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
a.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
|| b.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(c).eventNo() >= eventNo_
|
|| c.eventNo() >= eventNo_
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -228,18 +232,18 @@ bool Foam::regIOobject::upToDate
|
|||||||
|
|
||||||
bool Foam::regIOobject::upToDate
|
bool Foam::regIOobject::upToDate
|
||||||
(
|
(
|
||||||
const word& a,
|
const regIOobject& a,
|
||||||
const word& b,
|
const regIOobject& b,
|
||||||
const word& c,
|
const regIOobject& c,
|
||||||
const word& d
|
const regIOobject& d
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
db().lookupObject<regIOobject>(a).eventNo() >= eventNo_
|
a.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(b).eventNo() >= eventNo_
|
|| b.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(c).eventNo() >= eventNo_
|
|| c.eventNo() >= eventNo_
|
||||||
|| db().lookupObject<regIOobject>(d).eventNo() >= eventNo_
|
|| d.eventNo() >= eventNo_
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -154,19 +154,38 @@ public:
|
|||||||
//- Event number at last update.
|
//- Event number at last update.
|
||||||
inline label& eventNo();
|
inline label& eventNo();
|
||||||
|
|
||||||
//- Am I uptodate with respect to other regIOobjects
|
//- Return true if up-to-date with respect to given object
|
||||||
bool upToDate(const word&) const;
|
// otherwise false
|
||||||
bool upToDate(const word&, const word&) const;
|
bool upToDate(const regIOobject&) const;
|
||||||
bool upToDate(const word&, const word&, const word&) const;
|
|
||||||
|
//- Return true if up-to-date with respect to given objects
|
||||||
|
// otherwise false
|
||||||
bool upToDate
|
bool upToDate
|
||||||
(
|
(
|
||||||
const word&,
|
const regIOobject&,
|
||||||
const word&,
|
const regIOobject&
|
||||||
const word&,
|
|
||||||
const word&
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Flag me as up to date
|
//- Return true if up-to-date with respect to given objects
|
||||||
|
// otherwise false
|
||||||
|
bool upToDate
|
||||||
|
(
|
||||||
|
const regIOobject&,
|
||||||
|
const regIOobject&,
|
||||||
|
const regIOobject&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return true if up-to-date with respect to given objects
|
||||||
|
// otherwise false
|
||||||
|
bool upToDate
|
||||||
|
(
|
||||||
|
const regIOobject&,
|
||||||
|
const regIOobject&,
|
||||||
|
const regIOobject&,
|
||||||
|
const regIOobject&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Set up to date (obviously)
|
||||||
void setUpToDate();
|
void setUpToDate();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::atom
|
Foam::constant::atomic
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Atomic constants
|
Atomic constants
|
||||||
@ -68,7 +68,7 @@ namespace atomic
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace atomic
|
} // End namespace atomic
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -22,9 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
Collection of dimensioned constants
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -27,9 +27,10 @@ Global
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Dictionary reading and supplying the dimensioned constants used within
|
Dictionary reading and supplying the dimensioned constants used within
|
||||||
OpenFOAM particularly for thermodynamics. The values are read from the
|
OpenFOAM, particularly for thermodynamics.
|
||||||
OpenFOAM controlDict and should be changed to run with a different set of
|
|
||||||
units from the default SI units.
|
The values are read from the OpenFOAM etc/controlDict and should be
|
||||||
|
changed to run with a different set of units from the default SI units.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
dimensionedConstants.C
|
dimensionedConstants.C
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::em
|
Foam::constant::electromagnetic
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Electromagnetic constants
|
Electromagnetic constants
|
||||||
@ -77,7 +77,7 @@ namespace electromagnetic
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace electromagnetic
|
} // End namespace electromagnetic
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -26,7 +26,7 @@ Namespace
|
|||||||
Foam::constant::mathematical
|
Foam::constant::mathematical
|
||||||
|
|
||||||
Description
|
Description
|
||||||
mathematical constants
|
mathematical constants.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -56,7 +56,10 @@ namespace mathematical
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace mathematical
|
} // End namespace mathematical
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::phys
|
Foam::constant::physicoChemical
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Physico-chemical constants
|
Physico-chemical constants
|
||||||
@ -71,7 +71,7 @@ namespace physicoChemical
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace physicoChemical
|
} // End namespace physicoChemical
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::uni
|
Foam::constant::universal
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Universal constants
|
Universal constants
|
||||||
67
src/OpenFOAM/global/unitConversion/unitConversion.H
Normal file
67
src/OpenFOAM/global/unitConversion/unitConversion.H
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
Foam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Unit conversion functions
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef unitConversion_H
|
||||||
|
#define unitConversion_H
|
||||||
|
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
using namespace Foam::constant::mathematical;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Conversion from degrees to radians
|
||||||
|
inline scalar degToRad(const scalar& deg)
|
||||||
|
{
|
||||||
|
return (deg*pi/180.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Conversion from radians to degrees
|
||||||
|
inline scalar radToDeg(const scalar& rad)
|
||||||
|
{
|
||||||
|
return (rad*180.0/pi);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -59,11 +59,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
relaxationFactors_
|
cache_(ITstream("cache", tokenList())()),
|
||||||
(
|
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
|
||||||
ITstream("relaxationFactors",
|
|
||||||
tokenList())()
|
|
||||||
),
|
|
||||||
defaultRelaxationFactor_(0),
|
defaultRelaxationFactor_(0),
|
||||||
solvers_(ITstream("solvers", tokenList())())
|
solvers_(ITstream("solvers", tokenList())())
|
||||||
{
|
{
|
||||||
@ -151,44 +148,14 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::solution::read()
|
bool Foam::solution::cache(const word& name) const
|
||||||
{
|
{
|
||||||
if (regIOobject::read())
|
if (debug)
|
||||||
{
|
{
|
||||||
const dictionary& dict = solutionDict();
|
Info<< "Find cache entry for " << name << endl;
|
||||||
|
|
||||||
if (dict.found("relaxationFactors"))
|
|
||||||
{
|
|
||||||
relaxationFactors_ = dict.subDict("relaxationFactors");
|
|
||||||
}
|
|
||||||
|
|
||||||
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
|
||||||
|
|
||||||
if (dict.found("solvers"))
|
|
||||||
{
|
|
||||||
solvers_ = dict.subDict("solvers");
|
|
||||||
upgradeSolverDict(solvers_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return cache_.found(name);
|
||||||
const Foam::dictionary& Foam::solution::solutionDict() const
|
|
||||||
{
|
|
||||||
if (found("select"))
|
|
||||||
{
|
|
||||||
return subDict(word(lookup("select")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,6 +202,19 @@ Foam::scalar Foam::solution::relaxationFactor(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::dictionary& Foam::solution::solutionDict() const
|
||||||
|
{
|
||||||
|
if (found("select"))
|
||||||
|
{
|
||||||
|
return subDict(word(lookup("select")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -259,4 +239,37 @@ const Foam::dictionary& Foam::solution::solver(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::solution::read()
|
||||||
|
{
|
||||||
|
if (regIOobject::read())
|
||||||
|
{
|
||||||
|
const dictionary& dict = solutionDict();
|
||||||
|
|
||||||
|
if (dict.found("cache"))
|
||||||
|
{
|
||||||
|
cache_ = dict.subDict("cache");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("relaxationFactors"))
|
||||||
|
{
|
||||||
|
relaxationFactors_ = dict.subDict("relaxationFactors");
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
||||||
|
|
||||||
|
if (dict.found("solvers"))
|
||||||
|
{
|
||||||
|
solvers_ = dict.subDict("solvers");
|
||||||
|
upgradeSolverDict(solvers_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -53,6 +53,9 @@ class solution
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Dictionary of temporary fields to cache
|
||||||
|
dictionary cache_;
|
||||||
|
|
||||||
//- Dictionary of relaxation factors for all the fields
|
//- Dictionary of relaxation factors for all the fields
|
||||||
dictionary relaxationFactors_;
|
dictionary relaxationFactors_;
|
||||||
|
|
||||||
@ -62,6 +65,7 @@ class solution
|
|||||||
//- Dictionary of solver parameters for all the fields
|
//- Dictionary of solver parameters for all the fields
|
||||||
dictionary solvers_;
|
dictionary solvers_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct and assignment
|
//- Disallow default bitwise copy construct and assignment
|
||||||
@ -90,9 +94,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the selected sub-dictionary of solvers if the "select"
|
//- Return true if the given field should be cached
|
||||||
// keyword is given, otherwise return the complete dictionary
|
bool cache(const word& name) const;
|
||||||
const dictionary& solutionDict() const;
|
|
||||||
|
|
||||||
//- Return true if the relaxation factor is given for the field
|
//- Return true if the relaxation factor is given for the field
|
||||||
bool relax(const word& name) const;
|
bool relax(const word& name) const;
|
||||||
@ -100,6 +103,10 @@ public:
|
|||||||
//- Return the relaxation factor for the given field
|
//- Return the relaxation factor for the given field
|
||||||
scalar relaxationFactor(const word& name) const;
|
scalar relaxationFactor(const word& name) const;
|
||||||
|
|
||||||
|
//- Return the selected sub-dictionary of solvers if the "select"
|
||||||
|
// keyword is given, otherwise return the complete dictionary
|
||||||
|
const dictionary& solutionDict() const;
|
||||||
|
|
||||||
//- Return the solver controls dictionary for the given field
|
//- Return the solver controls dictionary for the given field
|
||||||
const dictionary& solverDict(const word& name) const;
|
const dictionary& solverDict(const word& name) const;
|
||||||
|
|
||||||
|
|||||||
@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection
|
|||||||
|
|
||||||
if (curHit.hit())
|
if (curHit.hit())
|
||||||
{
|
{
|
||||||
if (Foam::mag(curHit.distance()) < nearestHitDist)
|
if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist))
|
||||||
{
|
{
|
||||||
nearestHitDist = Foam::mag(curHit.distance());
|
nearestHitDist = curHit.distance();
|
||||||
nearest.setHit();
|
nearest.setHit();
|
||||||
nearest.setPoint(curHit.hitPoint());
|
nearest.setPoint(curHit.hitPoint());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramidPointFaceRef.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||||||
|
|
||||||
// Severe nonorthogonality threshold
|
// Severe nonorthogonality threshold
|
||||||
const scalar severeNonorthogonalityThreshold =
|
const scalar severeNonorthogonalityThreshold =
|
||||||
::cos(nonOrthThreshold_/180.0*constant::mathematical::pi);
|
::cos(degToRad(nonOrthThreshold_));
|
||||||
|
|
||||||
scalar minDDotS = GREAT;
|
scalar minDDotS = GREAT;
|
||||||
|
|
||||||
@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
Info<< " Mesh non-orthogonality Max: "
|
Info<< " Mesh non-orthogonality Max: "
|
||||||
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(minDDotS))
|
||||||
<< " average: " <<
|
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
|
||||||
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -839,7 +838,7 @@ bool Foam::primitiveMesh::checkFaceAngles
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
|
const scalar maxSin = Foam::sin(degToRad(maxDeg));
|
||||||
|
|
||||||
const pointField& p = points();
|
const pointField& p = points();
|
||||||
const faceList& fcs = faces();
|
const faceList& fcs = faces();
|
||||||
@ -915,8 +914,7 @@ bool Foam::primitiveMesh::checkFaceAngles
|
|||||||
if (nConcave > 0)
|
if (nConcave > 0)
|
||||||
{
|
{
|
||||||
scalar maxConcaveDegr =
|
scalar maxConcaveDegr =
|
||||||
Foam::asin(Foam::min(1.0, maxEdgeSin))
|
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,10 +31,7 @@ Description
|
|||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramidPointFaceRef.H"
|
||||||
#include "cell.H"
|
#include "cell.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -200,7 +197,7 @@ bool Foam::primitiveMesh::checkMeshMotion
|
|||||||
) << "Severe non-orthogonality in mesh motion for face "
|
) << "Severe non-orthogonality in mesh motion for face "
|
||||||
<< faceI
|
<< faceI
|
||||||
<< " between cells " << own[faceI] << " and " << nei[faceI]
|
<< " between cells " << own[faceI] << " and " << nei[faceI]
|
||||||
<< ": Angle = " << ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< ": Angle = " << radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
|
|
||||||
nDotProductErrors++;
|
nDotProductErrors++;
|
||||||
|
|||||||
@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
|
|||||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi());
|
mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi());
|
||||||
|
|
||||||
meshCoNum = max(SfUfbyDelta/mesh.magSf())
|
meshCoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanMeshCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanMeshCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Mesh Courant Number mean: " << meanMeshCoNum
|
Info<< "Mesh Courant Number mean: " << meanMeshCoNum
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "topoCellLooper.H"
|
#include "topoCellLooper.H"
|
||||||
#include "cellFeatures.H"
|
#include "cellFeatures.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
@ -44,8 +44,7 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Angle for polys to be considered splitHexes.
|
// Angle for polys to be considered splitHexes.
|
||||||
const Foam::scalar Foam::topoCellLooper::featureCos =
|
const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0));
|
||||||
Foam::cos(10.0*constant::mathematical::pi/180.0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|||||||
@ -32,7 +32,7 @@ License
|
|||||||
#include "cellCuts.H"
|
#include "cellCuts.H"
|
||||||
#include "splitCell.H"
|
#include "splitCell.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter
|
|||||||
faceRemover_
|
faceRemover_
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
Foam::cos(30.0/180.0*constant::mathematical::pi)
|
Foam::cos(degToRad(30.0))
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
#include "polyMeshGeometry.H"
|
#include "polyMeshGeometry.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramidPointFaceRef.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
|
|||||||
<< " between cells " << mesh.faceOwner()[faceI]
|
<< " between cells " << mesh.faceOwner()[faceI]
|
||||||
<< " and " << nei
|
<< " and " << nei
|
||||||
<< ": Angle = "
|
<< ": Angle = "
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
|
|||||||
<< " between cells " << mesh.faceOwner()[faceI]
|
<< " between cells " << mesh.faceOwner()[faceI]
|
||||||
<< " and " << nei
|
<< " and " << nei
|
||||||
<< ": Angle = "
|
<< ": Angle = "
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
|
|||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Severe nonorthogonality threshold
|
// Severe nonorthogonality threshold
|
||||||
const scalar severeNonorthogonalityThreshold =
|
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
|
||||||
::cos(orthWarn/180.0*constant::mathematical::pi);
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate coupled cell centre
|
// Calculate coupled cell centre
|
||||||
@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
|
|||||||
if (nDDotS > 0)
|
if (nDDotS > 0)
|
||||||
{
|
{
|
||||||
Info<< "Mesh non-orthogonality Max: "
|
Info<< "Mesh non-orthogonality Max: "
|
||||||
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(minDDotS))
|
||||||
<< " average: " <<
|
<< " average: " << radToDeg(::acos(sumDDotS/nDDotS))
|
||||||
::acos(sumDDotS/nDDotS)/constant::mathematical::pi*180.0
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
|
const scalar maxSin = Foam::sin(degToRad(maxDeg));
|
||||||
|
|
||||||
const faceList& fcs = mesh.faces();
|
const faceList& fcs = mesh.faces();
|
||||||
|
|
||||||
@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
|
|||||||
if (maxEdgeSin > SMALL)
|
if (maxEdgeSin > SMALL)
|
||||||
{
|
{
|
||||||
scalar maxConcaveDegr =
|
scalar maxConcaveDegr =
|
||||||
Foam::asin(Foam::min(1.0, maxEdgeSin))
|
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
Info<< "There are " << nConcave
|
Info<< "There are " << nConcave
|
||||||
<< " faces with concave angles between consecutive"
|
<< " faces with concave angles between consecutive"
|
||||||
|
|||||||
@ -119,7 +119,7 @@ void fvMotionSolverEngineMesh::move()
|
|||||||
|
|
||||||
|
|
||||||
pistonPosition_.value() += deltaZ;
|
pistonPosition_.value() += deltaZ;
|
||||||
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
|
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
|
||||||
|
|
||||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||||
|
|||||||
@ -121,7 +121,7 @@ void layeredEngineMesh::move()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pistonPosition_.value() += deltaZ;
|
pistonPosition_.value() += deltaZ;
|
||||||
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
|
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
|
||||||
|
|
||||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "engineTime.H"
|
#include "engineTime.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -123,12 +123,6 @@ bool Foam::engineTime::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::engineTime::degToRad(const scalar deg) const
|
|
||||||
{
|
|
||||||
return constant::mathematical::pi*deg/180.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
|
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
|
||||||
{
|
{
|
||||||
// 6 * rpm => deg/s
|
// 6 * rpm => deg/s
|
||||||
@ -171,7 +165,7 @@ Foam::scalar Foam::engineTime::thetaRevolution() const
|
|||||||
|
|
||||||
Foam::scalar Foam::engineTime::deltaTheta() const
|
Foam::scalar Foam::engineTime::deltaTheta() const
|
||||||
{
|
{
|
||||||
return timeToDeg(deltaT().value());
|
return timeToDeg(deltaTValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -222,7 +216,7 @@ Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
|
|||||||
(
|
(
|
||||||
"pistonSpeed",
|
"pistonSpeed",
|
||||||
dimVelocity,
|
dimVelocity,
|
||||||
pistonDisplacement().value()/(deltaT().value() + VSMALL)
|
pistonDisplacement().value()/(deltaTValue() + VSMALL)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -121,9 +121,6 @@ public:
|
|||||||
|
|
||||||
// Conversion
|
// Conversion
|
||||||
|
|
||||||
//- Convert degrees to radians
|
|
||||||
scalar degToRad(const scalar rad) const;
|
|
||||||
|
|
||||||
//- Convert degrees to seconds (for given engine speed in RPM)
|
//- Convert degrees to seconds (for given engine speed in RPM)
|
||||||
scalar degToTime(const scalar theta) const;
|
scalar degToTime(const scalar theta) const;
|
||||||
|
|
||||||
|
|||||||
@ -208,7 +208,7 @@ Foam::scalar Foam::engineValve::curVelocity() const
|
|||||||
lift(engineDB_.theta() - engineDB_.deltaTheta()),
|
lift(engineDB_.theta() - engineDB_.deltaTheta()),
|
||||||
minLift_
|
minLift_
|
||||||
)
|
)
|
||||||
)/(engineDB_.deltaT().value() + VSMALL);
|
)/(engineDB_.deltaTValue() + VSMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const labelList& ignitionSite::cells() const
|
|||||||
bool ignitionSite::igniting() const
|
bool ignitionSite::igniting() const
|
||||||
{
|
{
|
||||||
scalar curTime = db_.value();
|
scalar curTime = db_.value();
|
||||||
scalar deltaT = db_.deltaT().value();
|
scalar deltaT = db_.deltaTValue();
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
@ -120,7 +120,7 @@ bool ignitionSite::igniting() const
|
|||||||
bool ignitionSite::ignited() const
|
bool ignitionSite::ignited() const
|
||||||
{
|
{
|
||||||
scalar curTime = db_.value();
|
scalar curTime = db_.value();
|
||||||
scalar deltaT = db_.deltaT().value();
|
scalar deltaT = db_.deltaTValue();
|
||||||
|
|
||||||
return(curTime - deltaT >= time_);
|
return(curTime - deltaT >= time_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
|
|||||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi)/fvc::interpolate(rho);
|
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi)/fvc::interpolate(rho);
|
||||||
|
|
||||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Courant Number mean: " << meanCoNum
|
Info<< "Courant Number mean: " << meanCoNum
|
||||||
|
|||||||
@ -180,7 +180,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su
|
|||||||
DimensionedField<scalar, volMesh>& sourceField = tSource();
|
DimensionedField<scalar, volMesh>& sourceField = tSource();
|
||||||
|
|
||||||
const scalarField& V = mesh_.V();
|
const scalarField& V = mesh_.V();
|
||||||
const scalar dt = runTime_.deltaT().value();
|
const scalar dt = runTime_.deltaTValue();
|
||||||
|
|
||||||
forAll(pointSources_, sourceI)
|
forAll(pointSources_, sourceI)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su()
|
|||||||
DimensionedField<scalar, volMesh>& sourceField = tSource();
|
DimensionedField<scalar, volMesh>& sourceField = tSource();
|
||||||
|
|
||||||
const scalarField& V = mesh_.V();
|
const scalarField& V = mesh_.V();
|
||||||
const scalar dt = runTime_.deltaT().value();
|
const scalar dt = runTime_.deltaTValue();
|
||||||
|
|
||||||
forAll(pointSources_, sourceI)
|
forAll(pointSources_, sourceI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,12 +41,12 @@ if (adjustTimeStep)
|
|||||||
(
|
(
|
||||||
min
|
min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaT().value(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -39,7 +39,7 @@ if (adjustTimeStep)
|
|||||||
(
|
(
|
||||||
min
|
min
|
||||||
(
|
(
|
||||||
maxCo*runTime.deltaT().value()/CoNum,
|
maxCo*runTime.deltaTValue()/CoNum,
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
// Backward Differencing in time.
|
// Backward Differencing in time.
|
||||||
|
|
||||||
conserve.internalField() +=
|
conserve.internalField() +=
|
||||||
(1.0 - mesh.V0()/mesh.V())/runTime.deltaT().value();
|
(1.0 - mesh.V0()/mesh.V())/runTime.deltaTValue();
|
||||||
|
|
||||||
scalar sumLocalContErr = runTime.deltaT().value()*
|
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||||
mag(conserve)().weightedAverage(mesh.V()).value();
|
mag(conserve)().weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
scalar globalContErr = runTime.deltaT().value()*
|
scalar globalContErr = runTime.deltaTValue()*
|
||||||
conserve.weightedAverage(mesh.V()).value();
|
conserve.weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
Info<< "volume continuity errors : sum local = " << sumLocalContErr
|
Info<< "volume continuity errors : sum local = " << sumLocalContErr
|
||||||
|
|||||||
@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
|
|||||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi);
|
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi);
|
||||||
|
|
||||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
|
|
||||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
.value()*runTime.deltaT().value();
|
.value()*runTime.deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Courant Number mean: " << meanCoNum
|
Info<< "Courant Number mean: " << meanCoNum
|
||||||
|
|||||||
@ -33,10 +33,10 @@ Description
|
|||||||
{
|
{
|
||||||
volScalarField contErr = fvc::div(phi);
|
volScalarField contErr = fvc::div(phi);
|
||||||
|
|
||||||
scalar sumLocalContErr = runTime.deltaT().value()*
|
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
scalar globalContErr = runTime.deltaT().value()*
|
scalar globalContErr = runTime.deltaTValue()*
|
||||||
contErr.weightedAverage(mesh.V()).value();
|
contErr.weightedAverage(mesh.V()).value();
|
||||||
cumulativeContErr += globalContErr;
|
cumulativeContErr += globalContErr;
|
||||||
|
|
||||||
|
|||||||
@ -33,10 +33,10 @@ Description
|
|||||||
{
|
{
|
||||||
volScalarField contErr = fvc::div(phi + fvc::meshPhi(U));
|
volScalarField contErr = fvc::div(phi + fvc::meshPhi(U));
|
||||||
|
|
||||||
scalar sumLocalContErr = runTime.deltaT().value()*
|
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
scalar globalContErr = runTime.deltaT().value()*
|
scalar globalContErr = runTime.deltaTValue()*
|
||||||
contErr.weightedAverage(mesh.V()).value();
|
contErr.weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
cumulativeContErr += globalContErr;
|
cumulativeContErr += globalContErr;
|
||||||
|
|||||||
@ -32,11 +32,11 @@ Description
|
|||||||
|
|
||||||
if (mesh.moving())
|
if (mesh.moving())
|
||||||
{
|
{
|
||||||
scalar sumLocalContErr = runTime.deltaT().value()*
|
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||||
mag(fvc::div(phi + fvc::meshPhi(rho, U)))()
|
mag(fvc::div(phi + fvc::meshPhi(rho, U)))()
|
||||||
.weightedAverage(mesh.V()).value();
|
.weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
scalar globalContErr = runTime.deltaT().value()*
|
scalar globalContErr = runTime.deltaTValue()*
|
||||||
fvc::div(phi + fvc::meshPhi(rho, U))()
|
fvc::div(phi + fvc::meshPhi(rho, U))()
|
||||||
.weightedAverage(mesh.V()).value();
|
.weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
|
|||||||
@ -223,7 +223,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
openFraction_
|
openFraction_
|
||||||
+ max
|
+ max
|
||||||
(
|
(
|
||||||
this->db().time().deltaT().value()/openingTime_,
|
this->db().time().deltaTValue()/openingTime_,
|
||||||
maxOpenFractionDelta_
|
maxOpenFractionDelta_
|
||||||
)
|
)
|
||||||
*(orientation_*sign(forceDiff)),
|
*(orientation_*sign(forceDiff)),
|
||||||
|
|||||||
@ -202,7 +202,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
|
|||||||
this->dimensionedInternalField().mesh()
|
this->dimensionedInternalField().mesh()
|
||||||
.ddtScheme(this->dimensionedInternalField().name())
|
.ddtScheme(this->dimensionedInternalField().name())
|
||||||
);
|
);
|
||||||
scalar deltaT = this->db().time().deltaT().value();
|
scalar deltaT = this->db().time().deltaTValue();
|
||||||
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field =
|
const GeometricField<Type, fvPatchField, volMesh>& field =
|
||||||
this->db().objectRegistry::
|
this->db().objectRegistry::
|
||||||
|
|||||||
@ -112,7 +112,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
oldFc[i] = pp[i].centre(oldPoints);
|
oldFc[i] = pp[i].centre(oldPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
|
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue();
|
||||||
|
|
||||||
const volVectorField& U = db().lookupObject<volVectorField>("U");
|
const volVectorField& U = db().lookupObject<volVectorField>("U");
|
||||||
scalarField phip =
|
scalarField phip =
|
||||||
|
|||||||
@ -196,7 +196,7 @@ void syringePressureFvPatchScalarField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
scalar t = db().time().value();
|
scalar t = db().time().value();
|
||||||
scalar deltaT = db().time().deltaT().value();
|
scalar deltaT = db().time().deltaTValue();
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
db().lookupObject<surfaceScalarField>("phi");
|
db().lookupObject<surfaceScalarField>("phi");
|
||||||
|
|||||||
@ -59,8 +59,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar deltaT = mesh().time().deltaT().value();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
scalar deltaT0 = mesh().time().deltaT0().value();
|
scalar deltaT0 = mesh().time().deltaT0Value();
|
||||||
|
|
||||||
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
||||||
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
||||||
@ -137,8 +137,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar deltaT = mesh().time().deltaT().value();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
scalar deltaT0 = mesh().time().deltaT0().value();
|
scalar deltaT0 = mesh().time().deltaT0Value();
|
||||||
|
|
||||||
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
||||||
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
||||||
@ -246,8 +246,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
|
|||||||
|
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar deltaT = mesh().time().deltaT().value();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
scalar deltaT0 = mesh().time().deltaT0().value();
|
scalar deltaT0 = mesh().time().deltaT0Value();
|
||||||
|
|
||||||
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
||||||
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
||||||
@ -307,8 +307,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
|
|||||||
|
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar deltaT = mesh().time().deltaT().value();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
scalar deltaT0 = mesh().time().deltaT0().value();
|
scalar deltaT0 = mesh().time().deltaT0Value();
|
||||||
|
|
||||||
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
||||||
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
||||||
@ -368,8 +368,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
|
|||||||
|
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar deltaT = mesh().time().deltaT().value();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
scalar deltaT0 = mesh().time().deltaT0().value();
|
scalar deltaT0 = mesh().time().deltaT0Value();
|
||||||
|
|
||||||
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
|
||||||
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
|
||||||
|
|||||||
@ -276,7 +276,7 @@ EulerDdtScheme<Type>::fvmDdt
|
|||||||
|
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
|
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
|
||||||
|
|
||||||
fvm.diag() = rDeltaT*mesh().V();
|
fvm.diag() = rDeltaT*mesh().V();
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ EulerDdtScheme<Type>::fvmDdt
|
|||||||
);
|
);
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
|
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
|
||||||
|
|
||||||
fvm.diag() = rDeltaT*rho.value()*mesh().V();
|
fvm.diag() = rDeltaT*rho.value()*mesh().V();
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ EulerDdtScheme<Type>::fvmDdt
|
|||||||
);
|
);
|
||||||
fvMatrix<Type>& fvm = tfvm();
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
|
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
|
||||||
|
|
||||||
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();
|
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();
|
||||||
|
|
||||||
|
|||||||
@ -44,14 +44,14 @@ namespace fv
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
scalar backwardDdtScheme<Type>::deltaT_() const
|
scalar backwardDdtScheme<Type>::deltaT_() const
|
||||||
{
|
{
|
||||||
return mesh().time().deltaT().value();
|
return mesh().time().deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
scalar backwardDdtScheme<Type>::deltaT0_() const
|
scalar backwardDdtScheme<Type>::deltaT0_() const
|
||||||
{
|
{
|
||||||
return mesh().time().deltaT0().value();
|
return mesh().time().deltaT0Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,13 +42,13 @@ namespace fv
|
|||||||
|
|
||||||
scalar boundedBackwardDdtScheme::deltaT_() const
|
scalar boundedBackwardDdtScheme::deltaT_() const
|
||||||
{
|
{
|
||||||
return mesh().time().deltaT().value();
|
return mesh().time().deltaTValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar boundedBackwardDdtScheme::deltaT0_() const
|
scalar boundedBackwardDdtScheme::deltaT0_() const
|
||||||
{
|
{
|
||||||
return mesh().time().deltaT0().value();
|
return mesh().time().deltaT0Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,6 @@ void Foam::fvSchemes::clear()
|
|||||||
defaultLaplacianScheme_.clear();
|
defaultLaplacianScheme_.clear();
|
||||||
fluxRequired_.clear();
|
fluxRequired_.clear();
|
||||||
defaultFluxRequired_ = false;
|
defaultFluxRequired_ = false;
|
||||||
cacheFields_.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -169,15 +168,7 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
|||||||
tokenList()
|
tokenList()
|
||||||
)()
|
)()
|
||||||
),
|
),
|
||||||
defaultFluxRequired_(false),
|
defaultFluxRequired_(false)
|
||||||
cacheFields_
|
|
||||||
(
|
|
||||||
ITstream
|
|
||||||
(
|
|
||||||
objectPath() + "::cacheFields",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
@ -381,11 +372,6 @@ bool Foam::fvSchemes::read()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("cacheFields"))
|
|
||||||
{
|
|
||||||
cacheFields_ = dict.subDict("cacheFields");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -563,22 +549,4 @@ bool Foam::fvSchemes::fluxRequired(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::fvSchemes::cache(const word& name) const
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Lookup cache for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cacheFields_.found(name))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -79,8 +79,6 @@ class fvSchemes
|
|||||||
dictionary fluxRequired_;
|
dictionary fluxRequired_;
|
||||||
bool defaultFluxRequired_;
|
bool defaultFluxRequired_;
|
||||||
|
|
||||||
dictionary cacheFields_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -128,8 +126,6 @@ public:
|
|||||||
|
|
||||||
bool fluxRequired(const word& name) const;
|
bool fluxRequired(const word& name) const;
|
||||||
|
|
||||||
bool cache(const word& name) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Read
|
// Read
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ void Foam::MULES::explicitSolve
|
|||||||
|
|
||||||
scalarField& psiIf = psi;
|
scalarField& psiIf = psi;
|
||||||
const scalarField& psi0 = psi.oldTime();
|
const scalarField& psi0 = psi.oldTime();
|
||||||
const scalar deltaT = mesh.time().deltaT().value();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
|
|
||||||
psiIf = 0.0;
|
psiIf = 0.0;
|
||||||
fvc::surfaceIntegrate(psiIf, phiPsi);
|
fvc::surfaceIntegrate(psiIf, phiPsi);
|
||||||
@ -328,7 +328,7 @@ void Foam::MULES::limiter
|
|||||||
const unallocLabelList& owner = mesh.owner();
|
const unallocLabelList& owner = mesh.owner();
|
||||||
const unallocLabelList& neighb = mesh.neighbour();
|
const unallocLabelList& neighb = mesh.neighbour();
|
||||||
const scalarField& V = mesh.V();
|
const scalarField& V = mesh.V();
|
||||||
const scalar deltaT = mesh.time().deltaT().value();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
|
|
||||||
const scalarField& phiBDIf = phiBD;
|
const scalarField& phiBDIf = phiBD;
|
||||||
const surfaceScalarField::GeometricBoundaryField& phiBDBf =
|
const surfaceScalarField::GeometricBoundaryField& phiBDBf =
|
||||||
|
|||||||
@ -576,7 +576,7 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
|
|||||||
|
|
||||||
// Move the polyMesh and set the mesh motion fluxes to the swept-volumes
|
// Move the polyMesh and set the mesh motion fluxes to the swept-volumes
|
||||||
|
|
||||||
scalar rDeltaT = 1.0/time().deltaT().value();
|
scalar rDeltaT = 1.0/time().deltaTValue();
|
||||||
|
|
||||||
tmp<scalarField> tsweptVols = polyMesh::movePoints(p);
|
tmp<scalarField> tsweptVols = polyMesh::movePoints(p);
|
||||||
scalarField& sweptVols = tsweptVols();
|
scalarField& sweptVols = tsweptVols();
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Description
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "coupledFvPatch.H"
|
#include "coupledFvPatch.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
|
|||||||
// Calculate the non-orthogonality for meshes with 1 face or more
|
// Calculate the non-orthogonality for meshes with 1 face or more
|
||||||
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
|
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
|
||||||
{
|
{
|
||||||
NonOrthogCoeff =
|
NonOrthogCoeff = radToDeg
|
||||||
|
(
|
||||||
asin
|
asin
|
||||||
(
|
(
|
||||||
min
|
min
|
||||||
@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
|
|||||||
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
|
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
|
||||||
1.0
|
1.0
|
||||||
)
|
)
|
||||||
)*180.0/constant::mathematical::pi;
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat
|
|||||||
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
|
||||||
|
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
|
||||||
|
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
|
||||||
|
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C
|
||||||
|
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C
|
||||||
|
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
||||||
|
|||||||
@ -2,10 +2,12 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lforces
|
||||||
|
|||||||
@ -142,7 +142,7 @@ Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
|
|||||||
(
|
(
|
||||||
cmpt_,
|
cmpt_,
|
||||||
tcurPoints().component(cmpt_)
|
tcurPoints().component(cmpt_)
|
||||||
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
|
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
|
||||||
);
|
);
|
||||||
|
|
||||||
twoDCorrectPoints(tcurPoints());
|
twoDCorrectPoints(tcurPoints());
|
||||||
|
|||||||
@ -112,7 +112,7 @@ Foam::velocityLaplacianFvMotionSolver::curPoints() const
|
|||||||
tmp<pointField> tcurPoints
|
tmp<pointField> tcurPoints
|
||||||
(
|
(
|
||||||
fvMesh_.points()
|
fvMesh_.points()
|
||||||
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
|
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
|
||||||
);
|
);
|
||||||
|
|
||||||
twoDCorrectPoints(tcurPoints());
|
twoDCorrectPoints(tcurPoints());
|
||||||
|
|||||||
@ -146,7 +146,7 @@ void angularOscillatingVelocityPointPatchVectorField::updateCoeffs()
|
|||||||
+ (axisHat ^ p0Rel*sin(angle))
|
+ (axisHat ^ p0Rel*sin(angle))
|
||||||
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
|
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
|
||||||
- p.localPoints()
|
- p.localPoints()
|
||||||
)/t.deltaT().value()
|
)/t.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
|
|||||||
@ -125,7 +125,7 @@ void oscillatingVelocityPointPatchVectorField::updateCoeffs()
|
|||||||
Field<vector>::operator=
|
Field<vector>::operator=
|
||||||
(
|
(
|
||||||
(p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
|
(p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
|
||||||
/t.deltaT().value()
|
/t.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
|
|||||||
@ -0,0 +1,192 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "sixDoFRigidBodyDisplacementPointPatchVectorField.H"
|
||||||
|
#include "pointPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "uniformDimensionedFields.H"
|
||||||
|
#include "forces.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField::
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(p, iF),
|
||||||
|
motion_(),
|
||||||
|
p0_(p.localPoints()),
|
||||||
|
rhoInf_(1.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField::
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||||
|
motion_(dict),
|
||||||
|
rhoInf_(readScalar(dict.lookup("rhoInf")))
|
||||||
|
{
|
||||||
|
if (!dict.found("value"))
|
||||||
|
{
|
||||||
|
updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("p0"))
|
||||||
|
{
|
||||||
|
p0_ = vectorField("p0", dict , p.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p0_ = p.localPoints();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField::
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf,
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const pointPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||||
|
motion_(ptf.motion_),
|
||||||
|
p0_(ptf.p0_),
|
||||||
|
rhoInf_(ptf.rhoInf_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField::
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(ptf, iF),
|
||||||
|
motion_(ptf.motion_),
|
||||||
|
p0_(ptf.p0_),
|
||||||
|
rhoInf_(ptf.rhoInf_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||||
|
const Time& t = mesh.time();
|
||||||
|
const pointPatch& ptPatch = this->patch();
|
||||||
|
|
||||||
|
// Patch force data is valid for the current positions, so
|
||||||
|
// calculate the forces on the motion object from this data, then
|
||||||
|
// update the positions
|
||||||
|
|
||||||
|
motion_.updatePosition(t.deltaTValue());
|
||||||
|
|
||||||
|
dictionary forcesDict;
|
||||||
|
|
||||||
|
forcesDict.add("patches", wordList(1, ptPatch.name()));
|
||||||
|
forcesDict.add("rhoInf", rhoInf_);
|
||||||
|
forcesDict.add("CofR", motion_.centreOfMass());
|
||||||
|
|
||||||
|
forces f("forces", db(), forcesDict);
|
||||||
|
|
||||||
|
forces::forcesMoments fm = f.calcForcesMoment();
|
||||||
|
|
||||||
|
// Get the forces on the patch faces at the current positions
|
||||||
|
|
||||||
|
vector gravity = vector::zero;
|
||||||
|
|
||||||
|
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
||||||
|
{
|
||||||
|
uniformDimensionedVectorField g =
|
||||||
|
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||||
|
|
||||||
|
gravity = g.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
motion_.updateForce
|
||||||
|
(
|
||||||
|
fm.first().first() + fm.first().second() + gravity*motion_.mass(),
|
||||||
|
fm.second().first() + fm.second().second(),
|
||||||
|
t.deltaTValue()
|
||||||
|
);
|
||||||
|
|
||||||
|
Field<vector>::operator=(motion_.generatePositions(p0_) - p0_);
|
||||||
|
|
||||||
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
pointPatchField<vector>::write(os);
|
||||||
|
motion_.write(os);
|
||||||
|
os.writeKeyword("rhoInf")
|
||||||
|
<< rhoInf_ << token::END_STATEMENT << nl;
|
||||||
|
p0_.writeEntry("p0", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePointPatchTypeField
|
||||||
|
(
|
||||||
|
pointPatchVectorField,
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sixDoFRigidBodyDisplacementPointPatchVectorField_H
|
||||||
|
#define sixDoFRigidBodyDisplacementPointPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fixedValuePointPatchField.H"
|
||||||
|
#include "sixDoFRigidBodyMotion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValuePointPatchField<vector>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Six dof motion object
|
||||||
|
sixDoFRigidBodyMotion motion_;
|
||||||
|
|
||||||
|
//- Reference positions of points on the patch
|
||||||
|
pointField p0_;
|
||||||
|
|
||||||
|
//- Reference density required by the forces object for
|
||||||
|
// incompressible calculations
|
||||||
|
scalar rhoInf_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("sixDoFRigidBodyDisplacement");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given patchField<vector> onto a new patch
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyDisplacementPointPatchVectorField&,
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&,
|
||||||
|
const pointPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<pointPatchField<vector> >
|
||||||
|
(
|
||||||
|
new sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyDisplacementPointPatchVectorField&,
|
||||||
|
const DimensionedField<vector, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual autoPtr<pointPatchField<vector> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return autoPtr<pointPatchField<vector> >
|
||||||
|
(
|
||||||
|
new sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,210 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "sixDoFRigidBodyMotion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
||||||
|
:
|
||||||
|
motionState_(),
|
||||||
|
refCentreOfMass_(vector::zero),
|
||||||
|
momentOfInertia_(diagTensor::one*VSMALL),
|
||||||
|
mass_(VSMALL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
||||||
|
(
|
||||||
|
const point& centreOfMass,
|
||||||
|
const tensor& Q,
|
||||||
|
const vector& v,
|
||||||
|
const vector& a,
|
||||||
|
const vector& pi,
|
||||||
|
const vector& tau,
|
||||||
|
scalar mass,
|
||||||
|
const point& refCentreOfMass,
|
||||||
|
const diagTensor& momentOfInertia
|
||||||
|
)
|
||||||
|
:
|
||||||
|
motionState_
|
||||||
|
(
|
||||||
|
centreOfMass,
|
||||||
|
Q,
|
||||||
|
v,
|
||||||
|
a,
|
||||||
|
pi,
|
||||||
|
tau
|
||||||
|
),
|
||||||
|
refCentreOfMass_(refCentreOfMass),
|
||||||
|
momentOfInertia_(momentOfInertia),
|
||||||
|
mass_(mass)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
||||||
|
:
|
||||||
|
motionState_(dict),
|
||||||
|
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
|
||||||
|
momentOfInertia_(dict.lookup("momentOfInertia")),
|
||||||
|
mass_(readScalar(dict.lookup("mass")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyMotion& sDoFRBM
|
||||||
|
)
|
||||||
|
:
|
||||||
|
motionState_(sDoFRBM.motionState()),
|
||||||
|
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
|
||||||
|
momentOfInertia_(sDoFRBM.momentOfInertia()),
|
||||||
|
mass_(sDoFRBM.mass())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotion::~sixDoFRigidBodyMotion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotion::updatePosition
|
||||||
|
(
|
||||||
|
scalar deltaT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// First leapfrog velocity adjust and motion part, required before
|
||||||
|
// force calculation
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
v() += 0.5*deltaT*a();
|
||||||
|
|
||||||
|
pi() += 0.5*deltaT*tau();
|
||||||
|
|
||||||
|
// Leapfrog move part
|
||||||
|
centreOfMass() += deltaT*v();
|
||||||
|
|
||||||
|
// Leapfrog orientation adjustment
|
||||||
|
|
||||||
|
tensor R;
|
||||||
|
|
||||||
|
R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx());
|
||||||
|
pi() = pi() & R;
|
||||||
|
Q() = Q() & R;
|
||||||
|
|
||||||
|
R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy());
|
||||||
|
pi() = pi() & R;
|
||||||
|
Q() = Q() & R;
|
||||||
|
|
||||||
|
R = rotationTensorZ(deltaT*pi().z()/momentOfInertia_.zz());
|
||||||
|
pi() = pi() & R;
|
||||||
|
Q() = Q() & R;
|
||||||
|
|
||||||
|
R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy());
|
||||||
|
pi() = pi() & R;
|
||||||
|
Q() = Q() & R;
|
||||||
|
|
||||||
|
R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx());
|
||||||
|
pi() = pi() & R;
|
||||||
|
Q() = Q() & R;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::scatter(motionState_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotion::updateForce
|
||||||
|
(
|
||||||
|
const vector& fGlobal,
|
||||||
|
const vector& tauGlobal,
|
||||||
|
scalar deltaT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Second leapfrog velocity adjust part, required after motion and
|
||||||
|
// force calculation part
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
a() = fGlobal/mass_;
|
||||||
|
|
||||||
|
tau() = (Q().T() & tauGlobal);
|
||||||
|
|
||||||
|
v() += 0.5*deltaT*a();
|
||||||
|
|
||||||
|
pi() += 0.5*deltaT*tau();
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::scatter(motionState_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotion::updateForce
|
||||||
|
(
|
||||||
|
const pointField& positions,
|
||||||
|
const vectorField& forces,
|
||||||
|
scalar deltaT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Second leapfrog velocity adjust part, required after motion and
|
||||||
|
// force calculation part
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
a() = vector::zero;
|
||||||
|
|
||||||
|
tau() = vector::zero;
|
||||||
|
|
||||||
|
forAll(positions, i)
|
||||||
|
{
|
||||||
|
const vector& f = forces[i];
|
||||||
|
|
||||||
|
a() += f/mass_;
|
||||||
|
|
||||||
|
tau() += (positions[i] ^ (Q().T() & f));
|
||||||
|
}
|
||||||
|
|
||||||
|
v() += 0.5*deltaT*a();
|
||||||
|
|
||||||
|
pi() += 0.5*deltaT*tau();
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::scatter(motionState_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::pointField>
|
||||||
|
Foam::sixDoFRigidBodyMotion::generatePositions(const pointField& pts) const
|
||||||
|
{
|
||||||
|
return (centreOfMass() + (Q() & (pts - refCentreOfMass_)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user