Compare commits

..

1 Commits

Author SHA1 Message Date
d3f7f91f6c ENH: track old output times for lumpedPoint output (#1793)
- now also tracks the previous output time, which aids on restarts
  since it allows the FEA side the possibility of determining
  the effective deltaT between the output of forces
2020-08-06 09:24:50 +02:00
44 changed files with 277 additions and 1082 deletions

View File

@ -1,2 +1,2 @@
api=2006
patch=201012
patch=200727

View File

@ -67,10 +67,10 @@ if (doLagrangian)
}
}
// Field order may differ on individual processors, so sort by name
for (const word& fieldName : theseCloudFields.sortedToc())
forAllConstIters(theseCloudFields, fieldIter)
{
const word& fieldType = theseCloudFields[fieldName];
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter.val();
IOobject fieldObject
(
@ -88,13 +88,9 @@ if (doLagrangian)
// but that combination does not work.
// So check the header and sync globally
const bool parRun = Pstream::parRun();
Pstream::parRun() = false;
fieldExists =
fieldObject.typeHeaderOk<IOField<scalar>>(false);
Pstream::parRun() = parRun;
reduce(fieldExists, orOp<bool>());
}

View File

@ -5,6 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wmake $targetType pdrFields
wmake $targetType PDRsetFields
wmake PDRsetFields
#------------------------------------------------------------------------------

View File

@ -69,12 +69,13 @@ Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
const dictionary& dict
)
:
// __INTEL_COMPILER bug with inheriting constructors?? (issue #1821)
origin_(dict.get<point>("origin")),
radius_(dict.get<scalar>("radius")),
scale_(dict.getOrDefault<scalar>("scale", 1)),
direction_(dict.get<vector>("direction").normalise()),
project_(tensor::I - direction_*direction_) // outer product
cylinderImplicitFunction
(
dict.get<point>("origin"),
dict.get<scalar>("radius"),
dict.getOrDefault<scalar>("scale", 1),
dict.get<vector>("direction")
)
{}

View File

@ -72,13 +72,15 @@ Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
const dictionary& dict
)
:
// __INTEL_COMPILER bug with inheriting constructors?? (issue #1821)
period_(dict.get<scalar>("period")),
phase_(dict.getOrDefault<scalar>("phase", 0)),
amplitude_(dict.get<scalar>("amplitude")),
up_(dict.get<vector>("up").normalise()),
direction_(dict.get<vector>("direction").normalise()),
origin_(dict.get<vector>("origin"))
sinImplicitFunction
(
dict.get<scalar>("period"),
dict.getOrDefault<scalar>("phase", 0),
dict.get<scalar>("amplitude"),
dict.get<vector>("direction"),
dict.get<vector>("up"),
dict.get<vector>("origin")
)
{}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,7 +49,7 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
"ODESolver",
solverType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
) << exit(FatalError);
}
return autoPtr<ODESolver>(cstrIter()(odes, dict));

View File

@ -43,13 +43,14 @@ Description
Read csv format:
\verbatim
readerType csv;
file "<constant>/p0vsTime.csv";
hasHeaderLine true; // skip first line
refColumn 0; // reference (eg, time) is in column 0
componentColumns (1); // component values starts in column 1
readerType csv;
file "<constant>/p0vsTime.csv";
hasHeaderLine true; // skip first line
timeColumn 0; // time is in column 0
valueColumns (1); // value starts in column 1
\endverbatim
Note
- Accessing an empty list results in an error.
- Accessing a list with a single element always returns the same value.

View File

@ -37,7 +37,6 @@ template<class Type>
Foam::labelList Foam::csvTableReader<Type>::getComponentColumns
(
const word& name,
std::initializer_list<std::pair<const char*,int>> compat,
const dictionary& dict
)
{
@ -46,7 +45,7 @@ Foam::labelList Foam::csvTableReader<Type>::getComponentColumns
labelList cols;
ITstream& is = dict.lookupCompat(name, compat);
ITstream& is = dict.lookup(name);
is.format(IOstream::ASCII);
is >> cols;
dict.checkITstream(is, name);
@ -114,11 +113,8 @@ Foam::csvTableReader<Type>::csvTableReader(const dictionary& dict)
:
tableReader<Type>(dict),
headerLine_(dict.get<bool>("hasHeaderLine")),
refColumn_(dict.getCompat<label>("refColumn", {{"timeColumn", 1912}})),
componentColumns_
(
getComponentColumns("componentColumns", {{"valueColumns", 1912}}, dict)
),
refColumn_(dict.get<label>("timeColumn")),
componentColumns_(getComponentColumns("valueColumns", dict)),
separator_(dict.getOrDefault<string>("separator", ",")[0])
{}
@ -222,9 +218,9 @@ void Foam::csvTableReader<Type>::write(Ostream& os) const
tableReader<Type>::write(os);
os.writeEntry("hasHeaderLine", headerLine_);
os.writeEntry("refColumn", refColumn_);
os.writeEntry("timeColumn", refColumn_);
// Force writing labelList in ASCII
// Force writing labelList in ascii
const enum IOstream::streamFormat fmt = os.format();
os.format(IOstream::ASCII);
os.writeEntry("componentColumns", componentColumns_);

View File

@ -76,7 +76,6 @@ class csvTableReader
static labelList getComponentColumns
(
const word& name,
std::initializer_list<std::pair<const char*,int>> compat,
const dictionary& dict
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -86,7 +86,7 @@ Foam::mapPolyMesh::mapPolyMesh(const polyMesh& mesh)
forAll(faceZoneFaceMap_, zonei)
{
faceZoneFaceMap_[zonei] = identity(mesh.faceZones()[zonei].size());
pointZoneMap_[zonei] = identity(mesh.faceZones()[zonei].size());
}
forAll(cellZoneMap_, zonei)

View File

@ -264,7 +264,7 @@ void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const
os.writeEntry("nHeaderLine", nHeaderLine_);
os.writeEntry("refColumn", refColumn_);
// Force writing labelList in ASCII
// Force writing labelList in ascii
const enum IOstream::streamFormat fmt = os.format();
os.format(IOstream::ASCII);
os.writeEntry("componentColumns", componentColumns_);

View File

@ -1,6 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------

View File

@ -190,15 +190,6 @@ realizableKE<BasicTurbulenceModel>::realizableKE
1.2
)
),
implicitKEpsilonSource_
(
Switch::lookupOrAddToDict
(
"implicitKEpsilonSource",
this->coeffDict_,
false
)
),
k_
(
@ -246,11 +237,6 @@ bool realizableKE<BasicTurbulenceModel>::read()
C2_.readIfPresent(this->coeffDict());
sigmak_.readIfPresent(this->coeffDict());
sigmaEps_.readIfPresent(this->coeffDict());
implicitKEpsilonSource_.readIfPresent
(
"implicitKEpsilonSource",
this->coeffDict()
);
return true;
}
@ -302,41 +288,6 @@ void realizableKE<BasicTurbulenceModel>::correct()
)
);
tmp<fvScalarMatrix> tEpsilonSourceEq
(
new fvScalarMatrix
(
epsilon_,
dimVolume*rho.dimensions()*epsilon_.dimensions()/dimTime
)
);
tmp<volScalarField> Cmu(rCmu(tgradU(), S2, magS));
if (implicitKEpsilonSource_)
{
tmp<volScalarField> tEpsSp
(
- C1*alpha*rho*eta/sqrt(this->nut_/Cmu())
+ alpha*rho*C2_/(sqrt(this->nut_/Cmu()) + sqrt(this->nu()))
);
tEpsilonSourceEq.ref() +=
0.5*tEpsSp()*pow(epsilon_, 1.5)
- fvm::Sp(1.5*tEpsSp()*sqrt(epsilon_), epsilon_);
}
else
{
tEpsilonSourceEq.ref() +=
C1*alpha*rho*magS*epsilon_
- fvm::Sp
(
C2_*alpha*rho*epsilon_/(k_ + sqrt(nuLimited*epsilon_)),
epsilon_
);
}
// Dissipation equation
tmp<fvScalarMatrix> epsEqn
(
@ -344,7 +295,12 @@ void realizableKE<BasicTurbulenceModel>::correct()
+ fvm::div(alphaRhoPhi, epsilon_)
- fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
==
tEpsilonSourceEq()
C1*alpha*rho*magS*epsilon_
- fvm::Sp
(
C2_*alpha*rho*epsilon_/(k_ + sqrt(nuLimited*epsilon_)),
epsilon_
)
+ epsilonSource()
+ fvOptions(alpha, rho, epsilon_)
);
@ -358,26 +314,6 @@ void realizableKE<BasicTurbulenceModel>::correct()
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> tkSourceEq
(
new fvScalarMatrix
(
k_,
dimVolume*rho.dimensions()*k_.dimensions()/dimTime
)
);
if (implicitKEpsilonSource_)
{
tkSourceEq.ref() +=
alpha*rho*G + alpha*alpha*rho*rho*Cmu()/this->nut_*sqr(k_)
- fvm::Sp(2.0*alpha*alpha*rho*rho*Cmu()*k_/this->nut_, k_);
}
else
{
tkSourceEq.ref() += alpha*rho*G - fvm::Sp(alpha*rho*epsilon_/k_, k_);
}
tmp<fvScalarMatrix> kEqn
(
@ -385,8 +321,9 @@ void realizableKE<BasicTurbulenceModel>::correct()
+ fvm::div(alphaRhoPhi, k_)
- fvm::laplacian(alpha*rho*DkEff(), k_)
==
alpha*rho*G
- fvm::SuSp(2.0/3.0*alpha*rho*divU, k_)
+ tkSourceEq()
- fvm::Sp(alpha*rho*epsilon_/k_, k_)
+ kSource()
+ fvOptions(alpha, rho, k_)
);

View File

@ -97,9 +97,6 @@ protected:
dimensionedScalar sigmak_;
dimensionedScalar sigmaEps_;
//- Use implicit k-Epilon source
Switch implicitKEpsilonSource_;
// Fields

View File

@ -12,7 +12,7 @@ warning="==> skip optional libccm adapter"
# Link with static libccmio only (fewer issues)
if have_ccmio
then
wmake $targetType || echo "$warning (build issues detected)"
wmake libso || echo "$warning (build issues detected)"
else
echo $warning
fi

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2010-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -261,14 +261,7 @@ Foam::tmp<GeomField> Foam::expressions::fvExprDriver::getOrReadFieldImpl
tfield.reset
(
GeomField::New
(
name,
meshRef,
dimensioned<Type>(Zero),
// Patch is zeroGradient (volFields) or calculated (other)
defaultBoundaryType(GeomField::null())
)
GeomField::New(name, meshRef, dimensioned<Type>(Zero))
);
GeomField& fld = tfield.ref();

View File

@ -31,7 +31,6 @@ License
#include "fvMesh.H"
#include "fvPatch.H"
#include "pointMesh.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -98,6 +97,7 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
else
{
// No gradient expression - same as Zero
if (debug_)
{
Info<< "No gradientExpr" << nl;
@ -106,14 +106,7 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
if (dict.readIfPresent("fractionExpr", expr))
{
stringOps::inplaceTrim(expr);
if (expr == "0" || expr == "1")
{
// Special cases, handled with more efficiency
fracExpr_ = expr;
}
else if (!expr.empty())
if (!expr.empty() && expr != "0")
{
if (isPointVal)
{
@ -123,9 +116,11 @@ Foam::expressions::patchExprFieldBase::patchExprFieldBase
fracExpr_ = expressions::exprString(expr, dict);
}
}
// No fraction expression? - defer treatment to inherited BC
// Mixed BC may elect to simply ignore gradient expression
else
{
// No fraction expression - same as 1 (one)
// Mixed BC may elect to simply ignore gradient expression
}
}
}

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019-2020 OpenCFD Ltd.
Original code Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -89,7 +89,7 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
setDebug();
DebugInFunction << nl;
// Require valueExpr
// Basic sanity
if (this->valueExpr_.empty())
{
FatalIOErrorInFunction(dict)
@ -97,7 +97,6 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
<< exit(FatalIOError);
}
driver_.readDict(dict);
if (dict.found("value"))
@ -111,12 +110,11 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
{
(*this) == this->patchInternalField();
#ifdef FULLDEBUG
WarningInFunction
<< "No value defined for "
<< this->internalField().name() << " on "
<< this->patch().name() << " - using patch internal field" << endl;
#endif
<< this->patch().name() << " - setting to internalField value "
<< nl;
}
if (this->evalOnConstruct_)
@ -163,29 +161,31 @@ Foam::exprFixedValueFvPatchField<Type>::exprFixedValueFvPatchField
template<class Type>
void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
if (debug)
{
InfoInFunction
<< "Value: " << this->valueExpr_ << nl
<< "Variables: ";
driver_.writeVariableStrings(Info) << nl;
Info<< "... updating" << endl;
driver_.writeVariableStrings(Info) << endl;
}
if (this->updated())
{
return;
}
DebugInFunction
<< "updating" << nl;
// Expression evaluation
{
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
driver_.clearVariables();
if (evalValue)
if (this->valueExpr_.empty())
{
(*this) == Zero;
}
else
{
tmp<Field<Type>> tresult(driver_.evaluate<Type>(this->valueExpr_));
@ -196,10 +196,6 @@ void Foam::exprFixedValueFvPatchField<Type>::updateCoeffs()
(*this) == tresult;
}
else
{
(*this) == Zero;
}
}
fixedValueFvPatchField<Type>::updateCoeffs();

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019-2020 OpenCFD Ltd.
Original code Copyright (C) 2009-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -91,51 +91,20 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
setDebug();
DebugInFunction << nl;
// Require one or both of valueExpr, gradientExpr
// Basic sanity checks
if (this->valueExpr_.empty() && this->gradExpr_.empty())
{
FatalIOErrorInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Require either or both: valueExpr and gradientExpr" << nl
<< exit(FatalIOError);
}
if (this->fracExpr_.empty())
{
// No fractionExpr. Expect only one of valueExpr or gradientExpr
if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
{
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Recommend using fractionExpr when specifying both"
<< " valueExpr and gradientExpr. Assuming a value of 1."
<< nl << endl;
}
}
else if (this->fracExpr_ == "0")
{
// Gradient only. Expect gradientExpr
if (this->gradExpr_.empty())
{
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Gradient only, but did not specify gradientExpr."
<< nl << endl;
}
}
else if (this->fracExpr_ == "1")
{
// Value only. Expect valueExpr
if (this->valueExpr_.empty())
{
IOWarningInFunction(dict)
<< "For " << this->internalField().name() << " on "
<< this->patch().name() << nl
<< "Value only, but did not specify valueExpr."
<< nl << endl;
FatalIOErrorInFunction(dict)
<< "The valueExpr was not defined!" << nl
<< exit(FatalIOError);
}
if (this->gradExpr_.empty())
{
FatalIOErrorInFunction(dict)
<< "The gradientExpr was not defined!" << nl
<< exit(FatalIOError);
}
}
@ -145,12 +114,14 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
// Similar to fvPatchField constructor, which we have bypassed
dict.readIfPresent("patchType", this->patchType());
bool needsRefValue = true;
if (dict.found("refValue"))
{
needsRefValue = false;
this->refValue() = Field<Type>("refValue", dict, p.size());
}
else
{
this->refValue() = this->patchInternalField();
}
if (dict.found("value"))
{
@ -159,27 +130,22 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
Field<Type>("value", dict, p.size())
);
if (needsRefValue)
if (!dict.found("refValue"))
{
// Ensure refValue has a sensible value for the "update" below
this->refValue() = static_cast<const Field<Type>&>(*this);
this->refValue() = Field<Type>("value", dict, p.size());
}
}
else
{
if (needsRefValue)
{
this->refValue() = this->patchInternalField();
}
fvPatchField<Type>::operator=(this->refValue());
#ifdef FULLDEBUG
WarningInFunction
<< "No value defined for "
<< this->internalField().name() << " on "
<< this->patch().name() << " - using patch internal field" << endl;
#endif
<< this->internalField().name()
<< " on " << this->patch().name() << " therefore using "
<< "the internal field next to the patch"
<< endl;
}
@ -198,7 +164,7 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
}
else
{
this->valueFraction() = scalar(1);
this->valueFraction() = 1;
}
@ -268,11 +234,6 @@ Foam::exprMixedFvPatchField<Type>::exprMixedFvPatchField
template<class Type>
void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
if (debug)
{
InfoInFunction
@ -280,67 +241,45 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
<< "Gradient: " << this->gradExpr_ << nl
<< "Fraction: " << this->fracExpr_ << nl
<< "Variables: ";
driver_.writeVariableStrings(Info) << nl;
Info<< "... updating" << endl;
driver_.writeVariableStrings(Info) << endl;
}
if (this->updated())
{
return;
}
DebugInFunction << " - updating" << nl;
// Expression evaluation
{
bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ != "0");
bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ != "0");
bool evalFrac = (!this->fracExpr_.empty());
scalar fraction = 1;
// Have one or both of valueExpr, gradientExpr (checked in constructor)
driver_.clearVariables();
if (this->valueExpr_.empty())
{
// No value expression -> gradient only
fraction = 0;
evalValue = false;
evalFrac = false;
}
else if (this->gradExpr_.empty())
{
// No gradient expression -> value only
fraction = 1;
evalGrad = false;
evalFrac = false;
}
else if (this->fracExpr_.empty())
{
// No fractionExpr, but has both valueExpr and gradientExpr
// -> treat as value only (warning in constructor)
fraction = 1;
evalGrad = false;
evalFrac = false;
}
else if (this->fracExpr_ == "0")
{
// Gradient only
fraction = 0;
evalValue = false;
evalFrac = false;
}
else if (this->fracExpr_ == "1")
{
// Value only
fraction = 1;
evalGrad = false;
evalFrac = false;
}
driver_.clearVariables();
if (evalValue)
{
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
this->refValue() = Zero;
}
else
{
this->refValue() = Zero;
this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
}
bool evalGrad = !this->gradExpr_.empty();
if (this->fracExpr_.empty() || this->fracExpr_ == "1")
{
evalGrad = false;
this->valueFraction() = scalar(1);
}
else if (this->fracExpr_ == "0")
{
this->valueFraction() = Zero;
}
else
{
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
}
if (evalGrad)
@ -351,15 +290,6 @@ void Foam::exprMixedFvPatchField<Type>::updateCoeffs()
{
this->refGrad() = Zero;
}
if (evalFrac)
{
this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
}
else
{
this->valueFraction() = fraction;
}
}
mixedFvPatchField<Type>::updateCoeffs();

View File

@ -1,276 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "relaxedNonOrthoGaussLaplacianScheme.H"
#include "surfaceInterpolate.H"
#include "fvcDiv.H"
#include "fvcGrad.H"
#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type, class GType>
tmp<fvMatrix<Type>>
relaxedNonOrthoGaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const surfaceScalarField& deltaCoeffs,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type>> tfvm
(
new fvMatrix<Type>
(
vf,
deltaCoeffs.dimensions()*gammaMagSf.dimensions()*vf.dimensions()
)
);
fvMatrix<Type>& fvm = tfvm.ref();
fvm.upper() = deltaCoeffs.primitiveField()*gammaMagSf.primitiveField();
fvm.negSumDiag();
forAll(vf.boundaryField(), patchi)
{
const fvPatchField<Type>& pvf = vf.boundaryField()[patchi];
const fvsPatchScalarField& pGamma = gammaMagSf.boundaryField()[patchi];
const fvsPatchScalarField& pDeltaCoeffs =
deltaCoeffs.boundaryField()[patchi];
if (pvf.coupled())
{
fvm.internalCoeffs()[patchi] =
pGamma*pvf.gradientInternalCoeffs(pDeltaCoeffs);
fvm.boundaryCoeffs()[patchi] =
-pGamma*pvf.gradientBoundaryCoeffs(pDeltaCoeffs);
}
else
{
fvm.internalCoeffs()[patchi] = pGamma*pvf.gradientInternalCoeffs();
fvm.boundaryCoeffs()[patchi] = -pGamma*pvf.gradientBoundaryCoeffs();
}
}
return tfvm;
}
template<class Type, class GType>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
relaxedNonOrthoGaussLaplacianScheme<Type, GType>::gammaSnGradCorr
(
const surfaceVectorField& SfGammaCorr,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = this->mesh();
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tgammaSnGradCorr
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
"gammaSnGradCorr("+vf.name()+')',
vf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
SfGammaCorr.dimensions()
*vf.dimensions()*mesh.deltaCoeffs().dimensions()
)
);
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
{
tgammaSnGradCorr.ref().replace
(
cmpt,
fvc::dotInterpolate(SfGammaCorr, fvc::grad(vf.component(cmpt)))
);
}
return tgammaSnGradCorr;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type, class GType>
tmp<GeometricField<Type, fvPatchField, volMesh>>
relaxedNonOrthoGaussLaplacianScheme<Type, GType>::fvcLaplacian
(
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = this->mesh();
tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian
(
fvc::div(this->tsnGradScheme_().snGrad(vf)*mesh.magSf())
);
tLaplacian.ref().rename("laplacian(" + vf.name() + ')');
return tLaplacian;
}
template<class Type, class GType>
tmp<fvMatrix<Type>>
relaxedNonOrthoGaussLaplacianScheme<Type, GType>::fvmLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = this->mesh();
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SType;
const surfaceVectorField Sn(mesh.Sf()/mesh.magSf());
const surfaceVectorField SfGamma(mesh.Sf() & gamma);
const GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn
(
SfGamma & Sn
);
const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn);
tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected
(
SfGammaSn,
this->tsnGradScheme_().deltaCoeffs(vf),
vf
);
fvMatrix<Type>& fvm = tfvm.ref();
tmp<SType> tfaceFluxCorrection = gammaSnGradCorr(SfGammaCorr, vf);
if (this->tsnGradScheme_().corrected())
{
tfaceFluxCorrection.ref() +=
SfGammaSn*this->tsnGradScheme_().correction(vf);
}
const word corrName(tfaceFluxCorrection().name());
tmp<SType> trelaxedCorrection(new SType(tfaceFluxCorrection()));
const word oldName(corrName + "_0");
const scalar relax(vf.mesh().equationRelaxationFactor(oldName));
const objectRegistry& obr = vf.db();
if (obr.foundObject<SType>(oldName))
{
SType& oldCorrection = obr.lookupObjectRef<SType>(oldName);
trelaxedCorrection.ref() *= relax;
trelaxedCorrection.ref() += (1.0-relax)*oldCorrection;
oldCorrection = tfaceFluxCorrection;
}
else
{
SType* s = new SType(oldName, tfaceFluxCorrection);
s->store();
}
fvm.source() -=
mesh.V()
*fvc::div
(
trelaxedCorrection()
)().primitiveField();
if (mesh.fluxRequired(vf.name()))
{
fvm.faceFluxCorrectionPtr() = trelaxedCorrection.ptr();
}
return tfvm;
}
template<class Type, class GType>
tmp<GeometricField<Type, fvPatchField, volMesh>>
relaxedNonOrthoGaussLaplacianScheme<Type, GType>::fvcLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = this->mesh();
const surfaceVectorField Sn(mesh.Sf()/mesh.magSf());
const surfaceVectorField SfGamma(mesh.Sf() & gamma);
const GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn
(
SfGamma & Sn
);
const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn);
tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian
(
fvc::div
(
SfGammaSn*this->tsnGradScheme_().snGrad(vf)
+ gammaSnGradCorr(SfGammaCorr, vf)
)
);
tLaplacian.ref().rename
(
"laplacian(" + gamma.name() + ',' + vf.name() + ')'
);
return tLaplacian;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,190 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 <http://www.gnu.org/licenses/>.
Class
Foam::fv::relaxedNonOrthoGaussLaplacianScheme
Description
Basic second-order laplacian using face-gradients and Gauss' theorem.
SourceFiles
relaxedNonOrthoGaussLaplacianScheme.C
\*---------------------------------------------------------------------------*/
#ifndef relaxedNonOrthoGaussLaplacianScheme_H
#define relaxedNonOrthoGaussLaplacianScheme_H
#include "laplacianScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
/*---------------------------------------------------------------------------*\
Class relaxedNonOrthoGaussLaplacianScheme Declaration
\*---------------------------------------------------------------------------*/
template<class Type, class GType>
class relaxedNonOrthoGaussLaplacianScheme
:
public fv::laplacianScheme<Type, GType>
{
// Private Member Functions
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> gammaSnGradCorr
(
const surfaceVectorField& SfGammaCorr,
const GeometricField<Type, fvPatchField, volMesh>&
);
//- No copy construct
relaxedNonOrthoGaussLaplacianScheme
(
const relaxedNonOrthoGaussLaplacianScheme&
) = delete;
//- No copy assignment
void operator=(const relaxedNonOrthoGaussLaplacianScheme&) = delete;
public:
//- Runtime type information
TypeName("relaxedNonOrthoGauss");
// Constructors
//- Construct null
relaxedNonOrthoGaussLaplacianScheme(const fvMesh& mesh)
:
laplacianScheme<Type, GType>(mesh)
{}
//- Construct from Istream
relaxedNonOrthoGaussLaplacianScheme(const fvMesh& mesh, Istream& is)
:
laplacianScheme<Type, GType>(mesh, is)
{}
//- Construct from mesh, interpolation and snGradScheme schemes
relaxedNonOrthoGaussLaplacianScheme
(
const fvMesh& mesh,
const tmp<surfaceInterpolationScheme<GType>>& igs,
const tmp<snGradScheme<Type>>& sngs
)
:
laplacianScheme<Type, GType>(mesh, igs, sngs)
{}
//- Destructor
virtual ~relaxedNonOrthoGaussLaplacianScheme() = default;
// Member Functions
static tmp<fvMatrix<Type>> fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const surfaceScalarField& deltaCoeffs,
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvPatchField, volMesh>> fvcLaplacian
(
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type>> fvmLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvPatchField, volMesh>> fvcLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
};
// Use macros to emulate partial-specialisation of the Laplacian functions
// for scalar diffusivity gamma
#define defineFvmLaplacianScalarGamma(Type) \
\
template<> \
tmp<fvMatrix<Type>> \
relaxedNonOrthoGaussLaplacianScheme<Type, scalar>::fvmLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>&, \
const GeometricField<Type, fvPatchField, volMesh>& \
); \
\
template<> \
tmp<GeometricField<Type, fvPatchField, volMesh>> \
relaxedNonOrthoGaussLaplacianScheme<Type, scalar>::fvcLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>&, \
const GeometricField<Type, fvPatchField, volMesh>& \
);
defineFvmLaplacianScalarGamma(scalar);
defineFvmLaplacianScalarGamma(vector);
defineFvmLaplacianScalarGamma(sphericalTensor);
defineFvmLaplacianScalarGamma(symmTensor);
defineFvmLaplacianScalarGamma(tensor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "relaxedNonOrthoGaussLaplacianScheme.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,140 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "relaxedNonOrthoGaussLaplacianScheme.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvLaplacianScheme(relaxedNonOrthoGaussLaplacianScheme)
#define declareFvmLaplacianScalarGamma(Type) \
\
template<> \
Foam::tmp<Foam::fvMatrix<Foam::Type>> \
Foam::fv::relaxedNonOrthoGaussLaplacianScheme<Foam::Type, Foam::scalar>:: \
fvmLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
const GeometricField<Type, fvPatchField, volMesh>& vf \
) \
{ \
const fvMesh& mesh = this->mesh(); \
\
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SType; \
\
GeometricField<scalar, fvsPatchField, surfaceMesh> gammaMagSf \
( \
gamma*mesh.magSf() \
); \
\
tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected \
( \
gammaMagSf, \
this->tsnGradScheme_().deltaCoeffs(vf), \
vf \
); \
fvMatrix<Type>& fvm = tfvm.ref(); \
\
if (this->tsnGradScheme_().corrected()) \
{ \
tmp<SType> tCorr(this->tsnGradScheme_().correction(vf)); \
const word corrName(tCorr().name()); \
tmp<SType> tfaceFluxCorrection(gammaMagSf*tCorr); \
\
tmp<SType> trelaxedCorrection(new SType(tfaceFluxCorrection())); \
\
const word oldName(corrName + "_0"); \
const scalar relax(vf.mesh().equationRelaxationFactor(corrName)); \
const objectRegistry& obr = vf.db(); \
if (obr.foundObject<SType>(oldName)) \
{ \
SType& oldCorrection = obr.lookupObjectRef<SType>(oldName); \
trelaxedCorrection.ref() *= relax; \
trelaxedCorrection.ref() += (1.0-relax)*oldCorrection; \
\
oldCorrection = trelaxedCorrection(); \
} \
else \
{ \
SType* s = new SType(oldName, tfaceFluxCorrection); \
s->store(); \
} \
\
tmp<Field<Type>> tcorr \
( \
mesh.V() \
*fvc::div \
( \
trelaxedCorrection() \
)().primitiveField() \
); \
\
fvm.source() -= tcorr(); \
\
if (mesh.fluxRequired(vf.name())) \
{ \
fvm.faceFluxCorrectionPtr() = trelaxedCorrection.ptr(); \
} \
} \
\
return tfvm; \
} \
\
\
template<> \
Foam::tmp<Foam::GeometricField<Foam::Type, Foam::fvPatchField, Foam::volMesh>> \
Foam::fv::relaxedNonOrthoGaussLaplacianScheme<Foam::Type, Foam::scalar>::fvcLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
const GeometricField<Type, fvPatchField, volMesh>& vf \
) \
{ \
const fvMesh& mesh = this->mesh(); \
\
tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian \
( \
fvc::div(gamma*this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) \
); \
\
tLaplacian.ref().rename \
( \
"laplacian(" + gamma.name() + ',' + vf.name() + ')' \
); \
\
return tLaplacian; \
}
declareFvmLaplacianScalarGamma(scalar);
declareFvmLaplacianScalarGamma(vector);
declareFvmLaplacianScalarGamma(sphericalTensor);
declareFvmLaplacianScalarGamma(symmTensor);
declareFvmLaplacianScalarGamma(tensor);
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,7 +68,7 @@ Foam::surfaceInterpolationScheme<Type>::New
"discretisation",
schemeName,
*MeshConstructorTablePtr_
) << exit(FatalIOError);
) << exit(FatalError);
}
return cstrIter()(mesh, schemeData);

View File

@ -127,7 +127,7 @@ void Foam::fv::actuationDiskSource::calcFroudeMethod
Ostream& os = file();
writeCurrentTime(os);
os << Uref << tab << Cp << tab << Ct << tab << a << tab << T
os << Uref << tab << Cp << tab << Ct << tab << a << tab << T << tab
<< endl;
}
}
@ -238,7 +238,7 @@ void Foam::fv::actuationDiskSource::calcVariableScalingMethod
Ostream& os = file();
writeCurrentTime(os);
os << Uref << tab << Cp << tab << Ct << tab
os << Uref << tab << Cp << tab << Ct
<< Udisk << tab << CpStar << tab << CtStar << tab << T << tab << P
<< endl;
}

View File

@ -1157,7 +1157,7 @@ bool Foam::lumpedPointMovement::writeData
const UList<vector>& forces,
const UList<vector>& moments,
const outputFormatType fmt,
const Time* timeinfo
const Tuple2<scalar, scalar>* timesWritten
) const
{
const bool writeMoments = (moments.size() == forces.size());
@ -1165,15 +1165,13 @@ bool Foam::lumpedPointMovement::writeData
if (fmt == outputFormatType::PLAIN)
{
os <<"########" << nl;
if (timeinfo)
if (timesWritten)
{
const Time& t = *timeinfo;
os <<"# Time index=" << t.timeIndex() << nl
<<"# Time value=" << t.timeOutputValue() << nl;
os << "# Time value=" << timesWritten->first() << nl
<< "# Time prev=" << timesWritten->second() << nl;
}
os <<"# size=" << this->size() << nl
<<"# columns (points) (forces)";
os << "# size=" << this->size() << nl
<< "# columns (points) (forces)";
if (writeMoments)
{
@ -1272,12 +1270,10 @@ bool Foam::lumpedPointMovement::writeData
// - ensure lists have consistent format
os <<"////////" << nl;
if (timeinfo)
if (timesWritten)
{
const Time& t = *timeinfo;
os <<"// Time index=" << t.timeIndex() << nl;
os.writeEntry("time", t.timeOutputValue());
os.writeEntry("time", timesWritten->first());
os.writeEntry("prevTime", timesWritten->second());
}
os << nl;
@ -1298,7 +1294,7 @@ bool Foam::lumpedPointMovement::writeData
(
const UList<vector>& forces,
const UList<vector>& moments,
const Time* timeinfo
const Tuple2<scalar, scalar>* timesWritten
) const
{
if (!Pstream::master())
@ -1308,26 +1304,24 @@ bool Foam::lumpedPointMovement::writeData
// Regular output
{
const fileName output(coupler().resolveFile(outputName_));
OFstream os(output, IOstream::ASCII);
OFstream os
(
coupler().resolveFile(outputName_)
);
writeData(os, forces, moments, outputFormat_, timeinfo);
writeData(os, forces, moments, outputFormat_, timesWritten);
}
// Log output
{
const fileName output(coupler().resolveFile(logName_));
OFstream os
(
output,
IOstream::ASCII,
IOstream::currentVersion,
IOstream::UNCOMPRESSED,
true // append mode
coupler().resolveFile(logName_),
IOstreamOption(),
true // append
);
writeData(os, forces, moments, outputFormatType::PLAIN, timeinfo);
writeData(os, forces, moments, outputFormatType::PLAIN, timesWritten);
}
return true;

View File

@ -100,6 +100,7 @@ SourceFiles
#include "primitiveFields.H"
#include "IOobject.H"
#include "tmp.H"
#include "Tuple2.H"
#include "HashPtrTable.H"
#include "externalFileCoupler.H"
#include "lumpedPointController.H"
@ -116,7 +117,6 @@ namespace Foam
class polyMesh;
class polyPatch;
class pointPatch;
class Time;
/*---------------------------------------------------------------------------*\
Class lumpedPointMovement Declaration
@ -423,7 +423,7 @@ public:
const UList<vector>& forces,
const UList<vector>& moments,
const outputFormatType fmt = outputFormatType::PLAIN,
const Time* timeinfo = nullptr
const Tuple2<scalar, scalar>* timesWritten = nullptr
) const;
//- Write points, forces, moments
@ -431,7 +431,7 @@ public:
(
const UList<vector>& forces,
const UList<vector>& moments = List<vector>(),
const Time* timeinfo = nullptr
const Tuple2<scalar, scalar>* timesWritten = nullptr
) const;
//- Read state from file, applying relaxation as requested

View File

@ -208,7 +208,9 @@ lumpedPointDisplacementPointPatchVectorField
)
:
fixedValuePointPatchField<vector>(p, iF),
controllers_()
controllers_(),
dataWritten_(0, 0),
points0Ptr_(nullptr)
{}
@ -221,10 +223,14 @@ lumpedPointDisplacementPointPatchVectorField
)
:
fixedValuePointPatchField<vector>(p, iF, dict),
controllers_()
controllers_(),
dataWritten_(0, 0),
points0Ptr_(nullptr)
{
dict.readIfPresent("controllers", controllers_);
dict.readIfPresent("dataWritten", dataWritten_);
if (controllers_.empty())
{
WarningInFunction
@ -239,26 +245,30 @@ lumpedPointDisplacementPointPatchVectorField
Foam::lumpedPointDisplacementPointPatchVectorField::
lumpedPointDisplacementPointPatchVectorField
(
const lumpedPointDisplacementPointPatchVectorField& pf,
const lumpedPointDisplacementPointPatchVectorField& rhs,
const pointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
fixedValuePointPatchField<vector>(pf, p, iF, mapper),
controllers_(pf.controllers_)
fixedValuePointPatchField<vector>(rhs, p, iF, mapper),
controllers_(rhs.controllers_),
dataWritten_(rhs.dataWritten_),
points0Ptr_(nullptr)
{}
Foam::lumpedPointDisplacementPointPatchVectorField::
lumpedPointDisplacementPointPatchVectorField
(
const lumpedPointDisplacementPointPatchVectorField& pf,
const lumpedPointDisplacementPointPatchVectorField& rhs,
const DimensionedField<vector, pointMesh>& iF
)
:
fixedValuePointPatchField<vector>(pf, iF),
controllers_(pf.controllers_)
fixedValuePointPatchField<vector>(rhs, iF),
controllers_(rhs.controllers_),
dataWritten_(rhs.dataWritten_),
points0Ptr_(nullptr)
{}
@ -336,7 +346,7 @@ void Foam::lumpedPointDisplacementPointPatchVectorField::updateCoeffs()
}
else if (movement().couplingPending(timeIndex))
{
// Trigger is pending, or coupling not yet not initialized
// Trigger is pending, or coupling not yet initialized
triggered = 1;
}
@ -351,21 +361,24 @@ void Foam::lumpedPointDisplacementPointPatchVectorField::updateCoeffs()
Pout<<"gatherForces: " << forces << " called from patch "
<< this->patch().index() << endl;
if (Pstream::master())
{
Pout<<"output forces to file: called from patch "
<< this->patch().index() << nl
<<"# " << forces.size() << " force entries" << nl
<<"# fx fy fz" << nl
<<"output forces to file: "
<< forces << " called from patch "
<< this->patch().index() << endl;
}
Info<< "output forces to file: called from patch "
<< this->patch().index() << nl
<< "# " << forces.size() << " force entries" << nl
<< "# fx fy fz" << nl
<< "output forces to file: "
<< forces << " called from patch "
<< this->patch().index() << endl;
}
// Update times when data (forces) were written
// With first=time, second=prevTime
dataWritten_.second() = dataWritten_.first();
dataWritten_.first() = this->db().time().timeOutputValue();
if (Pstream::master())
{
movement().writeData(forces, moments, &(this->db().time()));
movement().writeData(forces, moments, &dataWritten_);
// Signal external source to execute
movement().coupler().useSlave();
@ -427,6 +440,12 @@ const
os.writeEntry("controllers", controllers_);
}
// Times when data were written is only meaningful on the owner patch
if (movement().ownerId() == this->patch().index())
{
os.writeEntry("dataWritten", dataWritten_);
}
writeEntry("value", os);
}

View File

@ -56,10 +56,7 @@ SourceFiles
#include "fixedValuePointPatchField.H"
#include "lumpedPointMovement.H"
#include "lumpedPointState.H"
#include "lumpedPointIOMovement.H"
#include "labelList.H"
#include "tmp.H"
#include "pointField.H"
#include "pointFieldsFwd.H"
@ -84,13 +81,18 @@ class lumpedPointDisplacementPointPatchVectorField
//- Names of the movement controller(s) in use
wordList controllers_;
//- Times when data (forces) were written
// With first=time, second=prevTime
Tuple2<scalar, scalar> dataWritten_;
//- Backup method for getting "points0" without a motion solver
mutable autoPtr<pointIOField> points0Ptr_;
//- Convenience typedefs
typedef lumpedPointDisplacementPointPatchVectorField patchType;
typedef DimensionedField<vector, pointMesh> fieldType;
// Convenience typedefs
typedef lumpedPointDisplacementPointPatchVectorField patchType;
typedef DimensionedField<vector, pointMesh> fieldType;
protected:
@ -130,7 +132,7 @@ public:
//- Construct by mapping given patchField<vector> onto a new patch
lumpedPointDisplacementPointPatchVectorField
(
const lumpedPointDisplacementPointPatchVectorField& pf,
const lumpedPointDisplacementPointPatchVectorField& rhs,
const pointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const pointPatchFieldMapper& mapper
@ -151,7 +153,7 @@ public:
//- Construct as copy setting internal field reference
lumpedPointDisplacementPointPatchVectorField
(
const lumpedPointDisplacementPointPatchVectorField& pf,
const lumpedPointDisplacementPointPatchVectorField& rhs,
const DimensionedField<vector, pointMesh>& iF
);
@ -171,6 +173,7 @@ public:
);
}
//- Destructor. De-register movement if in use and managed by this patch
virtual ~lumpedPointDisplacementPointPatchVectorField();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,7 +51,10 @@ Foam::gradingDescriptor::gradingDescriptor
nDivFraction_(nDivFraction),
expansionRatio_(expansionRatio)
{
correct();
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
}
@ -64,7 +67,10 @@ Foam::gradingDescriptor::gradingDescriptor
nDivFraction_(1),
expansionRatio_(expansionRatio)
{
correct();
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
}
@ -76,15 +82,6 @@ Foam::gradingDescriptor::gradingDescriptor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradingDescriptor::correct()
{
if (expansionRatio_ < 0)
{
expansionRatio_ = 1.0/(-expansionRatio_);
}
}
Foam::gradingDescriptor Foam::gradingDescriptor::inv() const
{
return gradingDescriptor
@ -132,8 +129,6 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptor& gd)
is.readEnd("gradingDescriptor");
}
gd.correct();
is.check(FUNCTION_NAME);
return is;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +57,7 @@ SourceFiles
namespace Foam
{
// Forward Declarations
// Forward declarations
class Istream;
class Ostream;
class gradingDescriptor;
@ -81,13 +81,12 @@ class gradingDescriptor
public:
// Friendship with gradingDescriptors
friend class gradingDescriptors;
// Constructors
//- Default construct (1, 1, 1)
//- Default constructor
gradingDescriptor();
//- Construct from components
@ -111,6 +110,8 @@ public:
// Member Functions
// Access
scalar blockFraction() const
{
return blockFraction_;
@ -126,9 +127,7 @@ public:
return expansionRatio_;
}
//- Adjust expansion ratio.
// Trap negative value and treat as its inverse.
void correct();
// Member Functions
//- Return the inverse gradingDescriptor with 1/expansionRatio
gradingDescriptor inv() const;
@ -144,6 +143,8 @@ public:
friend Istream& operator>>(Istream&, gradingDescriptor&);
friend Ostream& operator<<(Ostream&, const gradingDescriptor&);
friend Istream& operator>>(Istream&, gradingDescriptors&);
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,16 +32,7 @@ License
Foam::gradingDescriptors::gradingDescriptors()
:
List<gradingDescriptor>(1, gradingDescriptor())
{}
Foam::gradingDescriptors::gradingDescriptors
(
const label len
)
:
List<gradingDescriptor>(len, gradingDescriptor())
gradingDescriptors(gradingDescriptor())
{}
@ -53,35 +44,6 @@ Foam::gradingDescriptors::gradingDescriptors(const gradingDescriptor& gd)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gradingDescriptors::correct()
{
for (gradingDescriptor& gd : *this)
{
gd.correct();
}
}
void Foam::gradingDescriptors::normalise()
{
scalar sumBlockFraction = 0;
scalar sumNDivFraction = 0;
for (const gradingDescriptor& gd : *this)
{
sumBlockFraction += gd.blockFraction_;
sumNDivFraction += gd.nDivFraction_;
}
for (gradingDescriptor& gd : *this)
{
gd.blockFraction_ /= sumBlockFraction;
gd.nDivFraction_ /= sumNDivFraction;
gd.correct();
}
}
Foam::gradingDescriptors Foam::gradingDescriptors::inv() const
{
gradingDescriptors ret(*this);
@ -105,7 +67,6 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
if (t.isNumber())
{
gds = gradingDescriptors(gradingDescriptor(t.number()));
gds.correct();
}
else
{
@ -114,10 +75,28 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
// Read the list for gradingDescriptors
is >> static_cast<List<gradingDescriptor>&>(gds);
gds.normalise();
// Check state of Istream
is.check(FUNCTION_NAME);
// Normalize the blockFractions and nDivFractions
// of the list of gradingDescriptors
scalar sumBlockFraction = 0;
scalar sumNDivFraction = 0;
forAll(gds, i)
{
sumBlockFraction += gds[i].blockFraction_;
sumNDivFraction += gds[i].nDivFraction_;
}
forAll(gds, i)
{
gds[i].blockFraction_ /= sumBlockFraction;
gds[i].nDivFraction_ /= sumNDivFraction;
}
}
is.check(FUNCTION_NAME);
return is;
}

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,9 +46,10 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class Istream;
// Forward declarations
class gradingDescriptors;
class Istream;
Istream& operator>>(Istream& is, gradingDescriptors& gd);
/*---------------------------------------------------------------------------*\
@ -64,26 +64,15 @@ public:
// Constructors
//- Default construct with a single default gradingDescriptor
//- Default constructor
gradingDescriptors();
//- Construct with specified number of default gradingDescriptor
explicit gradingDescriptors(const label len);
//- Construct from a single gradingDescriptor
explicit gradingDescriptors(const gradingDescriptor& gd);
//- Construct from a gradingDescriptor
gradingDescriptors(const gradingDescriptor& gd);
// Member Functions
//- Adjust expansion ratios.
// Trap negative value and treat as its inverse.
void correct();
//- Normalize blockFractions and nDivFractions for the list
//- of gradingDescriptors, and call correct()
void normalise();
//- Return the inverse gradingDescriptors with 1/expansionRatio
gradingDescriptors inv() const;

View File

@ -78,7 +78,7 @@ void Foam::regionToFace::markZone
const indirectPrimitivePatch& patch,
const label proci,
const label facei,
const label zonei,
const label zoneI,
labelList& faceZone
) const
{
@ -100,7 +100,7 @@ void Foam::regionToFace::markZone
edgeTopoDistanceData<label>
(
0, // distance
zonei
zoneI
)
);
}
@ -124,13 +124,9 @@ void Foam::regionToFace::markZone
forAll(allFaceInfo, facei)
{
if
(
allFaceInfo[facei].valid(calc.data())
&& allFaceInfo[facei].data() == zonei
)
if (allFaceInfo[facei].data() == zoneI)
{
faceZone[facei] = zonei;
faceZone[facei] = zoneI;
}
}
}

View File

@ -1,6 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch

View File

@ -27,6 +27,7 @@ boundaryField
outOfBounds clamp;
direction in;
readerType openFoam;
hasHeaderLine true;
file "<constant>/FluxVsdP.dat";
//nonDimensional true;
//rpm 300;

View File

@ -24,8 +24,6 @@ RAS
turbulence on;
printCoeffs on;
implicitKEpsilonSource true;
}

View File

@ -22,14 +22,14 @@ solvers
solver GAMG;
smoother GaussSeidel;
tolerance 1e-09;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
$p;
tolerance 1e-09;
tolerance 1e-06;
relTol 0;
}
@ -37,14 +37,14 @@ solvers
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-015;
tolerance 1e-05;
relTol 0.1;
}
"(U|k|epsilon)Final"
{
$U;
tolerance 1e-15;
tolerance 1e-05;
relTol 0;
}
}
@ -61,14 +61,12 @@ PIMPLE
SIMPLE
{
nNonOrthogonalCorrectors 0;
/*
residualControl
{
p 1e-2;
U 1e-3;
"(k|epsilon)" 1e-3;
}
*/
}
relaxationFactors
@ -81,7 +79,7 @@ relaxationFactors
{
U 0.7;
k 0.7;
epsilon 0.7;
"epsilon.*" 0.7;
}
}

View File

@ -26,8 +26,6 @@ RAS
turbulence on;
printCoeffs on;
implicitKEpsilonSource true;
}

View File

@ -90,7 +90,6 @@ search_scotch()
then
header=$(findFirstFile \
"$prefix/include/$localDir/$incName" \
"$prefix/include/scotch/$incName" \
"$prefix/include/$incName" \
)
library=$(findExtLib "$libName")
@ -202,15 +201,12 @@ search_ptscotch()
header=$(findFirstFile \
"$prefix/include/$FOAM_MPI/$incName" \
"$prefix/include/$localDir/$incName" \
"$prefix/include/ptscotch/$incName" \
"$prefix/include/scotch/$incName" \
"$prefix/include/$incName"
)
library="$(findExtLib $FOAM_MPI/$libName $libName)"
elif isSystem "$prefix"
then
header=$(findFirstFile \
"/usr/local/include/$localDir/$incName" \
"/usr/local/include/ptscotch/$incName" \
"/usr/local/include/scotch/$incName" \
"/usr/local/include/$incName" \

View File

@ -173,18 +173,13 @@ findObjectDir()
# Default (local) build directory
if [ -z "$objectsDir" ]
then
if [ -d "$absdir/Make" ]
then
objectsDir="${absdir}/Make/${WM_OPTIONS}"
else
relativeDir="$absdir"
appDir=.
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
absdir=$(expandPath "$appDir"/.)
relativeDir="$absdir"
appDir=.
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
absdir=$(expandPath "$appDir"/.)
relativeDir="${relativeDir#${absdir}}"
objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}"
fi
relativeDir="${relativeDir#${absdir}}"
objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}"
fi
echo "$objectsDir"

View File

@ -313,18 +313,16 @@ fi
# Clean the 'Make' directory if present
#------------------------------------------------------------------------------
if [ -d "$MakeDir" ] && [ -n "$WM_OPTIONS" ]
if [ -d "$MakeDir" ]
then
# Remove in-source directory (if any)
rm -rf "$MakeDir/$WM_OPTIONS" 2>/dev/null
# Remove out-of-source directory (if applicable)
relativeDir="${PWD#${WM_PROJECT_DIR}/}"
if [ "$relativeDir" != "$PWD" ]
then
objectsDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${relativeDir}"
rm -rf "$objectsDir" 2>/dev/null
fi
objectsDir="$MakeDir/$WM_OPTIONS"
case "$PWD" in
("$WM_PROJECT_DIR"/*)
buildPath="$WM_PROJECT_DIR/build/${WM_OPTIONS}"
objectsDir=$buildPath$(echo $PWD | sed s%$WM_PROJECT_DIR%% )
;;
esac
rm -rf "$objectsDir" 2>/dev/null
fi
#------------------------------------------------------------------------------

View File

@ -177,8 +177,6 @@ die()
# Default make is the "make" in the path
make="make"
# Print compiler/system information (serial only)
printInfo() { make --no-print-directory -f "$WM_DIR"/makefiles/info "$@"; }
#------------------------------------------------------------------------------
@ -270,11 +268,11 @@ do
-show-api | -show-ext-so | \
-show-compile-c | -show-c | -show-cflags | -show-cflags-arch | \
-show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch )
printInfo "${1#-show-}"
$make -f $WM_DIR/makefiles/info "${1#-show-}"
optShow=true
;;
-show-path-c | -show-path-cxx )
command -v $(printInfo "${1#-show-path-}")
command -v $($make -f $WM_DIR/makefiles/info "${1#-show-path-}")
optShow=true
;;
-a | -all | all)
@ -325,7 +323,7 @@ do
: "${optAll:=all}" # implies 'all', unless previously set
;;
-version | --version)
printInfo api
$make -f $WM_DIR/makefiles/info api
optShow=true
break;
;;