Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-06-23 17:50:40 +01:00
2228 changed files with 5719 additions and 4899 deletions

View File

@ -51,199 +51,16 @@ PDRkEpsilon::PDRkEpsilon
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const basicThermo& thermophysicalModel, const basicThermo& thermophysicalModel,
const word& turbulenceModelName const word& turbulenceModelName,
const word& modelName
) )
: :
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName), kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName)
{}
Cmu_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Cmu",
coeffDict_,
0.09
)
),
C1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"C1",
coeffDict_,
1.44
)
),
C2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"C2",
coeffDict_,
1.92
)
),
sigmak_
(
dimensioned<scalar>::lookupOrAddToDict
(
"sigmak",
coeffDict_,
1.0
)
),
sigmaEps_
(
dimensioned<scalar>::lookupOrAddToDict
(
"sigmaEps",
coeffDict_,
1.3
)
),
Prt_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Prt",
coeffDict_,
1.0
)
),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("k", mesh_)
),
epsilon_
(
IOobject
(
"epsilon",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateEpsilon("epsilon", mesh_)
),
mut_
(
IOobject
(
"mut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
autoCreateMut("mut", mesh_)
),
alphat_
(
IOobject
(
"alphat",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateAlphat("alphat", mesh_)
)
{
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
printCoeffs();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> PDRkEpsilon::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> PDRkEpsilon::devRhoReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-muEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> PDRkEpsilon::divDevRhoReff(volVectorField& U) const
{
return
(
- fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
);
}
bool PDRkEpsilon::read()
{
if (RASModel::read())
{
Cmu_.readIfPresent(coeffDict_);
C1_.readIfPresent(coeffDict_);
C2_.readIfPresent(coeffDict_);
sigmak_.readIfPresent(coeffDict());
sigmaEps_.readIfPresent(coeffDict());
Prt_.readIfPresent(coeffDict());
return true;
}
else
{
return false;
}
}
void PDRkEpsilon::correct() void PDRkEpsilon::correct()
{ {
if (!turbulence_) if (!turbulence_)
@ -272,7 +89,7 @@ void PDRkEpsilon::correct()
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU())))); volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear(); tgradU.clear();
// Update espsilon and G at the wall // Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs(); epsilon_.boundaryField().updateCoeffs();
// Add the blockage generation term so that it is included consistently // Add the blockage generation term so that it is included consistently
@ -321,6 +138,7 @@ void PDRkEpsilon::correct()
solve(kEqn); solve(kEqn);
bound(k_, kMin_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();

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
@ -25,12 +25,13 @@ Class
Foam::compressible::RASModels::PDRkEpsilon Foam::compressible::RASModels::PDRkEpsilon
Description Description
Standard k-epsilon turbulence model with additional source terms Standard k-epsilon turbulence model for compressible flow
with additional source terms
corresponding to PDR basic drag model (\link basic.H \endlink) corresponding to PDR basic drag model (\link basic.H \endlink)
The default model coefficients correspond to the following: The default model coefficients correspond to the following:
@verbatim @verbatim
kEpsilonCoeffs PDRkEpsilonCoeffs
{ {
Cmu 0.09; Cmu 0.09;
C1 1.44; C1 1.44;
@ -53,7 +54,6 @@ Description
SourceFiles SourceFiles
PDRkEpsilon.C PDRkEpsilon.C
PDRkEpsilonCorrect.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -61,6 +61,7 @@ SourceFiles
#define compressiblePDRkEpsilon_H #define compressiblePDRkEpsilon_H
#include "RASModel.H" #include "RASModel.H"
#include "kEpsilon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,26 +78,8 @@ namespace RASModels
class PDRkEpsilon class PDRkEpsilon
: :
public RASModel public kEpsilon
{ {
// Private data
// Model coefficients
dimensionedScalar Cmu_;
dimensionedScalar C1_;
dimensionedScalar C2_;
dimensionedScalar sigmak_;
dimensionedScalar sigmaEps_;
dimensionedScalar Prt_;
// Fields
volScalarField k_;
volScalarField epsilon_;
volScalarField mut_;
volScalarField alphat_;
public: public:
@ -113,7 +96,8 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const basicThermo& thermophysicalModel, const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
); );
@ -124,62 +108,9 @@ public:
// Member Functions // Member Functions
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", mut_/sigmak_ + mu())
);
}
//- Return the effective diffusivity for epsilon
tmp<volScalarField> DepsilonEff() const
{
return tmp<volScalarField>
(
new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu())
);
}
//- Return the turbulence viscosity
virtual tmp<volScalarField> mut() const
{
return mut_;
}
//- Return the turbulence thermal diffusivity
virtual tmp<volScalarField> alphat() const
{
return alphat_;
}
//- Return the turbulence kinetic energy
virtual tmp<volScalarField> k() const
{
return k_;
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> epsilon() const
{
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
//- Solve the turbulence equations and correct the turbulence viscosity //- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct(); virtual void correct();
//- Read turbulenceProperties dictionary
virtual bool read();
}; };

View File

@ -13,7 +13,6 @@
); );
TEqn.relax(); TEqn.relax();
TEqn.solve(); TEqn.solve();
rhok = 1.0 - beta*(T - TRef); rhok = 1.0 - beta*(T - TRef);

View File

@ -8,6 +8,8 @@
UEqn().relax(); UEqn().relax();
if (momentumPredictor)
{
solve solve
( (
UEqn() UEqn()
@ -15,8 +17,9 @@
fvc::reconstruct fvc::reconstruct
( (
( (
fvc::interpolate(rhok)*(g & mesh.Sf()) - ghf*fvc::snGrad(rhok)
- fvc::snGrad(p)*mesh.magSf() - fvc::snGrad(p_rgh)
) )*mesh.magSf()
) )
); );
}

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
p.storePrevIter(); p_rgh.storePrevIter();
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {

View File

@ -14,12 +14,12 @@
mesh mesh
); );
Info<< "Reading field p\n" << endl; Info<< "Reading field p_rgh\n" << endl;
volScalarField p volScalarField p_rgh
( (
IOobject IOobject
( (
"p", "p_rgh",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -42,9 +42,9 @@
mesh mesh
); );
# include "createPhi.H" #include "createPhi.H"
# include "readTransportProperties.H" #include "readTransportProperties.H"
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence autoPtr<incompressible::RASModel> turbulence
@ -52,20 +52,6 @@
incompressible::RASModel::New(U, phi, laminarTransport) incompressible::RASModel::New(U, phi, laminarTransport)
); );
Info<< "Calculating field beta*(g.h)\n" << endl;
surfaceScalarField betaghf("betagh", beta*(g & mesh.Cf()));
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
p,
mesh.solutionDict().subDict("SIMPLE"),
pRefCell,
pRefValue
);
// Kinematic density for buoyancy force // Kinematic density for buoyancy force
volScalarField rhok volScalarField rhok
( (
@ -77,3 +63,47 @@
), ),
1.0 - beta*(T - TRef) 1.0 - beta*(T - TRef)
); );
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh + rhok*gh
);
label p_rghRefCell = 0;
scalar p_rghRefValue = 0.0;
setRefCell
(
p_rgh,
mesh.solutionDict().subDict("SIMPLE"),
p_rghRefCell,
p_rghRefValue
);
scalar pRefValue = 0.0;
if (p_rgh.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("SIMPLE").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, p_rghRefCell)
);
}

View File

@ -6,45 +6,56 @@
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf(); phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p); adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi = surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf();
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); phi -= buoyancyPhi;
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rUAf, p) == fvc::div(phi) fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
pEqn.solve(); p_rghEqn.solve();
} }
else else
{ {
pEqn.solve(); p_rghEqn.solve();
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= pEqn.flux(); phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p_rgh.relax();
// Correct the momentum source with the pressure gradient flux // Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure // calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf); U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }
#include "continuityErrs.H" #include "continuityErrs.H"
p = p_rgh + rhok*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, p_rghRefCell)
);
}
} }

View File

@ -8,13 +8,18 @@
UEqn().relax(); UEqn().relax();
if (momentumPredictor)
{
solve solve
( (
UEqn() UEqn()
== ==
fvc::reconstruct fvc::reconstruct
( (
fvc::interpolate(rho)*(g & mesh.Sf()) (
- fvc::snGrad(p)*mesh.magSf() - ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
) )
); );
}

View File

@ -55,15 +55,18 @@ int main(int argc, char *argv[])
#include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
p.storePrevIter(); p_rgh.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
#include "UEqn.H" #include "UEqn.H"
#include "hEqn.H" #include "hEqn.H"
for (int i=0; i<3; i++)
{
#include "pEqn.H" #include "pEqn.H"
} }
}
turbulence->correct(); turbulence->correct();

View File

@ -23,6 +23,19 @@
volScalarField& h = thermo.h(); volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi(); const volScalarField& psi = thermo.psi();
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
@ -53,17 +66,40 @@
) )
); );
thermo.correct(); Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
label pRefCell = 0; p = p_rgh + rho*gh;
scalar pRefValue = 0.0; thermo.correct();
rho = thermo.rho();
p_rgh = p - rho*gh;
label p_rghRefCell = 0;
scalar p_rghRefValue = 0.0;
setRefCell setRefCell
( (
p, p_rgh,
mesh.solutionDict().subDict("SIMPLE"), mesh.solutionDict().subDict("SIMPLE"),
pRefCell, p_rghRefCell,
pRefValue p_rghRefValue
); );
scalar pRefValue = 0.0;
if (p_rgh.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("SIMPLE").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, p_rghRefCell)
);
}
dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar initialMass = fvc::domainIntegrate(rho);

View File

@ -10,7 +10,6 @@
); );
hEqn.relax(); hEqn.relax();
hEqn.solve(); hEqn.solve();
thermo.correct(); thermo.correct();

View File

@ -5,50 +5,52 @@
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
U = rUA*UEqn().H(); U = rUA*UEqn().H();
UEqn.clear(); //UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p); bool closedVolume = adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi = surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); phi -= buoyancyPhi;
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix p_rghEqn
( (
fvm::laplacian(rhorUAf, p) == fvc::div(phi) fvm::laplacian(rhorUAf, p_rgh) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
pEqn.solve(); p_rghEqn.solve();
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
}
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= pEqn.flux(); phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p_rgh.relax();
// Correct the momentum source with the pressure gradient flux // Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure // calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf); U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }
#include "continuityErrs.H" #include "continuityErrs.H"
p = p_rgh + rho*gh;
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
p_rgh == p - rho*gh;
}
rho = thermo.rho(); rho = thermo.rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()

View File

@ -1,4 +1,4 @@
EXE_INC = \ EXE_INC = -ggdb3 \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application Application
compressibleLesInterFoam compressibleInterFoam
Description Description
Solver for 2 compressible, isothermal immiscible fluids using a VOF Solver for 2 compressible, isothermal immiscible fluids using a VOF

View File

@ -75,8 +75,8 @@
alpha1, alpha1,
phiAlpha1BD, phiAlpha1BD,
phiAlpha1, phiAlpha1,
zero(), zeroField(),
zero(), zeroField(),
1, 1,
0, 0,
3 3
@ -112,8 +112,8 @@
alpha2, alpha2,
phiAlpha2BD, phiAlpha2BD,
phiAlpha2, phiAlpha2,
zero(), zeroField(),
zero(), zeroField(),
1, 1,
0, 0,
3 3

View File

@ -31,6 +31,41 @@ Description
using namespace Foam; using namespace Foam;
template<class T>
void printInfo
(
const word& tag,
const UList<T>& lst,
const bool showSize = false
)
{
Info<< "<" << tag;
if (showSize)
{
Info<< " size=\"" << lst.size() << "\"";
}
Info<< ">" << lst << "</" << tag << ">" << endl;
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
void printInfo
(
const word& tag,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>& lst,
const bool showSize = false
)
{
Info<< "<" << tag;
if (showSize)
{
Info<< " size=\"" << lst.size()
<< "\" capacity=\"" << lst.capacity() << "\"";
}
Info<< ">" << lst << "</" << tag << ">" << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
@ -104,10 +139,8 @@ int main(int argc, char *argv[])
List<label> lstA; List<label> lstA;
lstA.transfer(dlB); lstA.transfer(dlB);
Info<< "Transferred to normal list" << endl; Info<< "Transferred to normal list" << endl;
Info<< "<lstA>" << lstA << "</lstA>" << nl << "sizes: " printInfo("lstA", lstA, true);
<< " " << lstA.size() << endl; printInfo("dlB", dlB, true);
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// Copy back and append a few time // Copy back and append a few time
for (label i=0; i < 3; i++) for (label i=0; i < 3; i++)
@ -116,15 +149,12 @@ int main(int argc, char *argv[])
} }
Info<< "appended list a few times" << endl; Info<< "appended list a few times" << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: " printInfo("dlB", dlB, true);
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// assign the list (should maintain allocated space) // assign the list (should maintain allocated space)
dlB = lstA; dlB = lstA;
Info<< "assigned list" << endl; Info<< "assigned list" << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: " printInfo("dlB", dlB, true);
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// Copy back and append a few time // Copy back and append a few time
for (label i=0; i < 3; i++) for (label i=0; i < 3; i++)
@ -136,38 +166,30 @@ int main(int argc, char *argv[])
// check allocation granularity // check allocation granularity
DynamicList<label, 6, 0> dlC; DynamicList<label, 6, 0> dlC;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: " printInfo("dlC", dlC, true);
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
dlC.reserve(dlB.size()); dlC.reserve(dlB.size());
dlC = dlB; dlC = dlB;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: " printInfo("dlC", dlC, true);
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
List<label> lstB(dlC.xfer()); List<label> lstB(dlC.xfer());
Info<< "Transferred to normal list via the xfer() method" << endl; Info<< "Transferred to normal list via the xfer() method" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: " printInfo("lstB", lstB, true);
<< " " << lstB.size() << endl; printInfo("dlC", dlC, true);
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
DynamicList<label> dlD(lstB.xfer()); DynamicList<label> dlD(lstB.xfer());
Info<< "Transfer construct from normal list" << endl; Info<< "Transfer construct from normal list" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: " printInfo("lstB", lstB, true);
<< " " << lstB.size() << endl; printInfo("dlD", dlD, true);
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
DynamicList<label,10> dlE1(10); DynamicList<label,10> dlE1(10);
DynamicList<label> dlE2(dlE1); // construct dissimilar DynamicList<label> dlE2(dlE1); // construct dissimilar
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: " printInfo("dlE1", dlE1, true);
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl; printInfo("dlE2", dlE2, true);
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl;
for (label elemI=0; elemI < 5; ++elemI) for (label elemI=0; elemI < 5; ++elemI)
{ {
@ -175,19 +197,42 @@ int main(int argc, char *argv[])
dlE2.append(elemI); dlE2.append(elemI);
} }
Info<< "<dlE2>" << dlE2 << "</dlE2>" << endl; printInfo("dlE2", dlE2, true);
DynamicList<label> dlE3(dlE2); // construct identical DynamicList<label> dlE3(dlE2); // construct identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl; printInfo("dlE3", dlE3, true);
dlE3 = dlE1; // assign dissimilar dlE3 = dlE1; // assign dissimilar
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl; printInfo("dlE3", dlE3, true);
dlE3 = dlE2; // assign identical dlE3 = dlE2; // assign identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl; printInfo("dlE3", dlE3, true);
DynamicList<label> dlE4(reorder(identity(dlE3.size()), dlE3)); DynamicList<label> dlE4(reorder(identity(dlE3.size()), dlE3));
Info<< "<dlE4>" << dlE4 << "</dlE4>" << endl; printInfo("dlE4", dlE4, true);
printInfo("dlE3", dlE3, true);
{
DynamicList<label> addr(10);
addr.append(3);
addr.append(1);
addr.append(2);
forAll(dlE2, i)
{
dlE2[i] *= 10;
}
UIndirectList<label> uil
(
dlE2, addr
);
Info<< "use UIndirectList " << uil << " remapped from " << dlE2 << endl;
dlE4 = uil;
printInfo("dlE4", dlE4, true);
}
Info<< "\nEnd\n"; Info<< "\nEnd\n";

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any | | \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any | | \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any | | \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any | | \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

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
@ -27,15 +27,49 @@ Description
#include "IOstreams.H" #include "IOstreams.H"
#include "pTraits.H" #include "pTraits.H"
#include "vector.H"
#include "tensor.H"
using namespace Foam; using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
template<class T>
void printTraits()
{
Info<< pTraits<T>::typeName
<< ": zero=" << pTraits<T>::zero
<< " one=" << pTraits<T>::one << endl;
}
template<class T>
void printTraits(const pTraits<T>& p)
{
Info<< p.typeName << " == " << p << endl;
}
int main() int main()
{ {
Info<< pTraits<scalar>::typeName << endl; printTraits<bool>();
printTraits<label>();
printTraits<scalar>();
printTraits<vector>();
printTraits<tensor>();
{
pTraits<bool> b(true);
printTraits(b);
}
{
pTraits<label> l(100);
printTraits(l);
}
printTraits(pTraits<scalar>(3.14159));
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
( (

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -1,15 +1,20 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
if [ -f /usr/include/readline/readline.h ] unset COMP_FLAGS LINK_FLAGS
#
# use readline if available
# unless otherwise specified (with NO_READLINE)
#
# eg, ./Allwmake NO_READLINE
#
if [ -f /usr/include/readline/readline.h -a "${1%NO_READLINE}" = "$1" ]
then then
echo "Found readline/readline.h -- enabling readline support." echo "Found <readline/readline.h> -- enabling readline support."
export READLINE=1 export COMP_FLAGS="-DHAS_READLINE"
export READLINELINK="-lreadline -lncurses" export LINK_FLAGS="-lreadline -lncurses"
else
# no readline/readline.h -- disabling readline support
export READLINE=0
unset READLINELINK
fi fi
wmake wmake

View File

@ -1,9 +1,7 @@
/* NB: trailing zero after define improves robustness */
EXE_INC = \ EXE_INC = \
-DREADLINE=$(READLINE)0 \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude $(COMP_FLAGS)
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
$(READLINELINK) $(LINK_FLAGS)

View File

@ -49,7 +49,7 @@ Description
#include <stdio.h> #include <stdio.h>
#if READLINE != 0 #ifdef HAS_READLINE
# include <readline/readline.h> # include <readline/readline.h>
# include <readline/history.h> # include <readline/history.h>
#endif #endif
@ -59,29 +59,10 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#if READLINE != 0 #ifdef HAS_READLINE
static const char* historyFile = ".setSet"; static const char* historyFile = ".setSet";
#endif #endif
Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
{
if (is0Ptr)
{
return *is0Ptr;
}
else if (is1Ptr)
{
return *is1Ptr;
}
else
{
FatalErrorIn("selectStream(Istream*, Istream*)")
<< "No valid stream opened" << abort(FatalError);
return *is0Ptr;
}
}
// Write set to VTK readable files // Write set to VTK readable files
void writeVTK void writeVTK
@ -867,7 +848,7 @@ int main(int argc, char *argv[])
printAllSets(mesh, Info); printAllSets(mesh, Info);
// Read history if interactive // Read history if interactive
# if READLINE != 0 # ifdef HAS_READLINE
if (!batch && !read_history(historyFile)) if (!batch && !read_history(historyFile))
{ {
Info<< "Successfully read history from " << historyFile << endl; Info<< "Successfully read history from " << historyFile << endl;
@ -949,7 +930,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
# if READLINE != 0 # ifdef HAS_READLINE
{ {
char* linePtr = readline("readline>"); char* linePtr = readline("readline>");

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
Exec : adiabaticFlameT -case . controlDict Exec : adiabaticFlameT -case . controlDict

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
Exec : adiabaticFlameT -case . controlDict Exec : adiabaticFlameT -case . controlDict

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
Exec : adiabaticFlameT -case . controlDict Exec : adiabaticFlameT -case . controlDict

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
Exec : equilibriumFlameT -case . controlDict Exec : equilibriumFlameT -case . controlDict

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -87,7 +87,7 @@ printHeader()
| ========= | | | ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: $version | | \\\\ / O peration | Version: $version |
| \\\\ / A nd | Web: www.OpenFOAM.org | | \\\\ / A nd | Web: www.OpenFOAM.com |
| \\\\/ M anipulation | | | \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/ \\*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -226,7 +226,7 @@ SunOS)
cat <<USAGE cat <<USAGE
Your "$WM_ARCH" operating system is not supported by this release Your "$WM_ARCH" operating system is not supported by this release
of OpenFOAM. For further assistance, please contact www.OpenFOAM.org of OpenFOAM. For further assistance, please contact www.OpenFOAM.com
USAGE USAGE
;; ;;

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -216,7 +216,7 @@ case SunOS:
default: default:
echo echo
echo "Your '$WM_ARCH' operating system is not supported by this release" echo "Your '$WM_ARCH' operating system is not supported by this release"
echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org" echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.com"
echo echo
breaksw breaksw

View File

@ -1,17 +1,20 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
unset COMP_FLAGS LINK_FLAGS
# #
# use <sys/inotify.h> if available (Linux) # use <sys/inotify.h> if available (Linux)
# unless otherwise specified (with FOAM_USE_STAT) # unless otherwise specified (with USE_STAT)
# #
# eg, ./Allwmake FOAM_USE_STAT # eg, ./Allwmake USE_STAT
# #
if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ] if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ]
then then
unset FOAM_FILE_MONITOR echo "Found <sys/inotify.h> -- using inotify for file monitoring."
unset COMP_FLAGS
else else
export FOAM_FILE_MONITOR="-DFOAM_USE_STAT" export COMP_FLAGS="-DFOAM_USE_STAT"
fi fi

View File

@ -1 +1 @@
EXE_INC = $(FOAM_FILE_MONITOR) EXE_INC = $(COMP_FLAGS)

View File

@ -207,6 +207,10 @@ public:
//- Assignment from UList //- Assignment from UList
inline void operator=(const UList<T>&); inline void operator=(const UList<T>&);
//- Assignment from UIndirectList
inline void operator=(const UIndirectList<T>&);
// IOstream operators // IOstream operators

View File

@ -406,29 +406,6 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
} }
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator= inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
( (
@ -461,4 +438,49 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
} }
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const UIndirectList<T>& lst
)
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -91,8 +91,10 @@ public:
//- Return the last element of the list. //- Return the last element of the list.
inline const T& last() const; inline const T& last() const;
//- Return the complete list
inline const UList<T>& completeList() const; inline const UList<T>& completeList() const;
//- Return the list addressing
inline const List<label>& addressing() const; inline const List<label>& addressing() const;

View File

@ -64,7 +64,7 @@ inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
"| ========= | |\n" "| ========= | |\n"
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n" "| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n" "| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
"| \\\\ / A nd | Web: www.OpenFOAM.org |\n" "| \\\\ / A nd | Web: www.OpenFOAM.com |\n"
"| \\\\/ M anipulation | |\n" "| \\\\/ M anipulation | |\n"
"\\*---------------------------------------------------------------------------*/\n"; "\\*---------------------------------------------------------------------------*/\n";

View File

@ -65,6 +65,8 @@ public:
// Member Operators // Member Operators
inline scalar operator[](const label) const; inline scalar operator[](const label) const;
inline oneField field() const;
}; };

View File

@ -33,4 +33,10 @@ inline Foam::scalar Foam::oneField::operator[](const label) const
} }
inline Foam::oneField Foam::oneField::field() const
{
return oneField();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -64,6 +64,8 @@ public:
// Member Operators // Member Operators
inline scalar operator[](const label) const; inline scalar operator[](const label) const;
inline zeroField field() const;
}; };

View File

@ -32,4 +32,11 @@ inline Foam::scalar Foam::zeroField::operator[](const label) const
return scalar(0); return scalar(0);
} }
inline Foam::zeroField Foam::zeroField::field() const
{
return zeroField();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -836,7 +836,7 @@ void Foam::argList::printUsage() const
Info<< nl Info<< nl
<<"Using OpenFOAM-" << Foam::FOAMversion <<"Using OpenFOAM-" << Foam::FOAMversion
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org" <<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.com"
<< nl << endl; << nl << endl;
} }

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) 2008-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "IFstream.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -239,7 +238,9 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
template<class Type> template<class Type>
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
( (
const fileName& fn, const word& instance, const fvMesh& mesh const fileName& fn,
const word& instance,
const fvMesh& mesh
) )
: :
List<scalarField>(), List<scalarField>(),
@ -357,11 +358,11 @@ void Foam::interpolationLookUpTable<Type>::write
control.writeHeader(os); control.writeHeader(os);
os.writeKeyword("fields"); os.writeKeyword("fields")
os << entries_ << token::END_STATEMENT << nl; << entries_ << token::END_STATEMENT << nl;
os.writeKeyword("output"); os.writeKeyword("output")
os << output_ << token::END_STATEMENT << nl; << output_ << token::END_STATEMENT << nl;
if (this->size() == 0) if (this->size() == 0)
{ {
@ -370,8 +371,8 @@ void Foam::interpolationLookUpTable<Type>::write
"Foam::interpolationTable<Type>::write()" "Foam::interpolationTable<Type>::write()"
) << "table is empty" << nl << exit(FatalError); ) << "table is empty" << nl << exit(FatalError);
} }
os.writeKeyword("values"); os.writeKeyword("values")
os << *this << token::END_STATEMENT << nl; << *this << token::END_STATEMENT << nl;
} }
@ -381,8 +382,7 @@ template<class Type>
Foam::scalarField& Foam::scalarField&
Foam::interpolationLookUpTable<Type>::operator[](const label i) Foam::interpolationLookUpTable<Type>::operator[](const label i)
{ {
label ii = i; const label n = this->size();
label n = this->size();
if (n <= 1) if (n <= 1)
{ {
@ -391,22 +391,22 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i)
"Foam::interpolationLookUpTable<Type>::operator[](const label)" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "table has (" << n << ") columns" << nl << exit(FatalError); ) << "table has (" << n << ") columns" << nl << exit(FatalError);
} }
else if (ii < 0) else if (i < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[](const label)" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "index (" << ii << ") underflow" << nl << exit(FatalError); ) << "index (" << i << ") underflow" << nl << exit(FatalError);
} }
else if (ii > n) else if (i >= n)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[](const label)" "Foam::interpolationLookUpTable<Type>::operator[](const label)"
) << "index (" << ii << ") overflow" << nl << exit(FatalError); ) << "index (" << i << ") overflow" << nl << exit(FatalError);
} }
return List<scalarField>::operator[](ii); return List<scalarField>::operator[](i);
} }
@ -414,8 +414,7 @@ template<class Type>
const Foam::scalarField& const Foam::scalarField&
Foam::interpolationLookUpTable<Type>::operator[](const label i) const Foam::interpolationLookUpTable<Type>::operator[](const label i) const
{ {
label ii = i; const label n = this->size();
label n = this->size();
if (n <= 1) if (n <= 1)
{ {
@ -425,26 +424,25 @@ Foam::interpolationLookUpTable<Type>::operator[](const label i) const
"(const label) const" "(const label) const"
) << "table has (" << n << ") columns" << nl << exit(FatalError); ) << "table has (" << n << ") columns" << nl << exit(FatalError);
} }
else if (ii < 0) else if (i < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const" "(const label) const"
) << "index (" << ii << ") underflow" << nl << exit(FatalError); ) << "index (" << i << ") underflow" << nl << exit(FatalError);
} }
else if (i >= n)
else if (ii > n)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::interpolationLookUpTable<Type>::operator[]" "Foam::interpolationLookUpTable<Type>::operator[]"
"(const label) const" "(const label) const"
) << "index (" << ii << ") overflow" << nl ) << "index (" << i << ") overflow" << nl
<< exit(FatalError); << exit(FatalError);
} }
return List<scalarField>::operator[](ii); return List<scalarField>::operator[](i);
} }

View File

@ -65,7 +65,7 @@ class interpolationLookUpTable
{ {
private: private:
// Privsate data // Private data
//- File name //- File name
fileName fileName_; fileName fileName_;
@ -88,10 +88,10 @@ private:
//- Output dictionaries //- Output dictionaries
List<dictionary> output_; List<dictionary> output_;
//- Input indices from the look up table //- Input indices from the lookup table
List<label> entryIndices_; List<label> entryIndices_;
//- Output Indeces from the Look Up Table //- Output indices from the lookup Table
List<label> outputIndices_; List<label> outputIndices_;
//- Field names and indices //- Field names and indices
@ -118,7 +118,7 @@ private:
//- Check range of lookup value //- Check range of lookup value
bool checkRange(const scalar, const label) const; bool checkRange(const scalar, const label) const;
//- Interpolate function return an scalar //- Interpolate function returning a scalar
scalar interpolate scalar interpolate
( (
const label lo, const label lo,
@ -159,13 +159,13 @@ public:
// Member Functions // Member Functions
//- Return true if the filed exists in the table //- Return true if the field exists in the table
bool found(const word& fieldName) const; bool found(const word& fieldName) const;
//- Return the output list given a single input scalar //- Return the output list given a single input scalar
const List<scalar>& lookUp(const scalar); const List<scalar>& lookUp(const scalar);
//- Write Look Up Table to filename. //- Write lookup table to filename.
void write void write
( (
Ostream&, Ostream&,

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) 2009-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,8 +65,8 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
dict.lookup("data") >> *this; dict.lookup("data") >> *this;
dict.lookup("x0") >> x0_; dict.lookup("x0") >> x0_;
dict.lookup("dx") >> dx_; dict.lookup("dx") >> dx_;
dict.lookup("log10") >> log10_; dict.readIfPresent("log10", log10_);
dict.lookup("bound") >> bound_; dict.readIfPresent("bound", bound_);
} }
checkTable(); checkTable();
@ -94,13 +94,13 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
List<scalar>(2, 0.0), List<scalar>(2, 0.0),
x0_(readScalar(dict.lookup("x0"))), x0_(readScalar(dict.lookup("x0"))),
dx_(readScalar(dict.lookup("dx"))), dx_(readScalar(dict.lookup("dx"))),
log10_(dict.lookup("log10")), log10_(dict.lookupOrDefault<Switch>("log10", false)),
bound_(dict.lookup("bound")) bound_(dict.lookupOrDefault<Switch>("bound", false))
{ {
if (initialiseOnly) if (initialiseOnly)
{ {
scalar xMax = readScalar(dict.lookup("xMax")); const scalar xMax = readScalar(dict.lookup("xMax"));
label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1; const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
this->setSize(nIntervals); this->setSize(nIntervals);
} }
else else
@ -168,9 +168,9 @@ Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
} }
} }
label i = static_cast<label>((x - x0_)/dx_); const label i = static_cast<label>((x - x0_)/dx_);
scalar xLo = x0_ + i*dx_; const scalar xLo = x0_ + i*dx_;
Type fx = (x - xLo)/dx_*(operator[](i+1) - operator[](i)) + operator[](i); Type fx = (x - xLo)/dx_*(operator[](i+1) - operator[](i)) + operator[](i);
@ -225,8 +225,14 @@ void Foam::uniformInterpolationTable<Type>::write() const
dict.add("data", static_cast<const List<scalar>&>(*this)); dict.add("data", static_cast<const List<scalar>&>(*this));
dict.add("x0", x0_); dict.add("x0", x0_);
dict.add("dx", dx_); dict.add("dx", dx_);
if (log10_)
{
dict.add("log10", log10_); dict.add("log10", log10_);
}
if (bound_)
{
dict.add("bound", bound_); dict.add("bound", bound_);
}
dict.regIOobject::write(); dict.regIOobject::write();
} }

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) 2009-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,8 +28,9 @@ Description
Table with uniform interval in independant variable, with linear Table with uniform interval in independant variable, with linear
interpolation interpolation
Example usage (scalar): values specified in a dictionary: Example usage (scalar): values specified within a dictionary:
@verbatim
{ {
x0 0; // lower limit x0 0; // lower limit
dx 0.2; // fixed interval dx 0.2; // fixed interval
@ -42,6 +43,7 @@ Description
7870 // value at x0 + n*dx 7870 // value at x0 + n*dx
); );
} }
@endverbatim
SourceFiles SourceFiles
uniformInterpolationTable.C uniformInterpolationTable.C
@ -73,7 +75,7 @@ class uniformInterpolationTable
{ {
// Private data // Private data
// Control parameetrs // Control parameters
//- Lower limit //- Lower limit
scalar x0_; scalar x0_;
@ -81,7 +83,7 @@ class uniformInterpolationTable
//- Fixed interval //- Fixed interval
scalar dx_; scalar dx_;
//- Flag to indicate that x data is given in log10(x) form //- Flag to indicate that x data are given in log10(x) form
Switch log10_; Switch log10_;
//- Bound x values //- Bound x values
@ -101,9 +103,9 @@ public:
// Constructors // Constructors
//- Construct from IOobject and readFields flag. Creates a null object //- Construct from IOobject and readFields flag.
// if readFields = false // Creates a null object if readFields = false
uniformInterpolationTable(const IOobject& io, const bool readFields); uniformInterpolationTable(const IOobject&, const bool readFields);
//- Construct from name, objectRegistry and dictionary. //- Construct from name, objectRegistry and dictionary.
// If initialiseOnly flag is set, control parameters are read from // If initialiseOnly flag is set, control parameters are read from
@ -111,13 +113,13 @@ public:
uniformInterpolationTable uniformInterpolationTable
( (
const word& tableName, const word& tableName,
const objectRegistry& db, const objectRegistry&,
const dictionary& dict, const dictionary&,
const bool initialiseOnly = false const bool initialiseOnly = false
); );
//- Construct as copy //- Construct as copy
uniformInterpolationTable(const uniformInterpolationTable& uit); uniformInterpolationTable(const uniformInterpolationTable&);
//- Destructor //- Destructor
@ -174,22 +176,10 @@ public:
// Override ancestor size() function and [] operator // Override ancestor size() function and [] operator
//- Return the size of the table //- Return the size of the table
label size() const using List<Type>::size;
{
return List<Type>::size();
}
//- Use List[] operator for read access //- Use List[] operator for read/write access
Type operator[](label x) const using List<Type>::operator[];
{
return List<Type>::operator[](x);
}
//- Use List[] operator for write access
Type& operator[](label x)
{
return List<Type>::operator[](x);
}
// I-O // I-O

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
@ -38,6 +38,12 @@ const Scalar pTraits<Scalar>::max = ScalarVGREAT;
const char* pTraits<Scalar>::componentNames[] = { "x" }; const char* pTraits<Scalar>::componentNames[] = { "x" };
pTraits<Scalar>::pTraits(const Scalar& p)
:
p_(p)
{}
pTraits<Scalar>::pTraits(Istream& is) pTraits<Scalar>::pTraits(Istream& is)
{ {
is >> p_; is >> p_;

View File

@ -65,6 +65,9 @@ public:
// Constructors // Constructors
//- Construct from primitive
explicit pTraits(const Scalar&);
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);

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
@ -28,11 +28,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* const Foam::pTraits<bool>::typeName = "bool"; const char* const Foam::pTraits<bool>::typeName = "bool";
const bool Foam::pTraits<bool>::zero(false); const bool Foam::pTraits<bool>::zero = false;
const bool Foam::pTraits<bool>::one(true); const bool Foam::pTraits<bool>::one = true;
const char* Foam::pTraits<bool>::componentNames[] = { "x" }; const char* Foam::pTraits<bool>::componentNames[] = { "x" };
Foam::pTraits<bool>::pTraits(const bool& p)
:
p_(p)
{}
Foam::pTraits<bool>::pTraits(Istream& is) Foam::pTraits<bool>::pTraits(Istream& is)
{ {
is >> p_; is >> p_;

View File

@ -91,6 +91,9 @@ public:
// Constructors // Constructors
//- Construct from primitive
explicit pTraits(const bool&);
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);

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
@ -41,6 +41,12 @@ const label pTraits<label>::max = labelMax;
const char* pTraits<label>::componentNames[] = { "x" }; const char* pTraits<label>::componentNames[] = { "x" };
pTraits<label>::pTraits(const label& p)
:
p_(p)
{}
pTraits<label>::pTraits(Istream& is) pTraits<label>::pTraits(Istream& is)
{ {
is >> p_; is >> p_;

View File

@ -165,6 +165,9 @@ public:
// Constructors // Constructors
//- Construct from primitive
explicit pTraits(const label&);
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);

View File

@ -41,6 +41,12 @@ const uLabel pTraits<uLabel>::max = uLabelMax;
const char* pTraits<uLabel>::componentNames[] = { "x" }; const char* pTraits<uLabel>::componentNames[] = { "x" };
pTraits<uLabel>::pTraits(const uLabel& p)
:
p_(p)
{}
pTraits<uLabel>::pTraits(Istream& is) pTraits<uLabel>::pTraits(Istream& is)
{ {
is >> p_; is >> p_;

View File

@ -149,6 +149,9 @@ public:
// Constructors // Constructors
//- Construct from primitive
explicit pTraits(const uLabel&);
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);

View File

@ -55,11 +55,13 @@ public:
// Constructors // Constructors
//- Construct from primitive
pTraits(const PrimitiveType& p) pTraits(const PrimitiveType& p)
: :
PrimitiveType(p) PrimitiveType(p)
{} {}
//- Construct from Istream
pTraits(Istream& is) pTraits(Istream& is)
: :
PrimitiveType(is) PrimitiveType(is)
@ -68,11 +70,13 @@ public:
// Member operators // Member operators
//- Access to the primitive
operator PrimitiveType() const operator PrimitiveType() const
{ {
return *this; return *this;
} }
//- Access to the primitive
operator PrimitiveType&() operator PrimitiveType&()
{ {
return *this; return *this;

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -73,6 +73,8 @@ Foam::porousZone::porousZone
cellZoneID_(mesh_.cellZones().findZoneID(name)), cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict, mesh), coordSys_(dict, mesh),
porosity_(1), porosity_(1),
intensity_(0),
mixingLength_(0),
C0_(0), C0_(0),
C1_(0), C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
@ -95,9 +97,11 @@ Foam::porousZone::porousZone
// porosity // porosity
if (dict_.readIfPresent("porosity", porosity_)) if
{ (
if (porosity_ <= 0.0 || porosity_ > 1.0) dict_.readIfPresent("porosity", porosity_)
&& (porosity_ <= 0.0 || porosity_ > 1.0)
)
{ {
FatalIOErrorIn FatalIOErrorIn
( (
@ -108,8 +112,42 @@ Foam::porousZone::porousZone
<< "out-of-range porosity value " << porosity_ << "out-of-range porosity value " << porosity_
<< exit(FatalIOError); << exit(FatalIOError);
} }
// turbulent intensity
if
(
dict_.readIfPresent("intensity", intensity_)
&& (intensity_ <= 0.0 || intensity_ > 1.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent intensity value " << intensity_
<< exit(FatalIOError);
} }
// turbulent length scale
if
(
dict_.readIfPresent("mixingLength", mixingLength_)
&& (mixingLength_ <= 0.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent length scale " << mixingLength_
<< exit(FatalIOError);
}
// powerLaw coefficients // powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{ {
@ -171,9 +209,6 @@ Foam::porousZone::porousZone
} }
} }
// provide some feedback for the user
// writeDict(Info, false);
// it is an error not to define anything // it is an error not to define anything
if if
( (
@ -191,6 +226,12 @@ Foam::porousZone::porousZone
"nor Darcy-Forchheimer law (d/f) specified" "nor Darcy-Forchheimer law (d/f) specified"
<< exit(FatalIOError); << exit(FatalIOError);
} }
// feedback for the user
if (dict.lookupOrDefault("printCoeffs", false))
{
writeDict(Info, false);
}
} }
@ -365,7 +406,8 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (subDict) if (subDict)
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl; os.writeKeyword("name")
<< zoneName() << token::END_STATEMENT << nl;
} }
else else
{ {
@ -375,15 +417,28 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("note")) if (dict_.found("note"))
{ {
os.writeKeyword("note") << string(dict_.lookup("note")) os.writeKeyword("note")
<< token::END_STATEMENT << nl; << string(dict_.lookup("note")) << token::END_STATEMENT << nl;
} }
coordSys_.writeDict(os, true); coordSys_.writeDict(os, true);
if (dict_.found("porosity")) if (dict_.found("porosity"))
{ {
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl; os.writeKeyword("porosity")
<< porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("intensity"))
{
os.writeKeyword("intensity")
<< intensity() << token::END_STATEMENT << nl;
}
if (dict_.found("mixingLength"))
{
os.writeKeyword("mixingLength")
<< mixingLength() << token::END_STATEMENT << nl;
} }
// powerLaw coefficients // powerLaw coefficients
@ -406,9 +461,9 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pZone) Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz)
{ {
pZone.writeDict(os); pz.writeDict(os);
return os; return os;
} }

View File

@ -51,6 +51,25 @@ Description
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt() The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
method, but accounts for the effective volume of the cells. method, but accounts for the effective volume of the cells.
An example dictionary entry:
@verbatim
cat1
{
note "some catalyst";
coordinateSystem system_10;
porosity 0.809;
intensity 0.001; // optional
mixingLength 0.0001; // optional
printCoeffs yes; // optional: feedback for the user
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07);
f f [0 -1 0 0 0] (-1000 -1000 15.83);
}
}
@endverbatim
See Also See Also
porousZones and coordinateSystems porousZones and coordinateSystems
@ -111,6 +130,12 @@ class porousZone
// Currently unused. // Currently unused.
scalar porosity_; scalar porosity_;
//- Turbulent intensity as fraction of the velocity
scalar intensity_;
//- Turbulent length scale
scalar mixingLength_;
//- powerLaw coefficient C0 //- powerLaw coefficient C0
scalar C0_; scalar C0_;
@ -283,6 +308,30 @@ public:
return porosity_; return porosity_;
} }
//- Return turbulent intensity
scalar intensity() const
{
return intensity_;
}
//- Edit access to turbulent intensity
scalar& intensity()
{
return intensity_;
}
//- Return turbulent length scale
scalar mixingLength() const
{
return mixingLength_;
}
//- Edit access to turbulent length scale
scalar& mixingLength()
{
return mixingLength_;
}
//- Modify time derivative elements according to porosity //- Modify time derivative elements according to porosity
template<class Type> template<class Type>

View File

@ -116,12 +116,13 @@ void buoyantPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<scalar>& rho = const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// If the variable name is "pmh" or "pd" assume it is p - rho*g.h // If the variable name is "p_rgh", "ph_rgh" or "pd"
// and set the gradient appropriately. // assume it is p? - rho*g.h and set the gradient appropriately.
// Otherwise assume the variable is the static pressure. // Otherwise assume the variable is the static pressure.
if if
( (
dimensionedInternalField().name() == "pmh" dimensionedInternalField().name() == "p_rgh"
|| dimensionedInternalField().name() == "ph_rgh"
|| dimensionedInternalField().name() == "pd" || dimensionedInternalField().name() == "pd"
) )
{ {

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
@ -28,6 +28,7 @@ License
#include "calculatedFvPatchFields.H" #include "calculatedFvPatchFields.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "coupledFvPatchFields.H" #include "coupledFvPatchFields.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -177,6 +178,95 @@ void Foam::fvMatrix<Type>::addBoundarySource
} }
template<class Type>
template<template<class> class ListType>
void Foam::fvMatrix<Type>::setValuesFromList
(
const unallocLabelList& cellLabels,
const ListType<Type>& values
)
{
const fvMesh& mesh = psi_.mesh();
const cellList& cells = mesh.cells();
const unallocLabelList& own = mesh.owner();
const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i)
{
const label celli = cellLabels[i];
const Type& value = values[i];
psi[celli] = value;
source_[celli] = value*Diag[celli];
if (symmetric() || asymmetric())
{
const cell& c = cells[celli];
forAll(c, j)
{
const label facei = c[j];
if (mesh.isInternalFace(facei))
{
if (symmetric())
{
if (celli == own[facei])
{
source_[nei[facei]] -= upper()[facei]*value;
}
else
{
source_[own[facei]] -= upper()[facei]*value;
}
upper()[facei] = 0.0;
}
else
{
if (celli == own[facei])
{
source_[nei[facei]] -= lower()[facei]*value;
}
else
{
source_[own[facei]] -= upper()[facei]*value;
}
upper()[facei] = 0.0;
lower()[facei] = 0.0;
}
}
else
{
label patchi = mesh.boundaryMesh().whichPatch(facei);
if (internalCoeffs_[patchi].size())
{
label patchFacei =
mesh.boundaryMesh()[patchi].whichFace(facei);
internalCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
boundaryCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
}
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -393,92 +483,25 @@ Foam::fvMatrix<Type>::~fvMatrix()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Set solution in given cells and eliminate corresponding
// equations from the matrix
template<class Type> template<class Type>
void Foam::fvMatrix<Type>::setValues void Foam::fvMatrix<Type>::setValues
( (
const labelList& cellLabels, const unallocLabelList& cellLabels,
const Field<Type>& values const UList<Type>& values
) )
{ {
const fvMesh& mesh = psi_.mesh(); this->setValuesFromList(cellLabels, values);
}
const cellList& cells = mesh.cells();
const unallocLabelList& own = mesh.owner();
const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag(); template<class Type>
Field<Type>& psi = void Foam::fvMatrix<Type>::setValues
const_cast (
< const unallocLabelList& cellLabels,
GeometricField<Type, fvPatchField, volMesh>& const UIndirectList<Type>& values
>(psi_).internalField(); )
{
forAll(cellLabels, i) this->setValuesFromList(cellLabels, values);
{
label celli = cellLabels[i];
psi[celli] = values[i];
source_[celli] = values[i]*Diag[celli];
if (symmetric() || asymmetric())
{
const cell& c = cells[celli];
forAll(c, j)
{
label facei = c[j];
if (mesh.isInternalFace(facei))
{
if (symmetric())
{
if (celli == own[facei])
{
source_[nei[facei]] -= upper()[facei]*values[i];
}
else
{
source_[own[facei]] -= upper()[facei]*values[i];
}
upper()[facei] = 0.0;
}
else
{
if (celli == own[facei])
{
source_[nei[facei]] -= lower()[facei]*values[i];
}
else
{
source_[own[facei]] -= upper()[facei]*values[i];
}
upper()[facei] = 0.0;
lower()[facei] = 0.0;
}
}
else
{
label patchi = mesh.boundaryMesh().whichPatch(facei);
if (internalCoeffs_[patchi].size())
{
label patchFacei =
mesh.boundaryMesh()[patchi].whichFace(facei);
internalCoeffs_[patchi][patchFacei] =
pTraits<Type>::zero;
boundaryCoeffs_[patchi][patchFacei] =
pTraits<Type>::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
@ -101,6 +101,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > operator&
template<class Type> template<class Type>
Ostream& operator<<(Ostream&, const fvMatrix<Type>&); Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
template<class T> class UIndirectList;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fvMatrix Declaration Class fvMatrix Declaration
@ -112,8 +114,6 @@ class fvMatrix
public refCount, public refCount,
public lduMatrix public lduMatrix
{ {
public:
// Private data // Private data
//- Const reference to GeometricField<Type, fvPatchField, volMesh> //- Const reference to GeometricField<Type, fvPatchField, volMesh>
@ -139,8 +139,12 @@ public:
mutable GeometricField<Type, fvsPatchField, surfaceMesh> mutable GeometricField<Type, fvsPatchField, surfaceMesh>
*faceFluxCorrectionPtr_; *faceFluxCorrectionPtr_;
protected:
// Private Member Functions //- Declare friendship with the fvSolver class
friend class fvSolver;
// Protected Member Functions
//- Add patch contribution to internal field //- Add patch contribution to internal field
template<class Type2> template<class Type2>
@ -193,12 +197,22 @@ public:
const bool couples=true const bool couples=true
) const; ) const;
// Matrix manipulation functionality
//- Set solution in given cells to the specified values
template<template<class> class ListType>
void setValuesFromList
(
const unallocLabelList& cells,
const ListType<Type>& values
);
public: public:
//- Solver class returned by the solver function //- Solver class returned by the solver function
// used for systems in which it is useful to cache the solver for reuse // used for systems in which it is useful to cache the solver for reuse
// e.g. if the solver is potentialy expensive to construct (AMG) and can // e.g. if the solver is potentially expensive to construct (AMG) and can
// be used several times (PISO) // be used several times (PISO)
class fvSolver class fvSolver
{ {
@ -309,12 +323,20 @@ public:
// Operations // Operations
//- Set solution in given cells and eliminate corresponding //- Set solution in given cells to the specified values
// equations from the matrix // and eliminate the corresponding equations from the matrix.
void setValues void setValues
( (
const labelList& cells, const unallocLabelList& cells,
const Field<Type>& values const UList<Type>& values
);
//- Set solution in given cells to the specified values
// and eliminate the corresponding equations from the matrix.
void setValues
(
const unallocLabelList& cells,
const UIndirectList<Type>& values
); );
//- Set reference level for solution //- Set reference level for solution

View File

@ -53,7 +53,7 @@ void Foam::MULES::explicitSolve
psi, psi,
phi, phi,
phiPsi, phiPsi,
zero(), zero(), zeroField(), zeroField(),
psiMax, psiMin psiMax, psiMin
); );
} }
@ -74,7 +74,7 @@ void Foam::MULES::implicitSolve
psi, psi,
phi, phi,
phiPsi, phiPsi,
zero(), zero(), zeroField(), zeroField(),
psiMax, psiMin psiMax, psiMin
); );
} }

View File

@ -107,19 +107,20 @@ void Foam::MULES::explicitSolve
{ {
psiIf = psiIf =
( (
mesh.Vsc0()*rho.oldTime()*psi0/(deltaT*mesh.Vsc()) mesh.Vsc0()().field()*rho.oldTime().field()
+ Su *psi0/(deltaT*mesh.Vsc()().field())
+ Su.field()
- psiIf - psiIf
)/(rho/deltaT - Sp); )/(rho.field()/deltaT - Sp.field());
} }
else else
{ {
psiIf = psiIf =
( (
rho.oldTime()*psi0/deltaT rho.oldTime().field()*psi0/deltaT
+ Su + Su.field()
- psiIf - psiIf
)/(rho/deltaT - Sp); )/(rho.field()/deltaT - Sp.field());
} }
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
@ -456,23 +457,32 @@ void Foam::MULES::limiter
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0(); tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0();
psiMaxn = psiMaxn =
V*((rho/deltaT - Sp)*psiMaxn - Su) V*((rho.field()/deltaT - Sp.field())*psiMaxn - Su.field())
- (V0()/deltaT)*rho.oldTime()*psi0 - (V0().field()/deltaT)*rho.oldTime().field()*psi0
+ sumPhiBD; + sumPhiBD;
psiMinn = psiMinn =
V*(Su - (rho/deltaT - Sp)*psiMinn) V*(Su.field() - (rho.field()/deltaT - Sp.field())*psiMinn)
+ (V0/deltaT)*rho.oldTime()*psi0 + (V0().field()/deltaT)*rho.oldTime().field()*psi0
- sumPhiBD; - sumPhiBD;
} }
else else
{ {
psiMaxn = psiMaxn =
V*((rho/deltaT - Sp)*psiMaxn - (rho.oldTime()/deltaT)*psi0 - Su) V
*(
(rho.field()/deltaT - Sp.field())*psiMaxn
- (rho.oldTime().field()/deltaT)*psi0
- Su.field()
)
+ sumPhiBD; + sumPhiBD;
psiMinn = psiMinn =
V*((rho/deltaT)*psi0 - (rho.oldTime()/deltaT - Sp)*psiMinn + Su) V
*(
(rho.field()/deltaT)*psi0
- (rho.oldTime().field()/deltaT - Sp.field())*psiMinn + Su.field()
)
- sumPhiBD; - sumPhiBD;
} }

View File

@ -103,7 +103,7 @@ void Foam::writeRegisteredObject::write()
( (
"Foam::writeRegisteredObject::read(const dictionary&)" "Foam::writeRegisteredObject::read(const dictionary&)"
) << "Object " << objectNames_[i] << " not found in " ) << "Object " << objectNames_[i] << " not found in "
<< "database. Available objects are:" << nl << obr_.toc() << "database. Available objects:" << nl << obr_.sortedToc()
<< endl; << endl;
} }

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile

View File

@ -0,0 +1,75 @@
/*--------------------------------*- 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;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application XXX;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 1e-05;
writeControl timeStep;
writeInterval 10;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
minMax
{
// Type of functionObject
type fieldMinMax;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Function object enabled flag
enabled true;
// Log to output (default: false)
log false;
// Write information to file (default: true)
write true;
// Fields to be monitored - runTime modifiable
fields
(
U
p
);
}
}
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More