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 surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
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();
}
kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName)
{}
// * * * * * * * * * * * * * * * 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()
{
if (!turbulence_)
@ -272,7 +89,7 @@ void PDRkEpsilon::correct()
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Add the blockage generation term so that it is included consistently
@ -321,6 +138,7 @@ void PDRkEpsilon::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,12 +25,13 @@ Class
Foam::compressible::RASModels::PDRkEpsilon
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)
The default model coefficients correspond to the following:
@verbatim
kEpsilonCoeffs
PDRkEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
@ -53,7 +54,6 @@ Description
SourceFiles
PDRkEpsilon.C
PDRkEpsilonCorrect.C
\*---------------------------------------------------------------------------*/
@ -61,6 +61,7 @@ SourceFiles
#define compressiblePDRkEpsilon_H
#include "RASModel.H"
#include "kEpsilon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,26 +78,8 @@ namespace RASModels
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:
@ -113,7 +96,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);
@ -124,62 +108,9 @@ public:
// 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
virtual void correct();
//- Read turbulenceProperties dictionary
virtual bool read();
};

View File

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

View File

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

View File

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

View File

@ -14,12 +14,12 @@
mesh
);
Info<< "Reading field p\n" << endl;
volScalarField p
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p",
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
@ -42,9 +42,9 @@
mesh
);
# include "createPhi.H"
#include "createPhi.H"
# include "readTransportProperties.H"
#include "readTransportProperties.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence
@ -52,20 +52,6 @@
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
volScalarField rhok
(
@ -77,3 +63,47 @@
),
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();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);
adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi =
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
phi += buoyancyPhi;
surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf();
phi -= buoyancyPhi;
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
if (nonOrth == 0)
{
pEqn.solve();
p_rghEqn.solve();
}
else
{
pEqn.solve();
p_rghEqn.solve();
}
if (nonOrth == nNonOrthCorr)
{
// Calculate the conservative fluxes
phi -= pEqn.flux();
phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
p_rgh.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
U.correctBoundaryConditions();
}
}
#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();
solve
(
UEqn()
==
fvc::reconstruct
if (momentumPredictor)
{
solve
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
);
UEqn()
==
fvc::reconstruct
(
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
}

View File

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

View File

@ -23,6 +23,19 @@
volScalarField& h = thermo.h();
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;
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;
scalar pRefValue = 0.0;
p = p_rgh + rho*gh;
thermo.correct();
rho = thermo.rho();
p_rgh = p - rho*gh;
label p_rghRefCell = 0;
scalar p_rghRefValue = 0.0;
setRefCell
(
p,
p_rgh,
mesh.solutionDict().subDict("SIMPLE"),
pRefCell,
pRefValue
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)
);
}
dimensionedScalar initialMass = fvc::domainIntegrate(rho);

View File

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

View File

@ -5,50 +5,52 @@
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
U = rUA*UEqn().H();
UEqn.clear();
//UEqn.clear();
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p);
bool closedVolume = adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi =
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
phi += buoyancyPhi;
surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
phi -= buoyancyPhi;
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);
pEqn.solve();
p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
p_rghEqn.solve();
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
phi -= pEqn.flux();
phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
p_rgh.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
U.correctBoundaryConditions();
}
}
#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.relax();
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/incompressible/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/>.
Application
compressibleLesInterFoam
compressibleInterFoam
Description
Solver for 2 compressible, isothermal immiscible fluids using a VOF

View File

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

View File

@ -31,6 +31,41 @@ Description
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:
@ -104,10 +139,8 @@ int main(int argc, char *argv[])
List<label> lstA;
lstA.transfer(dlB);
Info<< "Transferred to normal list" << endl;
Info<< "<lstA>" << lstA << "</lstA>" << nl << "sizes: "
<< " " << lstA.size() << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
printInfo("lstA", lstA, true);
printInfo("dlB", dlB, true);
// Copy back and append a few time
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<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
printInfo("dlB", dlB, true);
// assign the list (should maintain allocated space)
dlB = lstA;
Info<< "assigned list" << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
printInfo("dlB", dlB, true);
// Copy back and append a few time
for (label i=0; i < 3; i++)
@ -136,38 +166,30 @@ int main(int argc, char *argv[])
// check allocation granularity
DynamicList<label, 6, 0> dlC;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
printInfo("dlC", dlC, true);
dlC.reserve(dlB.size());
dlC = dlB;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
printInfo("dlC", dlC, true);
List<label> lstB(dlC.xfer());
Info<< "Transferred to normal list via the xfer() method" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
<< " " << lstB.size() << endl;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
printInfo("lstB", lstB, true);
printInfo("dlC", dlC, true);
DynamicList<label> dlD(lstB.xfer());
Info<< "Transfer construct from normal list" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
<< " " << lstB.size() << endl;
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
printInfo("lstB", lstB, true);
printInfo("dlD", dlD, true);
DynamicList<label,10> dlE1(10);
DynamicList<label> dlE2(dlE1); // construct dissimilar
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: "
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl;
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl;
printInfo("dlE1", dlE1, true);
printInfo("dlE2", dlE2, true);
for (label elemI=0; elemI < 5; ++elemI)
{
@ -175,19 +197,42 @@ int main(int argc, char *argv[])
dlE2.append(elemI);
}
Info<< "<dlE2>" << dlE2 << "</dlE2>" << endl;
printInfo("dlE2", dlE2, true);
DynamicList<label> dlE3(dlE2); // construct identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
printInfo("dlE3", dlE3, true);
dlE3 = dlE1; // assign dissimilar
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
printInfo("dlE3", dlE3, true);
dlE3 = dlE2; // assign identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
printInfo("dlE3", dlE3, true);
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";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,15 +27,49 @@ Description
#include "IOstreams.H"
#include "pTraits.H"
#include "vector.H"
#include "tensor.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// 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()
{
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,15 +1,20 @@
#!/bin/sh
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
echo "Found readline/readline.h -- enabling readline support."
export READLINE=1
export READLINELINK="-lreadline -lncurses"
else
# no readline/readline.h -- disabling readline support
export READLINE=0
unset READLINELINK
echo "Found <readline/readline.h> -- enabling readline support."
export COMP_FLAGS="-DHAS_READLINE"
export LINK_FLAGS="-lreadline -lncurses"
fi
wmake

View File

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

View File

@ -49,7 +49,7 @@ Description
#include <stdio.h>
#if READLINE != 0
#ifdef HAS_READLINE
# include <readline/readline.h>
# include <readline/history.h>
#endif
@ -59,29 +59,10 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#if READLINE != 0
#ifdef HAS_READLINE
static const char* historyFile = ".setSet";
#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
void writeVTK
@ -867,7 +848,7 @@ int main(int argc, char *argv[])
printAllSets(mesh, Info);
// Read history if interactive
# if READLINE != 0
# ifdef HAS_READLINE
if (!batch && !read_history(historyFile))
{
Info<< "Successfully read history from " << historyFile << endl;
@ -949,7 +930,7 @@ int main(int argc, char *argv[])
}
else
{
# if READLINE != 0
# ifdef HAS_READLINE
{
char* linePtr = readline("readline>");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -226,7 +226,7 @@ SunOS)
cat <<USAGE
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
;;

View File

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

View File

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

View File

@ -216,7 +216,7 @@ case SunOS:
default:
echo
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
breaksw

View File

@ -1,17 +1,20 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
unset COMP_FLAGS LINK_FLAGS
#
# 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" ]
then
unset FOAM_FILE_MONITOR
echo "Found <sys/inotify.h> -- using inotify for file monitoring."
unset COMP_FLAGS
else
export FOAM_FILE_MONITOR="-DFOAM_USE_STAT"
export COMP_FLAGS="-DFOAM_USE_STAT"
fi

View File

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

View File

@ -207,6 +207,10 @@ public:
//- Assignment from UList
inline void operator=(const UList<T>&);
//- Assignment from UIndirectList
inline void operator=(const UIndirectList<T>&);
// 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>
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.
inline const T& last() const;
//- Return the complete list
inline const UList<T>& completeList() const;
//- Return the list addressing
inline const List<label>& addressing() const;

View File

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

View File

@ -65,6 +65,8 @@ public:
// Member Operators
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
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);
}
inline Foam::zeroField Foam::zeroField::field() const
{
return zeroField();
}
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,8 +65,8 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
dict.lookup("data") >> *this;
dict.lookup("x0") >> x0_;
dict.lookup("dx") >> dx_;
dict.lookup("log10") >> log10_;
dict.lookup("bound") >> bound_;
dict.readIfPresent("log10", log10_);
dict.readIfPresent("bound", bound_);
}
checkTable();
@ -94,13 +94,13 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
List<scalar>(2, 0.0),
x0_(readScalar(dict.lookup("x0"))),
dx_(readScalar(dict.lookup("dx"))),
log10_(dict.lookup("log10")),
bound_(dict.lookup("bound"))
log10_(dict.lookupOrDefault<Switch>("log10", false)),
bound_(dict.lookupOrDefault<Switch>("bound", false))
{
if (initialiseOnly)
{
scalar xMax = readScalar(dict.lookup("xMax"));
label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
const scalar xMax = readScalar(dict.lookup("xMax"));
const label nIntervals = static_cast<label>(xMax - x0_)/dx_ + 1;
this->setSize(nIntervals);
}
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);
@ -225,8 +225,14 @@ void Foam::uniformInterpolationTable<Type>::write() const
dict.add("data", static_cast<const List<scalar>&>(*this));
dict.add("x0", x0_);
dict.add("dx", dx_);
dict.add("log10", log10_);
dict.add("bound", bound_);
if (log10_)
{
dict.add("log10", log10_);
}
if (bound_)
{
dict.add("bound", bound_);
}
dict.regIOobject::write();
}

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,6 +38,12 @@ const Scalar pTraits<Scalar>::max = ScalarVGREAT;
const char* pTraits<Scalar>::componentNames[] = { "x" };
pTraits<Scalar>::pTraits(const Scalar& p)
:
p_(p)
{}
pTraits<Scalar>::pTraits(Istream& is)
{
is >> p_;

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,11 +28,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* const Foam::pTraits<bool>::typeName = "bool";
const bool Foam::pTraits<bool>::zero(false);
const bool Foam::pTraits<bool>::one(true);
const bool Foam::pTraits<bool>::zero = false;
const bool Foam::pTraits<bool>::one = true;
const char* Foam::pTraits<bool>::componentNames[] = { "x" };
Foam::pTraits<bool>::pTraits(const bool& p)
:
p_(p)
{}
Foam::pTraits<bool>::pTraits(Istream& is)
{
is >> p_;

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,12 @@ const label pTraits<label>::max = labelMax;
const char* pTraits<label>::componentNames[] = { "x" };
pTraits<label>::pTraits(const label& p)
:
p_(p)
{}
pTraits<label>::pTraits(Istream& is)
{
is >> p_;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -73,6 +73,8 @@ Foam::porousZone::porousZone
cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict, mesh),
porosity_(1),
intensity_(0),
mixingLength_(0),
C0_(0),
C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
@ -95,21 +97,57 @@ Foam::porousZone::porousZone
// porosity
if (dict_.readIfPresent("porosity", porosity_))
if
(
dict_.readIfPresent("porosity", porosity_)
&& (porosity_ <= 0.0 || porosity_ > 1.0)
)
{
if (porosity_ <= 0.0 || porosity_ > 1.0)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range porosity value " << porosity_
<< exit(FatalIOError);
}
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range porosity value " << porosity_
<< 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
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
if
(
@ -191,6 +226,12 @@ Foam::porousZone::porousZone
"nor Darcy-Forchheimer law (d/f) specified"
<< 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)
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl;
os.writeKeyword("name")
<< zoneName() << token::END_STATEMENT << nl;
}
else
{
@ -375,40 +417,53 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
os.writeKeyword("note")
<< string(dict_.lookup("note")) << token::END_STATEMENT << nl;
}
coordSys_.writeDict(os, true);
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
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
os << indent << "powerLaw";
os << indent << "powerLaw";
dictPtr->write(os);
}
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
os << indent << "Darcy";
os << indent << "Darcy";
dictPtr->write(os);
}
os << decrIndent << indent << token::END_BLOCK << endl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * 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;
}

View File

@ -51,6 +51,25 @@ Description
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
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
porousZones and coordinateSystems
@ -111,6 +130,12 @@ class porousZone
// Currently unused.
scalar porosity_;
//- Turbulent intensity as fraction of the velocity
scalar intensity_;
//- Turbulent length scale
scalar mixingLength_;
//- powerLaw coefficient C0
scalar C0_;
@ -283,6 +308,30 @@ public:
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
template<class Type>

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,6 +28,7 @@ License
#include "calculatedFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "coupledFvPatchFields.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * 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 * * * * * * * * * * * * * * //
template<class Type>
@ -393,92 +483,25 @@ Foam::fvMatrix<Type>::~fvMatrix()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Set solution in given cells and eliminate corresponding
// equations from the matrix
template<class Type>
void Foam::fvMatrix<Type>::setValues
(
const labelList& cellLabels,
const Field<Type>& values
const unallocLabelList& cellLabels,
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();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i)
{
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;
}
}
}
}
}
template<class Type>
void Foam::fvMatrix<Type>::setValues
(
const unallocLabelList& cellLabels,
const UIndirectList<Type>& values
)
{
this->setValuesFromList(cellLabels, values);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,6 +101,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > operator&
template<class Type>
Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
template<class T> class UIndirectList;
/*---------------------------------------------------------------------------*\
Class fvMatrix Declaration
@ -112,8 +114,6 @@ class fvMatrix
public refCount,
public lduMatrix
{
public:
// Private data
//- Const reference to GeometricField<Type, fvPatchField, volMesh>
@ -139,8 +139,12 @@ public:
mutable GeometricField<Type, fvsPatchField, surfaceMesh>
*faceFluxCorrectionPtr_;
protected:
// Private Member Functions
//- Declare friendship with the fvSolver class
friend class fvSolver;
// Protected Member Functions
//- Add patch contribution to internal field
template<class Type2>
@ -193,12 +197,22 @@ public:
const bool couples=true
) 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:
//- Solver class returned by the solver function
// 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)
class fvSolver
{
@ -309,12 +323,20 @@ public:
// Operations
//- Set solution in given cells and eliminate corresponding
// equations from the matrix
//- Set solution in given cells to the specified values
// and eliminate the corresponding equations from the matrix.
void setValues
(
const labelList& cells,
const Field<Type>& values
const unallocLabelList& cells,
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

View File

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

View File

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

View File

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

View File

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