Merge branch 'master' into cvm

This commit is contained in:
graham
2011-03-18 15:13:40 +00:00
432 changed files with 9368 additions and 2619558 deletions

View File

@ -196,7 +196,7 @@
#+BEGIN_SRC c++ #+BEGIN_SRC c++
outlet outlet
{ {
type codedFixedValue<scalar>; type codedFixedValue;
value uniform 0; value uniform 0;
redirectType fixedValue10; redirectType fixedValue10;

View File

@ -1,11 +1,18 @@
EXE_INC = \ EXE_INC = \
-IBCs/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-IBCs/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/sampling/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \
-lspecie \ -lspecie \
-lrhoCentralFoam -lrhoCentralFoam \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lmeshTools

View File

@ -96,3 +96,18 @@ surfaceScalarField neg
mesh, mesh,
dimensionedScalar("neg", dimless, -1.0) dimensionedScalar("neg", dimless, -1.0)
); );
surfaceScalarField phi("phi", mesh.Sf() & fvc::interpolate(rhoU));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);

View File

@ -1,10 +1,10 @@
EXE_INC = \ EXE_INC = \
-I.. \ -I.. \
-I../BCs/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I../BCs/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
@ -13,5 +13,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \
-lspecie \ -lspecie \
-lrhoCentralFoam \ -lrhoCentralFoam \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-ldynamicMesh \ -ldynamicMesh \
-lmeshTools -lmeshTools

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -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
rhoCentralFoam rhoCentralDyMFoam
Description Description
Density-based compressible flow solver based on central-upwind schemes of Density-based compressible flow solver based on central-upwind schemes of
@ -32,6 +32,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "basicPsiThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "fixedRhoFvPatchScalarField.H" #include "fixedRhoFvPatchScalarField.H"
#include "motionSolver.H" #include "motionSolver.H"
@ -185,12 +186,11 @@ int main(int argc, char *argv[])
+ aSf*p_pos - aSf*p_neg + aSf*p_pos - aSf*p_neg
); );
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U)))); volScalarField muEff(turbulence->muEff());
volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U))));
// --- Solve density // --- Solve density
Info<< max(rho) << " " << min(rho) << endl;
solve(fvm::ddt(rho) + fvc::div(phi)); solve(fvm::ddt(rho) + fvc::div(phi));
Info<< max(rho) << " " << min(rho) << endl;
// --- Solve momentum // --- Solve momentum
solve(fvm::ddt(rhoU) + fvc::div(phiUp)); solve(fvm::ddt(rhoU) + fvc::div(phiUp));
@ -206,7 +206,7 @@ int main(int argc, char *argv[])
solve solve
( (
fvm::ddt(rho, U) - fvc::ddt(rho, U) fvm::ddt(rho, U) - fvc::ddt(rho, U)
- fvm::laplacian(mu, U) - fvm::laplacian(muEff, U)
- fvc::div(tauMC) - fvc::div(tauMC)
); );
rhoU = rho*U; rhoU = rho*U;
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
surfaceScalarField sigmaDotU surfaceScalarField sigmaDotU
( (
( (
fvc::interpolate(mu)*mesh.magSf()*fvc::snGrad(U) fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U)
+ (mesh.Sf() & fvc::interpolate(tauMC)) + (mesh.Sf() & fvc::interpolate(tauMC))
) )
& (a_pos*U_pos + a_neg*U_neg) & (a_pos*U_pos + a_neg*U_neg)
@ -240,12 +240,12 @@ int main(int argc, char *argv[])
if (!inviscid) if (!inviscid)
{ {
volScalarField k("k", thermo.Cp()*mu/Pr); volScalarField k("k", thermo.Cp()*muEff/Pr);
solve solve
( (
fvm::ddt(rho, e) - fvc::ddt(rho, e) fvm::ddt(rho, e) - fvc::ddt(rho, e)
- fvm::laplacian(thermo.alpha(), e) - fvm::laplacian(turbulence->alphaEff(), e)
+ fvc::laplacian(thermo.alpha(), e) + fvc::laplacian(turbulence->alpha(), e)
- fvc::laplacian(k, T) - fvc::laplacian(k, T)
); );
thermo.correct(); thermo.correct();
@ -258,6 +258,8 @@ int main(int argc, char *argv[])
p.correctBoundaryConditions(); p.correctBoundaryConditions();
rho.boundaryField() = psi.boundaryField()*p.boundaryField(); rho.boundaryField() = psi.boundaryField()*p.boundaryField();
turbulence->correct();
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,6 +32,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "basicPsiThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "fixedRhoFvPatchScalarField.H" #include "fixedRhoFvPatchScalarField.H"
@ -128,14 +129,6 @@ int main(int argc, char *argv[])
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap))); surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
#include "compressibleCourantNo.H"
#include "readTimeControls.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField aSf(am*a_pos); surfaceScalarField aSf(am*a_pos);
if (fluxScheme == "Tadmor") if (fluxScheme == "Tadmor")
@ -152,6 +145,18 @@ int main(int argc, char *argv[])
surfaceScalarField aphiv_pos(phiv_pos - aSf); surfaceScalarField aphiv_pos(phiv_pos - aSf);
surfaceScalarField aphiv_neg(phiv_neg + aSf); surfaceScalarField aphiv_neg(phiv_neg + aSf);
// Reuse amaxSf for the maximum positive and negative fluxes
// estimated by the central scheme
amaxSf = max(mag(aphiv_pos), mag(aphiv_neg));
#include "compressibleCourantNo.H"
#include "readTimeControls.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg); surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
surfaceVectorField phiUp surfaceVectorField phiUp
@ -167,7 +172,8 @@ int main(int argc, char *argv[])
+ aSf*p_pos - aSf*p_neg + aSf*p_pos - aSf*p_neg
); );
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U)))); volScalarField muEff(turbulence->muEff());
volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U))));
// --- Solve density // --- Solve density
solve(fvm::ddt(rho) + fvc::div(phi)); solve(fvm::ddt(rho) + fvc::div(phi));
@ -188,7 +194,7 @@ int main(int argc, char *argv[])
solve solve
( (
fvm::ddt(rho, U) - fvc::ddt(rho, U) fvm::ddt(rho, U) - fvc::ddt(rho, U)
- fvm::laplacian(mu, U) - fvm::laplacian(muEff, U)
- fvc::div(tauMC) - fvc::div(tauMC)
); );
rhoU = rho*U; rhoU = rho*U;
@ -198,7 +204,7 @@ int main(int argc, char *argv[])
surfaceScalarField sigmaDotU surfaceScalarField sigmaDotU
( (
( (
fvc::interpolate(mu)*mesh.magSf()*fvc::snGrad(U) fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U)
+ (mesh.Sf() & fvc::interpolate(tauMC)) + (mesh.Sf() & fvc::interpolate(tauMC))
) )
& (a_pos*U_pos + a_neg*U_neg) & (a_pos*U_pos + a_neg*U_neg)
@ -222,12 +228,12 @@ int main(int argc, char *argv[])
if (!inviscid) if (!inviscid)
{ {
volScalarField k("k", thermo.Cp()*mu/Pr); volScalarField k("k", thermo.Cp()*muEff/Pr);
solve solve
( (
fvm::ddt(rho, e) - fvc::ddt(rho, e) fvm::ddt(rho, e) - fvc::ddt(rho, e)
- fvm::laplacian(thermo.alpha(), e) - fvm::laplacian(turbulence->alphaEff(), e)
+ fvc::laplacian(thermo.alpha(), e) + fvc::laplacian(turbulence->alpha(), e)
- fvc::laplacian(k, T) - fvc::laplacian(k, T)
); );
thermo.correct(); thermo.correct();
@ -240,6 +246,8 @@ int main(int argc, char *argv[])
p.correctBoundaryConditions(); p.correctBoundaryConditions();
rho.boundaryField() = psi.boundaryField()*p.boundaryField(); rho.boundaryField() = psi.boundaryField()*p.boundaryField();
turbulence->correct();
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -1,9 +1,8 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x
# Clean time folders only wmake
wmake rhoPorousMRFPimpleFoam
rm -rf *[1-9]*
rm -f log.* 2>/dev/null
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -39,6 +39,16 @@
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMin")
);
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence autoPtr<compressible::turbulenceModel> turbulence
( (

View File

@ -1,4 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
U = rAU*UEqn().H(); U = rAU*UEqn().H();
@ -98,6 +101,9 @@ p.relax();
// Recalculate density from the relaxed pressure // Recalculate density from the relaxed pressure
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl; << " " << min(rho).value() << 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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,6 +75,7 @@ int main(int argc, char *argv[])
if (nOuterCorr != 1) if (nOuterCorr != 1)
{ {
p.storePrevIter(); p.storePrevIter();
rho.storePrevIter();
} }
#include "UEqn.H" #include "UEqn.H"

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-I../rhoPimpleFoam \ -I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/cfdTools \

View File

@ -0,0 +1,5 @@
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);

View File

@ -1,4 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn().A()); volScalarField rAU(1.0/UEqn().A());
U = rAU*UEqn().H(); U = rAU*UEqn().H();
@ -16,7 +19,7 @@ if (transonic)
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi) //+ fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
mrfZones.relativeFlux(fvc::interpolate(psi), phid); mrfZones.relativeFlux(fvc::interpolate(psi), phid);
@ -96,8 +99,6 @@ else
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
//if (oCorr != nOuterCorr-1)
{
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
@ -107,19 +108,8 @@ else
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl; << " " << min(rho).value() << endl;
}
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
// 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);
}
*/

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,6 +48,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,77 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMin")
);
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
//dimensionedScalar initialMass = fvc::domainIntegrate(rho);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);

View File

@ -1,3 +0,0 @@
rhoPorousSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam

View File

@ -1,98 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
thermo.rho()
);
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
(
rho,
U,
phi,
thermo
)
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -1,73 +0,0 @@
if (pressureImplicitPorosity)
{
U = trTU()&UEqn().H();
}
else
{
U = trAU()*UEqn().H();
}
UEqn.clear();
phi = fvc::interpolate(rho*U) & mesh.Sf();
bool closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tpEqn().setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
tpEqn().solve();
}
else
{
tpEqn().solve();
}
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U -= trTU()&fvc::grad(p);
}
else
{
U -= trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
// 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);
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake rhoPorousMRFSimpleFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,3 @@
rhoPorousMRFSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousMRFSimpleFoam

View File

@ -1,4 +1,5 @@
EXE_INC = \ EXE_INC = \
-I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \

View File

@ -8,6 +8,8 @@
UEqn().relax(); UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
// Include the porous media resistance and solve the momentum equation // Include the porous media resistance and solve the momentum equation
// either implicit in the tensorial resistance or transport using by // either implicit in the tensorial resistance or transport using by
// including the spherical part of the resistance in the momentum diagonal // including the spherical part of the resistance in the momentum diagonal

View File

@ -0,0 +1,29 @@
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -5,8 +5,8 @@
- fvm::Sp(fvc::div(phi), h) - fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h) - fvm::laplacian(turbulence->alphaEff(), h)
== ==
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)")) fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
- p*fvc::div(phi/fvc::interpolate(rho)) - (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
); );
pZones.addEnthalpySource(thermo, rho, hEqn); pZones.addEnthalpySource(thermo, rho, hEqn);

View File

@ -0,0 +1,105 @@
if (pressureImplicitPorosity)
{
U = trTU()&UEqn().H();
}
else
{
U = trAU()*UEqn().H();
}
UEqn.clear();
bool closedVolume = false;
if (transonic)
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trTU(), p));
}
else
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trAU(), p));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi == tpEqn().flux();
}
}
}
else
{
phi = fvc::interpolate(rho*U) & mesh.Sf();
mrfZones.relativeFlux(fvc::interpolate(rho), phi);
closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U -= trTU()&fvc::grad(p);
}
else
{
U -= trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
// 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);
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << 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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,13 +26,15 @@ Application
Description Description
Steady-state solver for turbulent flow of compressible fluids with Steady-state solver for turbulent flow of compressible fluids with
RANS turbulence modelling, and implicit or explicit porosity treatment RANS turbulence modelling, implicit or explicit porosity treatment
and MRF for HVAC and similar applications.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicPsiThermo.H" #include "basicPsiThermo.H"
#include "RASModel.H" #include "RASModel.H"
#include "MRFZones.H"
#include "thermalPorousZones.H" #include "thermalPorousZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,6 +45,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -1,20 +0,0 @@
{
#include "rhoEqn.H"
}
{
scalar sumLocalContErr =
sum
(
mag(rho.internalField() - (psi*p)().internalField())
)/sum(rho.internalField());
scalar globalContErr =
sum(rho.internalField() - (psi*p)().internalField())
/sum(rho.internalField());
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr << endl;
}

View File

@ -1,57 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo.p();
volScalarField& e = thermo.e();
const volScalarField& psi = thermo.psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt
(
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);

View File

@ -1,23 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar R
(
thermodynamicProperties.lookup("R")
);
dimensionedScalar Cv
(
thermodynamicProperties.lookup("Cv")
);

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake sonicDyMFoam
wmake sonicLiquidFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-I../sonicFoam \ -I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \

View File

@ -0,0 +1,33 @@
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
U = UEqn.H()/UEqn.A();
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
- fvc::meshPhi(rho, U)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rAU, p)
);
pEqn.solve();
phi = pEqn.flux();
}
#include "compressibleContinuityErrs.H"
U -= rAU*fvc::grad(p);
U.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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,14 +62,7 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
fvVectorMatrix UEqn #include "UEqn.H"
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
solve(UEqn == -fvc::grad(p));
#include "eEqn.H" #include "eEqn.H"
@ -78,50 +71,12 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
U = UEqn.H()/UEqn.A(); #include "pEqn.H"
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho/UEqn.A(), p)
);
pEqn.solve();
phi = pEqn.flux();
} }
#include "compressibleContinuityErrs.H"
U -= fvc::grad(p)/UEqn.A();
U.correctBoundaryConditions();
}
DpDt = fvc::DDt
(
surfaceScalarField
(
"phiU",
phi/fvc::interpolate(rho) + fvc::meshPhi(rho, U)
),
p
);
turbulence->correct(); turbulence->correct();
rho = psi*p; rho = thermo.rho();
runTime.write(); runTime.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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -1,18 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar mu
(
transportProperties.lookup("mu")
);

View File

@ -1,70 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake porousSimpleFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-I../simpleFoam \ -I.. \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \

View File

@ -0,0 +1,26 @@
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -43,6 +43,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createPorousZones.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -18,7 +18,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -40,4 +41,5 @@ EXE_LIBS = \
-lchemistryModel \ -lchemistryModel \
-lradiationModels \ -lradiationModels \
-lODE \ -lODE \
-lregionModels \
-lsurfaceFilmModels -lsurfaceFilmModels

View File

@ -17,7 +17,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude -I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \ EXE_LIBS = \
@ -40,5 +41,6 @@ EXE_LIBS = \
-lSLGThermo \ -lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lradiationModels \ -lradiationModels \
-lregionModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-lODE -lODE

View File

@ -11,7 +11,8 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude -I$(LIB_SRC)/dynamicFvMesh/lnInclude
@ -28,6 +29,7 @@ EXE_LIBS = \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lregionModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-ldynamicMesh \ -ldynamicMesh \
-ldynamicFvMesh \ -ldynamicFvMesh \

View File

@ -10,7 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
EXE_LIBS = \ EXE_LIBS = \
-llagrangian \ -llagrangian \
@ -24,4 +25,5 @@ EXE_LIBS = \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lregionModels \
-lsurfaceFilmModels -lsurfaceFilmModels

View File

@ -18,7 +18,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -40,4 +41,5 @@ EXE_LIBS = \
-lchemistryModel \ -lchemistryModel \
-lradiationModels \ -lradiationModels \
-lODE \ -lODE \
-lregionModels \
-lsurfaceFilmModels -lsurfaceFilmModels

View File

@ -14,7 +14,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude -I$(LIB_SRC)/ODE/lnInclude
@ -32,6 +33,7 @@ EXE_LIBS = \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lSLGThermo \ -lSLGThermo \
-lchemistryModel \ -lchemistryModel \
-lregionModels \
-lradiationModels \ -lradiationModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-llagrangianIntermediate \ -llagrangianIntermediate \

View File

@ -1,6 +1,7 @@
Info<< "\nConstructing surface film model" << endl; Info<< "\nConstructing surface film model" << endl;
autoPtr<surfaceFilmModels::surfaceFilmModel> typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
tsurfaceFilm(surfaceFilmModels::surfaceFilmModel::New(mesh, g));
surfaceFilmModels::surfaceFilmModel& surfaceFilm = tsurfaceFilm(); autoPtr<filmModelType> tsurfaceFilm(filmModelType::New(mesh, g));
filmModelType& surfaceFilm = tsurfaceFilm();

View File

@ -17,7 +17,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -39,4 +40,5 @@ EXE_LIBS = \
-lchemistryModel \ -lchemistryModel \
-lradiationModels \ -lradiationModels \
-lODE \ -lODE \
-lregionModels \
-lsurfaceFilmModels -lsurfaceFilmModels

View File

@ -8,7 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-llagrangian \ -llagrangian \
@ -22,4 +23,5 @@ EXE_LIBS = \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lregionModels \
-lsurfaceFilmModels -lsurfaceFilmModels

View File

@ -26,7 +26,9 @@ FoamFile
// - specify where the faces should come from // - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis // - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier // and centre to make matching easier
// - pointSync true to guarantee points to line up. // - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic: // 2. Correct incorrect cyclic:
// This will usually fail upon loading: // This will usually fail upon loading:
@ -45,24 +47,23 @@ matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches. // Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches // Note: this does not work with points that are on multiple coupled patches
// with transformations. // with transformations.
pointSync true; pointSync false;
// Patches to create. // Patches to create.
patches patches
( (
{ {
// Name of new patch // Name of new patch
name sidePatches; name cyc_half0;
// Type of new patch // Dictionary to construct new patch from
patchInfo patchInfo
{ {
type cyclic; type cyclic;
neighbourPatch cyc_half1;
// Optional: explicitly set transformation tensor. // Optional: explicitly set transformation tensor.
// Used when matching and synchronising points. // Used when matching and synchronising points.
//transform translational;
//separationVector (-2289 0 0);
transform rotational; transform rotational;
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
@ -72,28 +73,37 @@ patches
constructFrom patches; constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed. // If constructFrom = patches : names of patches. Wildcards allowed.
patches ("periodic.*"); patches (periodic1);
// If constructFrom = set : name of faceSet // If constructFrom = set : name of faceSet
set f0; set f0;
} }
{ {
name bottom; // Name of new patch
name cyc_half1;
// Type of new patch // Dictionary to construct new patch from
dictionary patchInfo
{ {
type wall; type cyclic;
neighbourPatch cyc_half0;
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
transform rotational;
rotationAxis ( 0 0 1 );
rotationCentre ( 0.3 0 0 );
} }
constructFrom set; // How to construct: either from 'patches' or 'set'
constructFrom patches;
patches (); // If constructFrom = patches : names of patches. Wildcards allowed.
patches (periodic2);
set bottomFaces; // If constructFrom = set : name of faceSet
set f0;
} }
); );
// ************************************************************************* // // ************************************************************************* //

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,7 +63,15 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
volVectorField U(Uheader, mesh); volVectorField U(Uheader, mesh);
if (isFile(runTime.constantPath()/"thermophysicalProperties")) if
(
IOobject
(
"thermophysicalProperties",
runTime.constant(),
mesh
).headerOk()
)
{ {
// thermophysical Mach // thermophysical Mach
autoPtr<basicPsiThermo> thermo autoPtr<basicPsiThermo> thermo

View File

@ -204,15 +204,15 @@ fileName="${1#~OpenFOAM/}"
unset dirList unset dirList
case "$mode" in case "$mode" in
*u*) # user *u*) # user
dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}/$version" userDir="$HOME/.${WM_PROJECT:-OpenFOAM}"
dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}" dirList="$dirList $userDir/$version $userDir"
;; ;;
esac esac
case "$mode" in case "$mode" in
*g*) # group *g*) # group (site)
dirList="$dirList $prefixDir/site/$version" siteDir="${WM_PROJECT_SITE:-$prefixDir/site}"
dirList="$dirList $prefixDir/site" dirList="$dirList $siteDir/$version $siteDir"
;; ;;
esac esac

View File

@ -33,6 +33,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
toolsDir=${0%/*}/tools toolsDir=${0%/*}/tools
siteDir=${WM_PROJECT_SITE:-${WM_PROJECT_INST_DIR:-<unknown>}/site}
userDir=$HOME/.OpenFOAM
usage() { usage() {
exec 1>&2 exec 1>&2
@ -84,10 +86,10 @@ The value taken will be the first (non-space)word after this column.
The database ($Script.db) will taken from these locations: The database ($Script.db) will taken from these locations:
. .
$HOME/.OpenFOAM/$WM_PROJECT_VERSION $userDir/$WM_PROJECT_VERSION
$HOME/.OpenFOAM $userDir
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION $siteDir/$WM_PROJECT_VERSION
$WM_PROJECT_INST_DIR/site $siteDir
$WM_PROJECT_DIR/etc $WM_PROJECT_DIR/etc
$toolsDir $toolsDir

View File

@ -30,7 +30,7 @@
# - requires rsync # - requires rsync
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
siteDir=${WM_PROJECT_INST_DIR:-unknown}/site siteDir=${WM_PROJECT_SITE:-${WM_PROJECT_INST_DIR:-<unknown>}/site}
userDir=$HOME/.OpenFOAM userDir=$HOME/.OpenFOAM
version=${WM_PROJECT_VERSION:-unknown} version=${WM_PROJECT_VERSION:-unknown}
templateDir="appTemplates" templateDir="appTemplates"

View File

@ -172,7 +172,7 @@ do
node="" node=""
esac esac
echo "#!/bin/sh" > $procCmdFile echo "#!/bin/bash" > $procCmdFile
case "$method" in case "$method" in
0) 0)
echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile

25
bin/tools/foamConfigurePaths Normal file → Executable file
View File

@ -37,6 +37,7 @@ usage() {
usage: ${0##*/} usage: ${0##*/}
--foamInstall dir specify installation directory (e.g. /opt) --foamInstall dir specify installation directory (e.g. /opt)
--projectName name specify project name (e.g. openfoam170) --projectName name specify project name (e.g. openfoam170)
--projectVersion ver specify project version (e.g. 1.7.x)
--archOption arch specify architecture option (only 32 or 64 applicable) --archOption arch specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380) --paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
@ -76,7 +77,7 @@ _inlineSed()
[ -f etc/bashrc ] || usage "Please run from top-level directory of installation" [ -f etc/bashrc ] || usage "Please run from top-level directory of installation"
unset foamInstall projectName archOption paraviewInstall unset foamInstall projectName projectVersion archOption paraviewInstall
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -102,7 +103,17 @@ do
_inlineSed \ _inlineSed \
etc/bashrc \ etc/bashrc \
'/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \ '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
"Replacing WM_PROJECT_DIR setting by '$projectName'" "Replacing WM_PROJECT_DIR setting by $projectName"
shift 2
;;
--projectVersion)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
projectVersion="$2"
# replace WM_PROJECT_VERSION=...
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \
"Replacing WM_PROJECT_VERSION setting by $projectVersion"
shift 2 shift 2
;; ;;
-archOption | --archOption) -archOption | --archOption)
@ -142,10 +153,10 @@ _inlineSed \
'/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \ '/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \
"Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'" "Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'"
# set foamCompiler=system always ## set foamCompiler=system always
_inlineSed \ #_inlineSed \
etc/bashrc \ # etc/bashrc \
'/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \ # '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \
"Replacing foamCompiler setting by 'system'" # "Replacing foamCompiler setting by 'system'"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -36,9 +36,8 @@
scalar start = readScalar(dict["startTime"]); scalar start = readScalar(dict["startTime"]);
scalar end = readScalar(dict["endTime"]); scalar end = readScalar(dict["endTime"]);
label nDumps = 5; label nDumps = 5;
label interval = end-start os << ((end-start)/nDumps);
os << ((start-end)/nDumps) #};
#}
}; };
#+END_SRC #+END_SRC
@ -65,7 +64,7 @@
#+BEGIN_SRC c++ #+BEGIN_SRC c++
outlet outlet
{ {
type codedFixedValue<scalar>; type codedFixedValue;
value uniform 0; value uniform 0;
redirectType fixedValue10; redirectType fixedValue10;
@ -132,6 +131,10 @@
}; };
#+END_SRC #+END_SRC
Note: above field initialisation has the problem that the boundary conditions
are not evaluated so e.g. processor boundaries will not hold the opposite cell
value.
* Pitfalls * Pitfalls
The syntax of =#codeStream= can be quite hard to get right. These are some The syntax of =#codeStream= can be quite hard to get right. These are some
common pitfalls: common pitfalls:
@ -146,19 +149,18 @@
+ the =#codeStream= entry (itself a dictionary) has to end in a ';' + the =#codeStream= entry (itself a dictionary) has to end in a ';'
* Exceptions * Exceptions
There are unfortunately some exceptions. Following applications read There are unfortunately some exceptions to above field massaging.
Following applications read
the field as a dictionary, not as an =IOdictionary=: the field as a dictionary, not as an =IOdictionary=:
- =foamFormatConvert= - =foamFormatConvert=
- =changeDictionaryDict= - =changeDictionaryDict=
- =foamUpgradeCyclics= - =foamUpgradeCyclics=
These applications will usually switch off all '#' processing. These applications will usually switch off all '#' processing which
just preserves the entries as strings (including all formatting).
Note: above field initialisation has the problem that the boundary conditions
are not evaluated so e.g. processor boundaries will not hold the opposite cell
value.
* Other * Other
- the implementation is still changing though the syntax is fixed
- parallel running not tested a lot. What about distributed data - parallel running not tested a lot. What about distributed data
(i.e. non-=NFS=) parallel? (i.e. non-=NFS=) parallel?
- paraview has been patched so it will pass in RTLD_GLOBAL when loading
the OpenFOAM reader module. This is necessary for above dictionary
processing to work.

View File

@ -67,6 +67,11 @@ alias foamSol 'cd $FOAM_SOLVERS'
alias foamTuts 'cd $FOAM_TUTORIALS' alias foamTuts 'cd $FOAM_TUTORIALS'
alias foamUtils 'cd $FOAM_UTILITIES' alias foamUtils 'cd $FOAM_UTILITIES'
alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR' alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
if ( $?WM_PROJECT_SITE ) then
alias foamSite 'cd $WM_PROJECT_SITE'
else
alias foamSite 'cd $WM_PROJECT_INST_DIR/site' alias foamSite 'cd $WM_PROJECT_INST_DIR/site'
endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -72,6 +72,12 @@ alias foamSol='cd $FOAM_SOLVERS'
alias foamTuts='cd $FOAM_TUTORIALS' alias foamTuts='cd $FOAM_TUTORIALS'
alias foamUtils='cd $FOAM_UTILITIES' alias foamUtils='cd $FOAM_UTILITIES'
alias foam3rdParty='cd $WM_THIRD_PARTY_DIR' alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
if [ -n "$WM_PROJECT_SITE" ]
then
alias foamSite='cd $WM_PROJECT_SITE'
else
alias foamSite='cd $WM_PROJECT_INST_DIR/site' alias foamSite='cd $WM_PROJECT_INST_DIR/site'
fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -108,16 +108,24 @@ then
fi fi
# Location of site/user files # Location of installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Location of third-party software # Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# Location of site-specific templates etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# unset is equivalent to $WM_PROJECT_INST_DIR/site
unset WM_PROJECT_SITE
# Location of user files
# ~~~~~~~~~~~~~~~~~~~~~~
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Source files, possibly with some verbosity # Source files, possibly with some verbosity
_foamSource() _foamSource()
@ -169,99 +177,6 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
export FOAM_SETTINGS="$@" export FOAM_SETTINGS="$@"
_foamEval $@ _foamEval $@
# Detect system type and set environment variables appropriately
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_ARCH=`uname -s`
case $WM_ARCH in
Linux)
WM_ARCH=linux
# compiler specifics
case `uname -m` in
i686)
;;
x86_64)
case "$WM_ARCH_OPTION" in
32)
export WM_COMPILER_ARCH='-64'
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m32 -fPIC'
export WM_CXXFLAGS='-m32 -fPIC'
export WM_LDFLAGS='-m32'
;;
64)
WM_ARCH=linux64
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m64 -fPIC'
export WM_CXXFLAGS='-m64 -fPIC'
export WM_LDFLAGS='-m64'
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
;;
esac
;;
ia64)
WM_ARCH=linuxIA64
export WM_COMPILER=I64
;;
mips64)
WM_ARCH=SiCortex64
WM_MPLIB=MPI
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-mabi=64 -fPIC'
export WM_CXXFLAGS='-mabi=64 -fPIC'
export WM_LDFLAGS='-mabi=64 -G0'
;;
ppc64)
WM_ARCH=linuxPPC64
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m64 -fPIC'
export WM_CXXFLAGS='-m64 -fPIC'
export WM_LDFLAGS='-m64'
;;
*)
echo Unknown processor type `uname -m` for Linux
;;
esac
;;
SunOS)
WM_ARCH=SunOS64
WM_MPLIB=FJMPI
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-mabi=64 -fPIC'
export WM_CXXFLAGS='-mabi=64 -fPIC'
export WM_LDFLAGS='-mabi=64 -G0'
;;
*) # an unsupported operating system
cat <<USAGE
Your "$WM_ARCH" operating system is not supported by this release
of OpenFOAM. For further assistance, please contact www.OpenFOAM.com
USAGE
;;
esac
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath foamClean=$WM_PROJECT_DIR/bin/foamCleanPath

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fixedValueFvPatchScalarFieldTemplate.H" #include "fixedValueFvPatchFieldTemplate.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
@ -71,24 +71,25 @@ extern "C"
makeRemovablePatchTypeField makeRemovablePatchTypeField
( (
fvPatchScalarField, fvPatch${FieldType},
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
); );
const char* ${typeName}FixedValueFvPatchScalarField::SHA1sum = "${SHA1sum}"; const char* const ${typeName}FixedValueFvPatch${FieldType}::SHA1sum =
"${SHA1sum}";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<${TemplateType}, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(p, iF) fixedValueFvPatchField<${TemplateType}>(p, iF)
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -98,16 +99,16 @@ ${typeName}FixedValueFvPatchScalarField
} }
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const ${typeName}FixedValueFvPatchScalarField& ptf, const ${typeName}FixedValueFvPatch${FieldType}& ptf,
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<${TemplateType}, volMesh>& iF,
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchScalarField(ptf, p, iF, mapper) fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper)
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -117,15 +118,15 @@ ${typeName}FixedValueFvPatchScalarField
} }
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<${TemplateType}, volMesh>& iF,
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchScalarField(p, iF, dict) fixedValueFvPatchField<${TemplateType}>(p, iF, dict)
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -135,13 +136,13 @@ ${typeName}FixedValueFvPatchScalarField
} }
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const ${typeName}FixedValueFvPatchScalarField& ptf const ${typeName}FixedValueFvPatch${FieldType}& ptf
) )
: :
fixedValueFvPatchScalarField(ptf) fixedValueFvPatchField<${TemplateType}>(ptf)
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -151,14 +152,14 @@ ${typeName}FixedValueFvPatchScalarField
} }
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const ${typeName}FixedValueFvPatchScalarField& ptf, const ${typeName}FixedValueFvPatch${FieldType}& ptf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<${TemplateType}, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(ptf, iF) fixedValueFvPatchField<${TemplateType}>(ptf, iF)
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -170,8 +171,8 @@ ${typeName}FixedValueFvPatchScalarField
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
${typeName}FixedValueFvPatchScalarField:: ${typeName}FixedValueFvPatch${FieldType}::
~${typeName}FixedValueFvPatchScalarField() ~${typeName}FixedValueFvPatch${FieldType}()
{ {
if (${verbose:-false}) if (${verbose:-false})
{ {
@ -182,7 +183,7 @@ ${typeName}FixedValueFvPatchScalarField::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void ${typeName}FixedValueFvPatchScalarField::updateCoeffs() void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
@ -198,7 +199,7 @@ void ${typeName}FixedValueFvPatchScalarField::updateCoeffs()
${code} ${code}
//}}} end code //}}} end code
fixedValueFvPatchScalarField::updateCoeffs(); this->fixedValueFvPatchField<${TemplateType}>::updateCoeffs();
} }

View File

@ -21,21 +21,19 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fixedValueFvPatchScalarFieldTemplate
Description Description
Template for use with onTheFlyFixedValue. Template for use with dynamic code generation of a
- fixedValueFvPatchScalarField fixedValue fvPatchField.
- without state - without state
SourceFiles SourceFiles
fixedValueFvPatchScalarFieldTemplate.C fixedValueFvPatchFieldTemplate.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fixedValueFvPatchScalarFieldTemplate_H #ifndef fixedValueFvPatchTemplate${FieldType}_H
#define fixedValueFvPatchScalarFieldTemplate_H #define fixedValueFvPatchTemplate${FieldType}_H
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
@ -45,18 +43,17 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fixedValueFvPatchScalarField Declaration A templated FixedValueFvPatch
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class ${typeName}FixedValueFvPatchScalarField class ${typeName}FixedValueFvPatch${FieldType}
: :
public fixedValueFvPatchScalarField public fixedValueFvPatchField<${TemplateType}>
{ {
public: public:
//- Information about the SHA1 of the code itself //- Information about the SHA1 of the code itself
static const char* SHA1sum; static const char* const SHA1sum;
//- Runtime type information //- Runtime type information
TypeName("${typeName}"); TypeName("${typeName}");
@ -65,73 +62,70 @@ public:
// Constructors // Constructors
//- Construct from patch and internal field //- Construct from patch and internal field
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const fvPatch&, const fvPatch&,
const DimensionedField<scalar, volMesh>& const DimensionedField<${TemplateType}, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const fvPatch&, const fvPatch&,
const DimensionedField<scalar, volMesh>&, const DimensionedField<${TemplateType}, volMesh>&,
const dictionary& const dictionary&
); );
//- Construct by mapping given //- Construct by mapping a copy onto a new patch
// ${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
// onto a new patch
${typeName}FixedValueFvPatchScalarField
( (
const ${typeName}FixedValueFvPatchScalarField&, const ${typeName}FixedValueFvPatch${FieldType}&,
const fvPatch&, const fvPatch&,
const DimensionedField<scalar, volMesh>&, const DimensionedField<${TemplateType}, volMesh>&,
const fvPatchFieldMapper& const fvPatchFieldMapper&
); );
//- Construct as copy //- Construct as copy
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const ${typeName}FixedValueFvPatchScalarField& const ${typeName}FixedValueFvPatch${FieldType}&
); );
//- Construct and return a clone //- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const virtual tmp< fvPatch${FieldType} > clone() const
{ {
return tmp<fvPatchScalarField> return tmp< fvPatch${FieldType} >
( (
new ${typeName}FixedValueFvPatchScalarField(*this) new ${typeName}FixedValueFvPatch${FieldType}(*this)
); );
} }
//- Construct as copy setting internal field reference //- Construct as copy setting internal field reference
${typeName}FixedValueFvPatchScalarField ${typeName}FixedValueFvPatch${FieldType}
( (
const ${typeName}FixedValueFvPatchScalarField&, const ${typeName}FixedValueFvPatch${FieldType}&,
const DimensionedField<scalar, volMesh>& const DimensionedField<${TemplateType}, volMesh>&
); );
//- Construct and return a clone setting internal field reference //- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone virtual tmp< fvPatch${FieldType} > clone
( (
const DimensionedField<scalar, volMesh>& iF const DimensionedField<${TemplateType}, volMesh>& iF
) const ) const
{ {
return tmp<fvPatchScalarField> return tmp< fvPatch${FieldType} >
( (
new ${typeName}FixedValueFvPatchScalarField(*this, iF) new ${typeName}FixedValueFvPatch${FieldType}(*this, iF)
); );
} }
//- Destructor //- Destructor
virtual ~${typeName}FixedValueFvPatchScalarField(); virtual ~${typeName}FixedValueFvPatch${FieldType}();
// Member functions // Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
}; };

116
etc/cshrc
View File

@ -102,17 +102,31 @@ setenv FOAM_SIGFPE
# - remove anything under top-level directory. # - remove anything under top-level directory.
# NB: the WM_PROJECT_INST_DIR might not be identical between versions # NB: the WM_PROJECT_INST_DIR might not be identical between versions
set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME" set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
if ( $?WM_PROJECT_INST_DIR ) then
if ( "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ) then
set foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
endif
endif
# Location of site/user files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Location of installation
# ~~~~~~~~~~~~~~~~~~~~~~~~
setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
# Location of third-party software # Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# Location of site-specific templates etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# unset is equivalent to $WM_PROJECT_INST_DIR/site
unsetenv WM_PROJECT_SITE
# Location of user files
# ~~~~~~~~~~~~~~~~~~~~~~
setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
# Source files, possibly with some verbosity # Source files, possibly with some verbosity
alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*' alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*'
@ -127,10 +141,12 @@ while ( $#argv > 0 )
switch ($argv[1]) switch ($argv[1])
case *=: case *=:
# name= -> unsetenv name # name= -> unsetenv name
if ($?FOAM_VERBOSE && $?prompt) echo "unsetenv $argv[1]:s/=//"
eval "unsetenv $argv[1]:s/=//" eval "unsetenv $argv[1]:s/=//"
breaksw breaksw
case *=*: case *=*:
# name=value -> setenv name value # name=value -> setenv name value
if ($?FOAM_VERBOSE && $?prompt) echo "setenv $argv[1]:s/=/ /"
eval "setenv $argv[1]:s/=/ /" eval "setenv $argv[1]:s/=/ /"
breaksw breaksw
default: default:
@ -146,100 +162,6 @@ while ( $#argv > 0 )
end end
# Detect system type and set environment variables
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv WM_ARCH `uname -s`
switch ($WM_ARCH)
case Linux:
setenv WM_ARCH linux
switch (`uname -m`)
case i686:
breaksw
case x86_64:
switch ($WM_ARCH_OPTION)
case 32:
setenv WM_COMPILER_ARCH '-64'
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m32 -fPIC'
setenv WM_CXXFLAGS '-m32 -fPIC'
setenv WM_LDFLAGS '-m32'
breaksw
case 64:
setenv WM_ARCH linux64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
breaksw
endsw
breaksw
case ia64:
setenv WM_ARCH linuxIA64
setenv WM_COMPILER I64
breaksw
case mips64:
setenv WM_ARCH SiCortex64
setenv WM_MPLIB MPI
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-mabi=64 -fPIC'
setenv WM_CXXFLAGS '-mabi=64 -fPIC'
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
case ppc64:
setenv WM_ARCH linuxPPC64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo Unknown processor type `uname -m` for Linux
breaksw
endsw
breaksw
case SunOS:
setenv WM_ARCH SunOS64
setenv WM_MPLIB FJMPI
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-mabi=64 -fPIC'
setenv WM_CXXFLAGS '-mabi=64 -fPIC'
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
default:
echo
echo "Your '$WM_ARCH' operating system is not supported by this release"
echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.com"
echo
breaksw
endsw
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath

View File

@ -37,6 +37,100 @@ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH # prefix to MANPATH
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}' alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
#------------------------------------------------------------------------------
# Set environment variables according to system type
setenv WM_ARCH `uname -s`
switch ($WM_ARCH)
case Linux:
setenv WM_ARCH linux
switch (`uname -m`)
case i686:
breaksw
case x86_64:
switch ($WM_ARCH_OPTION)
case 32:
setenv WM_COMPILER_ARCH '-64'
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m32 -fPIC'
setenv WM_CXXFLAGS '-m32 -fPIC'
setenv WM_LDFLAGS '-m32'
breaksw
case 64:
setenv WM_ARCH linux64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
breaksw
endsw
breaksw
case ia64:
setenv WM_ARCH linuxIA64
setenv WM_COMPILER I64
breaksw
case mips64:
setenv WM_ARCH SiCortex64
setenv WM_MPLIB MPI
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-mabi=64 -fPIC'
setenv WM_CXXFLAGS '-mabi=64 -fPIC'
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
case ppc64:
setenv WM_ARCH linuxPPC64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo Unknown processor type `uname -m` for Linux
breaksw
endsw
breaksw
case SunOS:
setenv WM_ARCH SunOS64
setenv WM_MPLIB FJMPI
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-mabi=64 -fPIC'
setenv WM_CXXFLAGS '-mabi=64 -fPIC'
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
default:
echo
echo "Your '$WM_ARCH' operating system is not supported by this release"
echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.com"
echo
breaksw
endsw
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# location of the jobControl directory # location of the jobControl directory
@ -56,8 +150,13 @@ setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# shared site executables/libraries # shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion # similar naming convention as ~OpenFOAM expansion
if ( $?WM_PROJECT_SITE ) then
setenv FOAM_SITE_APPBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
else
setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
endif
# user executables/libraries # user executables/libraries
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin

View File

@ -60,6 +60,98 @@ _foamAddMan()
done done
} }
#------------------------------------------------------------------------------
# Set environment variables according to system type
export WM_ARCH=`uname -s`
case "$WM_ARCH" in
Linux)
WM_ARCH=linux
# compiler specifics
case `uname -m` in
i686)
;;
x86_64)
case "$WM_ARCH_OPTION" in
32)
export WM_COMPILER_ARCH='-64'
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m32 -fPIC'
export WM_CXXFLAGS='-m32 -fPIC'
export WM_LDFLAGS='-m32'
;;
64)
WM_ARCH=linux64
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m64 -fPIC'
export WM_CXXFLAGS='-m64 -fPIC'
export WM_LDFLAGS='-m64'
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
;;
esac
;;
ia64)
WM_ARCH=linuxIA64
export WM_COMPILER=I64
;;
mips64)
WM_ARCH=SiCortex64
WM_MPLIB=MPI
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-mabi=64 -fPIC'
export WM_CXXFLAGS='-mabi=64 -fPIC'
export WM_LDFLAGS='-mabi=64 -G0'
;;
ppc64)
WM_ARCH=linuxPPC64
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-m64 -fPIC'
export WM_CXXFLAGS='-m64 -fPIC'
export WM_LDFLAGS='-m64'
;;
*)
echo Unknown processor type `uname -m` for Linux
;;
esac
;;
SunOS)
WM_ARCH=SunOS64
WM_MPLIB=FJMPI
export WM_COMPILER_LIB_ARCH=64
export WM_CC='gcc'
export WM_CXX='g++'
export WM_CFLAGS='-mabi=64 -fPIC'
export WM_CXXFLAGS='-mabi=64 -fPIC'
export WM_LDFLAGS='-mabi=64 -G0'
;;
*) # an unsupported operating system
cat <<USAGE
Your "$WM_ARCH" operating system is not supported by this release
of OpenFOAM. For further assistance, please contact www.OpenFOAM.com
USAGE
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# location of the jobControl directory # location of the jobControl directory
@ -79,8 +171,14 @@ export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# shared site executables/libraries # shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion # similar naming convention as ~OpenFOAM expansion
if [ -n "$WM_PROJECT_SITE" ]
then
export FOAM_SITE_APPBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
else
export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
fi
# user executables/libraries # user executables/libraries
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin

View File

@ -60,7 +60,7 @@ wmake $makeType randomProcesses
thermophysicalModels/Allwmake $* thermophysicalModels/Allwmake $*
transportModels/Allwmake $* transportModels/Allwmake $*
turbulenceModels/Allwmake $* turbulenceModels/Allwmake $*
wmake $makeType surfaceFilmModels regionModels/Allwmake $*
lagrangian/Allwmake $* lagrangian/Allwmake $*
postProcessing/Allwmake $* postProcessing/Allwmake $*
mesh/Allwmake $* mesh/Allwmake $*

View File

@ -253,19 +253,20 @@ bool Foam::chDir(const fileName& dir)
Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
{ {
// Search user files: //
// ~~~~~~~~~~~~~~~~~~ // search for user files in
// * ~/.OpenFOAM/VERSION
// * ~/.OpenFOAM
//
fileName searchDir = home()/".OpenFOAM"; fileName searchDir = home()/".OpenFOAM";
if (isDir(searchDir)) if (isDir(searchDir))
{ {
// Check for user file in ~/.OpenFOAM/VERSION
fileName fullName = searchDir/FOAMversion/name; fileName fullName = searchDir/FOAMversion/name;
if (isFile(fullName)) if (isFile(fullName))
{ {
return fullName; return fullName;
} }
// Check for version-independent user file in ~/.OpenFOAM
fullName = searchDir/name; fullName = searchDir/name;
if (isFile(fullName)) if (isFile(fullName))
{ {
@ -274,32 +275,61 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
} }
// Search site files: //
// ~~~~~~~~~~~~~~~~~~ // search for group (site) files in
// * $WM_PROJECT_SITE/VERSION
// * $WM_PROJECT_SITE
//
searchDir = getEnv("WM_PROJECT_SITE");
if (searchDir.size())
{
if (isDir(searchDir))
{
fileName fullName = searchDir/FOAMversion/name;
if (isFile(fullName))
{
return fullName;
}
fullName = searchDir/name;
if (isFile(fullName))
{
return fullName;
}
}
}
else
{
//
// OR search for group (site) files in
// * $WM_PROJECT_INST_DIR/site/VERSION
// * $WM_PROJECT_INST_DIR/site
//
searchDir = getEnv("WM_PROJECT_INST_DIR"); searchDir = getEnv("WM_PROJECT_INST_DIR");
if (isDir(searchDir)) if (isDir(searchDir))
{ {
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
fileName fullName = searchDir/"site"/FOAMversion/name; fileName fullName = searchDir/"site"/FOAMversion/name;
if (isFile(fullName)) if (isFile(fullName))
{ {
return fullName; return fullName;
} }
// Check for version-independent site file in $WM_PROJECT_INST_DIR/site
fullName = searchDir/"site"/name; fullName = searchDir/"site"/name;
if (isFile(fullName)) if (isFile(fullName))
{ {
return fullName; return fullName;
} }
} }
}
// Search installation files:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// search for other (shipped) files in
// * $WM_PROJECT_DIR/etc
//
searchDir = getEnv("WM_PROJECT_DIR"); searchDir = getEnv("WM_PROJECT_DIR");
if (isDir(searchDir)) if (isDir(searchDir))
{ {
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fileName fullName = searchDir/"etc"/name; fileName fullName = searchDir/"etc"/name;
if (isFile(fullName)) if (isFile(fullName))
{ {
@ -311,7 +341,8 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
// abort if the file is mandatory, otherwise return null // abort if the file is mandatory, otherwise return null
if (mandatory) if (mandatory)
{ {
std::cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :" std::cerr
<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
" could not find mandatory file\n '" " could not find mandatory file\n '"
<< name.c_str() << "'\n\n" << std::endl; << name.c_str() << "'\n\n" << std::endl;
::exit(1); ::exit(1);

View File

@ -97,18 +97,16 @@ struct HashTableCore
{} {}
}; };
static const iteratorEnd endIter;
//- iteratorEnd set to beyond the end of any HashTable //- iteratorEnd set to beyond the end of any HashTable
inline static const iteratorEnd& cend() inline static iteratorEnd cend()
{ {
return endIter; return iteratorEnd();
} }
//- iteratorEnd set to beyond the end of any HashTable //- iteratorEnd set to beyond the end of any HashTable
inline static const iteratorEnd& end() inline static iteratorEnd end()
{ {
return endIter; return iteratorEnd();
} }
}; };
@ -451,9 +449,6 @@ public:
// Member operators // Member operators
//- Conversion to a const_iterator
inline operator const_iterator() const;
//- Return referenced hash value //- Return referenced hash value
inline T& operator*(); inline T& operator*();
inline T& operator()(); inline T& operator()();
@ -503,6 +498,9 @@ public:
//- Construct null (end iterator) //- Construct null (end iterator)
inline const_iterator(); inline const_iterator();
//- Construct from iterator
inline const_iterator(const iterator&);
//- Construct end iterator //- Construct end iterator
inline const_iterator(const iteratorEnd& unused); inline const_iterator(const iteratorEnd& unused);

View File

@ -37,9 +37,6 @@ const Foam::label Foam::HashTableCore::maxTableSize
) )
); );
const Foam::HashTableCore::iteratorEnd Foam::HashTableCore::endIter;
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::HashTableCore::canonicalSize(const label size) Foam::label Foam::HashTableCore::canonicalSize(const label size)

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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -362,17 +362,6 @@ inline Foam::HashTable<T, Key, Hash>::iterator::iterator
{} {}
template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::iterator::operator
typename Foam::HashTable<T, Key, Hash>::const_iterator() const
{
return *reinterpret_cast
<
const typename Foam::HashTable<T, Key, Hash>::const_iterator*
>(this);
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline T& inline T&
Foam::HashTable<T, Key, Hash>::iterator::operator*() Foam::HashTable<T, Key, Hash>::iterator::operator*()
@ -442,6 +431,16 @@ inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator()
{} {}
template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator
(
const HashTable<T, Key, Hash>::iterator& iter
)
:
iteratorBase(iter)
{}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator
( (

View File

@ -70,6 +70,9 @@ bool Foam::functionEntries::codeStream::execute
Istream& is Istream& is
) )
{ {
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity dynamicCode::checkSecurity
( (
"functionEntries::codeStream::execute(..)", "functionEntries::codeStream::execute(..)",

View File

@ -48,10 +48,10 @@ const Foam::word Foam::dynamicCode::codeTemplateEnvName
const Foam::fileName Foam::dynamicCode::codeTemplateDirName const Foam::fileName Foam::dynamicCode::codeTemplateDirName
= "codeTemplates/dynamicCode"; = "codeTemplates/dynamicCode";
const char* Foam::dynamicCode::libTargetRoot = const char* const Foam::dynamicCode::libTargetRoot =
"LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib"; "LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib";
const char* Foam::dynamicCode::topDirName = "dynamicCode"; const char* const Foam::dynamicCode::topDirName = "dynamicCode";
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -106,10 +106,10 @@ protected:
// Static data members // Static data members
//- Root of the LIB target for Make/files //- Root of the LIB target for Make/files
static const char* libTargetRoot; static const char* const libTargetRoot;
//- Top-level directory name for copy/compiling //- Top-level directory name for copy/compiling
static const char* topDirName; static const char* const topDirName;
// Protected Member Functions // Protected Member Functions

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::atomic::group = "atomic"; const char* const Foam::constant::atomic::group = "atomic";
const Foam::dimensionedScalar Foam::constant::atomic::alpha const Foam::dimensionedScalar Foam::constant::atomic::alpha
@ -129,6 +129,3 @@ const Foam::dimensionedScalar Foam::constant::atomic::Eh
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ namespace atomic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for atomic constants //- Group name for atomic constants
extern const char* group; extern const char* const group;
//- Fine-structure constant: default SI units: [] //- Fine-structure constant: default SI units: []
extern const dimensionedScalar alpha; extern const dimensionedScalar alpha;
@ -75,6 +75,3 @@ namespace atomic
#endif #endif
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::electromagnetic::group = "electromagnetic"; const char* const Foam::constant::electromagnetic::group = "electromagnetic";
const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0 const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
@ -164,5 +164,3 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::RK
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ namespace electromagnetic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for electromagnetic constants //- Group name for electromagnetic constants
extern const char* group; extern const char* const group;
//- Magnetic constant/permeability of free space: default SI units: [H/m] //- Magnetic constant/permeability of free space: default SI units: [H/m]
extern const dimensionedScalar mu0; extern const dimensionedScalar mu0;
@ -84,5 +84,3 @@ namespace electromagnetic
#endif #endif
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,7 +45,7 @@ namespace mathematical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static word group = "mathematical"; static const char* const group = "mathematical";
const scalar e(M_E); const scalar e(M_E);
const scalar pi(M_PI); const scalar pi(M_PI);

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::physicoChemical::group = "physicoChemical"; const char* const Foam::constant::physicoChemical::group = "physicoChemical";
const Foam::dimensionedScalar Foam::constant::physicoChemical::R const Foam::dimensionedScalar Foam::constant::physicoChemical::R

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ namespace physicoChemical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for physico-chemical constants //- Group name for physico-chemical constants
extern const char* group; extern const char* const group;
//- Universal gas constant: default SI units: [J/mol/K] //- Universal gas constant: default SI units: [J/mol/K]
extern const dimensionedScalar R; extern const dimensionedScalar R;
@ -78,7 +78,3 @@ namespace physicoChemical
#endif #endif
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::universal::group = "universal"; const char* const Foam::constant::universal::group = "universal";
const Foam::dimensionedScalar Foam::constant::universal::hr const Foam::dimensionedScalar Foam::constant::universal::hr
@ -49,4 +49,3 @@ const Foam::dimensionedScalar Foam::constant::universal::hr
// ************************************************************************* // // ************************************************************************* //

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-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ namespace universal
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for universal constants //- Group name for universal constants
extern const char* group; extern const char* const group;
//- Reduced Planck constant: default SI units: [J/s] //- Reduced Planck constant: default SI units: [J/s]
extern const dimensionedScalar hr; extern const dimensionedScalar hr;
@ -62,4 +62,3 @@ namespace universal
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -93,22 +93,22 @@ fileName cwd();
// else return false // else return false
bool chDir(const fileName& dir); bool chDir(const fileName& dir);
//- Search for \em name //- Search for a file from user/group/shipped directories.
// in the following hierarchy: // The search scheme allows for version-specific and
// -# personal settings: // version-independent files using the following hierarchy:
// - ~/.OpenFOAM/\<VERSION\>/ // - \b user settings:
// <em>for version-specific files</em> // - ~/.OpenFOAM/\<VERSION\>
// - ~/.OpenFOAM/ // - ~/.OpenFOAM/
// <em>for version-independent files</em> // - \b group (site) settings (when $WM_PROJECT_SITE is set):
// -# site-wide settings: // - $WM_PROJECT_SITE/\<VERSION\>
// - $WM_PROJECT_SITE
// - \b group (site) settings (when $WM_PROJECT_SITE is not set):
// - $WM_PROJECT_INST_DIR/site/\<VERSION\> // - $WM_PROJECT_INST_DIR/site/\<VERSION\>
// <em>for version-specific files</em>
// - $WM_PROJECT_INST_DIR/site/ // - $WM_PROJECT_INST_DIR/site/
// <em>for version-independent files</em> // - \b other (shipped) settings:
// -# shipped settings:
// - $WM_PROJECT_DIR/etc/ // - $WM_PROJECT_DIR/etc/
// //
// \return the full path name or fileName() if the name cannot be found // \return The full path name or fileName() if the name cannot be found
// Optionally abort if the file cannot be found // Optionally abort if the file cannot be found
fileName findEtcFile(const fileName&, bool mandatory=false); fileName findEtcFile(const fileName&, bool mandatory=false);

View File

@ -254,7 +254,10 @@ public:
} }
//- Transform a patch-based position from other side to this side //- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const = 0; virtual void transformPosition(pointField&) const = 0;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const = 0;
//- Are the planes separated. //- Are the planes separated.
virtual bool separated() const virtual bool separated() const
@ -297,12 +300,12 @@ public:
virtual void calcGeometry virtual void calcGeometry
( (
const primitivePatch& referPatch, const primitivePatch& referPatch,
const UList<point>& thisCtrs, const pointField& thisCtrs,
const UList<point>& thisAreas, const vectorField& thisAreas,
const UList<point>& thisCc, const pointField& thisCc,
const UList<point>& nbrCtrs, const pointField& nbrCtrs,
const UList<point>& nbrAreas, const vectorField& nbrAreas,
const UList<point>& nbrCc const pointField& nbrCc
) = 0; ) = 0;
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not

View File

@ -77,7 +77,6 @@ void Foam::cyclicPolyPatch::calcTransforms()
if (size()) if (size())
{ {
// Half0 // Half0
const cyclicPolyPatch& half0 = *this; const cyclicPolyPatch& half0 = *this;
vectorField half0Areas(half0.size()); vectorField half0Areas(half0.size());
forAll(half0, facei) forAll(half0, facei)
@ -108,10 +107,10 @@ void Foam::cyclicPolyPatch::calcTransforms()
void Foam::cyclicPolyPatch::calcTransforms void Foam::cyclicPolyPatch::calcTransforms
( (
const primitivePatch& half0, const primitivePatch& half0,
const UList<point>& half0Ctrs, const pointField& half0Ctrs,
const UList<point>& half0Areas, const vectorField& half0Areas,
const UList<point>& half1Ctrs, const pointField& half1Ctrs,
const UList<point>& half1Areas const vectorField& half1Areas
) )
{ {
if (debug && owner()) if (debug && owner())
@ -165,23 +164,9 @@ void Foam::cyclicPolyPatch::calcTransforms
if (half0Ctrs.size() > 0) if (half0Ctrs.size() > 0)
{ {
scalarField half0Tols
(
calcFaceTol
(
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
)
);
vectorField half0Normals(half0Areas.size()); vectorField half0Normals(half0Areas.size());
vectorField half1Normals(half1Areas.size()); vectorField half1Normals(half1Areas.size());
//- Additional warning about faces non-aligned with rotation axis
//scalar maxCos = -GREAT;
//label maxFacei = -1;
forAll(half0, facei) forAll(half0, facei)
{ {
scalar magSf = mag(half0Areas[facei]); scalar magSf = mag(half0Areas[facei]);
@ -221,34 +206,64 @@ void Foam::cyclicPolyPatch::calcTransforms
{ {
half0Normals[facei] = half0Areas[facei] / magSf; half0Normals[facei] = half0Areas[facei] / magSf;
half1Normals[facei] = half1Areas[facei] / nbrMagSf; half1Normals[facei] = half1Areas[facei] / nbrMagSf;
//if (transform_ == ROTATIONAL)
//{
// scalar cos = mag(half0Normals[facei] & rotationAxis_);
// if (cos > maxCos)
// {
// maxCos = cos;
// maxFacei = facei;
// }
//}
} }
} }
//if (maxCos > sqrt(SMALL))
//{
// WarningIn
// (
// "cyclicPolyPatch::calcTransforms()"
// ) << "on patch " << name()
// << " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei]
// << " is not perpendicular to the rotationAxis." << endl
// << "This will cause problems with topology changes." << endl
// << "rotation axis : " << rotationAxis_ << endl
// << "face normal : " << half0Normals[maxFacei] << endl
// << "cosine of angle : " << maxCos << endl;
//}
// Calculate transformation tensors // Calculate transformation tensors
if (transform_ == ROTATIONAL)
{
// Calculate using the given rotation axis and centre. Do not
// use calculated normals.
label face0 = getConsistentRotationFace(half0Ctrs);
label face1 = face0;
vector n0 = ((half0Ctrs[face0] - rotationCentre_) ^ rotationAxis_);
vector n1 = ((half1Ctrs[face1] - rotationCentre_) ^ -rotationAxis_);
n0 /= mag(n0) + VSMALL;
n1 /= mag(n1) + VSMALL;
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Specified rotation :"
<< " n0:" << n0 << " n1:" << n1 << endl;
}
// Extended tensor from two local coordinate systems calculated
// using normal and rotation axis
const tensor E0
(
rotationAxis_,
(n0 ^ rotationAxis_),
n0
);
const tensor E1
(
rotationAxis_,
(-n1 ^ rotationAxis_),
-n1
);
const tensor revT(E1.T() & E0);
const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const_cast<vectorField&>(separation()).setSize(0);
const_cast<boolList&>(collocated()) = boolList(1, false);
}
else
{
scalarField half0Tols
(
calcFaceTol
(
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
)
);
calcTransformTensors calcTransformTensors
( (
static_cast<const pointField&>(half0Ctrs), static_cast<const pointField&>(half0Ctrs),
@ -259,37 +274,6 @@ void Foam::cyclicPolyPatch::calcTransforms
matchTol, matchTol,
transform_ transform_
); );
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)
{
// Get index of maximum area face to minimise truncation errors.
label max0I = findMaxArea(half0.points(), half0);
const tensor fwdT = forwardT()[max0I];
const_cast<tensorField&>(forwardT()) = tensorField(1, fwdT);
const tensor revT = reverseT()[max0I];
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const bool coll = collocated()[max0I];
const_cast<boolList&>(collocated()).setSize(1);
const_cast<boolList&>(collocated())[0] = coll;
WarningIn
(
"cyclicPolyPatch::calcTransforms\n"
" (\n"
" const primitivePatch&,\n"
" const UList<point>&,\n"
" const UList<point>&,\n"
" const UList<point>&,\n"
" const UList<point>&\n"
" )"
) << "For patch " << name()
<< " calculated non-uniform transform tensor even though"
<< " the transform type is " << transformTypeNames[transform_]
<< "." << nl
<< " Setting the transformation tensor to be a uniform"
<< " rotation calculated from face " << max0I
<< endl;
} }
} }
} }
@ -333,14 +317,39 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
<< " n0:" << n0 << " n1:" << n1 << endl; << " n0:" << n0 << " n1:" << n1 << endl;
} }
// Rotation (around origin) // Extended tensor from two local coordinate systems calculated
const tensor reverseT(rotationTensor(n0, -n1)); // using normal and rotation axis
const tensor E0
(
rotationAxis_,
(n0 ^ rotationAxis_),
n0
);
const tensor E1
(
rotationAxis_,
(-n1 ^ rotationAxis_),
-n1
);
const tensor revT(E1.T() & E0);
// Rotation // Rotation
forAll(half0Ctrs, faceI) forAll(half0Ctrs, faceI)
{ {
half0Ctrs[faceI] = Foam::transform(reverseT, half0Ctrs[faceI]); half0Ctrs[faceI] =
anchors0[faceI] = Foam::transform(reverseT, anchors0[faceI]); Foam::transform
(
revT,
half0Ctrs[faceI] - rotationCentre_
)
+ rotationCentre_;
anchors0[faceI] =
Foam::transform
(
revT,
anchors0[faceI] - rotationCentre_
)
+ rotationCentre_;
} }
break; break;
@ -387,19 +396,19 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
} }
// Rotation (around origin) // Rotation (around origin)
const tensor reverseT(rotationTensor(n0, -n1)); const tensor revT(rotationTensor(n0, -n1));
// Rotation // Rotation
forAll(half0Ctrs, faceI) forAll(half0Ctrs, faceI)
{ {
half0Ctrs[faceI] = Foam::transform half0Ctrs[faceI] = Foam::transform
( (
reverseT, revT,
half0Ctrs[faceI] half0Ctrs[faceI]
); );
anchors0[faceI] = Foam::transform anchors0[faceI] = Foam::transform
( (
reverseT, revT,
anchors0[faceI] anchors0[faceI]
); );
} }
@ -437,41 +446,20 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace
const pointField& faceCentres const pointField& faceCentres
) const ) const
{ {
const scalarField magRadSqr // Determine a face furthest away from the axis
(
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
);
scalarField axisLen
(
(faceCentres - rotationCentre_) & rotationAxis_
);
axisLen -= min(axisLen);
const scalarField magLenSqr
(
magRadSqr + axisLen*axisLen
);
label rotFace = -1; const scalarField magRadSqr =
scalar maxMagLenSqr = -GREAT; magSqr((faceCentres - rotationCentre_) ^ rotationAxis_);
scalar maxMagRadSqr = -GREAT;
forAll(faceCentres, i) label rotFace = findMax(magRadSqr);
{
if (magLenSqr[i] >= maxMagLenSqr)
{
if (magRadSqr[i] > maxMagRadSqr)
{
rotFace = i;
maxMagLenSqr = magLenSqr[i];
maxMagRadSqr = magRadSqr[i];
}
}
}
if (debug) if (debug)
{ {
Pout<< "getConsistentRotationFace(const pointField&)" << nl Info<< "getConsistentRotationFace(const pointField&)" << nl
<< " rotFace = " << rotFace << nl << " rotFace = " << rotFace << nl
<< " point = " << faceCentres[rotFace] << endl; << " point = " << faceCentres[rotFace] << nl
<< " distance = " << Foam::sqrt(magRadSqr[rotFace])
<< endl;
} }
return rotFace; return rotFace;
@ -586,6 +574,17 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
{ {
dict.lookup("rotationAxis") >> rotationAxis_; dict.lookup("rotationAxis") >> rotationAxis_;
dict.lookup("rotationCentre") >> rotationCentre_; dict.lookup("rotationCentre") >> rotationCentre_;
scalar magRot = mag(rotationAxis_);
if (magRot < SMALL)
{
FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict)
<< "Illegal rotationAxis " << rotationAxis_ << endl
<< "Please supply a non-zero vector."
<< exit(FatalIOError);
}
rotationAxis_ /= magRot;
break; break;
} }
case TRANSLATIONAL: case TRANSLATIONAL:
@ -729,9 +728,18 @@ Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{ {
if (!parallel()) if (!parallel())
{
if (transform_ == ROTATIONAL)
{
l =
Foam::transform(forwardT(), l-rotationCentre_)
+ rotationCentre_;
}
else
{ {
l = Foam::transform(forwardT(), l); l = Foam::transform(forwardT(), l);
} }
}
else if (separated()) else if (separated())
{ {
const vectorField& s = separation(); const vectorField& s = separation();
@ -750,6 +758,40 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
} }
void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{
if (!parallel())
{
const tensor& T =
(
forwardT().size() == 1
? forwardT()[0]
: forwardT()[facei]
);
if (transform_ == ROTATIONAL)
{
l = Foam::transform(T, l-rotationCentre_) + rotationCentre_;
}
else
{
l = Foam::transform(T, l);
}
}
else if (separated())
{
const vector& s =
(
separation().size() == 1
? separation()[0]
: separation()[facei]
);
l -= s;
}
}
void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
polyPatch::initGeometry(pBufs); polyPatch::initGeometry(pBufs);
@ -759,9 +801,9 @@ void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
void Foam::cyclicPolyPatch::initGeometry void Foam::cyclicPolyPatch::initGeometry
( (
const primitivePatch& referPatch, const primitivePatch& referPatch,
UList<point>& nbrCtrs, pointField& nbrCtrs,
UList<point>& nbrAreas, vectorField& nbrAreas,
UList<point>& nbrCc pointField& nbrCc
) )
{} {}
@ -769,12 +811,12 @@ void Foam::cyclicPolyPatch::initGeometry
void Foam::cyclicPolyPatch::calcGeometry void Foam::cyclicPolyPatch::calcGeometry
( (
const primitivePatch& referPatch, const primitivePatch& referPatch,
const UList<point>& thisCtrs, const pointField& thisCtrs,
const UList<point>& thisAreas, const vectorField& thisAreas,
const UList<point>& thisCc, const pointField& thisCc,
const UList<point>& nbrCtrs, const pointField& nbrCtrs,
const UList<point>& nbrAreas, const vectorField& nbrAreas,
const UList<point>& nbrCc const pointField& nbrCc
) )
{ {
calcTransforms calcTransforms

View File

@ -110,10 +110,10 @@ class cyclicPolyPatch
void calcTransforms void calcTransforms
( (
const primitivePatch& half0, const primitivePatch& half0,
const UList<point>& half0Ctrs, const pointField& half0Ctrs,
const UList<point>& half0Areas, const vectorField& half0Areas,
const UList<point>& half1Ctrs, const pointField& half1Ctrs,
const UList<point>& half1Areas const vectorField& half1Areas
); );
// Face ordering // Face ordering
@ -149,9 +149,9 @@ protected:
virtual void initGeometry virtual void initGeometry
( (
const primitivePatch& referPatch, const primitivePatch& referPatch,
UList<point>& nbrCtrs, pointField& nbrCtrs,
UList<point>& nbrAreas, vectorField& nbrAreas,
UList<point>& nbrCc pointField& nbrCc
); );
//- Calculate the patch geometry //- Calculate the patch geometry
@ -161,12 +161,12 @@ protected:
virtual void calcGeometry virtual void calcGeometry
( (
const primitivePatch& referPatch, const primitivePatch& referPatch,
const UList<point>& thisCtrs, const pointField& thisCtrs,
const UList<point>& thisAreas, const vectorField& thisAreas,
const UList<point>& thisCc, const pointField& thisCc,
const UList<point>& nbrCtrs, const pointField& nbrCtrs,
const UList<point>& nbrAreas, const vectorField& nbrAreas,
const UList<point>& nbrCc const pointField& nbrCc
); );
//- Initialise the patches for moving points //- Initialise the patches for moving points
@ -342,6 +342,9 @@ public:
//- Transform a patch-based position from other side to this side //- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const; virtual void transformPosition(pointField& l) const;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const;
// Transformation // Transformation

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