mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into molecularDynamics
This commit is contained in:
@ -30,9 +30,9 @@ Description
|
|||||||
of values (e.g. words and numbers).
|
of values (e.g. words and numbers).
|
||||||
|
|
||||||
The dictionary class is the base class for IOdictionary.
|
The dictionary class is the base class for IOdictionary.
|
||||||
It serves the purpose of a bootstrap dictionary for the objectRegistry
|
It also serves as a bootstrap dictionary for the objectRegistry data
|
||||||
data dictionaries, since unlike the IOdictionary class, it does not use
|
dictionaries since, unlike the IOdictionary class, it does not use an
|
||||||
a objectRegistry itself to work.
|
objectRegistry itself to work.
|
||||||
|
|
||||||
ToDo
|
ToDo
|
||||||
A merge() member function with a non-const dictionary parameter.
|
A merge() member function with a non-const dictionary parameter.
|
||||||
@ -199,25 +199,31 @@ public:
|
|||||||
//- Find and return a T, if not found return the given default value
|
//- Find and return a T, if not found return the given default value
|
||||||
// If recursive search parent dictionaries
|
// If recursive search parent dictionaries
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrDefault(const word&, const T&, bool recursive=false) const;
|
T lookupOrDefault
|
||||||
|
(
|
||||||
|
const word&,
|
||||||
|
const T&,
|
||||||
|
bool recursive=false
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Find and return a T, if not found return the given default value,
|
//- Find and return a T, if not found return the given default value,
|
||||||
// and add to dictionary. If recusive search parent dictionaries
|
// and add to dictionary. If recursive search parent dictionaries
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrAddDefault
|
T lookupOrAddDefault
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
const T&,
|
const T&,
|
||||||
bool recusive=false
|
bool recursive=false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find an entry if present, and assign to T
|
//- Find an entry if present, and assign to T
|
||||||
|
// Returns true if the entry was found
|
||||||
template<class T>
|
template<class T>
|
||||||
void readIfPresent
|
bool readIfPresent
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
T&,
|
T&,
|
||||||
bool recusive=false
|
bool recursive=false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Check if entry is a sub-dictionary
|
//- Check if entry is a sub-dictionary
|
||||||
|
|||||||
@ -54,40 +54,42 @@ template<class T>
|
|||||||
T Foam::dictionary::lookupOrAddDefault
|
T Foam::dictionary::lookupOrAddDefault
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deft,
|
const T& deflt,
|
||||||
bool recusive
|
bool recursive
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const entry* ePtr = lookupEntryPtr(keyword, recusive);
|
const entry* entryPtr = lookupEntryPtr(keyword, recursive);
|
||||||
|
|
||||||
if (ePtr == NULL)
|
if (entryPtr == NULL)
|
||||||
{
|
{
|
||||||
entry* defPtr = new primitiveEntry(keyword, deft);
|
add(new primitiveEntry(keyword, deflt));
|
||||||
append(defPtr);
|
return deflt;
|
||||||
hashedEntries_.insert(defPtr->keyword(), defPtr);
|
|
||||||
|
|
||||||
return deft;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return pTraits<T>(ePtr->stream());
|
return pTraits<T>(entryPtr->stream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void Foam::dictionary::readIfPresent
|
bool Foam::dictionary::readIfPresent
|
||||||
(
|
(
|
||||||
const word& keyword,
|
const word& k,
|
||||||
T& deft,
|
T& val,
|
||||||
bool recusive
|
bool recursive
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const entry* ePtr = lookupEntryPtr(keyword, recusive);
|
const entry* entryPtr = lookupEntryPtr(k, recursive);
|
||||||
|
|
||||||
if (ePtr != NULL)
|
if (entryPtr == NULL)
|
||||||
{
|
{
|
||||||
ePtr->stream() >> deft;
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entryPtr->stream() >> val;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ Foam::IPstream::IPstream
|
|||||||
|
|
||||||
MPI_Status status;
|
MPI_Status status;
|
||||||
|
|
||||||
// If the buffer size is not specified probe the incomming message
|
// If the buffer size is not specified, probe the incomming message
|
||||||
// and set it
|
// and set it
|
||||||
if (!bufSize)
|
if (!bufSize)
|
||||||
{
|
{
|
||||||
@ -181,8 +181,7 @@ Foam::label Foam::IPstream::read
|
|||||||
(
|
(
|
||||||
"IPstream::read"
|
"IPstream::read"
|
||||||
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
|
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
|
||||||
) << "Unsupported communications type "
|
) << "Unsupported communications type " << commsType
|
||||||
<< Pstream::commsTypeNames[commsType]
|
|
||||||
<< Foam::abort(FatalError);
|
<< Foam::abort(FatalError);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -119,8 +119,7 @@ bool Foam::OPstream::write
|
|||||||
(
|
(
|
||||||
"OPstream::write"
|
"OPstream::write"
|
||||||
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
|
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
|
||||||
) << "Unsupported communications type "
|
) << "Unsupported communications type " << commsType
|
||||||
<< Pstream::commsTypeNames[commsType]
|
|
||||||
<< Foam::abort(FatalError);
|
<< Foam::abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,9 +123,9 @@ tmp<scalarField> turbulenceModel::yPlus(const label patchNo) const
|
|||||||
|
|
||||||
if (typeid(curPatch) == typeid(wallFvPatch))
|
if (typeid(curPatch) == typeid(wallFvPatch))
|
||||||
{
|
{
|
||||||
dimensionedScalar Cmu(turbulenceModelCoeffs_.lookup("Cmu"));
|
scalar Cmu(turbulenceModelCoeffs_.lookup("Cmu"));
|
||||||
|
|
||||||
Yp = pow(Cmu.value(), 0.25)
|
Yp = pow(Cmu, 0.25)
|
||||||
*y_[patchNo]
|
*y_[patchNo]
|
||||||
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
|
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
|
||||||
/(
|
/(
|
||||||
@ -164,32 +164,14 @@ bool turbulenceModel::read()
|
|||||||
lookup("turbulence") >> turbulence_;
|
lookup("turbulence") >> turbulence_;
|
||||||
turbulenceModelCoeffs_ = subDict(type() + "Coeffs");
|
turbulenceModelCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
|
||||||
kappa_ = dimensionedScalar
|
subDict("wallFunctionCoeffs").lookup("kappa") >> kappa_;
|
||||||
(
|
subDict("wallFunctionCoeffs").lookup("E") >> E_;
|
||||||
subDict("wallFunctionCoeffs").lookup("kappa")
|
|
||||||
).value();
|
|
||||||
|
|
||||||
E_ = dimensionedScalar
|
|
||||||
(
|
|
||||||
subDict("wallFunctionCoeffs").lookup("E")
|
|
||||||
).value();
|
|
||||||
|
|
||||||
yPlusLam_ = yPlusLam(kappa_, E_);
|
yPlusLam_ = yPlusLam(kappa_, E_);
|
||||||
|
|
||||||
if (found("k0"))
|
readIfPresent("k0", k0_);
|
||||||
{
|
readIfPresent("epsilon0", epsilon0_);
|
||||||
lookup("k0") >> k0_;
|
readIfPresent("epsilonSmall", epsilonSmall_);
|
||||||
}
|
|
||||||
|
|
||||||
if (found("epsilon0"))
|
|
||||||
{
|
|
||||||
lookup("epsilon0") >> epsilon0_;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found("epsilonSmall"))
|
|
||||||
{
|
|
||||||
lookup("epsilonSmall") >> epsilonSmall_;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,9 +123,9 @@ tmp<scalarField> turbulenceModel::yPlus(const label patchNo) const
|
|||||||
|
|
||||||
if (typeid(curPatch) == typeid(wallFvPatch))
|
if (typeid(curPatch) == typeid(wallFvPatch))
|
||||||
{
|
{
|
||||||
dimensionedScalar Cmu(turbulenceModelCoeffs_.lookup("Cmu"));
|
scalar Cmu(turbulenceModelCoeffs_.lookup("Cmu"));
|
||||||
|
|
||||||
Yp = pow(Cmu.value(), 0.25)*y_[patchNo]
|
Yp = pow(Cmu, 0.25)*y_[patchNo]
|
||||||
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
|
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
|
||||||
/nu().boundaryField()[patchNo];
|
/nu().boundaryField()[patchNo];
|
||||||
}
|
}
|
||||||
@ -161,32 +161,14 @@ bool turbulenceModel::read()
|
|||||||
lookup("turbulence") >> turbulence_;
|
lookup("turbulence") >> turbulence_;
|
||||||
turbulenceModelCoeffs_ = subDict(type() + "Coeffs");
|
turbulenceModelCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
|
||||||
kappa_ = dimensionedScalar
|
subDict("wallFunctionCoeffs").lookup("kappa") >> kappa_;
|
||||||
(
|
subDict("wallFunctionCoeffs").lookup("E") >> E_;
|
||||||
subDict("wallFunctionCoeffs").lookup("kappa")
|
|
||||||
).value();
|
|
||||||
|
|
||||||
E_ = dimensionedScalar
|
|
||||||
(
|
|
||||||
subDict("wallFunctionCoeffs").lookup("E")
|
|
||||||
).value();
|
|
||||||
|
|
||||||
yPlusLam_ = yPlusLam(kappa_, E_);
|
yPlusLam_ = yPlusLam(kappa_, E_);
|
||||||
|
|
||||||
if (found("k0"))
|
readIfPresent("k0", k0_);
|
||||||
{
|
readIfPresent("epsilon0", epsilon0_);
|
||||||
lookup("k0") >> k0_;
|
readIfPresent("epsilonSmall", epsilonSmall_);
|
||||||
}
|
|
||||||
|
|
||||||
if (found("epsilon0"))
|
|
||||||
{
|
|
||||||
lookup("epsilon0") >> epsilon0_;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found("epsilonSmall"))
|
|
||||||
{
|
|
||||||
lookup("epsilonSmall") >> epsilonSmall_;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user