MRG: Integrated foundation code

This commit is contained in:
Andrew Heather
2016-12-12 12:10:29 +00:00
509 changed files with 8350 additions and 1966 deletions

3
.gitignore vendored
View File

@ -75,9 +75,10 @@ doc/Doxygen/DTAGS
# Ignore .tags in the main directory # Ignore .tags in the main directory
/.tags /.tags
# Ignore eclipse project files in the main directory # Ignore project files in the main directory
/.cproject /.cproject
/.project /.project
/.dir-locals.el
# Ignore the test directory # Ignore the test directory
/tutorialsTest /tutorialsTest

View File

@ -17,10 +17,7 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
exit 1 exit 1
} }
set -x
wmake -all $targetType solvers wmake -all $targetType solvers
wmake -all $targetType utilities wmake -all $targetType utilities
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@
( (
"initialConditions", "initialConditions",
runTime.constant(), runTime.constant(),
runTime, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
@ -37,7 +37,7 @@
( (
"rho", "rho",
runTime.timeName(), runTime.timeName(),
runTime, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
@ -50,7 +50,7 @@
( (
"Rspecific", "Rspecific",
runTime.timeName(), runTime.timeName(),
runTime, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
@ -69,7 +69,7 @@
( (
"U", "U",
runTime.timeName(), runTime.timeName(),
runTime, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso BCs wclean libso BCs
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
(wmake $targetType BCs && wmake $targetType && wmake $targetType rhoCentralDyMFoam) (wmake $targetType BCs && wmake $targetType && wmake $targetType rhoCentralDyMFoam)

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 cd ${0%/*} || exit 1
set -x
wclean libso DPMTurbulenceModels wclean libso DPMTurbulenceModels
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType DPMTurbulenceModels wmake $targetType DPMTurbulenceModels

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso twoPhaseMixtureThermo wclean libso twoPhaseMixtureThermo
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType twoPhaseMixtureThermo wmake $targetType twoPhaseMixtureThermo

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso multiphaseMixtureThermo wclean libso multiphaseMixtureThermo
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType multiphaseMixtureThermo wmake $targetType multiphaseMixtureThermo
wmake $targetType wmake $targetType

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso mixtureViscosityModels wclean libso mixtureViscosityModels
wclean libso relativeVelocityModels wclean libso relativeVelocityModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType mixtureViscosityModels wmake $targetType mixtureViscosityModels
wmake $targetType relativeVelocityModels wmake $targetType relativeVelocityModels

View File

@ -24,6 +24,9 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "relativeVelocityModel.H" #include "relativeVelocityModel.H"
#include "fixedValueFvPatchFields.H"
#include "slipFvPatchFields.H"
#include "partialSlipFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +36,34 @@ namespace Foam
defineRunTimeSelectionTable(relativeVelocityModel, dictionary); defineRunTimeSelectionTable(relativeVelocityModel, dictionary);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
{
const volVectorField& U = mixture_.U();
wordList UdmTypes
(
U.boundaryField().size(),
calculatedFvPatchScalarField::typeName
);
forAll(U.boundaryField(), i)
{
if
(
isA<fixedValueFvPatchVectorField>(U.boundaryField()[i])
|| isA<slipFvPatchVectorField>(U.boundaryField()[i])
|| isA<partialSlipFvPatchVectorField>(U.boundaryField()[i])
)
{
UdmTypes[i] = fixedValueFvPatchVectorField::typeName;
}
}
return UdmTypes;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -55,11 +86,12 @@ Foam::relativeVelocityModel::relativeVelocityModel
"Udm", "Udm",
alphac_.time().timeName(), alphac_.time().timeName(),
alphac_.mesh(), alphac_.mesh(),
IOobject::NO_READ, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
alphac_.mesh(), alphac_.mesh(),
dimensionedVector("Udm", dimVelocity, Zero) dimensionedVector("Udm", dimVelocity, Zero),
UdmPatchFieldTypes()
) )
{} {}

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) 2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,12 +52,16 @@ class relativeVelocityModel
{ {
// Private Member Functions // Private Member Functions
//- Return the list of patchFieldTypes for Udm derived from U
wordList UdmPatchFieldTypes() const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
relativeVelocityModel(const relativeVelocityModel&); relativeVelocityModel(const relativeVelocityModel&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const relativeVelocityModel&); void operator=(const relativeVelocityModel&);
protected: protected:
// Protected data // Protected data

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso temperaturePhaseChangeTwoPhaseMixtures wclean libso temperaturePhaseChangeTwoPhaseMixtures
wclean wclean

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso phaseChangeTwoPhaseMixtures wclean libso phaseChangeTwoPhaseMixtures
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType phaseChangeTwoPhaseMixtures wmake $targetType phaseChangeTwoPhaseMixtures
wmake $targetType wmake $targetType

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso multiphaseSystem wclean libso multiphaseSystem
wclean libso interfacialModels wclean libso interfacialModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmakeLnInclude interfacialModels wmakeLnInclude interfacialModels
wmake $targetType multiphaseSystem wmake $targetType multiphaseSystem

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso multiphaseMixture wclean libso multiphaseMixture
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType multiphaseMixture wmake $targetType multiphaseMixture
wmake $targetType wmake $targetType

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso phaseSystems wclean libso phaseSystems
wclean libso interfacialModels wclean libso interfacialModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmakeLnInclude interfacialModels wmakeLnInclude interfacialModels
wmakeLnInclude interfacialCompositionModels wmakeLnInclude interfacialCompositionModels

View File

@ -77,11 +77,39 @@ void Foam::AnisothermalPhaseModel<BasePhaseModel>::correctThermo()
} }
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::AnisothermalPhaseModel<BasePhaseModel>::filterPressureWork
(
const tmp<volScalarField>& pressureWork
) const
{
const volScalarField& alpha = *this;
scalar pressureWorkAlphaLimit =
this->thermo_->lookupOrDefault("pressureWorkAlphaLimit", 0.0);
if (pressureWorkAlphaLimit > 0)
{
return
(
max(alpha - pressureWorkAlphaLimit, scalar(0))
/max(alpha - pressureWorkAlphaLimit, pressureWorkAlphaLimit)
)*pressureWork;
}
else
{
return pressureWork;
}
}
template<class BasePhaseModel> template<class BasePhaseModel>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn() Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
{ {
const volScalarField& alpha = *this; const volScalarField& alpha = *this;
const volVectorField& U = this->U();
const surfaceScalarField& alphaPhi = this->alphaPhi(); const surfaceScalarField& alphaPhi = this->alphaPhi();
const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi(); const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi();
@ -93,7 +121,8 @@ Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
tmp<fvScalarMatrix> tEEqn tmp<fvScalarMatrix> tEEqn
( (
fvm::ddt(alpha, this->rho(), he) + fvm::div(alphaRhoPhi, he) fvm::ddt(alpha, this->rho(), he)
+ fvm::div(alphaRhoPhi, he)
- fvm::Sp(contErr, he) - fvm::Sp(contErr, he)
+ fvc::ddt(alpha, this->rho(), K_) + fvc::div(alphaRhoPhi, K_) + fvc::ddt(alpha, this->rho(), K_) + fvc::div(alphaRhoPhi, K_)
@ -112,13 +141,15 @@ Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
// Add the appropriate pressure-work term // Add the appropriate pressure-work term
if (he.name() == this->thermo_->phasePropertyName("e")) if (he.name() == this->thermo_->phasePropertyName("e"))
{ {
tEEqn.ref() += tEEqn.ref() += filterPressureWork
fvc::ddt(alpha)*this->thermo().p() (
+ fvc::div(alphaPhi, this->thermo().p()); fvc::div(fvc::absolute(alphaPhi, alpha, U), this->thermo().p())
+ this->thermo().p()*fvc::ddt(alpha)
);
} }
else if (this->thermo_->dpdt()) else if (this->thermo_->dpdt())
{ {
tEEqn.ref() -= alpha*this->fluid().dpdt(); tEEqn.ref() -= filterPressureWork(alpha*this->fluid().dpdt());
} }
return tEEqn; return tEEqn;

View File

@ -58,6 +58,15 @@ class AnisothermalPhaseModel
volScalarField K_; volScalarField K_;
// Private member functions
//- Optionally filter the pressure work term as the phase-fraction -> 0
tmp<volScalarField> filterPressureWork
(
const tmp<volScalarField>& pressureWork
) const;
public: public:
// Constructors // Constructors

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) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,7 +40,12 @@ Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::ReactingPhaseModel
BasePhaseModel(fluid, phaseName, index, false), BasePhaseModel(fluid, phaseName, index, false),
reaction_ reaction_
( (
ReactionType::New(fluid.mesh(), this->name()) ReactionType::New
(
fluid.mesh(),
combustionModel::combustionPropertiesName,
this->name()
)
) )
{ {
this->thermo_ = &reaction_->thermo(); this->thermo_ = &reaction_->thermo();

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso multiphaseSystem wclean libso multiphaseSystem
wclean libso multiphaseCompressibleTurbulenceModels wclean libso multiphaseCompressibleTurbulenceModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType multiphaseSystem wmake $targetType multiphaseSystem
wmake $targetType multiphaseCompressibleTurbulenceModels wmake $targetType multiphaseCompressibleTurbulenceModels

View File

@ -35,6 +35,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
} }
fluid.correctThermo(); fluid.correctThermo();
fluid.correct();
} }

View File

@ -89,9 +89,6 @@ PtrList<surfaceScalarField> phiFs(phases.size());
// --- Pressure corrector loop // --- Pressure corrector loop
while (pimple.correct()) while (pimple.correct())
{ {
// Update continuity errors due to temperature changes
fluid.correct();
volScalarField rho("rho", fluid.rho()); volScalarField rho("rho", fluid.rho());
// Correct p_rgh for consistency with p and the updated densities // Correct p_rgh for consistency with p and the updated densities

View File

@ -77,11 +77,6 @@ int main(int argc, char *argv[])
//#include "pUf/createDDtU.H" //#include "pUf/createDDtU.H"
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -90,6 +85,11 @@ int main(int argc, char *argv[])
{ {
#include "readTimeControls.H" #include "readTimeControls.H"
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
);
if (LTS) if (LTS)
{ {
#include "setRDeltaT.H" #include "setRDeltaT.H"

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso twoPhaseSystem wclean libso twoPhaseSystem
wclean libso twoPhaseCompressibleTurbulenceModels wclean libso twoPhaseCompressibleTurbulenceModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType twoPhaseSystem wmake $targetType twoPhaseSystem
wmake $targetType twoPhaseCompressibleTurbulenceModels wmake $targetType twoPhaseCompressibleTurbulenceModels

View File

@ -29,36 +29,25 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
} }
{ {
tmp<fvScalarMatrix> E2eqn(phase2.heEqn()); tmp<fvScalarMatrix> E2Eqn(phase2.heEqn());
if (E2eqn.valid()) if (E2Eqn.valid())
{ {
E2eqn = E2Eqn =
( (
E2eqn E2Eqn
== ==
*heatTransfer[phase2.name()] *heatTransfer[phase2.name()]
+ alpha2*rho2*(U2&g) + alpha2*rho2*(U2&g)
+ fvOptions(alpha2, rho2, phase2.thermo().he()) + fvOptions(alpha2, rho2, phase2.thermo().he())
); );
E2eqn->relax(); E2Eqn->relax();
fvOptions.constrain(E2eqn.ref()); fvOptions.constrain(E2Eqn.ref());
E2eqn->solve(); E2Eqn->solve();
} }
} }
fluid.correctThermo(); fluid.correctThermo();
fluid.correct();
} }
Info<< phase1.name() << " min/max T "
<< min(phase1.thermo().T()).value()
<< " - "
<< max(phase1.thermo().T()).value()
<< endl;
Info<< phase2.name() << " min/max T "
<< min(phase2.thermo().T()).value()
<< " - "
<< max(phase2.thermo().T()).value()
<< endl;

View File

@ -0,0 +1,21 @@
tmp<surfaceScalarField> trDeltaTf;
if (LTS && faceMomentum)
{
trDeltaTf = tmp<surfaceScalarField>
(
new surfaceScalarField
(
IOobject
(
fv::localEulerDdt::rDeltaTfName,
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("one", dimless/dimTime, 1)
)
);
}

View File

@ -83,9 +83,6 @@ tmp<surfaceScalarField> phiF2;
// --- Pressure corrector loop // --- Pressure corrector loop
while (pimple.correct()) while (pimple.correct())
{ {
// Update continuity errors due to temperature changes
fluid.correct();
volScalarField rho("rho", fluid.rho()); volScalarField rho("rho", fluid.rho());
// Correct p_rgh for consistency with p and the updated densities // Correct p_rgh for consistency with p and the updated densities

View File

@ -1,9 +1,2 @@
ddtPhi1 = ddtPhi1 = fvc::ddt(phi1);
( ddtPhi2 = fvc::ddt(phi2);
(phi1 - phi1.oldTime())/runTime.deltaT()
);
ddtPhi2 =
(
(phi2 - phi2.oldTime())/runTime.deltaT()
);

View File

@ -1,9 +1,2 @@
surfaceScalarField ddtPhi1 surfaceScalarField ddtPhi1(fvc::ddt(phi1));
( surfaceScalarField ddtPhi2(fvc::ddt(phi2));
(phi1 - phi1.oldTime())/runTime.deltaT()
);
surfaceScalarField ddtPhi2
(
(phi2 - phi2.oldTime())/runTime.deltaT()
);

View File

@ -32,10 +32,10 @@ surfaceScalarField rAUf1
IOobject::groupName("rAUf", phase1.name()), IOobject::groupName("rAUf", phase1.name()),
1.0 1.0
/( /(
(alphaRhof10 + Vmf)/runTime.deltaT() byDt(alphaRhof10 + Vmf)
+ fvc::interpolate(U1Eqn.A()) + fvc::interpolate(U1Eqn.A())
+ Kdf + Kdf
) )
); );
surfaceScalarField rAUf2 surfaceScalarField rAUf2
@ -43,10 +43,10 @@ surfaceScalarField rAUf2
IOobject::groupName("rAUf", phase2.name()), IOobject::groupName("rAUf", phase2.name()),
1.0 1.0
/( /(
(alphaRhof20 + Vmf)/runTime.deltaT() byDt(alphaRhof20 + Vmf)
+ fvc::interpolate(U2Eqn.A()) + fvc::interpolate(U2Eqn.A())
+ Kdf + Kdf
) )
); );
@ -93,9 +93,6 @@ tmp<surfaceScalarField> Ff2;
while (pimple.correct()) while (pimple.correct())
{ {
// Update continuity errors due to temperature changes
fluid.correct();
volScalarField rho("rho", fluid.rho()); volScalarField rho("rho", fluid.rho());
// Correct p_rgh for consistency with p and the updated densities // Correct p_rgh for consistency with p and the updated densities
@ -160,7 +157,7 @@ while (pimple.correct())
rAUf1 rAUf1
*( *(
(alphaRhof10 + Vmf) (alphaRhof10 + Vmf)
*MRF.absolute(phi1.oldTime())/runTime.deltaT() *byDt(MRF.absolute(phi1.oldTime()))
+ fvc::flux(U1Eqn.H()) + fvc::flux(U1Eqn.H())
+ Vmf*ddtPhi2 + Vmf*ddtPhi2
+ Kdf*MRF.absolute(phi2) + Kdf*MRF.absolute(phi2)
@ -178,7 +175,7 @@ while (pimple.correct())
rAUf2 rAUf2
*( *(
(alphaRhof20 + Vmf) (alphaRhof20 + Vmf)
*MRF.absolute(phi2.oldTime())/runTime.deltaT() *byDt(MRF.absolute(phi2.oldTime()))
+ fvc::flux(U2Eqn.H()) + fvc::flux(U2Eqn.H())
+ Vmf*ddtPhi1 + Vmf*ddtPhi1
+ Kdf*MRF.absolute(phi1) + Kdf*MRF.absolute(phi1)

View File

@ -43,6 +43,22 @@ Description
#include "localEulerDdtScheme.H" #include "localEulerDdtScheme.H"
#include "fvcSmooth.H" #include "fvcSmooth.H"
namespace Foam
{
tmp<surfaceScalarField> byDt(const surfaceScalarField& sf)
{
if (fv::localEulerDdt::enabled(sf.mesh()))
{
return fv::localEulerDdt::localRDeltaTf(sf.mesh())*sf;
}
else
{
return sf/sf.mesh().time().deltaT();
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -76,13 +92,9 @@ int main(int argc, char *argv[])
) )
); );
#include "createRDeltaTf.H"
#include "pUf/createDDtU.H" #include "pUf/createDDtU.H"
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -91,9 +103,18 @@ int main(int argc, char *argv[])
{ {
#include "readTimeControls.H" #include "readTimeControls.H"
int nEnergyCorrectors
(
pimple.dict().lookupOrDefault<int>("nEnergyCorrectors", 1)
);
if (LTS) if (LTS)
{ {
#include "setRDeltaT.H" #include "setRDeltaT.H"
if (faceMomentum)
{
#include "setRDeltaTf.H"
}
} }
else else
{ {

View File

@ -0,0 +1 @@
trDeltaTf.ref() = fvc::interpolate(fv::localEulerDdt::localRDeltaT(mesh));

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso twoPhaseSystem wclean libso twoPhaseSystem
wclean libso interfacialModels wclean libso interfacialModels

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmakeLnInclude interfacialModels wmakeLnInclude interfacialModels
wmake $targetType twoPhaseSystem wmake $targetType twoPhaseSystem

View File

@ -16,7 +16,8 @@
- contErr1*K1 - contErr1*K1
+ ( + (
he1.name() == thermo1.phasePropertyName("e") he1.name() == thermo1.phasePropertyName("e")
? fvc::ddt(alpha1)*p + fvc::div(alphaPhi1, p) ? fvc::div(fvc::absolute(alphaPhi1, alpha1, U1), p)
+ p*fvc::ddt(alpha1)
: -alpha1*dpdt : -alpha1*dpdt
) )
@ -48,7 +49,8 @@
- contErr2*K2 - contErr2*K2
+ ( + (
he2.name() == thermo2.phasePropertyName("e") he2.name() == thermo2.phasePropertyName("e")
? fvc::ddt(alpha2)*p + fvc::div(alphaPhi2, p) ? fvc::div(fvc::absolute(alphaPhi2, alpha2, U2), p)
+ p*fvc::ddt(alpha1)
: -alpha2*dpdt : -alpha2*dpdt
) )

View File

@ -248,4 +248,30 @@ bool Foam::phaseModel::read(const dictionary& phaseProperties)
} }
void Foam::phaseModel::correctInflowFlux(surfaceScalarField& alphaPhi) const
{
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
// Ensure that the flux at inflow BCs is preserved
forAll(alphaPhiBf, patchi)
{
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
if (!alphaPhip.coupled())
{
const scalarField& phip = phi().boundaryField()[patchi];
const scalarField& alphap = boundaryField()[patchi];
forAll(alphaPhip, facei)
{
if (phip[facei] < SMALL)
{
alphaPhip[facei] = alphap[facei]*phip[facei];
}
}
}
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -319,6 +319,9 @@ public:
return alphaRhoPhi_; return alphaRhoPhi_;
} }
//- Ensure that the flux at inflow BCs is preserved
void correctInflowFlux(surfaceScalarField& alphaPhi) const;
//- Correct the phase properties //- Correct the phase properties
// other than the thermodynamics and turbulence // other than the thermodynamics and turbulence
// which have special treatment // which have special treatment

View File

@ -444,28 +444,7 @@ void Foam::twoPhaseSystem::solve()
) )
); );
surfaceScalarField::Boundary& alphaPhic1Bf = phase1_.correctInflowFlux(alphaPhic1);
alphaPhic1.boundaryFieldRef();
// Ensure that the flux at inflow BCs is preserved
forAll(alphaPhic1Bf, patchi)
{
fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi];
if (!alphaPhic1p.coupled())
{
const scalarField& phi1p = phi1.boundaryField()[patchi];
const scalarField& alpha1p = alpha1.boundaryField()[patchi];
forAll(alphaPhic1p, facei)
{
if (phi1p[facei] < 0)
{
alphaPhic1p[facei] = alpha1p[facei]*phi1p[facei];
}
}
}
}
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
{ {
@ -537,6 +516,7 @@ void Foam::twoPhaseSystem::solve()
phase2_.alphaPhi() = phi_ - phase1_.alphaPhi(); phase2_.alphaPhi() = phi_ - phase1_.alphaPhi();
alpha2 = scalar(1) - alpha1; alpha2 = scalar(1) - alpha1;
phase2_.correctInflowFlux(phase2_.alphaPhi());
phase2_.alphaRhoPhi() = phase2_.alphaRhoPhi() =
fvc::interpolate(phase2_.rho())*phase2_.alphaPhi(); fvc::interpolate(phase2_.rho())*phase2_.alphaPhi();

View File

@ -11,7 +11,6 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/etc/config.sh/functions . $WM_PROJECT_DIR/etc/config.sh/functions
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
set -x
# Build libccmio (.a|.so) # Build libccmio (.a|.so)
$WM_THIRD_PARTY_DIR/makeCCMIO lib # libso $WM_THIRD_PARTY_DIR/makeCCMIO lib # libso

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso extrude2DMesh wclean libso extrude2DMesh
wclean wclean

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType extrude2DMesh wmake $targetType extrude2DMesh
wmake $targetType wmake $targetType

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean conformalVoronoiMesh wclean conformalVoronoiMesh
wclean conformalVoronoi2DMesh wclean conformalVoronoi2DMesh

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for compilation (at least for error catching) # Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
if [ -d "${FASTDUALOCTREE_SRC_PATH}" ] if [ -d "${FASTDUALOCTREE_SRC_PATH}" ]
then then

View File

@ -11,7 +11,7 @@ unset COMP_FLAGS LINK_FLAGS
# #
if [ -f /usr/include/readline/readline.h ] if [ -f /usr/include/readline/readline.h ]
then then
echo "Found <readline/readline.h> -- enabling readline support." echo " found <readline/readline.h> -- enabling readline support."
export COMP_FLAGS="-DHAS_READLINE" export COMP_FLAGS="-DHAS_READLINE"
export LINK_FLAGS="-lreadline" export LINK_FLAGS="-lreadline"
fi fi

View File

@ -36,9 +36,6 @@ Description
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "topoSetSource.H" #include "topoSetSource.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "timeSelector.H" #include "timeSelector.H"
#include "IOobjectList.H" #include "IOobjectList.H"

View File

@ -342,8 +342,12 @@ FoamFile
// //
// cellZoneSet // cellZoneSet
// ~~~~~~~~~~~ // ~~~~~~~~~~~
// (mirrors operations on a cellSet into a cellZone) // Manipulates a cellZone (as well as a cellSet)
// Takes any cellSet source. The difference with a cellSet is
// - reads the cells from the cellZone, not the cellSet
// - write to the cellZone as well as the cellSet
// //
// For backwards compatibility:
// // Select based on cellSet // // Select based on cellSet
// source setToCellZone; // source setToCellZone;
// sourceInfo // sourceInfo
@ -355,6 +359,9 @@ FoamFile
// //
// faceZoneSet // faceZoneSet
// ~~~~~~~~~~~ // ~~~~~~~~~~~
// Manipulates a faceZone (as well as a faceSet). It can only be used
// with two special sources:
//
// // Select based on faceSet without orientation // // Select based on faceSet without orientation
// source setToFaceZone; // source setToFaceZone;
// sourceInfo // sourceInfo
@ -394,17 +401,19 @@ FoamFile
// //
// pointZoneSet // pointZoneSet
// ~~~~~~~~~~~~ // ~~~~~~~~~~~~
// (mirrors operations on a pointSet into a pointZone) // Manipulates a pointZone (as well as a pointSet)
// Takes any pointSet source. The difference with a pointSet is
// - reads the cells from the pointZone, not the pointSet
// - write to the pointZone as well as the pointSet
// //
// For backwards compatibility:
// // Select based on pointSet // // Select based on pointSet
// source setToPointZone; // source setToPointZone;
// sourceInfo // sourceInfo
// { // {
// set p0; // name of pointSet // set p0; // name of pointSet
// } // }
//
//
//
actions actions
( (
@ -465,6 +474,19 @@ actions
option all; option all;
} }
} }
// Example: create cellZone from geometric region
{
name c0;
type cellZoneSet;
action new;
source boxToCell;
sourceInfo
{
box (0.04 0 0)(0.06 100 100);
}
}
); );
// ************************************************************************* // // ************************************************************************* //

View File

@ -57,6 +57,9 @@ Usage
- \par -includes - \par -includes
List the \c #include and \c #includeIfPresent files to standard output List the \c #include and \c #includeIfPresent files to standard output
- \par -disableFunctionEntries
Do not expand macros or directives (#include etc)
Example usage: Example usage:
- Change simulation to run for one timestep only: - Change simulation to run for one timestep only:
\verbatim \verbatim
@ -97,6 +100,15 @@ Usage
-entry boundaryField -entry boundaryField
\endverbatim \endverbatim
- Change patch type:
\verbatim
foamDictionary constant/polyMesh/boundary \
-entry entry0.fixedWalls.type -set patch
\endverbatim
This uses special parsing of Lists which stores these in the
dictionary with keyword 'entryDDD' where DDD is the position
in the dictionary (after ignoring the FoamFile entry).
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
@ -271,6 +283,11 @@ int main(int argc, char *argv[])
"Read the specified dictionary file, expand the macros etc. and write " "Read the specified dictionary file, expand the macros etc. and write "
"the resulting dictionary to standard output" "the resulting dictionary to standard output"
); );
argList::addBoolOption
(
"disableFunctionEntries",
"Disable expansion of dictionary directives - #include, #codeStream etc"
);
argList args(argc, argv); argList args(argc, argv);
@ -281,6 +298,15 @@ int main(int argc, char *argv[])
Foam::functionEntries::includeEntry::log = true; Foam::functionEntries::includeEntry::log = true;
} }
const bool disableEntries = args.optionFound("disableFunctionEntries");
if (disableEntries)
{
Info<< "Not expanding variables or dictionary directives"
<< endl;
entry::disableFunctionEntries = true;
}
fileName dictFileName(args[1]); fileName dictFileName(args[1]);
autoPtr<IFstream> dictFile(new IFstream(dictFileName)); autoPtr<IFstream> dictFile(new IFstream(dictFileName));
@ -460,7 +486,7 @@ int main(int argc, char *argv[])
{ {
FatalIOErrorInFunction(dictFile) FatalIOErrorInFunction(dictFile)
<< "Cannot find entry " << entryName << "Cannot find entry " << entryName
<< exit(FatalError, 2); << exit(FatalIOError, 2);
} }
} }
} }

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType helpTypes wmake $targetType helpTypes
wmake $targetType wmake $targetType

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType foamToVTK wmake $targetType foamToVTK
wmake $targetType wmake $targetType

View File

@ -78,9 +78,9 @@ ENDIF()
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
PVFoamReader_SM PVFoamReader_SM
LINK_PUBLIC LINK_PUBLIC
OpenFOAM
finiteVolume
vtkPVFoam vtkPVFoam
finiteVolume
OpenFOAM
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@ -106,10 +106,6 @@ public:
//- Construct from components //- Construct from components
pqPVFoamReaderPanel(pqProxy*, QWidget*); pqPVFoamReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPVFoamReaderPanel();
}; };

View File

@ -79,9 +79,9 @@ ENDIF()
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
PVblockMeshReader_SM PVblockMeshReader_SM
LINK_PUBLIC LINK_PUBLIC
OpenFOAM
blockMesh
vtkPVblockMesh vtkPVblockMesh
blockMesh
OpenFOAM
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@ -30,16 +30,17 @@
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
<!-- Update GUI check box --> <!-- Refresh button -->
<IntVectorProperty <IntVectorProperty
name="UpdateGUI" name="UiRefresh"
command="SetUpdateGUI" command="SetRefresh"
number_of_elements="1" number_of_elements="1"
is_internal="0"
default_values="0" default_values="0"
animateable="0"> animateable="0">
<BooleanDomain name="bool"/> <BooleanDomain name="bool"/>
<Documentation> <Documentation>
A simple way to cause a reader GUI modification. Rescan for updated blockMeshDict.
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
@ -102,6 +103,7 @@
<Hints> <Hints>
<Property name="FileName" show="0"/> <Property name="FileName" show="0"/>
<Property name="UiRefresh" show="0"/>
<Property name="UiShowPointNumbers" show="0"/> <Property name="UiShowPointNumbers" show="0"/>
<ReaderFactory extensions="blockMesh" <ReaderFactory extensions="blockMesh"
file_description="OpenFOAM blockMesh"/> file_description="OpenFOAM blockMesh"/>

View File

@ -58,12 +58,30 @@ pqPVblockMeshReaderPanel::pqPVblockMeshReaderPanel
: :
pqAutoGeneratedObjectPanel(proxy, p) pqAutoGeneratedObjectPanel(proxy, p)
{ {
// create first sublayout (at top of the panel) // Create first sublayout (at top of the panel)
QGridLayout *form = new QGridLayout(); QGridLayout *form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1); this->PanelLayout->addLayout(form, 0, 0, 1, -1);
vtkSMProperty* prop = 0; vtkSMProperty* prop = 0;
// checkbox for showing point numbers
// Refresh button for updating blocks
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
{
prop->SetImmediateUpdate(1);
QPushButton* refresh = new QPushButton("Refresh");
refresh->setToolTip("Rescan for updated blockMeshDict.");
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
QObject::connect
(
refresh,
SIGNAL(clicked()),
this,
SLOT(RefreshPressed())
);
}
// Checkbox for showing point numbers
if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0) if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0)
{ {
prop->SetImmediateUpdate(true); prop->SetImmediateUpdate(true);
@ -97,7 +115,7 @@ void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
this->proxy()->GetProperty("UiShowPointNumbers") this->proxy()->GetProperty("UiShowPointNumbers")
)->SetElement(0, ShowPointNumbers_->isChecked()); )->SetElement(0, ShowPointNumbers_->isChecked());
// update the active view // Update the active view
if (this->view()) if (this->view())
{ {
this->view()->render(); this->view()->render();
@ -107,4 +125,19 @@ void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
} }
void pqPVblockMeshReaderPanel::RefreshPressed()
{
// Update everything
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiRefresh")
)->Modified();
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
// Render all views
pqApplicationCore::instance()->render();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -67,6 +67,7 @@ class pqPVblockMeshReaderPanel
protected slots: protected slots:
void ShowPointNumbersToggled(); void ShowPointNumbersToggled();
void RefreshPressed();
public: public:
@ -75,10 +76,6 @@ public:
//- Construct from components //- Construct from components
pqPVblockMeshReaderPanel(pqProxy*, QWidget*); pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPVblockMeshReaderPanel();
}; };

View File

@ -60,7 +60,6 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
foamData_ = nullptr; foamData_ = nullptr;
ShowPointNumbers = 1; ShowPointNumbers = 1;
UpdateGUI = 0;
BlockSelection = vtkDataArraySelection::New(); BlockSelection = vtkDataArraySelection::New();
CurvedEdgesSelection = vtkDataArraySelection::New(); CurvedEdgesSelection = vtkDataArraySelection::New();
@ -97,7 +96,7 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
if (foamData_) if (foamData_)
{ {
// remove point numbers // Remove point numbers
updatePointNumbersView(false); updatePointNumbersView(false);
delete foamData_; delete foamData_;
} }
@ -117,7 +116,6 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// Do everything except set the output info
int vtkPVblockMeshReader::RequestInformation int vtkPVblockMeshReader::RequestInformation
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
@ -158,23 +156,10 @@ int vtkPVblockMeshReader::RequestInformation
foamData_->updateInfo(); foamData_->updateInfo();
} }
// might need some other type of error handling
// {
// vtkErrorMacro("could not find valid OpenFOAM blockMesh");
//
// // delete foamData and flag it as fatal error
// delete foamData_;
// foamData_ = nullptr;
// return 0;
// }
return 1; return 1;
} }
// Set the output info
int vtkPVblockMeshReader::RequestData int vtkPVblockMeshReader::RequestData
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
@ -190,7 +175,7 @@ int vtkPVblockMeshReader::RequestData
return 0; return 0;
} }
// catch previous error // Catch previous error
if (!foamData_) if (!foamData_)
{ {
vtkErrorMacro("Reader failed - perhaps no mesh?"); vtkErrorMacro("Reader failed - perhaps no mesh?");
@ -233,6 +218,19 @@ int vtkPVblockMeshReader::RequestData
} }
void vtkPVblockMeshReader::SetRefresh(int val)
{
// Delete the current blockMesh to force re-read and update
if (foamData_)
{
updatePointNumbersView(false);
delete foamData_;
foamData_ = 0;
}
Modified();
}
void vtkPVblockMeshReader::SetShowPointNumbers(const int val) void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
{ {
@ -248,7 +246,7 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
// need to check this, since our destructor calls this // Need to check this, since our destructor calls this
if (!appCore) if (!appCore)
{ {
return; return;
@ -273,7 +271,7 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
); );
} }
// use refresh here? // Use refresh here?
} }

View File

@ -77,10 +77,8 @@ public:
vtkGetMacro(ShowPointNumbers, int); vtkGetMacro(ShowPointNumbers, int);
// Description: // Description:
// GUI update control // Refresh blockMesh from changes to blockMeshDict
vtkSetMacro(UpdateGUI, int); virtual void SetRefresh(int);
vtkGetMacro(UpdateGUI, int);
// Description: // Description:
// Blocks selection list control // Blocks selection list control
@ -158,9 +156,6 @@ private:
//- Show Point Numbers //- Show Point Numbers
int ShowPointNumbers; int ShowPointNumbers;
//- Dummy variable/switch to invoke a reader update
int UpdateGUI;
vtkDataArraySelection* BlockSelection; vtkDataArraySelection* BlockSelection;
vtkDataArraySelection* CurvedEdgesSelection; vtkDataArraySelection* CurvedEdgesSelection;

View File

@ -72,12 +72,17 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const int nBlocks = blkMesh.size(); const int nBlocks = blkMesh.size();
for (int blockI = 0; blockI < nBlocks; ++blockI) for (int blockI = 0; blockI < nBlocks; ++blockI)
{ {
const blockDescriptor& blockDef = blkMesh[blockI]; const blockDescriptor& blockDef = blkMesh[blockI];
word partName = Foam::name(blockI); // Display either blockI as a number or with its name
// (looked up from blockMeshDict)
OStringStream os;
blockDescriptor::write(os, blockI, blkMesh.meshDict());
word partName(os.str());
// append the (optional) zone name // append the (optional) zone name
if (!blockDef.zoneName().empty()) if (!blockDef.zoneName().empty())
@ -121,9 +126,10 @@ void Foam::vtkPVblockMesh::updateInfoEdges
forAll(edges, edgeI) forAll(edges, edgeI)
{ {
OStringStream ostr; OStringStream ostr;
blockVertex::write(ostr, edges[edgeI].start(), blkMesh.meshDict());
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - " ostr<< ":";
<< edges[edgeI].type(); blockVertex::write(ostr, edges[edgeI].end(), blkMesh.meshDict());
ostr << " - " << edges[edgeI].type();
// Add "beg:end - type" to GUI list // Add "beg:end - type" to GUI list
arraySelection->AddArray(ostr.str().c_str()); arraySelection->AddArray(ostr.str().c_str());
@ -352,7 +358,9 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
dictPath = dbPtr_().constant()/polyMesh::meshSubDir/dictName; dictPath = dbPtr_().constant()/polyMesh::meshSubDir/dictName;
} }
IOdictionary meshDict // Store dictionary since is used as database inside blockMesh class
// for names of vertices and blocks
IOdictionary* meshDictPtr = new IOdictionary
( (
IOobject IOobject
( (
@ -360,11 +368,12 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
dbPtr_(), dbPtr_(),
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false true
) )
); );
meshDictPtr->store();
meshPtr_ = new blockMesh(meshDict, meshRegion_); meshPtr_ = new blockMesh(*meshDictPtr, meshRegion_);
} }
@ -429,15 +438,22 @@ void Foam::vtkPVblockMesh::renderPointNumbers
if (show && meshPtr_) if (show && meshPtr_)
{ {
const pointField& cornerPts = meshPtr_->vertices(); const blockMesh& blkMesh = *meshPtr_;
const scalar scaleFactor = meshPtr_->scaleFactor(); const pointField& cornerPts = blkMesh.vertices();
const scalar scaleFactor = blkMesh.scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size()); pointNumberTextActorsPtrs_.setSize(cornerPts.size());
forAll(cornerPts, pointi) forAll(cornerPts, pointi)
{ {
vtkTextActor* txt = vtkTextActor::New(); vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(Foam::name(pointi).c_str()); // Display either pointi as a number or with its name
// (looked up from blockMeshDict)
{
OStringStream os;
blockVertex::write(os, pointi, blkMesh.meshDict());
txt->SetInput(os.str().c_str());
}
// Set text properties // Set text properties
vtkTextProperty* tprop = txt->GetTextProperty(); vtkTextProperty* tprop = txt->GetTextProperty();

View File

@ -384,24 +384,18 @@ public:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "addDictOption.H"
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
Info<< "Reading setFieldsDict\n" << endl; const word dictName("setFieldsDict");
#include "setSystemMeshDictionaryIO.H"
IOdictionary setFieldsDict Info<< "Reading " << dictName << "\n" << endl;
(
IOobject IOdictionary setFieldsDict(dictIO);
(
"setFieldsDict",
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
if (setFieldsDict.found("defaultFieldValues")) if (setFieldsDict.found("defaultFieldValues"))
{ {

View File

@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType tabulatedWallFunction wmake $targetType tabulatedWallFunction
wmake $targetType wmake $targetType

View File

@ -3,7 +3,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) 2011-2012 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -46,8 +46,7 @@ then
exit 1 exit 1
fi fi
for cmd in etags ctags-exuberant
for cmd in etags ectags
do do
type $cmd >/dev/null 2>&1 || { type $cmd >/dev/null 2>&1 || {
echo "${0##*/} cannot build tag files: '$cmd' command not found" echo "${0##*/} cannot build tag files: '$cmd' command not found"
@ -55,29 +54,16 @@ do
} }
done done
cd $WM_PROJECT_DIR || exit 1 cd $WM_PROJECT_DIR || exit 1
mkdir .tags 2>/dev/null mkdir .tags 2>/dev/null
#etagsCmd="etags --declarations -l c++ -o .tags/etags -"
etagsCmd="etags --declarations -l c++ -o .tags/etags -" etagsCmd="ctags-exuberant -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
#etagsDefCmd="etags -l c++ -o .tags/etagsDef -"
#etagsDecCmd="etags --declarations -l c++ -o .tags/etagsDec -"
etagsCmd="ectags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
etagsDefCmd="ectags -e --extra=+fq --file-scope=no -o .tags/etagsDef -L -"
etagsDecCmd="ectags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etagsDec -L -"
ectagsDecCmd="ectags -o .tags/ectagsDec --file-scope=no --c-kinds=+p --excmd=n --extra=+fq --fields=+afiKmnsSzt -L -"
find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsCmd find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsCmd
find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsDefCmd
find -H $WM_PROJECT_DIR \( -name "*.H" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsDecCmd
find -H $WM_PROJECT_DIR \( -name "*.H" -o -name lnInclude -prune -o -name Doxygen -prune \) | $ectagsDecCmd
gtags -i --gtagsconf bin/tools/gtagsrc .tags #gtags -i --gtagsconf bin/tools/gtagsrc .tags
foamEbrowse
#foamEbrowse
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,8 +1,8 @@
#-------------------------------*- makefile -*--------------------------------- #----------------------------*- makefile-gmake -*------------------------------
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -36,8 +36,9 @@ contCumulative/time step continuity errors :/cumulative =
minFu/min\(fu\) = /min(fu) = minFu/min\(fu\) = /min(fu) =
minFt/min\(ft\) = /min(ft) = minFt/min\(ft\) = /min(ft) =
#- Execution time: #- Timing:
executionTime/ExecutionTime = /ExecutionTime = executionTime/ExecutionTime = /ExecutionTime =
clockTime/ClockTime = /ClockTime =
#- Interface Courant no: #- Interface Courant no:
IntCourantMax/Interface Courant Number /max: IntCourantMax/Interface Courant Number /max:

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
# fix permissions (NB: '+X' and not '+x'!) # fix permissions (NB: '+X' and not '+x'!)
chmod a+rX $WM_PROJECT_DIR $WM_PROJECT_DIR/doc Doxygen chmod a+rX $WM_PROJECT_DIR $WM_PROJECT_DIR/doc Doxygen

View File

@ -2,9 +2,9 @@
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
[ -d "$WM_PROJECT_DIR" ] || { [ -d "$WM_PROJECT_DIR" ] || {
echo "Error: WM_PROJECT_DIR directory does not exist" echo " Error: WM_PROJECT_DIR directory does not exist"
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check the OpenFOAM entries in your dot-files and source them."
echo " WM_PROJECT_DIR=$WM_PROJECT_DIR" echo " WM_PROJECT_DIR=$WM_PROJECT_DIR"
exit 1 exit 1
} }
@ -58,7 +58,6 @@ do
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
set -x
rm -rf latex man rm -rf latex man

View File

@ -1,17 +0,0 @@
#!/bin/sh
#------------------------------------------------------------------------------
# Script
# find-its
#
# Description
# Search for files with "it's"
# This contraction (== "it is") looks too much like "its" (possesive)
# and confuses non-native (and some native) English speakers.
#
#------------------------------------------------------------------------------
set -x
cd $WM_PROJECT_DIR || exit 1
git grep -e "it's"
#------------------------------------------------------------------------------

View File

@ -7,7 +7,6 @@
# Search for files with trailing whitesapce # Search for files with trailing whitesapce
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
set -x
cd $WM_PROJECT_DIR || exit 1 cd $WM_PROJECT_DIR || exit 1
tab=$'\t' tab=$'\t'

View File

@ -61,7 +61,7 @@ export FOAM_INST_DIR
export WM_COMPILER_TYPE=system export WM_COMPILER_TYPE=system
#- Compiler: #- Compiler:
# WM_COMPILER = Gcc | Gcc4[5-9] | Gcc5[1-4] | Gcc61 | Clang | Icc # WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc
export WM_COMPILER=Gcc export WM_COMPILER=Gcc
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
@ -85,7 +85,7 @@ export WM_COMPILE_OPTION=Opt
#- MPI implementation: #- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | QSMPI | SGIMPI # | MPI | FJMPI | QSMPI | SGIMPI | INTELMPI
export WM_MPLIB=SYSTEMOPENMPI export WM_MPLIB=SYSTEMOPENMPI
#- Operating System: #- Operating System:

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Add a list of fields.
\*---------------------------------------------------------------------------*/
type add;
libs ("libfieldFunctionObjects.so");
fields (<field names>);
executeControl writeTime;
writeControl writeTime;
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
From the first field subtract the remaining fields in the list.
\*---------------------------------------------------------------------------*/
type subtract;
libs ("libfieldFunctionObjects.so");
fields (<field names>);
executeControl writeTime;
writeControl writeTime;
// ************************************************************************* //

View File

@ -58,6 +58,8 @@ set cmake_version=cmake-system
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if ( ! $?ParaView_DIR ) setenv ParaView_DIR
# Clean the PATH # Clean the PATH
if ( ! $?ParaView_DIR ) setenv ParaView_DIR if ( ! $?ParaView_DIR ) setenv ParaView_DIR
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`

View File

@ -41,9 +41,6 @@ ThirdParty)
Gcc | Gcc48) Gcc | Gcc48)
gcc_version=gcc-4.8.5 gcc_version=gcc-4.8.5
;; ;;
Gcc47)
gcc_version=gcc-4.7.4
;;
Gcc49) Gcc49)
gcc_version=gcc-4.9.3 gcc_version=gcc-4.9.3
;; ;;

View File

@ -888,7 +888,6 @@ DebugSwitches
wallHeatTransfer 0; wallHeatTransfer 0;
wallLayerCells 0; wallLayerCells 0;
wallModel 0; wallModel 0;
warnUnboundedGauss 1;
waveTransmissive 0; waveTransmissive 0;
wedge 0; wedge 0;
weighted 0; weighted 0;

View File

@ -61,7 +61,7 @@ echo $FOAM_INST_DIR
setenv WM_COMPILER_TYPE system setenv WM_COMPILER_TYPE system
#- Compiler: #- Compiler:
# WM_COMPILER = Gcc | Gcc4[5-9] | Gcc5[1-4] | Gcc61 | Clang | Icc # WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc
setenv WM_COMPILER Gcc setenv WM_COMPILER Gcc
setenv WM_COMPILER_ARCH # defined but empty setenv WM_COMPILER_ARCH # defined but empty
unsetenv WM_COMPILER_LIB_ARCH unsetenv WM_COMPILER_LIB_ARCH
@ -86,7 +86,7 @@ setenv WM_COMPILE_OPTION Opt
#- MPI implementation: #- MPI implementation:
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
# | MPI | QSMPI | SGIMPI # | MPI | FJMPI | QSMPI | SGIMPI | INTELMPI
setenv WM_MPLIB SYSTEMOPENMPI setenv WM_MPLIB SYSTEMOPENMPI
#- Operating System: #- Operating System:

View File

@ -17,8 +17,6 @@ wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
exit 1 exit 1
} }
set -x
# Update OpenFOAM version strings if required # Update OpenFOAM version strings if required
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null

View File

@ -34,7 +34,7 @@ namespace Foam
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::ODESolver::normalizeError Foam::scalar Foam::ODESolver::normalizeError
( (

View File

@ -12,7 +12,7 @@ unset COMP_FLAGS LINK_FLAGS
# #
if [ -f /usr/include/sys/inotify.h ] if [ -f /usr/include/sys/inotify.h ]
then then
echo "Found <sys/inotify.h> -- enabling inotify for file monitoring." echo " found <sys/inotify.h> -- enabling inotify for file monitoring."
export COMP_FLAGS="-DFOAM_USE_INOTIFY" export COMP_FLAGS="-DFOAM_USE_INOTIFY"
else else
unset COMP_FLAGS unset COMP_FLAGS

View File

@ -542,6 +542,22 @@ time_t Foam::lastModified(const fileName& name, const bool followLink)
} }
double Foam::highResLastModified(const fileName& name)
{
fileStat fileStatus(name);
if (fileStatus.isValid())
{
return
fileStatus.status().st_mtime
+ 1e-9*fileStatus.status().st_atim.tv_nsec;
}
else
{
return 0;
}
}
Foam::fileNameList Foam::readDir Foam::fileNameList Foam::readDir
( (
const fileName& directory, const fileName& directory,

View File

@ -126,7 +126,7 @@ namespace Foam
// For stat // For stat
//- From watch descriptor to modified time //- From watch descriptor to modified time
DynamicList<time_t> lastMod_; DynamicList<double> lastMod_;
@ -261,7 +261,7 @@ namespace Foam
<< abort(FatalError); << abort(FatalError);
} }
lastMod_(watchFd) = lastModified(fName); lastMod_(watchFd) = highResLastModified(fName);
} }
return true; return true;
@ -395,12 +395,12 @@ void Foam::fileMonitor::checkFiles() const
{ {
forAll(watcher_->lastMod_, watchFd) forAll(watcher_->lastMod_, watchFd)
{ {
time_t oldTime = watcher_->lastMod_[watchFd]; double oldTime = watcher_->lastMod_[watchFd];
if (oldTime != 0) if (oldTime != 0)
{ {
const fileName& fName = watchFile_[watchFd]; const fileName& fName = watchFile_[watchFd];
time_t newTime = lastModified(fName); double newTime = highResLastModified(fName);
if (newTime == 0) if (newTime == 0)
{ {
@ -615,7 +615,7 @@ void Foam::fileMonitor::setUnmodified(const label watchFd)
if (!useInotify_) if (!useInotify_)
{ {
watcher_->lastMod_[watchFd] = lastModified(watchFile_[watchFd]); watcher_->lastMod_[watchFd] = highResLastModified(watchFile_[watchFd]);
} }
} }

View File

@ -39,6 +39,7 @@ $(ints)/lists/labelListIOList.C
primitives/Scalar/doubleScalar/doubleScalar.C primitives/Scalar/doubleScalar/doubleScalar.C
primitives/Scalar/floatScalar/floatScalar.C primitives/Scalar/floatScalar/floatScalar.C
primitives/Scalar/scalar/scalar.C primitives/Scalar/scalar/scalar.C
primitives/Scalar/scalar/invIncGamma.C
primitives/Scalar/lists/scalarList.C primitives/Scalar/lists/scalarList.C
primitives/Scalar/lists/scalarIOList.C primitives/Scalar/lists/scalarIOList.C
primitives/Scalar/lists/scalarListIOList.C primitives/Scalar/lists/scalarListIOList.C
@ -187,6 +188,10 @@ dictionaryEntry = $(dictionary)/dictionaryEntry
$(dictionaryEntry)/dictionaryEntry.C $(dictionaryEntry)/dictionaryEntry.C
$(dictionaryEntry)/dictionaryEntryIO.C $(dictionaryEntry)/dictionaryEntryIO.C
dictionaryListEntry = $(dictionary)/dictionaryListEntry
$(dictionaryListEntry)/dictionaryListEntry.C
$(dictionaryListEntry)/dictionaryListEntryIO.C
functionEntries = $(dictionary)/functionEntries functionEntries = $(dictionary)/functionEntries
$(functionEntries)/calcEntry/calcEntry.C $(functionEntries)/calcEntry/calcEntry.C
$(functionEntries)/codeStream/codeStream.C $(functionEntries)/codeStream/codeStream.C

View File

@ -119,7 +119,7 @@ private:
// Static data // Static data
//- Relative peturbation tolerance. Determines when point is //- Relative perturbation tolerance. Determines when point is
// considered to be close to face/edge of bb of node. // considered to be close to face/edge of bb of node.
// The tolerance is relative to the bounding box of the smallest // The tolerance is relative to the bounding box of the smallest
// node. // node.

View File

@ -25,7 +25,7 @@ License
#include "DictionaryBase.H" #include "DictionaryBase.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class IDLListType, class T> template<class IDLListType, class T>
void Foam::DictionaryBase<IDLListType, T>::addEntries() void Foam::DictionaryBase<IDLListType, T>::addEntries()

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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,6 +62,4 @@ Foam::Ostream& Foam::operator<<
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -238,6 +238,7 @@ private:
const label index const label index
); );
protected: protected:
// Protected data // Protected data

View File

@ -80,7 +80,7 @@ const int Foam::Time::maxPrecision_(3 - log10(SMALL));
Foam::word Foam::Time::controlDictName("controlDict"); Foam::word Foam::Time::controlDictName("controlDict");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::Time::adjustDeltaT() void Foam::Time::adjustDeltaT()
{ {

View File

@ -59,6 +59,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declaration of classes
class argList; class argList;
@ -86,6 +87,7 @@ class Time
//- The controlDict //- The controlDict
unwatchedIOdictionary controlDict_; unwatchedIOdictionary controlDict_;
public: public:
//- Write control options //- Write control options

View File

@ -46,6 +46,131 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr
(
const word& keyword,
bool recursive,
bool patternMatch
) const
{
string::size_type dotPos = keyword.find('.');
if (dotPos == string::npos)
{
// Non-scoped lookup
return lookupEntryPtr(keyword, recursive, patternMatch);
}
else
{
if (dotPos == 0)
{
// Starting with a '.'. Go up for every 2nd '.' found
const dictionary* dictPtr = this;
string::size_type begVar = dotPos + 1;
string::const_iterator iter = keyword.begin() + begVar;
string::size_type endVar = begVar;
while (iter != keyword.end() && *iter == '.')
{
++iter;
++endVar;
// Go to parent
if (&dictPtr->parent_ == &dictionary::null)
{
FatalIOErrorInFunction
(
*this
) << "No parent of current dictionary"
<< " when searching for "
<< keyword.substr(begVar, keyword.size()-begVar)
<< exit(FatalIOError);
}
dictPtr = &dictPtr->parent_;
}
return dictPtr->lookupScopedSubEntryPtr
(
keyword.substr(endVar),
false,
patternMatch
);
}
else
{
// Extract the first word
word firstWord = keyword.substr(0, dotPos);
const entry* entPtr = lookupScopedSubEntryPtr
(
firstWord,
false, //recursive
patternMatch
);
if (!entPtr)
{
// Fall back to finding key with '.' so e.g. if keyword is
// a.b.c.d it would try
// a.b, a.b.c, a.b.c.d
string::size_type nextDotPos = keyword.find
(
'.',
dotPos+1
);
while (true)
{
const entry* subEntPtr = lookupEntryPtr
(
keyword.substr(0, nextDotPos),
false, //recursive,
patternMatch
);
if (nextDotPos == string::npos)
{
// Parsed the whole word. Return entry or null.
return subEntPtr;
}
if (subEntPtr && subEntPtr->isDict())
{
return subEntPtr->dict().lookupScopedSubEntryPtr
(
keyword.substr
(
nextDotPos,
keyword.size()-nextDotPos
),
false,
patternMatch
);
}
nextDotPos = keyword.find('.', nextDotPos+1);
}
}
if (entPtr->isDict())
{
return entPtr->dict().lookupScopedSubEntryPtr
(
keyword.substr(dotPos, keyword.size()-dotPos),
false,
patternMatch
);
}
else
{
return nullptr;
}
}
}
}
bool Foam::dictionary::findInPatterns bool Foam::dictionary::findInPatterns
( (
const bool patternMatch, const bool patternMatch,
@ -473,7 +598,7 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
} }
// At top. Recurse to find entries // At top. Recurse to find entries
return dictPtr->lookupScopedEntryPtr return dictPtr->lookupScopedSubEntryPtr
( (
keyword.substr(1, keyword.size()-1), keyword.substr(1, keyword.size()-1),
false, false,
@ -482,93 +607,12 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
} }
else else
{ {
string::size_type dotPos = keyword.find('.'); return lookupScopedSubEntryPtr
(
if (dotPos == string::npos) keyword,
{ recursive,
// Non-scoped lookup patternMatch
return lookupEntryPtr(keyword, recursive, patternMatch); );
}
else
{
if (dotPos == 0)
{
// Starting with a '.'. Go up for every 2nd '.' found
const dictionary* dictPtr = this;
string::size_type begVar = dotPos + 1;
string::const_iterator iter = keyword.begin() + begVar;
string::size_type endVar = begVar;
while
(
iter != keyword.end()
&& *iter == '.'
)
{
++iter;
++endVar;
// Go to parent
if (&dictPtr->parent_ == &dictionary::null)
{
FatalIOErrorInFunction
(
*this
) << "No parent of current dictionary"
<< " when searching for "
<< keyword.substr(begVar, keyword.size()-begVar)
<< exit(FatalIOError);
}
dictPtr = &dictPtr->parent_;
}
return dictPtr->lookupScopedEntryPtr
(
keyword.substr(endVar),
false,
patternMatch
);
}
else
{
// Extract the first word
word firstWord = keyword.substr(0, dotPos);
const entry* entPtr = lookupScopedEntryPtr
(
firstWord,
false, //recursive
patternMatch
);
if (!entPtr)
{
FatalIOErrorInFunction
(
*this
) << "keyword " << firstWord
<< " is undefined in dictionary "
<< name() << endl
<< "Valid keywords are " << keys()
<< exit(FatalIOError);
}
if (entPtr->isDict())
{
return entPtr->dict().lookupScopedEntryPtr
(
keyword.substr(dotPos, keyword.size()-dotPos),
false,
patternMatch
);
}
else
{
return nullptr;
}
}
}
} }
} }
@ -628,6 +672,21 @@ const Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword) const
} }
Foam::dictionary* Foam::dictionary::subDictPtr(const word& keyword)
{
entry* entryPtr = lookupEntryPtr(keyword, false, true);
if (entryPtr)
{
return &entryPtr->dict();
}
else
{
return nullptr;
}
}
const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
{ {
const entry* entryPtr = lookupEntryPtr(keyword, false, true); const entry* entryPtr = lookupEntryPtr(keyword, false, true);

View File

@ -161,6 +161,15 @@ class dictionary
// Private Member Functions // Private Member Functions
//- Find and return an entry data stream pointer if present
// otherwise return nullptr. Allows scoping using '.'
const entry* lookupScopedSubEntryPtr
(
const word&,
bool recursive,
bool patternMatch
) const;
//- Search patterns table for exact match or regular expression match //- Search patterns table for exact match or regular expression match
bool findInPatterns bool findInPatterns
( (
@ -364,7 +373,8 @@ public:
) const; ) const;
//- Find and return an entry data stream pointer if present //- Find and return an entry data stream pointer if present
// otherwise return nullptr. Allows scoping using '.' // otherwise return nullptr. Allows scoping using '.'.
// Special handling for ':' at start of keyword and '..'.
const entry* lookupScopedEntryPtr const entry* lookupScopedEntryPtr
( (
const word&, const word&,
@ -379,6 +389,10 @@ public:
// otherwise return nullptr. // otherwise return nullptr.
const dictionary* subDictPtr(const word&) const; const dictionary* subDictPtr(const word&) const;
//- Find and return a sub-dictionary pointer if present
// otherwise return nullptr.
dictionary* subDictPtr(const word&);
//- Find and return a sub-dictionary //- Find and return a sub-dictionary
const dictionary& subDict(const word&) const; const dictionary& subDict(const word&) const;

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) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,44 +23,18 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "block.H" #include "dictionaryListEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::block::block Foam::dictionaryListEntry::dictionaryListEntry
( (
const pointField& vertices, const dictionary& parentDict,
const blockEdgeList& edges, const dictionaryListEntry& dictEnt
const blockFaceList& faces,
Istream& is
) )
: :
blockDescriptor(vertices, edges, faces, is) dictionaryEntry(parentDict, dictEnt)
{ {}
createPoints();
createBoundary();
}
Foam::block::block(const blockDescriptor& blockDesc)
:
blockDescriptor(blockDesc)
{
createPoints();
createBoundary();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const block& b)
{
os << b.points() << nl
<< b.cells() << nl
<< b.boundaryPatches() << endl;
return os;
}
// ************************************************************************* // // ************************************************************************* //

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