diff --git a/applications/solvers/combustion/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/rhoReactingFoam/pEqn.H
index f11c979224..ee03ece751 100644
--- a/applications/solvers/combustion/rhoReactingFoam/pEqn.H
+++ b/applications/solvers/combustion/rhoReactingFoam/pEqn.H
@@ -24,12 +24,17 @@
fvc::interpolate(thermo.psi())*phiv
);
+ fvScalarMatrix pDDtEqn
+ (
+ fvc::ddt(rho) + fvc::div(phi)
+ + correction(fvm::ddt(psi, p) + fvm::div(phid, p))
+ );
+
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
- fvc::ddt(rho) + fvc::div(phi)
- + correction(fvm::ddt(psi, p) + fvm::div(phid, p))
+ pDDtEqn
- fvm::laplacian(rho*rAU, p)
);
@@ -63,12 +68,17 @@
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
);
+ fvScalarMatrix pDDtEqn
+ (
+ fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ + fvc::div(phi)
+ );
+
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
- fvc::ddt(rho) + psi*correction(fvm::ddt(p))
- + fvc::div(phi)
+ pDDtEqn
- fvm::laplacian(rho*rAU, p)
);
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
index 768876c316..c6d1ad5e3c 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
@@ -19,12 +19,17 @@
surfaceScalarField buoyancyPhi(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
phi += buoyancyPhi;
+ fvScalarMatrix p_rghDDtEqn
+ (
+ fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
+ + fvc::div(phi)
+ );
+
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix p_rghEqn
(
- fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
- + fvc::div(phi)
+ p_rghDDtEqn
- fvm::laplacian(rhorAUf, p_rgh)
);
diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H
index fccb98c8cb..9fb91f1d36 100644
--- a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H
+++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H
@@ -23,7 +23,7 @@
);
}
- fvScalarMatrix DrhoDtEqn
+ fvScalarMatrix pDDtEqn
(
fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ fvc::div(phi)
@@ -36,7 +36,7 @@
{
fvScalarMatrix pEqn
(
- DrhoDtEqn
+ pDDtEqn
- fvm::laplacian(rho*rAU, p)
);
diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H
index 4a28b0dd94..e173fa858b 100644
--- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H
+++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H
@@ -23,16 +23,21 @@
);
}
+ fvScalarMatrix pDDtEqn
+ (
+ fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ + fvc::div(phi)
+ ==
+ parcels.Srho()
+ + massSource.SuTot()
+ );
+
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
- fvc::ddt(rho) + psi*correction(fvm::ddt(p))
- + fvc::div(phi)
+ pDDtEqn
- fvm::laplacian(rho*rAU, p)
- ==
- parcels.Srho()
- + massSource.SuTot()
);
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C
index 5bcb5fe845..797055b60e 100644
--- a/applications/test/fileName/Test-fileName.C
+++ b/applications/test/fileName/Test-fileName.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -22,10 +22,10 @@ License
along with OpenFOAM. If not, see .
Application
- fileName
+ Test-fileName
Description
-
+ Test some basic fileName functionality
\*---------------------------------------------------------------------------*/
@@ -52,9 +52,10 @@ int main()
fileName pathName(wrdList);
Info<< "pathName = " << pathName << nl
- << "pathName.name() = " << pathName.name() << nl
- << "pathName.path() = " << pathName.path() << nl
- << "pathName.ext() = " << pathName.ext() << endl;
+ << "pathName.name() = >" << pathName.name() << "<\n"
+ << "pathName.path() = " << pathName.path() << nl
+ << "pathName.ext() = >" << pathName.ext() << "<\n"
+ << "pathName.name(true) = >" << pathName.name(true) << "<\n";
Info<< "pathName.components() = " << pathName.components() << nl
<< "pathName.component(2) = " << pathName.component(2) << nl
diff --git a/applications/test/string/Test-string.C b/applications/test/string/Test-string.C
index e9639c4736..6d9bfd7bab 100644
--- a/applications/test/string/Test-string.C
+++ b/applications/test/string/Test-string.C
@@ -40,8 +40,9 @@ int main(int argc, char *argv[])
{
string test
(
- " $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ with "
- " $(DONOTSUBST) some other ${USER} entries "
+ " $HOME kjhkjhkjh \" \\$HOME/tyetyery $; ${FOAM_RUN} \n $; hkjh;"
+ " $(DONOTSUBST) some other <${USER}> with '${__UNKNOWN:-some default}'"
+ " value "
);
dictionary dict;
@@ -88,7 +89,7 @@ int main(int argc, char *argv[])
Info<< "expanded: " << string(test).expand() << endl;
Info<<"dictionary-based substitution: " << dict << endl;
- Info<< "expandDict: " << stringOps::expandDict(test, dict) << endl;
+ Info<< "expand dict: " << stringOps::expand(test, dict) << endl;
string test2("~OpenFOAM/controlDict");
Info<< test2 << " => " << test2.expand() << endl;
diff --git a/etc/aliases.csh b/etc/aliases.csh
index 9005f180dd..76baa71585 100644
--- a/etc/aliases.csh
+++ b/etc/aliases.csh
@@ -67,5 +67,6 @@ alias foamSol 'cd $FOAM_SOLVERS'
alias foamTuts 'cd $FOAM_TUTORIALS'
alias foamUtils 'cd $FOAM_UTILITIES'
alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
+alias foamSite 'cd $WM_PROJECT_INST_DIR/site'
# -----------------------------------------------------------------------------
diff --git a/etc/aliases.sh b/etc/aliases.sh
index 870b457f5f..c3d05d4a72 100644
--- a/etc/aliases.sh
+++ b/etc/aliases.sh
@@ -72,5 +72,6 @@ alias foamSol='cd $FOAM_SOLVERS'
alias foamTuts='cd $FOAM_TUTORIALS'
alias foamUtils='cd $FOAM_UTILITIES'
alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
+alias foamSite='cd $WM_PROJECT_INST_DIR/site'
# -----------------------------------------------------------------------------
diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C
index d1213a4bea..9e88840aec 100644
--- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C
+++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C
@@ -28,7 +28,10 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
+//{{{ begin codeInclude
${codeInclude}
+//}}} end codeInclude
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -44,9 +47,16 @@ extern "C"
//
// unique function name that can be checked if the correct library version
// has been loaded
- bool ${typeName}_${SHA1sum}()
+ void ${typeName}_${SHA1sum}(bool load)
{
- return true;
+ if (load)
+ {
+ // code that can be explicitly executed after loading
+ }
+ else
+ {
+ // code that can be explicitly executed before unloading
+ }
}
}
@@ -61,7 +71,13 @@ ${typeName}FixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF)
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"construct ${typeName} sha1: ${SHA1sum}"
+ " from patch/DimensionedField\n";
+ }
+}
${typeName}FixedValueFvPatchScalarField::
@@ -74,7 +90,13 @@ ${typeName}FixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"construct ${typeName} sha1: ${SHA1sum}"
+ " from patch/DimensionedField/mapper\n";
+ }
+}
${typeName}FixedValueFvPatchScalarField::
@@ -86,7 +108,13 @@ ${typeName}FixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict)
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"construct ${typeName} sha1: ${SHA1sum}"
+ " from patch/dictionary\n";
+ }
+}
${typeName}FixedValueFvPatchScalarField::
@@ -96,7 +124,13 @@ ${typeName}FixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf)
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"construct ${typeName} sha1: ${SHA1sum}"
+ " as copy\n";
+ }
+}
${typeName}FixedValueFvPatchScalarField::
@@ -107,14 +141,25 @@ ${typeName}FixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, iF)
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"construct ${typeName} sha1: ${SHA1sum} "
+ "as copy/DimensionedField\n";
+ }
+}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
${typeName}FixedValueFvPatchScalarField::
~${typeName}FixedValueFvPatchScalarField()
-{}
+{
+ if (${verbose:-false})
+ {
+ Info<<"destroy ${typeName} sha1: ${SHA1sum}\n";
+ }
+}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@@ -126,7 +171,15 @@ void ${typeName}FixedValueFvPatchScalarField::updateCoeffs()
return;
}
- ${code}
+ if (${verbose:-false})
+ {
+ Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n";
+ }
+
+//{{{ begin code
+ ${code};
+//}}} end code
+
fixedValueFvPatchScalarField::updateCoeffs();
}
diff --git a/etc/prefs.csh-EXAMPLE b/etc/prefs.csh-EXAMPLE
index 64bd5dfaeb..56091f798e 100644
--- a/etc/prefs.csh-EXAMPLE
+++ b/etc/prefs.csh-EXAMPLE
@@ -36,13 +36,13 @@
#
#------------------------------------------------------------------------------
-## Specify system compiler
-## ~~~~~~~~~~~~~~~~~~~~~~~
-#set foamCompiler=OpenFOAM
+## Specify OpenFOAM ThirdParty compiler
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# set foamCompiler=ThirdParty
## Specify system openmpi
## ~~~~~~~~~~~~~~~~~~~~~~
-#setenv WM_MPLIB SYSTEMOPENMPI
+# setenv WM_MPLIB SYSTEMOPENMPI
# ----------------------------------------------------------------- end-of-file
diff --git a/etc/prefs.sh-EXAMPLE b/etc/prefs.sh-EXAMPLE
index 24fea69835..f3e771d030 100644
--- a/etc/prefs.sh-EXAMPLE
+++ b/etc/prefs.sh-EXAMPLE
@@ -36,13 +36,13 @@
#
#------------------------------------------------------------------------------
-# Specify system compiler
-# ~~~~~~~~~~~~~~~~~~~~~~~
-foamCompiler=OpenFOAM
+## Specify OpenFOAM ThirdParty compiler
+## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# foamCompiler=ThirdParty
-# Specify system openmpi
-# ~~~~~~~~~~~~~~~~~~~~~~
-export WM_MPLIB=SYSTEMOPENMPI
+## Specify system openmpi
+## ~~~~~~~~~~~~~~~~~~~~~~
+# export WM_MPLIB=SYSTEMOPENMPI
# ----------------------------------------------------------------- end-of-file
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
index 92a6b444f1..d24f4db67c 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C
@@ -98,21 +98,20 @@ bool Foam::functionEntries::codeStream::execute
// see if library is loaded
void* lib = dlLibraryTable::findLibrary(libPath);
- bool reuseLib = false;
-
// nothing loaded
// avoid compilation if possible by loading an existing library
if (!lib && dlLibraryTable::open(libPath, false))
{
lib = dlLibraryTable::findLibrary(libPath);
- reuseLib = true;
}
// create library if required
if (!lib)
{
- if (Pstream::master())
+ bool create = Pstream::master();
+
+ if (create)
{
if (!dynCode.upToDate(context))
{
@@ -137,7 +136,7 @@ bool Foam::functionEntries::codeStream::execute
"functionEntries::codeStream::execute(..)",
parentDict
) << "Failed writing files for" << nl
- << dynCode.libPath() << nl
+ << dynCode.libRelPath() << nl
<< exit(FatalIOError);
}
}
@@ -148,14 +147,13 @@ bool Foam::functionEntries::codeStream::execute
(
"functionEntries::codeStream::execute(..)",
parentDict
- ) << "Failed wmake " << libPath
+ ) << "Failed wmake " << dynCode.libRelPath() << nl
<< exit(FatalIOError);
}
}
- // all processes must wait for compile
- bool waiting = true;
- reduce(waiting, orOp());
+ // all processes must wait for compile to finish
+ reduce(create, orOp());
if (!dlLibraryTable::open(libPath, false))
{
@@ -163,24 +161,20 @@ bool Foam::functionEntries::codeStream::execute
(
"functionEntries::codeStream::execute(..)",
parentDict
- ) << "Failed loading library " << libPath
+ ) << "Failed loading library " << libPath << nl
<< exit(FatalIOError);
}
lib = dlLibraryTable::findLibrary(libPath);
}
- else if (reuseLib)
- {
- Info<< "Reusing library in " << libPath << endl;
- }
// Find the function handle in the library
- void (*function)(Ostream&, const dictionary&);
- function = reinterpret_cast
- (
- dlSym(lib, dynCode.codeName())
- );
+ streamingFunctionType function =
+ reinterpret_cast
+ (
+ dlSym(lib, dynCode.codeName())
+ );
if (!function)
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H
index 10e3262ca1..f35adcdae3 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H
+++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H
@@ -109,6 +109,11 @@ class codeStream
:
public functionEntry
{
+
+ //- Interpreter function type
+ typedef void (*streamingFunctionType)(Ostream&, const dictionary&);
+
+
// Private Member Functions
//- Disallow default bitwise copy construct
diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
index 2493ad8d16..3f66a43839 100644
--- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
+++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
@@ -51,6 +51,8 @@ const Foam::fileName Foam::dynamicCode::codeTemplateDirName
const char* Foam::dynamicCode::libTargetRoot =
"LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib";
+const char* Foam::dynamicCode::topDirName = "dynamicCode";
+
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@@ -75,6 +77,15 @@ void Foam::dynamicCode::checkSecurity
}
+Foam::word Foam::dynamicCode::libraryBaseName(const fileName& libPath)
+{
+ word libName(libPath.name(true));
+ libName.erase(0, 3); // remove leading 'lib' from name
+ return libName;
+}
+
+
+
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::dynamicCode::copyAndFilter
@@ -281,7 +292,7 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
:
- codeRoot_(stringOps::expand("$FOAM_CASE/dynamicCode")),
+ codeRoot_(stringOps::expand("$FOAM_CASE")/topDirName),
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
codeName_(codeName),
codeDirName_(codeDirName)
@@ -297,6 +308,18 @@ Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+Foam::fileName Foam::dynamicCode::codeRelPath() const
+{
+ return topDirName/codeDirName_;
+}
+
+
+Foam::fileName Foam::dynamicCode::libRelPath() const
+{
+ return codeRelPath()/libSubDir_/"lib" + codeName_ + ".so";
+}
+
+
void Foam::dynamicCode::clear()
{
compileFiles_.clear();
@@ -376,7 +399,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
{
if (verbose)
{
- Info<< "Creating new library in " << this->libPath() << endl;
+ Info<< "Creating new library in " << this->libRelPath() << endl;
}
if (!allowSystemOperations)
@@ -500,7 +523,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
bool Foam::dynamicCode::wmakeLibso() const
{
- const Foam::string wmakeCmd("wmake libso " + this->codePath());
+ const Foam::string wmakeCmd("wmake libso " + this->codeRelPath());
Info<< "Invoking " << wmakeCmd << endl;
if (Foam::system(wmakeCmd))
diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H
index af7f996c08..75764aca3a 100644
--- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H
+++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H
@@ -108,6 +108,9 @@ protected:
//- Root of the LIB target for Make/files
static const char* libTargetRoot;
+ //- Top-level directory name for copy/compiling
+ static const char* topDirName;
+
// Protected Member Functions
@@ -166,6 +169,9 @@ public:
//- Check security for creating dynamic code
static void checkSecurity(const char* title, const dictionary&);
+ //- Return the library basename without leading 'lib' or trailing '.so'
+ static word libraryBaseName(const fileName& libPath);
+
// Constructors
@@ -220,6 +226,17 @@ public:
return codeRoot_/libSubDir_/"lib" + codeName_ + ".so";
}
+ //- Path for specified code name relative to \$FOAM_CASE
+ // Corresponds to topDirName/codeDirName()
+ fileName codeRelPath() const;
+
+
+ //- Library path for specified code name relative to \$FOAM_CASE
+ // Corresponds to
+ // dynamicCode/codeDirName()/libSubDir()/lib\.so
+ fileName libRelPath() const;
+
+
//- Path for SHA1Digest
// Corresponds to codePath()/Make/SHA1Digest
fileName digestFile() const
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index a7c5f499cc..ee534bdb1b 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -204,6 +204,42 @@ Foam::word Foam::fileName::name() const
}
+Foam::word Foam::fileName::name(const bool noExt) const
+{
+ if (noExt)
+ {
+ size_type beg = rfind('/');
+ if (beg == npos)
+ {
+ beg = 0;
+ }
+ else
+ {
+ ++beg;
+ }
+
+ size_type dot = rfind('.');
+ if (dot != npos && dot <= beg)
+ {
+ dot = npos;
+ }
+
+ if (dot == npos)
+ {
+ return substr(beg, npos);
+ }
+ else
+ {
+ return substr(beg, dot - beg);
+ }
+ }
+ else
+ {
+ return this->name();
+ }
+}
+
+
// Return directory path name (part before last /)
//
// behaviour compared to /usr/bin/dirname:
@@ -283,22 +319,22 @@ Foam::wordList Foam::fileName::components(const char delimiter) const
{
DynamicList wrdList(20);
- size_type start=0, end=0;
+ size_type beg=0, end=0;
- while ((end = find(delimiter, start)) != npos)
+ while ((end = find(delimiter, beg)) != npos)
{
// avoid empty element (caused by doubled slashes)
- if (start < end)
+ if (beg < end)
{
- wrdList.append(substr(start, end-start));
+ wrdList.append(substr(beg, end-beg));
}
- start = end + 1;
+ beg = end + 1;
}
// avoid empty trailing element
- if (start < size())
+ if (beg < size())
{
- wrdList.append(substr(start, npos));
+ wrdList.append(substr(beg, npos));
}
// transfer to wordList
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index df5945be99..bdfad0dc14 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -153,6 +153,9 @@ public:
//- Return file name (part beyond last /)
word name() const;
+ //- Return file name, optionally without extension
+ word name(const bool noExt) const;
+
//- Return directory path name (part before last /)
fileName path() const;
diff --git a/src/OpenFOAM/primitives/strings/string/string.C b/src/OpenFOAM/primitives/strings/string/string.C
index 4c9218d77e..0a1011adcb 100644
--- a/src/OpenFOAM/primitives/strings/string/string.C
+++ b/src/OpenFOAM/primitives/strings/string/string.C
@@ -24,14 +24,16 @@ License
\*---------------------------------------------------------------------------*/
#include "string.H"
-#include "OSspecific.H"
+#include "stringOps.H"
+
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
const char* const Foam::string::typeName = "string";
-int Foam::string::debug(debug::debugSwitch(string::typeName, 0));
+int Foam::string::debug(Foam::debug::debugSwitch(string::typeName, 0));
const Foam::string Foam::string::null;
+
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Count and return the number of a given character in the string
@@ -43,7 +45,7 @@ Foam::string::size_type Foam::string::count(const char c) const
{
if (*iter == c)
{
- cCount++;
+ ++cCount;
}
}
@@ -95,136 +97,7 @@ Foam::string& Foam::string::replaceAll
Foam::string& Foam::string::expand(const bool allowEmpty)
{
- size_type begVar = 0;
-
- // Expand $VARS
- // Repeat until nothing more is found
- while
- (
- (begVar = find('$', begVar)) != npos
- && begVar < size()-1
- )
- {
- if (begVar == 0 || operator[](begVar-1) != '\\')
- {
- // Find end of first occurrence
- size_type endVar = begVar;
- size_type delim = 0;
-
- if (operator[](begVar+1) == '{')
- {
- endVar = find('}', begVar);
- delim = 1;
- }
- else
- {
- iterator iter = begin() + begVar + 1;
-
- while
- (
- iter != end()
- && (isalnum(*iter) || *iter == '_')
- )
- {
- ++iter;
- ++endVar;
- }
- }
-
- if (endVar != npos && endVar != begVar)
- {
- const string varName = substr
- (
- begVar + 1 + delim,
- endVar - begVar - 2*delim
- );
-
- const string varValue = getEnv(varName);
- if (varValue.size())
- {
- std::string::replace
- (
- begVar,
- endVar - begVar + 1,
- varValue
- );
- begVar += varValue.size();
- }
- else if (allowEmpty)
- {
- std::string::replace
- (
- begVar,
- endVar - begVar + 1,
- ""
- );
- }
- else
- {
- FatalErrorIn("string::expand(const bool, const bool)")
- << "Unknown variable name " << varName << '.'
- << exit(FatalError);
- }
- }
- else
- {
- break;
- }
- }
- else
- {
- ++begVar;
- }
- }
-
- if (size())
- {
- if (operator[](0) == '~')
- {
- // Expand initial ~
- // ~/ => home directory
- // ~OpenFOAM => site/user OpenFOAM configuration directory
- // ~user => home directory for specified user
-
- word user;
- fileName file;
-
- if ((begVar = find('/')) != npos)
- {
- user = substr(1, begVar - 1);
- file = substr(begVar + 1);
- }
- else
- {
- user = substr(1);
- }
-
- // NB: be a bit lazy and expand ~unknownUser as an
- // empty string rather than leaving it untouched.
- // otherwise add extra test
- if (user == "OpenFOAM")
- {
- *this = findEtcFile(file);
- }
- else
- {
- *this = home(user)/file;
- }
- }
- else if (operator[](0) == '.')
- {
- // Expand a lone '.' and an initial './' into cwd
- if (size() == 1)
- {
- *this = cwd();
- }
- else if (operator[](1) == '/')
- {
- std::string::replace(0, 1, cwd());
- }
- }
- }
-
+ stringOps::inplaceExpand(*this, allowEmpty);
return *this;
}
diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
index 99e7fb8ab3..2fbadd3a6a 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
@@ -66,10 +66,23 @@ Foam::string& Foam::stringOps::inplaceExpand
string::size_type endVar = begVar;
string::size_type delim = 0;
+ // The position of the ":-" default value
+ string::size_type altPos = string::npos;
+
if (s[begVar+1] == '{')
{
endVar = s.find('}', begVar);
delim = 1;
+
+ // looks like ${parameter:-word}
+ if (endVar != string::npos)
+ {
+ altPos = s.find(":-", begVar);
+ if (altPos != string::npos && altPos > endVar)
+ {
+ altPos = string::npos;
+ }
+ }
}
else
{
@@ -93,18 +106,43 @@ Foam::string& Foam::stringOps::inplaceExpand
}
}
- if (endVar != string::npos && endVar != begVar)
+ if (endVar == string::npos)
+ {
+ // likely parsed '${...' without closing '}' - abort
+ break;
+ }
+ else if (endVar == begVar)
+ {
+ // parsed '${}' or $badChar - skip over
+ begVar = endVar + 1;
+ }
+ else
{
const word varName
(
s.substr
(
begVar + 1 + delim,
- endVar - begVar - 2*delim
+ (
+ (altPos == string::npos ? endVar : altPos)
+ - begVar - 2*delim
+ )
),
false
);
+ std::string altValue;
+ if (altPos != string::npos)
+ {
+ // had ":-" default value
+ altValue = s.substr
+ (
+ altPos + 2,
+ endVar - altPos - 2*delim
+ );
+ }
+
+
HashTable::const_iterator fnd =
mapping.find(varName);
@@ -118,6 +156,17 @@ Foam::string& Foam::stringOps::inplaceExpand
);
begVar += (*fnd).size();
}
+ else if (altPos != string::npos)
+ {
+ // use alternative provided
+ s.std::string::replace
+ (
+ begVar,
+ endVar - begVar + 1,
+ altValue
+ );
+ begVar += altValue.size();
+ }
else
{
s.std::string::replace
@@ -128,10 +177,6 @@ Foam::string& Foam::stringOps::inplaceExpand
);
}
}
- else
- {
- break;
- }
}
else
{
@@ -205,7 +250,17 @@ Foam::string& Foam::stringOps::inplaceExpand
}
}
- if (endVar != string::npos && endVar != begVar)
+ if (endVar == string::npos)
+ {
+ // likely parsed '${...' without closing '}' - abort
+ break;
+ }
+ else if (endVar == begVar)
+ {
+ // parsed '${}' or $badChar - skip over
+ begVar = endVar + 1;
+ }
+ else
{
const word varName
(
@@ -249,13 +304,9 @@ Foam::string& Foam::stringOps::inplaceExpand
else
{
// not defined - leave original string untouched
- begVar = endVar;
+ begVar = endVar + 1;
}
}
- else
- {
- break;
- }
}
else
{
@@ -300,10 +351,23 @@ Foam::string& Foam::stringOps::inplaceExpand
string::size_type endVar = begVar;
string::size_type delim = 0;
+ // The position of the ":-" default value
+ string::size_type altPos = string::npos;
+
if (s[begVar+1] == '{')
{
endVar = s.find('}', begVar);
delim = 1;
+
+ // looks like ${parameter:-word}
+ if (endVar != string::npos)
+ {
+ altPos = s.find(":-", begVar);
+ if (altPos != string::npos && altPos > endVar)
+ {
+ altPos = string::npos;
+ }
+ }
}
else
{
@@ -320,21 +384,47 @@ Foam::string& Foam::stringOps::inplaceExpand
}
}
- if (endVar != string::npos && endVar != begVar)
+
+ if (endVar == string::npos)
+ {
+ // likely parsed '${...' without closing '}' - abort
+ break;
+ }
+ else if (endVar == begVar)
+ {
+ // parsed '${}' or $badChar - skip over
+ begVar = endVar + 1;
+ }
+ else
{
const word varName
(
s.substr
(
begVar + 1 + delim,
- endVar - begVar - 2*delim
+ (
+ (altPos == string::npos ? endVar : altPos)
+ - begVar - 2*delim
+ )
),
false
);
+ std::string altValue;
+ if (altPos != string::npos)
+ {
+ // had ":-" default value
+ altValue = s.substr
+ (
+ altPos + 2,
+ endVar - altPos - 2*delim
+ );
+ }
+
const string varValue = getEnv(varName);
if (varValue.size())
{
+ // direct replacement
s.std::string::replace
(
begVar,
@@ -343,6 +433,17 @@ Foam::string& Foam::stringOps::inplaceExpand
);
begVar += varValue.size();
}
+ else if (altPos != string::npos)
+ {
+ // use alternative provided
+ s.std::string::replace
+ (
+ begVar,
+ endVar - begVar + 1,
+ altValue
+ );
+ begVar += altValue.size();
+ }
else if (allowEmpty)
{
s.std::string::replace
@@ -362,10 +463,6 @@ Foam::string& Foam::stringOps::inplaceExpand
<< exit(FatalError);
}
}
- else
- {
- break;
- }
}
else
{
diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
index cfd7993739..63a4679c9b 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
@@ -55,7 +55,17 @@ namespace stringOps
// -# variables
// - "$VAR", "${VAR}"
//
- // Any unknown entries are removed
+ // Supports default values as per the Bourne/Korn shell.
+ // \code
+ // "${parameter:-defValue}"
+ // \endcode
+ // If parameter is unset or null, the \c defValue is substituted.
+ // Otherwise, the value of parameter is substituted.
+ //
+ // Any unknown entries are removed silently.
+ //
+ // Malformed entries (eg, brace mismatch, sigil followed by bad character)
+ // are left as is.
//
// \note the leading sigil can be changed to avoid conflicts with other
// string expansions
@@ -72,7 +82,17 @@ namespace stringOps
// -# variables
// - "$VAR", "${VAR}"
//
- // Any unknown entries are removed
+ // Supports default values as per the Bourne/Korn shell.
+ // \code
+ // "${parameter:-defValue}"
+ // \endcode
+ // If parameter is unset or null, the \c defValue is substituted.
+ // Otherwise, the value of parameter is substituted.
+ //
+ // Any unknown entries are removed silently.
+ //
+ // Malformed entries (eg, brace mismatch, sigil followed by bad character)
+ // are left as is.
//
// \note the leading sigil can be changed to avoid conflicts with other
// string expansions
@@ -128,7 +148,18 @@ namespace stringOps
// - leading "~user" : home directory for specified user
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
//
- // Any unknown entries are removed silently if allowEmpty is true
+ // Supports default values as per the Bourne/Korn shell.
+ // \code
+ // "${parameter:-defValue}"
+ // \endcode
+ // If parameter is unset or null, the \c defValue is substituted.
+ // Otherwise, the value of parameter is substituted.
+ //
+ // Any unknown entries are removed silently, if allowEmpty is true.
+ //
+ // Malformed entries (eg, brace mismatch, sigil followed by bad character)
+ // are left as is.
+ //
// \sa
// Foam::findEtcFile
string expand
@@ -149,7 +180,19 @@ namespace stringOps
// - leading "~user" : home directory for specified user
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
//
- // Any unknown entries are removed silently if allowEmpty is true
+ // Supports default values as per the Bourne/Korn shell.
+ // \code
+ // "${parameter:-defValue}"
+ // \endcode
+ // If parameter is unset or null, the \c defValue is substituted.
+ // Otherwise, the value of parameter is substituted.
+ //
+ // Any unknown entries are removed silently, if allowEmpty is true.
+ //
+ // Malformed entries (eg, brace mismatch, sigil followed by bad character)
+ // are left as is.
+ //
+ // Any unknown entries are removed silently if allowEmpty is true.
// \sa
// Foam::findEtcFile
string& inplaceExpand
diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files
index ff57597532..e6f6c26148 100644
--- a/src/finiteVolume/Make/files
+++ b/src/finiteVolume/Make/files
@@ -115,7 +115,6 @@ $(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorFi
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchScalarField.C
-$(derivedFvPatchFields)/codedFixedValue/codeProperties.C
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.C
deleted file mode 100644
index c104d3d71b..0000000000
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.C
+++ /dev/null
@@ -1,73 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-\*---------------------------------------------------------------------------*/
-
-#include "codeProperties.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(Foam::codeProperties, 0);
-
-
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-Foam::codeProperties::codeProperties(const IOobject& io)
-:
- IOdictionary(io),
- modified_(true)
-{}
-
-
-// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
-
-bool Foam::codeProperties::modified() const
-{
- modified_ = modified_ || regIOobject::modified();
-
- return modified_;
-}
-
-
-void Foam::codeProperties::setUnmodified() const
-{
- modified_ = false;
-}
-
-
-bool Foam::codeProperties::read()
-{
- if (regIOobject::read())
- {
- modified_ = true;
-
- return true;
- }
- else
- {
- return false;
- }
-}
-
-
-// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.H
deleted file mode 100644
index f8d855274f..0000000000
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codeProperties.H
+++ /dev/null
@@ -1,92 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Class
- Foam::codeProperties
-
-Description
- IOdictionary with an internal flag to explicitly track when a file changed.
-
-SourceFiles
- codeProperties.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef codeProperties_H
-#define codeProperties_H
-
-#include "IOdictionary.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
- Class codeProperties Declaration
-\*---------------------------------------------------------------------------*/
-
-class codeProperties
-:
- public IOdictionary
-{
- // Private data
-
- //- Monitor file change
- mutable bool modified_;
-
-public:
-
- // Declare name of the class and its debug switch
- ClassName("codeDict");
-
- // Constructors
-
- //- Construct from IOobject
- codeProperties(const IOobject&);
-
-
- // Member Functions
-
- //- A sticky version of regIOobject::modified()
- // Must explicitly clear with setUnmodified()
- virtual bool modified() const;
-
- //- Make modification unsticky
- void setUnmodified() const;
-
- //- Read the dictionary
- virtual bool read();
-
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C
index 8175f1b5ed..9123e0cb70 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C
@@ -35,7 +35,6 @@ License
#include "SHA1Digest.H"
#include "dynamicCode.H"
#include "dynamicCodeContext.H"
-#include "codeProperties.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -46,34 +45,156 @@ const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateC
const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateH
= "fixedValueFvPatchScalarFieldTemplate.H";
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
+(
+ const fileName& libPath,
+ const string& globalFuncName,
+ const dictionary& contextDict
+)
+{
+ void* lib = 0;
+
+ // avoid compilation by loading an existing library
+ if (!libPath.empty() && dlLibraryTable::open(libPath, false))
+ {
+ lib = dlLibraryTable::findLibrary(libPath);
+
+ // verify the loaded version and unload if needed
+ if (lib)
+ {
+ // provision for manual execution of code after loading
+ if (dlSymFound(lib, globalFuncName))
+ {
+ loaderFunctionType function =
+ reinterpret_cast
+ (
+ dlSym(lib, globalFuncName)
+ );
+
+ if (function)
+ {
+ (*function)(true); // force load
+ }
+ else
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::updateLibrary()",
+ contextDict
+ ) << "Failed looking up symbol " << globalFuncName << nl
+ << "from " << libPath << exit(FatalIOError);
+ }
+ }
+ else
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::loadLibrary()",
+ contextDict
+ ) << "Failed looking up symbol " << globalFuncName << nl
+ << "from " << libPath << exit(FatalIOError);
+
+ lib = 0;
+ if (!dlLibraryTable::close(libPath, false))
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::loadLibrary()",
+ contextDict
+ ) << "Failed unloading library "
+ << libPath
+ << exit(FatalIOError);
+ }
+ }
+ }
+ }
+
+ return lib;
+}
+
+
+void Foam::codedFixedValueFvPatchScalarField::unloadLibrary
+(
+ const fileName& libPath,
+ const string& globalFuncName,
+ const dictionary& contextDict
+)
+{
+ void* lib = 0;
+
+ if (!libPath.empty())
+ {
+ lib = dlLibraryTable::findLibrary(libPath);
+ }
+
+ if (!lib)
+ {
+ return;
+ }
+
+ // provision for manual execution of code before unloading
+ if (dlSymFound(lib, globalFuncName))
+ {
+ loaderFunctionType function =
+ reinterpret_cast
+ (
+ dlSym(lib, globalFuncName)
+ );
+
+ if (function)
+ {
+ (*function)(false); // force unload
+ }
+ else
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::unloadLibrary()",
+ contextDict
+ ) << "Failed looking up symbol " << globalFuncName << nl
+ << "from " << libPath << exit(FatalIOError);
+ }
+ }
+
+ if (!dlLibraryTable::close(libPath, false))
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::"
+ "updateLibrary()",
+ contextDict
+ ) << "Failed unloading library " << libPath
+ << exit(FatalIOError);
+ }
+}
+
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
-const Foam::codeProperties&
-Foam::codedFixedValueFvPatchScalarField::dict() const
+const Foam::IOdictionary& Foam::codedFixedValueFvPatchScalarField::dict() const
{
- if (db().foundObject(codeProperties::typeName))
+ if (db().foundObject("codeDict"))
{
- return db().lookupObject
- (
- codeProperties::typeName
- );
+ return db().lookupObject("codeDict");
}
else
{
- codeProperties* props = new codeProperties
+ return db().store
(
- IOobject
+ new IOdictionary
(
- codeProperties::typeName,
- db().time().system(),
- db(),
- IOobject::MUST_READ_IF_MODIFIED,
- IOobject::NO_WRITE
+ IOobject
+ (
+ "codeDict",
+ db().time().system(),
+ db(),
+ IOobject::MUST_READ_IF_MODIFIED,
+ IOobject::NO_WRITE
+ )
)
);
-
- return db().store(props);
}
}
@@ -84,45 +205,69 @@ void Foam::codedFixedValueFvPatchScalarField::createLibrary
const dynamicCodeContext& context
) const
{
- // Write files for new library
- if (Pstream::master() && !dynCode.upToDate(context))
+ bool create = Pstream::master();
+
+ if (create)
{
- // filter with this context
- dynCode.reset(context);
+ // Write files for new library
+ if (!dynCode.upToDate(context))
+ {
+ // filter with this context
+ dynCode.reset(context);
- // compile filtered C template
- dynCode.addCompileFile(codeTemplateC);
+ // compile filtered C template
+ dynCode.addCompileFile(codeTemplateC);
- // copy filtered H template
- dynCode.addCopyFile(codeTemplateH);
+ // copy filtered H template
+ dynCode.addCopyFile(codeTemplateH);
- // define Make/options
- dynCode.setMakeOptions
- (
- "EXE_INC = -g \\\n"
- "-I$(LIB_SRC)/finiteVolume/lnInclude\\\n"
- + context.options()
- + "\n\nLIB_LIBS = "
- );
+ // take no chances - typeName must be identical to redirectType_
+ dynCode.setFilterVariable("typeName", redirectType_);
- if (!dynCode.copyOrCreateFiles(true))
+ // debugging: make BC verbose
+ // dynCode.setFilterVariable("verbose", "true");
+ // Info<<"compile " << redirectType_ << " sha1: "
+ // << context.sha1() << endl;
+
+ // define Make/options
+ dynCode.setMakeOptions
+ (
+ "EXE_INC = -g \\\n"
+ "-I$(LIB_SRC)/finiteVolume/lnInclude\\\n"
+ + context.options()
+ + "\n\nLIB_LIBS = "
+ );
+
+ if (!dynCode.copyOrCreateFiles(true))
+ {
+ FatalIOErrorIn
+ (
+ "codedFixedValueFvPatchScalarField::createLibrary(..)",
+ context.dict()
+ ) << "Failed writing files for" << nl
+ << dynCode.libRelPath() << nl
+ << exit(FatalIOError);
+ }
+ }
+
+ if (!dynCode.wmakeLibso())
{
FatalIOErrorIn
(
- "codedFixedValueFvPatchScalarField::writeLibrary(..)",
+ "codedFixedValueFvPatchScalarField::createLibrary(..)",
context.dict()
- ) << "Failed writing files for" << nl
- << dynCode.libPath() << nl
+ ) << "Failed wmake " << dynCode.libRelPath() << nl
<< exit(FatalIOError);
}
}
+
+
+ // all processes must wait for compile to finish
+ reduce(create, orOp());
}
-void Foam::codedFixedValueFvPatchScalarField::updateLibrary
-(
- bool firstTime
-) const
+void Foam::codedFixedValueFvPatchScalarField::updateLibrary() const
{
dynamicCode::checkSecurity
(
@@ -130,176 +275,53 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary
dict_
);
- // use codeProperties or in-line
- const bool useCodeProps = !dict_.found("code");
-
+ // use system/codeDict or in-line
const dictionary& codeDict =
(
- useCodeProps
- ? this->dict().subDict(redirectType_)
- : dict_
+ dict_.found("code")
+ ? dict_
+ : this->dict().subDict(redirectType_)
);
+ dynamicCodeContext context(codeDict);
- autoPtr contextPtr;
-
- // write code into redirectType_ subdir as well
- dynamicCode dynCode(redirectType_);
+ // codeName: redirectType + _
+ // codeDir : redirectType
+ dynamicCode dynCode
+ (
+ redirectType_ + context.sha1().str(true),
+ redirectType_
+ );
const fileName libPath = dynCode.libPath();
- // see if library is loaded
- void* lib = dlLibraryTable::findLibrary(libPath);
- bool reuseLib = false;
- bool waiting = false;
-
- if (useCodeProps)
- {
- // library may be loaded, but out-of-date
- const codeProperties& codeProps = this->dict();
- if (codeProps.modified())
- {
- codeProps.setUnmodified();
-
- // Remove instantiation of fvPatchField provided by library
- redirectPatchFieldPtr_.clear();
-
- contextPtr.reset(new dynamicCodeContext(codeDict));
-
- // unload code
- if (lib)
- {
- firstTime = false;
- reuseLib = false;
- lib = 0;
-
- if (!dlLibraryTable::close(libPath, false))
- {
- FatalIOErrorIn
- (
- "codedFixedValueFvPatchScalarField::"
- "updateLibrary()",
- contextPtr().dict()
- ) << "Failed unloading library "
- << libPath
- << exit(FatalIOError);
- }
- }
- }
- }
-
-
- // library exists (and was not unloaded) - we can leave now
- if (lib)
+ // the correct library was already loaded => we are done
+ if (dlLibraryTable::findLibrary(libPath))
{
return;
}
-
- // Remove instantiation of fvPatchField provided by library
+ // remove instantiation of fvPatchField provided by library
redirectPatchFieldPtr_.clear();
- if (contextPtr.empty())
+ // may need to unload old library
+ unloadLibrary
+ (
+ oldLibPath_,
+ dynamicCode::libraryBaseName(oldLibPath_),
+ context.dict()
+ );
+
+ // try loading an existing library (avoid compilation when possible)
+ if (!loadLibrary(libPath, dynCode.codeName(), context.dict()))
{
- contextPtr.reset(new dynamicCodeContext(codeDict));
+ createLibrary(dynCode, context);
+
+ loadLibrary(libPath, dynCode.codeName(), context.dict());
}
- // function name serving as version control - based on the SHA1
- const string sentinelName
- = dynCode.codeName() + contextPtr().sha1().str(true);
-
- // avoid compilation (first time only) by loading an existing library
- if (firstTime && dlLibraryTable::open(libPath, false))
- {
- lib = dlLibraryTable::findLibrary(libPath);
-
- // verify the loaded version and unload if needed
- if (lib)
- {
- reuseLib = dlSymFound(lib, sentinelName);
- if (!reuseLib)
- {
- lib = 0;
- if (!dlLibraryTable::close(libPath, false))
- {
- FatalIOErrorIn
- (
- "codedFixedValueFvPatchScalarField::updateLibrary()",
- contextPtr().dict()
- ) << "Failed unloading library "
- << libPath
- << exit(FatalIOError);
- }
- }
- }
- }
-
-
- // really do need to create library
- if (!lib)
- {
- if (Pstream::master())
- {
- createLibrary(dynCode, contextPtr());
-
- if (!dynCode.wmakeLibso())
- {
- FatalIOErrorIn
- (
- "codedFixedValueFvPatchScalarField::updateLibrary()",
- contextPtr().dict()
- ) << "Failed wmake " << libPath
- << exit(FatalIOError);
- }
- }
-
- // all processes must wait for compile
- waiting = true;
- reduce(waiting, orOp());
-
- if (!dlLibraryTable::open(libPath, false))
- {
- FatalIOErrorIn
- (
- "codedFixedValueFvPatchScalarField::updateLibrary()",
- contextPtr().dict()
- ) << "Failed loading library " << libPath
- << exit(FatalIOError);
- }
-
- lib = dlLibraryTable::findLibrary(libPath);
- if (!lib)
- {
- FatalIOErrorIn
- (
- "codedFixedValueFvPatchScalarField::"
- "updateLibrary()",
- contextPtr().dict()
- ) << "Failed to load library " << libPath
- << exit(FatalIOError);
- }
-
-//#if 0
-// Info<<"check " << libPath << " for " << sentinelName << nl;
-// // paranoid - check that signature function is really there
-// lib = dlLibraryTable::findLibrary(libPath);
-// if (!lib || !dlSymFound(lib, sentinelName))
-// {
-// FatalIOErrorIn
-// (
-// "codedFixedValueFvPatchScalarField::"
-// "updateLibrary()",
-// contextPtr().dict()
-// ) << "Failed to load library with correct signature "
-// << libPath
-// << exit(FatalIOError);
-// }
-//#endif
- }
- else if (reuseLib)
- {
- Info<< "Reusing library in " << libPath << nl;
- }
+ // retain for future reference
+ oldLibPath_ = libPath;
}
@@ -313,6 +335,7 @@ codedFixedValueFvPatchScalarField
)
:
fixedValueFvPatchField(p, iF),
+ oldLibPath_(),
redirectPatchFieldPtr_()
{}
@@ -329,6 +352,7 @@ codedFixedValueFvPatchScalarField
fixedValueFvPatchField(ptf, p, iF, mapper),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
+ oldLibPath_(),
redirectPatchFieldPtr_()
{}
@@ -344,9 +368,10 @@ codedFixedValueFvPatchScalarField
fixedValueFvPatchField(p, iF, dict),
dict_(dict),
redirectType_(dict.lookup("redirectType")),
+ oldLibPath_(),
redirectPatchFieldPtr_()
{
- updateLibrary(true);
+ updateLibrary();
}
@@ -359,6 +384,7 @@ codedFixedValueFvPatchScalarField
fixedValueFvPatchField(ptf),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
+ oldLibPath_(),
redirectPatchFieldPtr_()
{}
@@ -373,6 +399,7 @@ codedFixedValueFvPatchScalarField
fixedValueFvPatchField(ptf, iF),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
+ oldLibPath_(),
redirectPatchFieldPtr_()
{}
@@ -385,15 +412,15 @@ Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const
if (!redirectPatchFieldPtr_.valid())
{
// Construct a patch
-
// Make sure to construct the patchfield with uptodate value.
+
OStringStream os;
os.writeKeyword("type") << redirectType_ << token::END_STATEMENT
<< nl;
static_cast(*this).writeEntry("value", os);
IStringStream is(os.str());
dictionary dict(is);
- Info<< "constructing patchField from :" << dict << endl;
+// Info<< "constructing patchField from :" << dict << endl;
// if (fvPatchScalarField::dictionaryConstructorTablePtr_)
// {
@@ -460,15 +487,18 @@ void Foam::codedFixedValueFvPatchScalarField::evaluate
void Foam::codedFixedValueFvPatchScalarField::write(Ostream& os) const
{
- //dict_.set("value", static_cast(*this));
- //os << dict_ << token::END_STATEMENT << nl;
fixedValueFvPatchField::write(os);
- os.writeKeyword("redirectType") << redirectType_ << token::END_STATEMENT
- << nl;
+ os.writeKeyword("redirectType") << redirectType_
+ << token::END_STATEMENT << nl;
+
if (dict_.found("code"))
{
- os.writeKeyword("code") << string(dict_["code"]) << token::END_STATEMENT
- << nl;
+ os.writeKeyword("code")
+ << token::HASH << token::BEGIN_BLOCK;
+
+ os.writeQuoted(string(dict_["code"]), false)
+ << token::HASH << token::END_BLOCK
+ << token::END_STATEMENT << nl;
}
}
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H
index 7b0ef5a642..0161654f30 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H
@@ -87,9 +87,9 @@ namespace Foam
{
// Forward declaration of classes
-class codeProperties;
class dynamicCode;
class dynamicCodeContext;
+class IOdictionary;
/*---------------------------------------------------------------------------*\
Class codedFixedValueFvPatchScalarField Declaration
@@ -106,18 +106,39 @@ class codedFixedValueFvPatchScalarField
const word redirectType_;
+ //- Previously loaded library
+ mutable fileName oldLibPath_;
+
mutable autoPtr redirectPatchFieldPtr_;
// Private Member Functions
- const codeProperties& dict() const;
+ const IOdictionary& dict() const;
+
+ //- Global loader/unloader function type
+ typedef void (*loaderFunctionType)(bool);
+
+ static void* loadLibrary
+ (
+ const fileName& libPath,
+ const string& globalFuncName,
+ const dictionary& contextDict
+ );
+
+ static void unloadLibrary
+ (
+ const fileName& libPath,
+ const string& globalFuncName,
+ const dictionary& contextDict
+ );
+
void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
//- Update library as required
- // Use 'firstTime' to alter behaviour
- void updateLibrary(bool firstTime=false) const;
+ void updateLibrary() const;
+
public:
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
index 3e49d29cd5..26cae658c6 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
@@ -218,10 +218,10 @@ void Foam::KinematicCloud::evolveCloud(TrackData& td)
{
// this->surfaceFilm().injectSteadyState(td);
- this->injection().injectSteadyState(td, solution_.deltaT());
+ this->injection().injectSteadyState(td, solution_.deltaTValue());
td.part() = TrackData::tpLinearTrack;
- CloudType::move(td, solution_.deltaT());
+ CloudType::move(td, solution_.deltaTValue());
}
}
@@ -353,7 +353,7 @@ Foam::KinematicCloud::KinematicCloud
IOobject::AUTO_WRITE
),
mesh_,
- dimensionedScalar("zero", dimMass/dimTime, 0.0)
+ dimensionedScalar("zero", dimMass, 0.0)
)
)
{
@@ -504,7 +504,7 @@ void Foam::KinematicCloud::checkParcelProperties
parcel.rho() = constProps_.rho0();
}
- const scalar carrierDt = solution_.deltaT();
+ const scalar carrierDt = solution_.deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.typeId() = constProps_.parcelTypeId();
}
@@ -582,7 +582,7 @@ template
void Foam::KinematicCloud::motion(TrackData& td)
{
td.part() = TrackData::tpLinearTrack;
- CloudType::move(td, solution_.deltaT());
+ CloudType::move(td, solution_.deltaTValue());
updateCellOccupancy();
}
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
index baa0f0141d..5987192bfd 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
@@ -332,10 +332,10 @@ Foam::KinematicCloud::SU(volVectorField& U) const
{
if (solution_.semiImplicit("U"))
{
- return
- UTrans()/(mesh_.V()*this->db().time().deltaT())
- - fvm::Sp(UCoeff()/mesh_.V(), U)
- + UCoeff()/mesh_.V()*U;
+ const DimensionedField
+ Vdt(mesh_.V()*this->db().time().deltaT());
+
+ return UTrans()/Vdt - fvm::Sp(UCoeff()/Vdt, U) + UCoeff()/Vdt*U;
}
else
{
@@ -374,16 +374,38 @@ Foam::KinematicCloud::theta() const
)
);
- scalarField& theta = ttheta().internalField();
+ volScalarField& theta = ttheta();
+ theta.boundaryField() == 0;
+
forAllConstIter(typename KinematicCloud, *this, iter)
{
const parcelType& p = iter();
const label cellI = p.cell();
+ if ((p.face() != -1))
+ {
+ const label patchI = p.patch(p.face());
+ if (patchI != -1)
+ {
+ scalarField& thetap = theta.boundaryField()[patchI];
+ const label faceI = p.patchFace(patchI, p.face());
+ thetap[faceI] += p.nParticle()*p.areaP();
+ }
+ }
+
theta[cellI] += p.nParticle()*p.volume();
}
- theta /= mesh().V();
+ theta.internalField() /= mesh_.V();
+
+ forAll(theta.boundaryField(), patchI)
+ {
+ scalarField& thetap = theta.boundaryField()[patchI];
+ if (thetap.size() > 0)
+ {
+ thetap /= mesh_.magSf().boundaryField()[patchI];
+ }
+ }
return ttheta;
}
@@ -420,7 +442,7 @@ Foam::KinematicCloud::alpha() const
alpha[cellI] += p.nParticle()*p.mass();
}
- alpha /= (mesh().V()*rho_);
+ alpha /= (mesh_.V()*rho_);
return talpha;
}
@@ -457,7 +479,7 @@ Foam::KinematicCloud::rhoEff() const
rhoEff[cellI] += p.nParticle()*p.mass();
}
- rhoEff /= mesh().V();
+ rhoEff /= mesh_.V();
return trhoEff;
}
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H
index 1162df6506..cb1c8330b3 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H
@@ -169,7 +169,10 @@ public:
inline label nextIter();
//- Return the time step
- inline scalar deltaT() const;
+ inline scalar deltaTValue() const;
+
+ //- Return the time step
+ inline const dimensionedScalar deltaT() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H
index 37aad4dbdf..a5da04150d 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolutionI.H
@@ -95,12 +95,18 @@ inline Foam::label Foam::cloudSolution::nextIter()
}
-inline Foam::scalar Foam::cloudSolution::deltaT() const
+inline Foam::scalar Foam::cloudSolution::deltaTValue() const
{
return deltaT_;
}
+inline const Foam::dimensionedScalar Foam::cloudSolution::deltaT() const
+{
+ return dimensionedScalar("cloudSolution::deltaT", dimTime, deltaT_);
+}
+
+
inline const Foam::Switch Foam::cloudSolution::coupled() const
{
return coupled_;
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
index 79b66f87ff..52c33017f3 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
@@ -114,7 +114,7 @@ inline Foam::tmp Foam::ReactingCloud::SYi
volScalarField& sourceField = trhoTrans();
sourceField.internalField() =
- rhoTrans_[i]/(this->db().time().deltaT()*this->mesh().V());
+ rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
const dimensionedScalar YiSMALL("YiSMALL", dimless, SMALL);
@@ -127,7 +127,7 @@ inline Foam::tmp Foam::ReactingCloud::SYi
tmp tfvm(new fvScalarMatrix(Yi, dimMass/dimTime));
fvScalarMatrix& fvm = tfvm();
- fvm.source() = -rhoTrans_[i]/this->db().time().deltaT();
+ fvm.source() = -rhoTrans_[i]/this->db().time().deltaTValue();
return tfvm;
}
@@ -167,7 +167,7 @@ Foam::ReactingCloud::Srho(const label i) const
if (this->solution().coupled())
{
scalarField& rhoi = tRhoi();
- rhoi = rhoTrans_[i]/(this->db().time().deltaT()*this->mesh().V());
+ rhoi = rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
}
return tRhoi;
@@ -209,7 +209,7 @@ Foam::ReactingCloud::Srho() const
sourceField += rhoTrans_[i];
}
- sourceField /= this->db().time().deltaT()*this->mesh().V();
+ sourceField /= this->db().time().deltaTValue()*this->mesh().V();
}
return trhoTrans;
@@ -249,7 +249,7 @@ Foam::ReactingCloud::Srho(volScalarField& rho) const
{
sourceField += rhoTrans_[i];
}
- sourceField /= this->db().time().deltaT()*this->mesh().V();
+ sourceField /= this->db().time().deltaTValue()*this->mesh().V();
return fvm::SuSp(trhoTrans()/rho, rho);
}
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
index 2dbe453580..e0365b54e2 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
@@ -127,7 +127,7 @@ Foam::ThermoCloud::ThermoCloud
IOobject::AUTO_WRITE
),
this->mesh(),
- dimensionedScalar("zero", dimEnergy/dimTime/dimTemperature, 0.0)
+ dimensionedScalar("zero", dimEnergy/dimTemperature, 0.0)
)
)
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
index c774133cb0..6889385431 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
@@ -138,11 +138,13 @@ Foam::ThermoCloud::Sh(volScalarField& hs) const
if (this->solution().semiImplicit("hs"))
{
const volScalarField Cp(thermo_.thermo().Cp());
+ const DimensionedField
+ Vdt(this->mesh().V()*this->db().time().deltaT());
return
- hsTrans()/(this->mesh().V()*this->db().time().deltaT())
- - fvm::Sp(hsCoeff()/(Cp*this->mesh().V()), hs)
- + hsCoeff()/(Cp*this->mesh().V())*hs;
+ hsTrans()/Vdt
+ - fvm::Sp(hsCoeff()/(Cp*Vdt), hs)
+ + hsCoeff()/(Cp*Vdt)*hs;
}
else
{
diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C
index 0a3e05d200..40e3efcb73 100644
--- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C
+++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C
@@ -202,7 +202,7 @@ const Foam::vector Foam::KinematicParcel::calcVelocity
const vector abp = (Feff.Sp()*Uc_ + (Feff.Su() + Su))/mass;
const scalar bp = Feff.Sp()/mass;
- Spu = Feff.Sp()*dt/td.cloud().solution().deltaT();
+ Spu = dt*Feff.Sp();
IntegrationScheme::integrationResult Ures =
td.cloud().UIntegrator().integrate(U, dt, abp, bp);
diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C
index 9df054c2d0..53a8e5545e 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C
@@ -339,7 +339,7 @@ Foam::scalar Foam::ThermoParcel::calcHeatTransfer
dhsTrans += dt*htc*As*(0.5*(T + Tnew) - Tc_);
- Cuh = bp*dt/td.cloud().solution().deltaT();
+ Cuh = dt*bp;
return Tnew;
}
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
index 5bf1c140c3..fb077dba51 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
@@ -520,7 +520,7 @@ void Foam::InjectionModel::inject(TrackData& td)
}
const scalar time = this->owner().db().time().value();
- const scalar carrierDt = this->owner().solution().deltaT();
+ const scalar carrierDt = this->owner().solution().deltaTValue();
const polyMesh& mesh = this->owner().mesh();
// Prepare for next time step
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C
index 3236774c18..70e440b0c3 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.C
@@ -290,7 +290,7 @@ void Foam::PatchInteractionModel::patchData
}
else
{
- Up = (Cf - Cf00)/this->owner().solution().deltaT();
+ Up = (Cf - Cf00)/this->owner().time().deltaTValue();
}
if (mag(dn) > SMALL)
@@ -314,7 +314,7 @@ void Foam::PatchInteractionModel::patchData
// angle/dt to give the correct angular velocity vector.
omega *=
Foam::asin(magOmega)
- /(magOmega*this->owner().solution().deltaT());
+ /(magOmega*this->owner().time().deltaTValue());
// Project position onto face and calculate this position
// relative to the face centre.
diff --git a/src/sampling/probes/patchProbes.C b/src/sampling/probes/patchProbes.C
index 7e545c9f96..d7ea026dce 100644
--- a/src/sampling/probes/patchProbes.C
+++ b/src/sampling/probes/patchProbes.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -53,23 +53,15 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
{
const vector& sample = operator[](probeI);
label faceI = meshSearchEngine.findNearestBoundaryFace(sample);
- if (faceI == -1)
- {
- nearest[probeI].second().first() = Foam::sqr(GREAT);
- nearest[probeI].second().second() = Pstream::myProcNo();
- }
- else
- {
- const point& fc = mesh.faceCentres()[faceI];
- nearest[probeI].first() = pointIndexHit
- (
- true,
- fc,
- faceI
- );
- nearest[probeI].second().first() = magSqr(fc-sample);
- nearest[probeI].second().second() = Pstream::myProcNo();
- }
+ const point& fc = mesh.faceCentres()[faceI];
+ nearest[probeI].first() = pointIndexHit
+ (
+ true,
+ fc,
+ faceI
+ );
+ nearest[probeI].second().first() = magSqr(fc-sample);
+ nearest[probeI].second().second() = Pstream::myProcNo();
}
@@ -92,27 +84,16 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
}
}
-
-
// Check if all patchProbes have been found.
forAll(nearest, sampleI)
{
- label localI = nearest[sampleI].first().index();
+ label localI = -1;
+ if (nearest[sampleI].second().second() == Pstream::myProcNo())
+ {
+ localI = nearest[sampleI].first().index();
+ }
- if (localI == -1)
- {
- if (Pstream::master())
- {
- WarningIn("patchProbes::findElements()")
- << "Did not find location "
- << nearest[sampleI].second().first()
- << " in any cell. Skipping location." << endl;
- }
- }
- else
- {
- elementList_[sampleI] = localI;
- }
+ elementList_[sampleI] = localI;
}
}