Merge branch 'master' into particleInteractions

This commit is contained in:
graham
2010-04-07 17:29:38 +01:00
98 changed files with 986 additions and 486 deletions

View File

@ -34,12 +34,7 @@
{ {
pZones.addResistance(UEqn()); pZones.addResistance(UEqn());
eqnResidual = solve solve(UEqn() == -fvc::grad(p));
(
UEqn() == -fvc::grad(p)
). initialResidual();
maxResidual = max(eqnResidual, maxResidual);
trAU = 1.0/UEqn().A(); trAU = 1.0/UEqn().A();
trAU().rename("rAU"); trAU().rename("rAU");

View File

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -13,8 +13,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();
} }

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -29,8 +29,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = tpEqn().solve().initialResidual(); tpEqn().solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -54,7 +54,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
@ -72,8 +71,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -8,9 +8,4 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve(UEqn() == -fvc::grad(p));
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);

View File

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -11,8 +11,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();
} }

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -33,8 +33,7 @@ if (transonic)
// Retain the residual from the first iteration // Retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {
@ -64,8 +63,7 @@ else
// Retain the residual from the first iteration // Retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -53,7 +53,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
@ -72,8 +71,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -8,9 +8,4 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve(UEqn() == -fvc::grad(p));
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);

View File

@ -11,8 +11,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();

View File

@ -41,8 +41,7 @@ if (transonic)
// Retain the residual from the first iteration // Retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {
@ -75,8 +74,7 @@ else
// Retain the residual from the first iteration // Retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -55,7 +55,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
@ -78,8 +77,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -14,8 +14,7 @@
TEqn.relax(); TEqn.relax();
eqnResidual = TEqn.solve().initialResidual(); TEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
rhok = 1.0 - beta*(T - TRef); rhok = 1.0 - beta*(T - TRef);
} }

View File

@ -8,7 +8,7 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve
( (
UEqn() UEqn()
== ==
@ -19,6 +19,4 @@
- fvc::snGrad(p)*mesh.magSf() - fvc::snGrad(p)*mesh.magSf()
) )
) )
).initialResidual(); );
maxResidual = max(eqnResidual, maxResidual);

View File

@ -69,7 +69,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
@ -87,8 +86,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -24,8 +24,7 @@
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -8,7 +8,7 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve
( (
UEqn() UEqn()
== ==
@ -17,6 +17,4 @@
fvc::interpolate(rho)*(g & mesh.Sf()) fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf() - fvc::snGrad(p)*mesh.magSf()
) )
).initialResidual(); );
maxResidual = max(eqnResidual, maxResidual);

View File

@ -54,7 +54,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
@ -73,8 +72,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -11,8 +11,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();
} }

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -26,8 +26,7 @@
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -57,7 +57,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
@ -76,8 +75,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -12,8 +12,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();

View File

@ -64,9 +64,7 @@ int main(int argc, char *argv[])
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readFluidMultiRegionSIMPLEControls.H" #include "readFluidMultiRegionSIMPLEControls.H"
#include "initConvergenceCheck.H"
#include "solveFluid.H" #include "solveFluid.H"
#include "convergenceCheck.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
@ -75,9 +73,7 @@ int main(int argc, char *argv[])
<< solidRegions[i].name() << endl; << solidRegions[i].name() << endl;
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionSIMPLEControls.H" #include "readSolidMultiRegionSIMPLEControls.H"
#include "initConvergenceCheck.H"
#include "solveSolid.H" #include "solveSolid.H"
#include "convergenceCheck.H"
} }
runTime.write(); runTime.write();

View File

@ -7,7 +7,7 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve
( (
UEqn() UEqn()
== ==
@ -16,6 +16,4 @@
fvc::interpolate(rho)*(g & mesh.Sf()) fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf() - fvc::snGrad(p)*mesh.magSf()
) )
).initialResidual(); );
maxResidual = max(eqnResidual, maxResidual);

View File

@ -1,12 +0,0 @@
// check convergence
Info<< "maxResidual: " << maxResidual
<< " convergence criterion: " << convergenceCriterion
<< endl;
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -11,8 +11,7 @@
hEqn.relax(); hEqn.relax();
eqnResidual = hEqn.solve().initialResidual(); hEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
thermo.correct(); thermo.correct();

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -29,8 +29,7 @@
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -6,9 +6,7 @@
-fvm::laplacian(K, T) -fvm::laplacian(K, T)
); );
tEqn.relax(); tEqn.relax();
eqnResidual = tEqn.solve().initialResidual(); tEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
Info<< "Min/max T:" << min(T).value() << ' ' Info<< "Min/max T:" << min(T).value() << ' '

View File

@ -34,12 +34,7 @@
{ {
pZones.addResistance(UEqn()); pZones.addResistance(UEqn());
eqnResidual = solve solve(UEqn() == -fvc::grad(p));
(
UEqn() == -fvc::grad(p)
). initialResidual();
maxResidual = max(eqnResidual, maxResidual);
trAU = 1.0/UEqn().A(); trAU = 1.0/UEqn().A();
trAU().rename("rAU"); trAU().rename("rAU");

View File

@ -28,8 +28,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = tpEqn().solve().initialResidual(); tpEqn().solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -54,7 +54,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
@ -71,8 +70,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -8,9 +8,4 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve(UEqn() == -fvc::grad(p));
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);

View File

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View File

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View File

@ -18,8 +18,7 @@
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pEqn.solve().initialResidual(); pEqn.solve();
maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {

View File

@ -52,7 +52,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter(); p.storePrevIter();
@ -69,8 +68,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
#include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -27,6 +27,7 @@ Global
Description Description
Execute the set of functionObjects specified in the selected dictionary Execute the set of functionObjects specified in the selected dictionary
(which defaults to system/controlDict) for the selected set of times. (which defaults to system/controlDict) for the selected set of times.
Alternative dictionaries should be placed in the system/ folder.
The flow (p-U) and optionally turbulence fields are available for the The flow (p-U) and optionally turbulence fields are available for the
function objects to operate on allowing forces and other related properties function objects to operate on allowing forces and other related properties
@ -144,12 +145,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
false false
); );
singlePhaseTransportModel laminarTransport(U, phi);
if (RASPropertiesHeader.headerOk()) if (RASPropertiesHeader.headerOk())
{ {
IOdictionary RASProperties(RASPropertiesHeader); IOdictionary RASProperties(RASPropertiesHeader);
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> RASModel autoPtr<incompressible::RASModel> RASModel
( (
incompressible::RASModel::New incompressible::RASModel::New
@ -165,6 +166,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
IOdictionary LESProperties(LESPropertiesHeader); IOdictionary LESProperties(LESPropertiesHeader);
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::LESModel> sgsModel autoPtr<incompressible::LESModel> sgsModel
( (
incompressible::LESModel::New(U, phi, laminarTransport) incompressible::LESModel::New(U, phi, laminarTransport)

View File

@ -60,7 +60,7 @@ fields
// midPoint one point per cell, inbetween two face intersections // midPoint one point per cell, inbetween two face intersections
// midPointAndFace combination of face and midPoint // midPointAndFace combination of face and midPoint
// //
// curve specified points, not nessecary on line, uses // polyLine specified points, not nessecary on line, uses
// tracking // tracking
// cloud specified points, uses findCell // cloud specified points, uses findCell
// triSurfaceMeshPointSet points of triSurface // triSurfaceMeshPointSet points of triSurface
@ -75,7 +75,7 @@ fields
// type specific: // type specific:
// uniform, face, midPoint, midPointAndFace : start and end coordinate // uniform, face, midPoint, midPointAndFace : start and end coordinate
// uniform: extra number of sampling points // uniform: extra number of sampling points
// curve, cloud: list of coordinates // polyLine, cloud: list of coordinates
sets sets
( (
lineX1 lineX1

View File

@ -107,7 +107,7 @@ public:
return IOdictionary::name(); return IOdictionary::name();
} }
//- Read the probes //- Read output filter properties
virtual bool read(); virtual bool read();
//- Sample and write //- Sample and write

View File

@ -102,6 +102,7 @@ public:
// Constructors // Constructors
//- Construct null
solverPerformance() solverPerformance()
: :
initialResidual_(0), initialResidual_(0),
@ -111,7 +112,7 @@ public:
singular_(false) singular_(false)
{} {}
//- Construct from components
solverPerformance solverPerformance
( (
const word& solverName, const word& solverName,
@ -132,6 +133,9 @@ public:
singular_(singular) singular_(singular)
{} {}
//- Construct from Istream
solverPerformance(Istream&);
// Member functions // Member functions
@ -204,6 +208,11 @@ public:
//- Print summary of solver performance //- Print summary of solver performance
void print() const; void print() const;
// Ostream Operator
friend Ostream& operator<<(Ostream&, const solverPerformance&);
}; };

View File

@ -30,6 +30,20 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> solverName_
>> fieldName_
>> initialResidual_
>> finalResidual_
>> noIterations_
>> converged_
>> singular_;
is.readEndList("lduMatrix::solverPerformance");
}
bool Foam::lduMatrix::solverPerformance::checkConvergence bool Foam::lduMatrix::solverPerformance::checkConvergence
( (
const scalar Tolerance, const scalar Tolerance,
@ -104,4 +118,23 @@ void Foam::lduMatrix::solverPerformance::print() const
} }
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Foam::lduMatrix::solverPerformance& sp
)
{
os << token::BEGIN_LIST
<< sp.solverName_ << token::SPACE
<< sp.fieldName_ << token::SPACE
<< sp.initialResidual_ << token::SPACE
<< sp.finalResidual_ << token::SPACE
<< sp.noIterations_ << token::SPACE
<< sp.converged_ << token::SPACE
<< sp.singular_ << token::SPACE
<< token::END_LIST;
return os;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -262,6 +262,7 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C
finiteVolume/fv/fv.C finiteVolume/fv/fv.C
finiteVolume/fvSchemes/fvSchemes.C finiteVolume/fvSchemes/fvSchemes.C
finiteVolume/fvData/fvData.C
ddtSchemes = finiteVolume/ddtSchemes ddtSchemes = finiteVolume/ddtSchemes
$(ddtSchemes)/ddtScheme/ddtSchemes.C $(ddtSchemes)/ddtScheme/ddtSchemes.C

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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 "fvData.H"
#include "Time.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvData::fvData(const objectRegistry& obr)
:
IOdictionary
(
IOobject
(
"fvData",
obr.time().system(),
obr,
IOobject::NO_READ,
IOobject::NO_WRITE
)
)
{
set("solverPerformance", dictionary());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
{
return subDict("solverPerformance");
}
void Foam::fvData::setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance& sp
) const
{
const_cast<dictionary&>(solverPerformanceDict()).set(name, sp);
}
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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::fvData
Description
Database for finite volume solution data, solver performance and
other reduced data. fvMesh is derived from fvData so that all fields have
access to the fvData from the mesh reference they hold.
SourceFiles
fvData.C
\*---------------------------------------------------------------------------*/
#ifndef fvData_H
#define fvData_H
#include "IOdictionary.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvData Declaration
\*---------------------------------------------------------------------------*/
class fvData
:
public IOdictionary
{
// Private Member Functions
//- Disallow default bitwise copy construct
fvData(const fvData&);
//- Disallow default bitwise assignment
void operator=(const fvData&);
public:
//- Debug switch
static int debug;
// Constructors
//- Construct for objectRegistry
fvData(const objectRegistry& obr);
// Member Functions
// Access
//- Return the dictionary of solver performance data
// which includes initial and final residuals for convergence
// checking
const dictionary& solverPerformanceDict() const;
//- Add/set the solverPerformance entry for the named field
void setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -164,6 +164,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerfVec);
return solverPerfVec; return solverPerfVec;
} }
@ -175,6 +177,7 @@ Foam::fvMatrix<Type>::solver()
return solver(psi_.mesh().solverDict(psi_.name())); return solver(psi_.mesh().solverDict(psi_.name()));
} }
template<class Type> template<class Type>
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve() Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
{ {

View File

@ -123,6 +123,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerf);
return solverPerf; return solverPerf;
} }
@ -166,6 +168,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solve
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerf);
return solverPerf; return solverPerf;
} }

View File

@ -151,6 +151,9 @@ Foam::fvMesh::fvMesh(const IOobject& io)
: :
polyMesh(io), polyMesh(io),
surfaceInterpolation(*this), surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this, boundaryMesh()), boundary_(*this, boundaryMesh()),
lduPtr_(NULL), lduPtr_(NULL),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex()),
@ -243,6 +246,9 @@ Foam::fvMesh::fvMesh
: :
polyMesh(io, points, faces, allOwner, allNeighbour, syncPar), polyMesh(io, points, faces, allOwner, allNeighbour, syncPar),
surfaceInterpolation(*this), surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this), boundary_(*this),
lduPtr_(NULL), lduPtr_(NULL),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex()),
@ -273,6 +279,9 @@ Foam::fvMesh::fvMesh
: :
polyMesh(io, points, faces, cells, syncPar), polyMesh(io, points, faces, cells, syncPar),
surfaceInterpolation(*this), surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this), boundary_(*this),
lduPtr_(NULL), lduPtr_(NULL),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex()),

View File

@ -52,6 +52,9 @@ SourceFiles
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "fvBoundaryMesh.H" #include "fvBoundaryMesh.H"
#include "surfaceInterpolation.H" #include "surfaceInterpolation.H"
#include "fvSchemes.H"
#include "fvSolution.H"
#include "fvData.H"
#include "DimensionedField.H" #include "DimensionedField.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
@ -77,7 +80,10 @@ class fvMesh
: :
public polyMesh, public polyMesh,
public lduMesh, public lduMesh,
public surfaceInterpolation public surfaceInterpolation,
public fvSchemes,
public fvSolution,
public fvData
{ {
// Private data // Private data

View File

@ -57,8 +57,6 @@ void surfaceInterpolation::clearOut()
surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm) surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm)
: :
fvSchemes(static_cast<const objectRegistry&>(fvm)),
fvSolution(static_cast<const objectRegistry&>(fvm)),
mesh_(fvm), mesh_(fvm),
weightingFactors_(NULL), weightingFactors_(NULL),
differenceFactors_(NULL), differenceFactors_(NULL),

View File

@ -37,8 +37,6 @@ SourceFiles
#include "tmp.H" #include "tmp.H"
#include "scalar.H" #include "scalar.H"
#include "fvSchemes.H"
#include "fvSolution.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "className.H" #include "className.H"
@ -53,9 +51,6 @@ namespace Foam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class surfaceInterpolation class surfaceInterpolation
:
public fvSchemes,
public fvSolution
{ {
// Private data // Private data

View File

@ -58,7 +58,7 @@ Foam::scalar Foam::ConeInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return volumeFlowRate_().integrate(time0, time1); return flowRateProfile_().integrate(time0, time1);
} }
else else
{ {
@ -85,11 +85,11 @@ Foam::ConeInjection<CloudType>::ConeInjection
( (
readScalar(this->coeffDict().lookup("parcelsPerSecond")) readScalar(this->coeffDict().lookup("parcelsPerSecond"))
), ),
volumeFlowRate_ flowRateProfile_
( (
DataEntry<scalar>::New DataEntry<scalar>::New
( (
"volumeFlowRate", "flowRateProfile",
this->coeffDict() this->coeffDict()
) )
), ),
@ -147,7 +147,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
tanVec2_ = direction_^tanVec1_; tanVec2_ = direction_^tanVec1_;
// Set total volume to inject // Set total volume to inject
this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_);
// Set/cache the injector cell // Set/cache the injector cell
this->findCellAtPosition(injectorCell_, position_); this->findCellAtPosition(injectorCell_, position_);

View File

@ -83,8 +83,8 @@ class ConeInjection
//- Number of parcels to introduce per second [] //- Number of parcels to introduce per second []
const label parcelsPerSecond_; const label parcelsPerSecond_;
//- Volume flow rate of parcels to introduce relative to SOI [m^3] //- Flow rate profile relative to SOI []
const autoPtr<DataEntry<scalar> > volumeFlowRate_; const autoPtr<DataEntry<scalar> > flowRateProfile_;
//- Parcel velocity magnitude relative to SOI [m/s] //- Parcel velocity magnitude relative to SOI [m/s]
const autoPtr<DataEntry<scalar> > Umag_; const autoPtr<DataEntry<scalar> > Umag_;

View File

@ -40,7 +40,7 @@ Foam::label Foam::ConeInjectionMP<CloudType>::parcelsToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
const scalar targetVolume = volumeFlowRate_().integrate(0, time1); const scalar targetVolume = flowRateProfile_().integrate(0, time1);
const label targetParcels = const label targetParcels =
parcelsPerInjector_*targetVolume/this->volumeTotal_; parcelsPerInjector_*targetVolume/this->volumeTotal_;
@ -67,7 +67,7 @@ Foam::scalar Foam::ConeInjectionMP<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return volumeFlowRate_().integrate(time0, time1); return flowRateProfile_().integrate(time0, time1);
} }
else else
{ {
@ -116,11 +116,11 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
( (
readScalar(this->coeffDict().lookup("parcelsPerInjector")) readScalar(this->coeffDict().lookup("parcelsPerInjector"))
), ),
volumeFlowRate_ flowRateProfile_
( (
DataEntry<scalar>::New DataEntry<scalar>::New
( (
"volumeFlowRate", "flowRateProfile",
this->coeffDict() this->coeffDict()
) )
), ),
@ -182,7 +182,7 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
} }
// Set total volume to inject // Set total volume to inject
this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_);
// Set/cache the injector cells // Set/cache the injector cells
forAll(positions_, i) forAll(positions_, i)

View File

@ -90,8 +90,8 @@ class ConeInjectionMP
//- Number of parcels to introduce per injector //- Number of parcels to introduce per injector
const label parcelsPerInjector_; const label parcelsPerInjector_;
//- Volume flow rate of parcels to introduce relative to SOI [m^3] //- Flow rate profile relative to SOI []
const autoPtr<DataEntry<scalar> > volumeFlowRate_; const autoPtr<DataEntry<scalar> > flowRateProfile_;
//- Parcel velocity magnitude relative to SOI [m/s] //- Parcel velocity magnitude relative to SOI [m/s]
const autoPtr<DataEntry<scalar> > Umag_; const autoPtr<DataEntry<scalar> > Umag_;

View File

@ -56,7 +56,7 @@ Foam::scalar Foam::PatchInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return fraction_*volumeFlowRate_().integrate(time0, time1); return fraction_*flowRateProfile_().integrate(time0, time1);
} }
else else
{ {
@ -82,11 +82,11 @@ Foam::PatchInjection<CloudType>::PatchInjection
readScalar(this->coeffDict().lookup("parcelsPerSecond")) readScalar(this->coeffDict().lookup("parcelsPerSecond"))
), ),
U0_(this->coeffDict().lookup("U0")), U0_(this->coeffDict().lookup("U0")),
volumeFlowRate_ flowRateProfile_
( (
DataEntry<scalar>::New DataEntry<scalar>::New
( (
"volumeFlowRate", "flowRateProfile",
this->coeffDict() this->coeffDict()
) )
), ),
@ -127,7 +127,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
fraction_ = scalar(patchSize)/totalPatchSize; fraction_ = scalar(patchSize)/totalPatchSize;
// Set total volume/mass to inject // Set total volume/mass to inject
this->volumeTotal_ = fraction_*volumeFlowRate_().integrate(0.0, duration_); this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_);
this->massTotal_ *= fraction_; this->massTotal_ *= fraction_;
} }

View File

@ -79,8 +79,8 @@ class PatchInjection
//- Initial parcel velocity [m/s] //- Initial parcel velocity [m/s]
const vector U0_; const vector U0_;
//- Volume flow rate of parcels to introduce relative to SOI [m^3/s] //- Flow rate profile relative to SOI []
const autoPtr<DataEntry<scalar> > volumeFlowRate_; const autoPtr<DataEntry<scalar> > flowRateProfile_;
//- Parcel size PDF model //- Parcel size PDF model
const autoPtr<pdfs::pdf> parcelPDF_; const autoPtr<pdfs::pdf> parcelPDF_;

View File

@ -637,7 +637,7 @@ Foam::directMappedPatchBase::directMappedPatchBase
samplePatch_(samplePatch), samplePatch_(samplePatch),
uniformOffset_(true), uniformOffset_(true),
offset_(offset), offset_(offset),
offsets_(0), offsets_(pp.size(), offset_),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL) mapPtr_(NULL)
{} {}
@ -670,7 +670,7 @@ Foam::directMappedPatchBase::directMappedPatchBase
offsets_ offsets_
( (
uniformOffset_ uniformOffset_
? pointField(patch_.size(), offset_) ? pointField(pp.size(), offset_)
: dict.lookup("offsets") : dict.lookup("offsets")
), ),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),

View File

@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C
fieldValues/cellSource/cellSource.C fieldValues/cellSource/cellSource.C
fieldValues/cellSource/cellSourceFunctionObject.C fieldValues/cellSource/cellSourceFunctionObject.C
readFields/readFields.C
readFields/readFieldsFunctionObject.C
streamLine/streamLine.C streamLine/streamLine.C
streamLine/streamLineParticle.C streamLine/streamLineParticle.C
streamLine/streamLineParticleCloud.C streamLine/streamLineParticleCloud.C

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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/>.
Typedef
Foam::IOreadFields
Description
Instance of the generic IOOutputFilter for readFields.
\*---------------------------------------------------------------------------*/
#ifndef IOreadFields_H
#define IOreadFields_H
#include "readFields.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<readFields> IOreadFields;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object postProcessingDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
functions
(
readFields1
{
type readFields;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl timeStep;
outputInterval 1;
fields
(
interpolateU
);
}
faceObj2
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl timeStep;
outputInterval 1;
log true;
valueOutput true;
source faceZone;
sourceName f0;
operation areaAverage;
fields
(
interpolateU
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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 "readFields.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(readFields, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::readFields::readFields
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"readFields::readFields"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
<< endl;
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::readFields::~readFields()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::readFields::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fields") >> fieldSet_;
}
}
void Foam::readFields::execute()
{
Info<< type() << " " << name_ << ":" << nl;
forAll(fieldSet_, fieldI)
{
setField<scalar>(fieldSet_[fieldI]);
setField<vector>(fieldSet_[fieldI]);
setField<sphericalTensor>(fieldSet_[fieldI]);
setField<symmTensor>(fieldSet_[fieldI]);
setField<tensor>(fieldSet_[fieldI]);
}
}
void Foam::readFields::end()
{
// Do nothing
}
void Foam::readFields::write()
{
// Do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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::readFields
Description
Reads fields from the time folders and adds them to the mesh database
for further post-processing.
SourceFiles
readFields.C
IOreadFields.H
\*---------------------------------------------------------------------------*/
#ifndef readFields_H
#define readFields_H
#include "OFstream.H"
#include "pointFieldFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class readFields Declaration
\*---------------------------------------------------------------------------*/
class readFields
{
protected:
// Protected data
//- Name of this set of readFields object
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Fields to assess min/max
wordList fieldSet_;
// Protected Member Functions
//- Disallow default bitwise copy construct
readFields(const readFields&);
//- Disallow default bitwise assignment
void operator=(const readFields&);
template<class Type>
void setField(const word& fieldName);
public:
//- Runtime type information
TypeName("readFields");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
readFields
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~readFields();
// Member Functions
//- Return name of the readFields object
virtual const word& name() const
{
return name_;
}
//- Read the field min/max data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "readFieldsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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 "readFieldsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(readFieldsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
readFieldsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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/>.
Typedef
Foam::readFieldsFunctionObject
Description
FunctionObject wrapper around readFields to allow them to be created via
the functions entry within controlDict.
SourceFiles
readFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef readFieldsFunctionObject_H
#define readFieldsFunctionObject_H
#include "readFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<readFields>
readFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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 "readFields.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::readFields::setField(const word& fieldName)
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
if (obr_.foundObject<vfType>(fieldName))
{
if (debug)
{
Info<< "Field " << fieldName << " already in database" << endl;
}
vfType& vf = const_cast<vfType&>(obr_.lookupObject<vfType>(fieldName));
vf.checkOut();
}
if (obr_.foundObject<sfType>(fieldName))
{
if (debug)
{
Info<< "Field " << fieldName << " already in database" << endl;
}
sfType& sf = const_cast<sfType&>(obr_.lookupObject<sfType>(fieldName));
sf.checkOut();
}
const fvMesh& mesh = refCast<const fvMesh>(obr_);
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == vfType::typeName
)
{
// store field on the mesh database
Info<< " Reading " << fieldName << endl;
obr_.store(new vfType(fieldHeader, mesh));
}
else if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == sfType::typeName
)
{
// store field on the mesh database
Info<< " Reading " << fieldName << endl;
obr_.store(new sfType(fieldHeader, mesh));
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -68,10 +68,10 @@ int main(int argc, char *argv[])
"dictionary name" "dictionary name"
); );
# include "setRootCase.H" #include "setRootCase.H"
# include "createTime.H" #include "createTime.H"
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
# include "createMesh.H" #include "createMesh.H"
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {

View File

@ -4,7 +4,7 @@ probes/probesFunctionObject/probesFunctionObject.C
sampledSet/cloud/cloudSet.C sampledSet/cloud/cloudSet.C
sampledSet/coordSet/coordSet.C sampledSet/coordSet/coordSet.C
sampledSet/curve/curveSet.C sampledSet/polyLine/polyLineSet.C
sampledSet/face/faceOnlySet.C sampledSet/face/faceOnlySet.C
sampledSet/midPoint/midPointSet.C sampledSet/midPoint/midPointSet.C
sampledSet/midPointAndFace/midPointAndFaceSet.C sampledSet/midPointAndFace/midPointAndFaceSet.C

View File

@ -151,20 +151,4 @@ Foam::cloudSet::~cloudSet()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const
{
if (pts.size())
{
// Use first samplePt as starting point
return pts[0];
}
else
{
return vector::zero;
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -75,6 +75,7 @@ class cloudSet
//- Uses calcSamples to obtain samples. Copies them into *this. //- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples(); void genSamples();
public: public:
//- Runtime type information //- Runtime type information
@ -104,14 +105,7 @@ public:
// Destructor // Destructor
virtual ~cloudSet(); virtual ~cloudSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
}; };

View File

@ -25,6 +25,22 @@ License
#include "coordSet.H" #include "coordSet.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::coordSet::coordFormat, 5>::names[] =
{
"xyz",
"x",
"y",
"z",
"distance"
};
const Foam::NamedEnum<Foam::coordSet::coordFormat, 5>
Foam::coordSet::coordFormatNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from components //- Construct from components
@ -36,8 +52,8 @@ Foam::coordSet::coordSet
: :
pointField(0), pointField(0),
name_(name), name_(name),
axis_(axis), axis_(coordFormatNames_[axis]),
refPoint_(vector::zero) curveDist_(0)
{} {}
@ -47,62 +63,21 @@ Foam::coordSet::coordSet
const word& name, const word& name,
const word& axis, const word& axis,
const List<point>& points, const List<point>& points,
const point& refPoint const scalarList& curveDist
) )
: :
pointField(points), pointField(points),
name_(name), name_(name),
axis_(axis), axis_(coordFormatNames_[axis]),
refPoint_(refPoint) curveDist_(curveDist)
{} {}
//- Construct from components
Foam::coordSet::coordSet
(
const word& name,
const word& axis,
const scalarField& points,
const scalar refPoint
)
:
pointField(points.size(), point::zero),
name_(name),
axis_(axis),
refPoint_(point::zero)
{
if (axis_ == "x" || axis_ == "distance")
{
refPoint_.x() = refPoint;
replace(point::X, points);
}
else if (axis_ == "y")
{
replace(point::Y, points);
}
else if (axis_ == "z")
{
replace(point::Z, points);
}
else
{
FatalErrorIn
(
"coordSet::coordSet(const word& name,"
"const word& axis, const List<scalar>& points,"
"const scalar refPoint)"
) << "Illegal axis specification " << axis_
<< " for sampling line " << name_
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::coordSet::hasVectorAxis() const bool Foam::coordSet::hasVectorAxis() const
{ {
return axis_ == "xyz"; return axis_ == XYZ;
} }
@ -113,22 +88,22 @@ Foam::scalar Foam::coordSet::scalarCoord
{ {
const point& p = operator[](index); const point& p = operator[](index);
if (axis_ == "x") if (axis_ == X)
{ {
return p.x(); return p.x();
} }
else if (axis_ == "y") else if (axis_ == Y)
{ {
return p.y(); return p.y();
} }
else if (axis_ == "z") else if (axis_ == Z)
{ {
return p.z(); return p.z();
} }
else if (axis_ == "distance") else if (axis_ == DISTANCE)
{ {
// Use distance to reference point // Use distance to reference point
return mag(p - refPoint_); return curveDist_[index];
} }
else else
{ {
@ -154,7 +129,7 @@ Foam::point Foam::coordSet::vectorCoord(const label index) const
Foam::Ostream& Foam::coordSet::write(Ostream& os) const Foam::Ostream& Foam::coordSet::write(Ostream& os) const
{ {
os << "name:" << name_ << " axis:" << axis_ << " reference:" << refPoint_ os << "name:" << name_ << " axis:" << axis_
<< endl << endl
<< endl << "\t(coord)" << endl << "\t(coord)"
<< endl; << endl;

View File

@ -52,16 +52,38 @@ class coordSet
public pointField public pointField
{ {
public:
// Public data types
//- Enumeration defining the output format for coordinates
enum coordFormat
{
XYZ,
X,
Y,
Z,
DISTANCE
};
private:
//- String representation of coordFormat enums
static const NamedEnum<coordFormat, 5> coordFormatNames_;
protected: protected:
//- Name //- Name
const word name_; const word name_;
//- Axis write type //- Axis write type
const word axis_; const coordFormat axis_;
//- Cumulative distance "distance" write specifier.
scalarList curveDist_;
//- Reference point for "distance" write specifier.
point refPoint_;
public: public:
@ -81,16 +103,7 @@ public:
const word& name, const word& name,
const word& axis, const word& axis,
const List<point>& points, const List<point>& points,
const point& refPoint = point::zero const scalarList& curveDist
);
//- Construct from components
coordSet
(
const word& name,
const word& axis,
const scalarField& points,
const scalar refPoint = 0.0
); );
@ -101,33 +114,26 @@ public:
return name_; return name_;
} }
const word& axis() const word axis() const
{ {
return axis_; return coordFormatNames_[axis_];
} }
const point& refPoint() const //- Cumulative distance
const scalarList& curveDist() const
{ {
return refPoint_; return curveDist_;
} }
//- Is axis specification a vector //- Is axis specification a vector
bool hasVectorAxis() const; bool hasVectorAxis() const;
//- Get coordinate of point according to axis specification. //- Get coordinate of point according to axis specification.
// If axis="distance" can be: -distance to starting point (e.g. // If axis="distance" is the curveDist[index]
// uniformSet) or -distance to first sampling point scalar scalarCoord(const label index) const;
// (e.g. cloudSet)
scalar scalarCoord
(
const label index
) const;
//- Get point according to axis="full" specification //- Get point according to axis="xyz" specification
vector vectorCoord vector vectorCoord(const label index) const;
(
const label index
) const;
Ostream& write(Ostream& os) const; Ostream& write(Ostream& os) const;
}; };

View File

@ -64,7 +64,7 @@ bool Foam::faceOnlySet::trackToBoundary
// Alias // Alias
const point& trackPt = singleParticle.position(); const point& trackPt = singleParticle.position();
while (true) while(true)
{ {
point oldPoint = trackPt; point oldPoint = trackPt;
@ -198,7 +198,7 @@ void Foam::faceOnlySet::calcSamples
// index in bHits; current boundary intersection // index in bHits; current boundary intersection
label bHitI = 1; label bHitI = 1;
while (true) while(true)
{ {
if (trackFaceI != -1) if (trackFaceI != -1)
{ {
@ -229,7 +229,7 @@ void Foam::faceOnlySet::calcSamples
); );
// fill sampleSegments // fill sampleSegments
for (label i = samplingPts.size() - 1; i >= startSegmentI; --i) for(label i = samplingPts.size() - 1; i >= startSegmentI; --i)
{ {
samplingSegments.append(segmentI); samplingSegments.append(segmentI);
} }
@ -380,12 +380,4 @@ Foam::faceOnlySet::~faceOnlySet()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::faceOnlySet::getRefPoint(const List<point>& pts) const
{
return start_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -92,6 +92,7 @@ class faceOnlySet
//- Uses calcSamples to obtain samples. Copies them into *this. //- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples(); void genSamples();
public: public:
//- Runtime type information //- Runtime type information
@ -121,7 +122,6 @@ public:
// Destructor // Destructor
virtual ~faceOnlySet(); virtual ~faceOnlySet();
@ -136,9 +136,6 @@ public:
{ {
return end_; return end_;
} }
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
}; };

View File

@ -53,7 +53,7 @@ void Foam::midPointSet::genSamples()
label sampleI = 0; label sampleI = 0;
while (true) while(true)
{ {
// calculate midpoint between sampleI and sampleI+1 (if in same segment) // calculate midpoint between sampleI and sampleI+1 (if in same segment)
while while

View File

@ -58,6 +58,7 @@ class midPointSet
void genSamples(); void genSamples();
public: public:
//- Runtime type information //- Runtime type information
@ -88,7 +89,6 @@ public:
// Destructor // Destructor
virtual ~midPointSet(); virtual ~midPointSet();
}; };

View File

@ -55,7 +55,7 @@ void Foam::midPointAndFaceSet::genSamples()
label sampleI = 0; label sampleI = 0;
while (true) while(true)
{ {
// sampleI is start of segment // sampleI is start of segment

View File

@ -59,6 +59,7 @@ class midPointAndFaceSet
void genSamples(); void genSamples();
public: public:
//- Runtime type information //- Runtime type information
@ -89,7 +90,6 @@ public:
// Destructor // Destructor
virtual ~midPointAndFaceSet(); virtual ~midPointAndFaceSet();
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "curveSet.H" #include "polyLineSet.H"
#include "meshSearch.H" #include "meshSearch.H"
#include "DynamicList.H" #include "DynamicList.H"
#include "polyMesh.H" #include "polyMesh.H"
@ -38,15 +38,15 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(curveSet, 0); defineTypeNameAndDebug(polyLineSet, 0);
addToRunTimeSelectionTable(sampledSet, curveSet, word); addToRunTimeSelectionTable(sampledSet, polyLineSet, word);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Sample till hits boundary. // Sample till hits boundary.
bool Foam::curveSet::trackToBoundary bool Foam::polyLineSet::trackToBoundary
( (
Particle<passiveParticle>& singleParticle, Particle<passiveParticle>& singleParticle,
label& sampleI, label& sampleI,
@ -127,7 +127,7 @@ bool Foam::curveSet::trackToBoundary
} }
void Foam::curveSet::calcSamples void Foam::polyLineSet::calcSamples
( (
DynamicList<point>& samplingPts, DynamicList<point>& samplingPts,
DynamicList<label>& samplingCells, DynamicList<label>& samplingCells,
@ -139,7 +139,7 @@ void Foam::curveSet::calcSamples
// Check sampling points // Check sampling points
if (sampleCoords_.size() < 2) if (sampleCoords_.size() < 2)
{ {
FatalErrorIn("curveSet::calcSamples()") FatalErrorIn("polyLineSet::calcSamples()")
<< "Incorrect sample specification. Too few points:" << "Incorrect sample specification. Too few points:"
<< sampleCoords_ << exit(FatalError); << sampleCoords_ << exit(FatalError);
} }
@ -148,7 +148,7 @@ void Foam::curveSet::calcSamples
{ {
if (mag(sampleCoords_[sampleI] - oldPoint) < SMALL) if (mag(sampleCoords_[sampleI] - oldPoint) < SMALL)
{ {
FatalErrorIn("curveSet::calcSamples()") FatalErrorIn("polyLineSet::calcSamples()")
<< "Incorrect sample specification." << "Incorrect sample specification."
<< " Point " << sampleCoords_[sampleI-1] << " Point " << sampleCoords_[sampleI-1]
<< " at position " << sampleI-1 << " at position " << sampleI-1
@ -310,7 +310,7 @@ void Foam::curveSet::calcSamples
} }
void Foam::curveSet::genSamples() void Foam::polyLineSet::genSamples()
{ {
// Storage for sample points // Storage for sample points
DynamicList<point> samplingPts; DynamicList<point> samplingPts;
@ -347,7 +347,7 @@ void Foam::curveSet::genSamples()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::curveSet::curveSet Foam::polyLineSet::polyLineSet
( (
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
@ -368,7 +368,7 @@ Foam::curveSet::curveSet
} }
Foam::curveSet::curveSet Foam::polyLineSet::polyLineSet
( (
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
@ -390,24 +390,8 @@ Foam::curveSet::curveSet
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::curveSet::~curveSet() Foam::polyLineSet::~polyLineSet()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::curveSet::getRefPoint(const List<point>& pts) const
{
if (pts.size())
{
// Use first samplePt as starting point
return pts[0];
}
else
{
return vector::zero;
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,17 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::curveSet Foam::polyLineSet
Description Description
Sample along poly line defined by a list of points (knots)
SourceFiles SourceFiles
curveSet.C polyLineSet.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef curveSet_H #ifndef polyLineSet_H
#define curveSet_H #define polyLineSet_H
#include "sampledSet.H" #include "sampledSet.H"
#include "DynamicList.H" #include "DynamicList.H"
@ -47,10 +48,10 @@ class passiveParticle;
template<class Type> class Particle; template<class Type> class Particle;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class curveSet Declaration Class polyLineSet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class curveSet class polyLineSet
: :
public sampledSet public sampledSet
{ {
@ -93,13 +94,13 @@ class curveSet
public: public:
//- Runtime type information //- Runtime type information
TypeName("curve"); TypeName("polyLine");
// Constructors // Constructors
//- Construct from components //- Construct from components
curveSet polyLineSet
( (
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
@ -109,7 +110,7 @@ public:
); );
//- Construct from dictionary //- Construct from dictionary
curveSet polyLineSet
( (
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
@ -119,14 +120,7 @@ public:
// Destructor // Destructor
virtual ~polyLineSet();
virtual ~curveSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
}; };

View File

@ -354,10 +354,11 @@ void Foam::sampledSet::setSamples
{ {
operator[](sampleI) = samplingPts[sampleI]; operator[](sampleI) = samplingPts[sampleI];
} }
curveDist_ = samplingCurveDist;
cells_ = samplingCells; cells_ = samplingCells;
faces_ = samplingFaces; faces_ = samplingFaces;
segments_ = samplingSegments; segments_ = samplingSegments;
curveDist_ = samplingCurveDist;
} }
@ -375,7 +376,6 @@ Foam::sampledSet::sampledSet
mesh_(mesh), mesh_(mesh),
searchEngine_(searchEngine), searchEngine_(searchEngine),
segments_(0), segments_(0),
curveDist_(0),
cells_(0), cells_(0),
faces_(0) faces_(0)
{} {}
@ -393,7 +393,6 @@ Foam::sampledSet::sampledSet
mesh_(mesh), mesh_(mesh),
searchEngine_(searchEngine), searchEngine_(searchEngine),
segments_(0), segments_(0),
curveDist_(0),
cells_(0), cells_(0),
faces_(0) faces_(0)
{} {}

View File

@ -41,13 +41,10 @@ SourceFiles
#ifndef sampledSet_H #ifndef sampledSet_H
#define sampledSet_H #define sampledSet_H
#include "pointField.H" #include "coordSet.H"
#include "word.H"
#include "labelList.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "coordSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,10 +77,6 @@ protected:
//- Segment numbers //- Segment numbers
labelList segments_; labelList segments_;
//- Parameter along sample curve. Uniquely identifies position
// along sampling. Used for combining parallel results.
scalarList curveDist_;
//- Cell numbers //- Cell numbers
labelList cells_; labelList cells_;
@ -245,7 +238,6 @@ public:
// Destructor // Destructor
virtual ~sampledSet(); virtual ~sampledSet();
@ -266,11 +258,6 @@ public:
return segments_; return segments_;
} }
const scalarList& curveDist() const
{
return curveDist_;
}
const labelList& cells() const const labelList& cells() const
{ {
return cells_; return cells_;
@ -281,9 +268,6 @@ public:
return faces_; return faces_;
} }
//- Given all sampling points (on all processors) return reference point
virtual point getRefPoint(const List<point>&) const = 0;
//- Output for debugging //- Output for debugging
Ostream& write(Ostream&) const; Ostream& write(Ostream&) const;
}; };

View File

@ -100,19 +100,6 @@ void Foam::sampledSets::combineSampledSets
SortableList<scalar> sortedDist(allCurveDist); SortableList<scalar> sortedDist(allCurveDist);
indexSets[setI] = sortedDist.indices(); indexSets[setI] = sortedDist.indices();
// Get reference point (note: only master has all points)
point refPt;
if (allPts.size())
{
refPt = samplePts.getRefPoint(allPts);
}
else
{
refPt = vector::zero;
}
masterSampledSets.set masterSampledSets.set
( (
setI, setI,
@ -121,7 +108,7 @@ void Foam::sampledSets::combineSampledSets
samplePts.name(), samplePts.name(),
samplePts.axis(), samplePts.axis(),
List<point>(UIndirectList<point>(allPts, indexSets[setI])), List<point>(UIndirectList<point>(allPts, indexSets[setI])),
refPt allCurveDist
) )
); );
} }

View File

@ -268,7 +268,6 @@ public:
// Destructor // Destructor
virtual ~sampledSets(); virtual ~sampledSets();

View File

@ -57,7 +57,6 @@ class triSurfaceMeshPointSet
//- Name of triSurfaceMesh //- Name of triSurfaceMesh
const word surface_; const word surface_;
//- Sampling points //- Sampling points
List<point> sampleCoords_; List<point> sampleCoords_;
@ -77,6 +76,7 @@ class triSurfaceMeshPointSet
//- Uses calcSamples to obtain samples. Copies them into *this. //- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples(); void genSamples();
public: public:
//- Runtime type information //- Runtime type information
@ -96,7 +96,6 @@ public:
// Destructor // Destructor
virtual ~triSurfaceMeshPointSet(); virtual ~triSurfaceMeshPointSet();

View File

@ -64,7 +64,7 @@ bool Foam::uniformSet::nextSample
samplePt += offset; samplePt += offset;
sampleI++; sampleI++;
for (; sampleI < nPoints_; sampleI++) for(; sampleI < nPoints_; sampleI++)
{ {
scalar s = (samplePt - currentPt) & normOffset; scalar s = (samplePt - currentPt) & normOffset;
@ -102,7 +102,7 @@ bool Foam::uniformSet::trackToBoundary
// Alias // Alias
const point& trackPt = singleParticle.position(); const point& trackPt = singleParticle.position();
while (true) while(true)
{ {
// Find next samplePt on/after trackPt. Update samplePt, sampleI // Find next samplePt on/after trackPt. Update samplePt, sampleI
if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI)) if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI))
@ -304,7 +304,7 @@ void Foam::uniformSet::calcSamples
// index in bHits; current boundary intersection // index in bHits; current boundary intersection
label bHitI = 1; label bHitI = 1;
while (true) while(true)
{ {
// Initialize tracking starting from trackPt // Initialize tracking starting from trackPt
Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>()); Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>());
@ -328,7 +328,7 @@ void Foam::uniformSet::calcSamples
); );
// fill sampleSegments // fill sampleSegments
for (label i = samplingPts.size() - 1; i >= startSegmentI; --i) for(label i = samplingPts.size() - 1; i >= startSegmentI; --i)
{ {
samplingSegments.append(segmentI); samplingSegments.append(segmentI);
} }
@ -483,14 +483,4 @@ Foam::uniformSet::~uniformSet()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::uniformSet::getRefPoint(const List<point>& pts) const
{
// Use start point as reference for 'distance'
return start_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -139,14 +139,7 @@ public:
// Destructor // Destructor
virtual ~uniformSet(); virtual ~uniformSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
}; };

View File

@ -98,7 +98,7 @@ PatchInjectionCoeffs
duration 10000; duration 10000;
parcelsPerSecond 1e5; parcelsPerSecond 1e5;
U0 (40 0 0); U0 (40 0 0);
volumeFlowRate constant 1; flowRateProfile constant 1;
parcelPDF parcelPDF
{ {
pdfType general; pdfType general;

View File

@ -86,7 +86,7 @@ ConeInjectionCoeffs
position ( 0.25 0.25 0.05 ); position ( 0.25 0.25 0.05 );
direction ( 0 -1 0 ); direction ( 0 -1 0 );
parcelsPerSecond 10000; parcelsPerSecond 10000;
volumeFlowRate Constant 0.01; flowRateProfile Constant 0.01;
Umag Constant 50; Umag Constant 50;
thetaInner Constant 0; thetaInner Constant 0;
thetaOuter Constant 30; thetaOuter Constant 30;