mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: git merge with master conflict resolution
This commit is contained in:
@ -66,6 +66,11 @@
|
|||||||
-doc display application documentation in browser
|
-doc display application documentation in browser
|
||||||
-help print the usage
|
-help print the usage
|
||||||
|
|
||||||
|
*** *New* basicSolidThermo solids thermophysical library
|
||||||
|
+ Used in all conjugate heat transfer solvers
|
||||||
|
+ constant properties
|
||||||
|
+ temperature dependent properties
|
||||||
|
+ temperature and direction (in local coordinate system) dependent properties
|
||||||
*** *New* Surface film library
|
*** *New* Surface film library
|
||||||
+ Creation of films by particle addition, or initial film distribution
|
+ Creation of films by particle addition, or initial film distribution
|
||||||
+ Coupled with the lagrangian/intermediate cloud hierarchy library
|
+ Coupled with the lagrangian/intermediate cloud hierarchy library
|
||||||
@ -87,6 +92,10 @@
|
|||||||
*** *Updated* particle tracking algorithm
|
*** *Updated* particle tracking algorithm
|
||||||
*** *Updated* split cyclics into two separate patches. See doc/changed/splitCyclics.txt
|
*** *Updated* split cyclics into two separate patches. See doc/changed/splitCyclics.txt
|
||||||
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
|
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
|
||||||
|
*** *Updated* runTimeModifiable
|
||||||
|
+ on linux uses inotify instead of time stamps - more efficient for large
|
||||||
|
numbers of monitored files. No more fileModificationSkew needed.
|
||||||
|
+ single integer reduction instead of one reduction per monitored file.
|
||||||
* Solvers
|
* Solvers
|
||||||
A number of new solvers have been developed for a range of engineering
|
A number of new solvers have been developed for a range of engineering
|
||||||
applications. There has been a set of improvements to certain classes of
|
applications. There has been a set of improvements to certain classes of
|
||||||
@ -125,6 +134,8 @@
|
|||||||
(nonuniformTransform)cyclic <zoneA>_<zoneB>
|
(nonuniformTransform)cyclic <zoneA>_<zoneB>
|
||||||
+ extrudes into master direction (i.e. away from the owner cell
|
+ extrudes into master direction (i.e. away from the owner cell
|
||||||
if flipMap is false)
|
if flipMap is false)
|
||||||
|
+ =topoSet=: replacement of cellSet,faceSet,pointSet utilities.
|
||||||
|
Comparable to a dictionary driven =setSet= utility.
|
||||||
*** Updated utilities
|
*** Updated utilities
|
||||||
+ =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial).
|
+ =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial).
|
||||||
+ =blockMesh=: specify patches via dictionary instead of type only. This
|
+ =blockMesh=: specify patches via dictionary instead of type only. This
|
||||||
@ -133,6 +144,8 @@
|
|||||||
* Post-processing
|
* Post-processing
|
||||||
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
|
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
|
||||||
field data.
|
field data.
|
||||||
|
+ =singleCellMesh=: new utility to convert mesh and fields to a single cell
|
||||||
|
mesh. Great for postprocessing.
|
||||||
+ Function objects:
|
+ Function objects:
|
||||||
+ =residualControl=: new function object to allow users to terminate steady
|
+ =residualControl=: new function object to allow users to terminate steady
|
||||||
state calculations when the defined residual levels are achieved
|
state calculations when the defined residual levels are achieved
|
||||||
@ -144,7 +157,9 @@
|
|||||||
+ =streamLine=: generate streamlines; ouputs both trajectory and field data
|
+ =streamLine=: generate streamlines; ouputs both trajectory and field data
|
||||||
|
|
||||||
* New tutorials
|
* New tutorials
|
||||||
There is a large number of new tutorials to support the new solvers in the
|
There is a large number of new tutorials for existing and new solvers in the
|
||||||
release.
|
release.
|
||||||
+ =reactingParcelFilmFoam= tutorials:
|
+ =reactingParcelFilmFoam= tutorials:
|
||||||
+ multipleBoxes, hotBoxes, panel, evaporationTest
|
+ multipleBoxes, hotBoxes, panel, evaporationTest
|
||||||
|
+ =interDyMFoam= tutorials:
|
||||||
|
+ testTubeMixer: showcases =solidBodyMotionFunction=
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
(
|
(
|
||||||
dimensionedScalar::lookupOrAddToDict
|
dimensionedScalar::lookupOrAddToDict
|
||||||
(
|
(
|
||||||
"alphaEps",
|
"alphak",
|
||||||
kEpsilonDict,
|
kEpsilonDict,
|
||||||
1.0
|
1.0
|
||||||
)
|
)
|
||||||
|
|||||||
@ -934,18 +934,31 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char* linePtr = readline("readline>");
|
char* linePtr = readline("readline>");
|
||||||
|
|
||||||
rawLine = string(linePtr);
|
if (linePtr)
|
||||||
|
|
||||||
if (*linePtr)
|
|
||||||
{
|
{
|
||||||
add_history(linePtr);
|
rawLine = string(linePtr);
|
||||||
write_history(historyFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(linePtr); // readline uses malloc, not new.
|
if (*linePtr)
|
||||||
|
{
|
||||||
|
add_history(linePtr);
|
||||||
|
write_history(historyFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(linePtr); // readline uses malloc, not new.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
{
|
{
|
||||||
|
if (!std::cin.good())
|
||||||
|
{
|
||||||
|
Info<< "End of cin" << endl;
|
||||||
|
// No error.
|
||||||
|
break;
|
||||||
|
}
|
||||||
Info<< "Command>" << flush;
|
Info<< "Command>" << flush;
|
||||||
std::getline(std::cin, rawLine);
|
std::getline(std::cin, rawLine);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,13 +68,13 @@ namespace Foam
|
|||||||
|
|
||||||
functionObjectList fol(runTime, dict);
|
functionObjectList fol(runTime, dict);
|
||||||
fol.start();
|
fol.start();
|
||||||
fol.execute();
|
fol.execute(true); // override outputControl - force writing
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
functionObjectList fol(runTime);
|
functionObjectList fol(runTime);
|
||||||
fol.start();
|
fol.start();
|
||||||
fol.execute();
|
fol.execute(true); // override outputControl - force writing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,7 @@ cleanCase()
|
|||||||
rm -rf processor* > /dev/null 2>&1
|
rm -rf processor* > /dev/null 2>&1
|
||||||
rm -rf probes* > /dev/null 2>&1
|
rm -rf probes* > /dev/null 2>&1
|
||||||
rm -rf forces* > /dev/null 2>&1
|
rm -rf forces* > /dev/null 2>&1
|
||||||
|
rm -rf sets > /dev/null 2>&1
|
||||||
rm -rf system/machines > /dev/null 2>&1
|
rm -rf system/machines > /dev/null 2>&1
|
||||||
(cd constant/polyMesh && \
|
(cd constant/polyMesh && \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
|
|||||||
@ -59,6 +59,14 @@ It will check if anything needs to be converted, backup the current file to .old
|
|||||||
and split any cyclic patchFields into two entries.
|
and split any cyclic patchFields into two entries.
|
||||||
|
|
||||||
|
|
||||||
|
Mesh converters
|
||||||
|
---------------
|
||||||
|
Most mesh formats use cyclics in a single patch (i.e. the old way).
|
||||||
|
The converters have been adapted to use the patch 'oldCyclic' instead of
|
||||||
|
'cyclic'. oldCyclic uses the 17x automatic ordering but writes 'type cyclic'
|
||||||
|
so afterwards foamUpgradeCyclics can be run to upgrade.
|
||||||
|
|
||||||
|
|
||||||
decomposePar
|
decomposePar
|
||||||
------------
|
------------
|
||||||
Decomposes cyclics into processorCyclic:
|
Decomposes cyclics into processorCyclic:
|
||||||
|
|||||||
@ -37,8 +37,11 @@ namespace Foam
|
|||||||
const label SIBS::nSeq_[iMaxX_] = {2, 6, 10, 14, 22, 34, 50, 70};
|
const label SIBS::nSeq_[iMaxX_] = {2, 6, 10, 14, 22, 34, 50, 70};
|
||||||
|
|
||||||
const scalar
|
const scalar
|
||||||
SIBS::safe1 = 0.25, SIBS::safe2 = 0.7,
|
SIBS::safe1 = 0.25,
|
||||||
SIBS::redMax = 1.0e-5, SIBS::redMin = 0.0, SIBS::scaleMX = 0.1;
|
SIBS::safe2 = 0.7,
|
||||||
|
SIBS::redMax = 1.0e-5,
|
||||||
|
SIBS::redMin = 0.7,
|
||||||
|
SIBS::scaleMX = 0.1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -170,7 +170,9 @@ namespace Foam
|
|||||||
<< "inotify instances" << endl
|
<< "inotify instances" << endl
|
||||||
<< " (/proc/sys/fs/inotify/max_user_instances"
|
<< " (/proc/sys/fs/inotify/max_user_instances"
|
||||||
<< " on Linux)" << endl
|
<< " on Linux)" << endl
|
||||||
<< " or switch off runTimeModifiable." << endl
|
<< " , switch off runTimeModifiable." << endl
|
||||||
|
<< " or compile this file with FOAM_USE_STAT to use"
|
||||||
|
<< " time stamps instead of inotify." << endl
|
||||||
<< " Continuing without additional file monitoring."
|
<< " Continuing without additional file monitoring."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,10 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
|||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
template<class OutputFilter>
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
|
bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
||||||
|
(
|
||||||
|
const bool forceWrite
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (enabled_)
|
if (enabled_)
|
||||||
{
|
{
|
||||||
@ -139,7 +142,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
|
|||||||
|
|
||||||
ptr_->execute();
|
ptr_->execute();
|
||||||
|
|
||||||
if (outputControl_.output())
|
if (forceWrite || outputControl_.output())
|
||||||
{
|
{
|
||||||
ptr_->write();
|
ptr_->write();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,7 @@ public:
|
|||||||
virtual bool start();
|
virtual bool start();
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop
|
//- Called at each ++ or += of the time-loop
|
||||||
virtual bool execute();
|
virtual bool execute(const bool forceWrite);
|
||||||
|
|
||||||
//- Called when Time::run() determines that the time-loop exits
|
//- Called when Time::run() determines that the time-loop exits
|
||||||
virtual bool end();
|
virtual bool end();
|
||||||
|
|||||||
@ -112,7 +112,7 @@ const Foam::word& Foam::functionObject::name() const
|
|||||||
|
|
||||||
bool Foam::functionObject::end()
|
bool Foam::functionObject::end()
|
||||||
{
|
{
|
||||||
return execute();
|
return execute(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -147,8 +147,9 @@ public:
|
|||||||
//- Called at the start of the time-loop
|
//- Called at the start of the time-loop
|
||||||
virtual bool start() = 0;
|
virtual bool start() = 0;
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop
|
//- Called at each ++ or += of the time-loop. forceWrite overrides the
|
||||||
virtual bool execute() = 0;
|
// outputControl behaviour.
|
||||||
|
virtual bool execute(const bool forceWrite) = 0;
|
||||||
|
|
||||||
//- Called when Time::run() determines that the time-loop exits.
|
//- Called when Time::run() determines that the time-loop exits.
|
||||||
// By default it simply calls execute().
|
// By default it simply calls execute().
|
||||||
|
|||||||
@ -144,7 +144,7 @@ bool Foam::functionObjectList::start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjectList::execute()
|
bool Foam::functionObjectList::execute(const bool forceWrite)
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ bool Foam::functionObjectList::execute()
|
|||||||
|
|
||||||
forAll(*this, objectI)
|
forAll(*this, objectI)
|
||||||
{
|
{
|
||||||
ok = operator[](objectI).execute() && ok;
|
ok = operator[](objectI).execute(forceWrite) && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -153,8 +153,10 @@ public:
|
|||||||
//- Called at the start of the time-loop
|
//- Called at the start of the time-loop
|
||||||
virtual bool start();
|
virtual bool start();
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop
|
//- Called at each ++ or += of the time-loop. forceWrite overrides
|
||||||
virtual bool execute();
|
// the usual outputControl behaviour and forces writing always
|
||||||
|
// (used in postprocessing mode)
|
||||||
|
virtual bool execute(const bool forceWrite = false);
|
||||||
|
|
||||||
//- Called when Time::run() determines that the time-loop exits
|
//- Called when Time::run() determines that the time-loop exits
|
||||||
virtual bool end();
|
virtual bool end();
|
||||||
|
|||||||
@ -287,6 +287,7 @@ $(ddtSchemes)/steadyStateDdtScheme/steadyStateDdtSchemes.C
|
|||||||
$(ddtSchemes)/EulerDdtScheme/EulerDdtSchemes.C
|
$(ddtSchemes)/EulerDdtScheme/EulerDdtSchemes.C
|
||||||
$(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C
|
$(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C
|
||||||
$(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C
|
$(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C
|
||||||
|
$(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C
|
||||||
$(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C
|
$(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C
|
||||||
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C
|
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C
|
||||||
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C
|
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C
|
||||||
|
|||||||
@ -0,0 +1,584 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2010 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
#include "surfaceInterpolate.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const
|
||||||
|
{
|
||||||
|
return mesh().objectRegistry::lookupObject<volScalarField>(rDeltaTName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
localEulerDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const dimensioned<Type>& dt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt(" + dt.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > tdtdt
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
dt.dimensions()/dimTime,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
tdtdt().internalField() =
|
||||||
|
rDeltaT.internalField()*dt.value()*(1.0 - mesh().V0()/mesh().V());
|
||||||
|
|
||||||
|
return tdtdt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
dt.dimensions()/dimTime,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
),
|
||||||
|
calculatedFvPatchField<Type>::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
localEulerDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt(" + vf.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*
|
||||||
|
(
|
||||||
|
vf.internalField()
|
||||||
|
- vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*
|
||||||
|
(
|
||||||
|
vf.boundaryField() - vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*(vf - vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
localEulerDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt(" + rho.name() + ',' + vf.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*rho.value()*
|
||||||
|
(
|
||||||
|
vf.internalField()
|
||||||
|
- vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*rho.value()*
|
||||||
|
(
|
||||||
|
vf.boundaryField() - vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*rho*(vf - vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
localEulerDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt(" + rho.name() + ',' + vf.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*
|
||||||
|
(
|
||||||
|
rho.internalField()*vf.internalField()
|
||||||
|
- rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*
|
||||||
|
(
|
||||||
|
rho.boundaryField()*vf.boundaryField()
|
||||||
|
- rho.oldTime().boundaryField()
|
||||||
|
*vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*(rho*vf - rho.oldTime()*vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
localEulerDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
const scalarField& rDeltaT = localRDeltaT().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
localEulerDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
rho.dimensions()*vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
const scalarField& rDeltaT = localRDeltaT().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*rho.value()*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.value()*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.value()*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
localEulerDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
rho.dimensions()*vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
const scalarField& rDeltaT = localRDeltaT().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<typename localEulerDdtScheme<Type>::fluxFieldType>
|
||||||
|
localEulerDdtScheme<Type>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddtPhiCorr(" + rA.name() + ',' + U.name() + ',' + phi.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<typename flux<Type>::type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
rA.dimensions()*phi.dimensions()/dimTime,
|
||||||
|
pTraits<typename flux<Type>::type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(U.oldTime(), phi.oldTime())*
|
||||||
|
(
|
||||||
|
fvc::interpolate(rDeltaT*rA)*phi.oldTime()
|
||||||
|
- (fvc::interpolate(rDeltaT*rA*U.oldTime()) & mesh().Sf())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<typename localEulerDdtScheme<Type>::fluxFieldType>
|
||||||
|
localEulerDdtScheme<Type>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddtPhiCorr("
|
||||||
|
+ rA.name() + ',' + rho.name() + ',' + U.name() + ',' + phi.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<typename flux<Type>::type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
rA.dimensions()*rho.dimensions()*phi.dimensions()/dimTime,
|
||||||
|
pTraits<typename flux<Type>::type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const volScalarField& rDeltaT = localRDeltaT();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimVelocity
|
||||||
|
&& phi.dimensions() == dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(U.oldTime(), phi.oldTime())
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA*rho.oldTime())*phi.oldTime()
|
||||||
|
- (fvc::interpolate(rDeltaT*rA*rho.oldTime()*U.oldTime())
|
||||||
|
& mesh().Sf())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimVelocity
|
||||||
|
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff
|
||||||
|
(
|
||||||
|
U.oldTime(),
|
||||||
|
phi.oldTime()/fvc::interpolate(rho.oldTime())
|
||||||
|
)
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA*rho.oldTime())
|
||||||
|
*phi.oldTime()/fvc::interpolate(rho.oldTime())
|
||||||
|
- (
|
||||||
|
fvc::interpolate
|
||||||
|
(
|
||||||
|
rDeltaT*rA*rho.oldTime()*U.oldTime()
|
||||||
|
) & mesh().Sf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimDensity*dimVelocity
|
||||||
|
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(rho.oldTime(), U.oldTime(), phi.oldTime())
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA)*phi.oldTime()
|
||||||
|
- (
|
||||||
|
fvc::interpolate(rDeltaT*rA*U.oldTime())&mesh().Sf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"localEulerDdtScheme<Type>::fvcDdtPhiCorr"
|
||||||
|
) << "dimensions of phi are not correct"
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
return fluxFieldType::null();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<surfaceScalarField> localEulerDdtScheme<Type>::meshPhi
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<surfaceScalarField>
|
||||||
|
(
|
||||||
|
new surfaceScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshPhi",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("0", dimVolume/dimTime, 0.0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fv
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,210 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2010 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fv::localEulerDdtScheme
|
||||||
|
|
||||||
|
Description
|
||||||
|
Local time-step first-order Euler implicit/explicit ddt.
|
||||||
|
The reciprocal of the local time-step field is looked-up from the
|
||||||
|
database with the name provided.
|
||||||
|
|
||||||
|
This scheme should only be used for steady-state computations
|
||||||
|
using transient codes where local time-stepping is preferably to
|
||||||
|
under-relaxation for transport consistency reasons.
|
||||||
|
|
||||||
|
See also CoEulerDdtScheme.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
localEulerDdtScheme.C
|
||||||
|
localEulerDdtSchemes.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef localEulerDdtScheme_H
|
||||||
|
#define localEulerDdtScheme_H
|
||||||
|
|
||||||
|
#include "ddtScheme.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class localEulerDdtScheme Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class localEulerDdtScheme
|
||||||
|
:
|
||||||
|
public fv::ddtScheme<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Name of the reciprocal local time-step field
|
||||||
|
word rDeltaTName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
localEulerDdtScheme(const localEulerDdtScheme&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const localEulerDdtScheme&);
|
||||||
|
|
||||||
|
//- Return the reciprocal of the local time-step
|
||||||
|
const volScalarField& localRDeltaT() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("localEuler");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh and Istream
|
||||||
|
localEulerDdtScheme(const fvMesh& mesh, Istream& is)
|
||||||
|
:
|
||||||
|
ddtScheme<Type>(mesh, is),
|
||||||
|
rDeltaTName_(is)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return fv::ddtScheme<Type>::mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const dimensioned<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const volScalarField&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
const volScalarField&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
|
||||||
|
|
||||||
|
tmp<fluxFieldType> fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fluxFieldType> fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<surfaceScalarField> meshPhi
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
tmp<surfaceScalarField> localEulerDdtScheme<scalar>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
tmp<surfaceScalarField> localEulerDdtScheme<scalar>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fv
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "localEulerDdtScheme.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2010 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
makeFvDdtScheme(localEulerDdtScheme)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -255,8 +255,7 @@ void Foam::fvc::sweep
|
|||||||
changedFaces.append(facei);
|
changedFaces.append(facei);
|
||||||
changedFacesInfo.append
|
changedFacesInfo.append
|
||||||
(
|
(
|
||||||
sweepData(max(field[own], field[nbr]),
|
sweepData(max(field[own], field[nbr]), Cf[facei])
|
||||||
Cf[facei])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,12 +21,22 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
function
|
InNamespace
|
||||||
Foam::fvc::smooth
|
Foam::fvc
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Function that uses smoothData to apply spatial smoothing of a
|
Provides functions smooth spread and sweep which use the FaceCellWave
|
||||||
volume field using the FaceCellWave algorithm
|
algorithm to smooth and redistribute the first field argument.
|
||||||
|
|
||||||
|
smooth: smooths the field by ensuring the values in neighbouring
|
||||||
|
cells are at least coeff* the cell value.
|
||||||
|
|
||||||
|
spread: redistributes the field by spreading the maximum value within
|
||||||
|
the region defined by the value and gradient of alpha.
|
||||||
|
|
||||||
|
sweep: redistributes the field by sweeping the maximum value where the
|
||||||
|
gradient of alpha is large away from that starting point of the
|
||||||
|
sweep.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fvcSmooth.C
|
fvcSmooth.C
|
||||||
|
|||||||
@ -25,9 +25,9 @@ Class
|
|||||||
Foam::smoothData
|
Foam::smoothData
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Helper class used by the smoothVolField class
|
Helper class used by the fvc::smooth and fvc::spread functions.
|
||||||
|
|
||||||
Files
|
SourceFiles
|
||||||
smoothData.H
|
smoothData.H
|
||||||
smoothDataI.H
|
smoothDataI.H
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,9 @@ Class
|
|||||||
Foam::sweepData
|
Foam::sweepData
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Helper class used by fvcSmooth
|
Helper class used by fvc::sweep function.
|
||||||
|
|
||||||
Files
|
SourceFiles
|
||||||
sweepData.H
|
sweepData.H
|
||||||
sweepDataI.H
|
sweepDataI.H
|
||||||
|
|
||||||
|
|||||||
@ -53,16 +53,10 @@ void Foam::streamLine::track()
|
|||||||
initialParticles
|
initialParticles
|
||||||
);
|
);
|
||||||
|
|
||||||
//Pout<< "Seeding particles." << endl;
|
|
||||||
|
|
||||||
const sampledSet& seedPoints = sampledSetPtr_();
|
const sampledSet& seedPoints = sampledSetPtr_();
|
||||||
|
|
||||||
forAll(seedPoints, i)
|
forAll(seedPoints, i)
|
||||||
{
|
{
|
||||||
//Pout<< "Seeded particle at " << seedPoints[i]
|
|
||||||
// << " at cell:" << seedPoints.cells()[i]
|
|
||||||
// << endl;
|
|
||||||
|
|
||||||
particles.addParticle
|
particles.addParticle
|
||||||
(
|
(
|
||||||
new streamLineParticle
|
new streamLineParticle
|
||||||
@ -228,6 +222,7 @@ void Foam::streamLine::track()
|
|||||||
vvInterp,
|
vvInterp,
|
||||||
UIndex, // index of U in vvInterp
|
UIndex, // index of U in vvInterp
|
||||||
trackForward_, // track in +u direction
|
trackForward_, // track in +u direction
|
||||||
|
nSubCycle_, // step through cells in steps?
|
||||||
allTracks_,
|
allTracks_,
|
||||||
allScalars_,
|
allScalars_,
|
||||||
allVectors_
|
allVectors_
|
||||||
@ -299,6 +294,19 @@ void Foam::streamLine::read(const dictionary& dict)
|
|||||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
UName_ = dict.lookupOrDefault<word>("U", "U");
|
||||||
dict.lookup("trackForward") >> trackForward_;
|
dict.lookup("trackForward") >> trackForward_;
|
||||||
dict.lookup("lifeTime") >> lifeTime_;
|
dict.lookup("lifeTime") >> lifeTime_;
|
||||||
|
if (lifeTime_ < 1)
|
||||||
|
{
|
||||||
|
FatalErrorIn(":streamLine::read(const dictionary&)")
|
||||||
|
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
dict.lookup("nSubCycle") >> nSubCycle_;
|
||||||
|
if (nSubCycle_ < 1)
|
||||||
|
{
|
||||||
|
nSubCycle_ = 1;
|
||||||
|
}
|
||||||
|
|
||||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||||
dict.lookup("seedSampleSet") >> seedSet_;
|
dict.lookup("seedSampleSet") >> seedSet_;
|
||||||
|
|
||||||
@ -326,7 +334,6 @@ void Foam::streamLine::execute()
|
|||||||
{
|
{
|
||||||
// const Time& runTime = const_cast<Time&>(obr_.time());
|
// const Time& runTime = const_cast<Time&>(obr_.time());
|
||||||
// Pout<< "**streamLine::execute : time:" << runTime.timeName() << endl;
|
// Pout<< "**streamLine::execute : time:" << runTime.timeName() << endl;
|
||||||
// Pout<< "**streamLine::execute : time:" << runTime.timeIndex() << endl;
|
|
||||||
//
|
//
|
||||||
// bool isOutputTime = false;
|
// bool isOutputTime = false;
|
||||||
//
|
//
|
||||||
|
|||||||
@ -92,6 +92,9 @@ class streamLine
|
|||||||
//- Maximum lifetime (= number of cells) of particle
|
//- Maximum lifetime (= number of cells) of particle
|
||||||
label lifeTime_;
|
label lifeTime_;
|
||||||
|
|
||||||
|
//- Number of subcycling steps
|
||||||
|
label nSubCycle_;
|
||||||
|
|
||||||
//- Optional specified name of particles
|
//- Optional specified name of particles
|
||||||
word cloudName_;
|
word cloudName_;
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,24 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Estimate dt to cross cell in a few steps
|
||||||
|
Foam::scalar Foam::streamLineParticle::calcSubCycleDeltaT
|
||||||
|
(
|
||||||
|
streamLineParticle::trackData& td,
|
||||||
|
const scalar dt,
|
||||||
|
const vector& U
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
streamLineParticle testParticle(*this);
|
||||||
|
bool oldKeepParticle = td.keepParticle;
|
||||||
|
bool oldSwitchProcessor = td.switchProcessor;
|
||||||
|
scalar fraction = testParticle.trackToFace(position()+dt*U, td);
|
||||||
|
td.keepParticle = oldKeepParticle;
|
||||||
|
td.switchProcessor = oldSwitchProcessor;
|
||||||
|
// Adapt the dt to subdivide the trajectory into 4 substeps.
|
||||||
|
return dt *fraction/td.nSubCycle_;
|
||||||
|
}
|
||||||
|
|
||||||
Foam::vector Foam::streamLineParticle::interpolateFields
|
Foam::vector Foam::streamLineParticle::interpolateFields
|
||||||
(
|
(
|
||||||
const streamLineParticle::trackData& td,
|
const streamLineParticle::trackData& td,
|
||||||
@ -171,34 +189,56 @@ bool Foam::streamLineParticle::move
|
|||||||
&& lifeTime_ > 0
|
&& lifeTime_ > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// TBD: implement subcycling so step through cells in more than
|
|
||||||
// one step.
|
|
||||||
|
|
||||||
// set the lagrangian time-step
|
// set the lagrangian time-step
|
||||||
scalar dt = min(dtMax, tEnd);
|
scalar dt = min(dtMax, tEnd);
|
||||||
|
|
||||||
// Store current position and sampled velocity.
|
// Cross cell in steps
|
||||||
--lifeTime_;
|
for (label subIter = 0; subIter < td.nSubCycle_; subIter++)
|
||||||
sampledPositions_.append(position());
|
|
||||||
vector U = interpolateFields(td, position(), cell());
|
|
||||||
|
|
||||||
if (!td.trackForward_)
|
|
||||||
{
|
{
|
||||||
U = -U;
|
--lifeTime_;
|
||||||
}
|
|
||||||
|
|
||||||
dt *= trackToFace(position()+dt*U, td);
|
// Store current position and sampled velocity.
|
||||||
|
sampledPositions_.append(position());
|
||||||
|
vector U = interpolateFields(td, position(), cell());
|
||||||
|
|
||||||
tEnd -= dt;
|
if (!td.trackForward_)
|
||||||
stepFraction() = 1.0 - tEnd/trackTime;
|
{
|
||||||
|
U = -U;
|
||||||
|
}
|
||||||
|
|
||||||
if (tEnd <= ROOTVSMALL)
|
|
||||||
{
|
if (subIter == 0 && td.nSubCycle_ > 1)
|
||||||
// Force removal
|
{
|
||||||
lifeTime_ = 0;
|
// Adapt dt to cross cell in a few steps
|
||||||
|
dt = calcSubCycleDeltaT(td, dt, U);
|
||||||
|
}
|
||||||
|
else if (subIter == td.nSubCycle_-1)
|
||||||
|
{
|
||||||
|
// Do full step on last subcycle
|
||||||
|
dt = min(dtMax, tEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scalar fraction = trackToFace(position()+dt*U, td);
|
||||||
|
dt *= fraction;
|
||||||
|
|
||||||
|
tEnd -= dt;
|
||||||
|
stepFraction() = 1.0 - tEnd/deltaT;
|
||||||
|
|
||||||
|
if (tEnd <= ROOTVSMALL)
|
||||||
|
{
|
||||||
|
// Force removal
|
||||||
|
lifeTime_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!td.keepParticle || td.switchProcessor || lifeTime_ == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!td.keepParticle || lifeTime_ == 0)
|
if (!td.keepParticle || lifeTime_ == 0)
|
||||||
{
|
{
|
||||||
if (lifeTime_ == 0)
|
if (lifeTime_ == 0)
|
||||||
|
|||||||
@ -72,6 +72,7 @@ public:
|
|||||||
const PtrList<interpolationCellPoint<vector> >& vvInterp_;
|
const PtrList<interpolationCellPoint<vector> >& vvInterp_;
|
||||||
const label UIndex_;
|
const label UIndex_;
|
||||||
const bool trackForward_;
|
const bool trackForward_;
|
||||||
|
const label nSubCycle_;
|
||||||
|
|
||||||
DynamicList<vectorList>& allPositions_;
|
DynamicList<vectorList>& allPositions_;
|
||||||
List<DynamicList<scalarList> >& allScalars_;
|
List<DynamicList<scalarList> >& allScalars_;
|
||||||
@ -87,6 +88,7 @@ public:
|
|||||||
const PtrList<interpolationCellPoint<vector> >& vvInterp,
|
const PtrList<interpolationCellPoint<vector> >& vvInterp,
|
||||||
const label UIndex,
|
const label UIndex,
|
||||||
const bool trackForward,
|
const bool trackForward,
|
||||||
|
const label nSubCycle,
|
||||||
DynamicList<List<point> >& allPositions,
|
DynamicList<List<point> >& allPositions,
|
||||||
List<DynamicList<scalarList> >& allScalars,
|
List<DynamicList<scalarList> >& allScalars,
|
||||||
List<DynamicList<vectorList> >& allVectors
|
List<DynamicList<vectorList> >& allVectors
|
||||||
@ -97,6 +99,7 @@ public:
|
|||||||
vvInterp_(vvInterp),
|
vvInterp_(vvInterp),
|
||||||
UIndex_(UIndex),
|
UIndex_(UIndex),
|
||||||
trackForward_(trackForward),
|
trackForward_(trackForward),
|
||||||
|
nSubCycle_(nSubCycle),
|
||||||
allPositions_(allPositions),
|
allPositions_(allPositions),
|
||||||
allScalars_(allScalars),
|
allScalars_(allScalars),
|
||||||
allVectors_(allVectors)
|
allVectors_(allVectors)
|
||||||
@ -123,6 +126,15 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Estimate dt to cross from current face to next one in nSubCycle
|
||||||
|
// steps.
|
||||||
|
scalar calcSubCycleDeltaT
|
||||||
|
(
|
||||||
|
streamLineParticle::trackData& td,
|
||||||
|
const scalar dt,
|
||||||
|
const vector& U
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate all quantities; return interpolated velocity.
|
//- Interpolate all quantities; return interpolated velocity.
|
||||||
vector interpolateFields
|
vector interpolateFields
|
||||||
(
|
(
|
||||||
|
|||||||
@ -83,7 +83,10 @@ functions
|
|||||||
fields (p U k);
|
fields (p U k);
|
||||||
|
|
||||||
// Cells particles can travel before being removed
|
// Cells particles can travel before being removed
|
||||||
lifeTime 1000;
|
lifeTime 10000;
|
||||||
|
|
||||||
|
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||||
|
nSubCycle 5;
|
||||||
|
|
||||||
// Cloud name to use
|
// Cloud name to use
|
||||||
cloudName particleTracks;
|
cloudName particleTracks;
|
||||||
|
|||||||
@ -85,7 +85,10 @@ functions
|
|||||||
fields (p k U);
|
fields (p k U);
|
||||||
|
|
||||||
// Cells particles can travel before being removed
|
// Cells particles can travel before being removed
|
||||||
lifeTime 1000;
|
lifeTime 10000;
|
||||||
|
|
||||||
|
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||||
|
nSubCycle 5;
|
||||||
|
|
||||||
// Cloud name to use
|
// Cloud name to use
|
||||||
cloudName particleTracks;
|
cloudName particleTracks;
|
||||||
|
|||||||
Reference in New Issue
Block a user