Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Mark Olesen 2022-08-19 12:50:50 +02:00
commit 5218bfd721
12 changed files with 125 additions and 58 deletions

View File

@ -62,8 +62,8 @@ Usage
-rotate-z angle
Rotate (degrees) about z-axis.
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
or -yawPitchRoll : (yaw pitch roll) degrees
or -rollPitchYaw : (roll pitch yaw) degrees
-scale scalar|vector
Scale the points by the given scalar or vector on output.
@ -268,15 +268,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -437,18 +440,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
@ -545,15 +548,15 @@ int main(int argc, char *argv[])
}
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

View File

@ -109,6 +109,7 @@ Note
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "processorFvPatchField.H"
#include "wallFvPatch.H"
#include "fixedValueFvPatchFields.H"
@ -122,6 +123,40 @@ void InfoField(const word& fldName)
}
template<class Type>
void correctProcessorPatches
(
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
if (!Pstream::parRun())
{
return;
}
// Not possible to use correctBoundaryConditions on fields as they may
// use local info as opposed to the constraint values employed here,
// but still need to update processor patches
auto& bf = vf.boundaryFieldRef();
forAll(bf, patchi)
{
if (isA<processorFvPatchField<Type>>(bf[patchi]))
{
bf[patchi].initEvaluate();
}
}
forAll(bf, patchi)
{
if (isA<processorFvPatchField<Type>>(bf[patchi]))
{
bf[patchi].evaluate();
}
}
}
IOobject createIOobject
(
const fvMesh& mesh,
@ -447,22 +482,26 @@ int main(int argc, char *argv[])
// (M:Eq. 9)
const dimensionedScalar maxU(dimVelocity, SMALL);
U *= min(scalar(1), fRei*uTau/max(mag(U), maxU));
correctProcessorPatches<vector>(U);
}
if (tepsilon.valid())
{
tepsilon.ref() = epsilon;
correctProcessorPatches<scalar>(tepsilon.ref());
}
if (tk.valid())
{
tk.ref() = k;
correctProcessorPatches<scalar>(tk.ref());
}
if (tomega.valid())
{
const dimensionedScalar k0(sqr(dimLength/dimTime), SMALL);
tomega.ref() = Cmu*epsilon/(k + k0);
correctProcessorPatches<scalar>(tomega.ref());
}
if (tR.valid())
@ -475,6 +514,7 @@ int main(int argc, char *argv[])
{
R[celli] = Rdiag[celli];
}
correctProcessorPatches<symmTensor>(R);
}

View File

@ -188,15 +188,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -352,18 +355,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
@ -455,15 +458,15 @@ int main(int argc, char *argv[])
transform(points, rot, points);
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("write-scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

View File

@ -22,12 +22,14 @@ functions
#includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
operation areaAverage;
fields (p);
$region1;
}
region2
{
#includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
operation areaAverage;
fields (p);
$region2;
}
}

View File

@ -6,8 +6,6 @@
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
region1
{
regionType patch;
@ -19,4 +17,6 @@ region2
name $patch2;
}
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
// ************************************************************************* //

View File

@ -6,16 +6,14 @@
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
region1
{
regionType sampledSurface;
regionType sampledSurface;
name $triSurface1;
sampledSurfaceDict
{
type meshedSurface;
regionType cells;
source cells;
interpolate true;
surface $triSurface1;
}
@ -24,10 +22,13 @@ region1
region2
{
$region1;
name $triSurface2;
sampledSurfaceDict
{
surface $triSurface2;
}
}
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,16 +41,18 @@ namespace Foam
Foam::solidBodyMotionFunction::solidBodyMotionFunction
(
const dictionary& SBMFCoeffs,
const dictionary& dict,
const Time& runTime
)
:
SBMFCoeffs_
(
SBMFCoeffs.optionalSubDict
dict.found("solidBodyMotionFunction")
? dict.optionalSubDict
(
SBMFCoeffs.get<word>("solidBodyMotionFunction") + "Coeffs"
dict.get<word>("solidBodyMotionFunction") + "Coeffs"
)
: dict
),
time_(runTime)
{}
@ -57,9 +60,9 @@ Foam::solidBodyMotionFunction::solidBodyMotionFunction
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::solidBodyMotionFunction::read(const dictionary& SBMFCoeffs)
bool Foam::solidBodyMotionFunction::read(const dictionary& dict)
{
SBMFCoeffs_ = SBMFCoeffs.optionalSubDict(type() + "Coeffs");
SBMFCoeffs_ = dict.optionalSubDict(type() + "Coeffs");
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -110,14 +110,14 @@ void Foam::fa::externalHeatFluxSource::addSup
false
);
auto tQ = new areaScalarField
auto tQ = tmp<areaScalarField>::New
(
io,
regionMesh(),
dimensionedScalar("q", dimPower/sqr(dimLength), 0),
zeroGradientFaPatchScalarField::typeName
);
areaScalarField& Q = *tQ;
areaScalarField& Q = tQ.ref();
switch (mode_)
{

View File

@ -148,6 +148,11 @@ Foam::binModel::binModel
bool Foam::binModel::read(const dictionary& dict)
{
if (!functionObjects::writeFile::read(dict))
{
return false;
}
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
fieldNames_ = dict.get<wordHashSet>("fields").sortedToc();

View File

@ -104,7 +104,7 @@ bool Foam::binModels::singleDirectionUniformBin::processField
return false;
}
if (Pstream::master() && !writtenHeader_)
if (writeToFile() && !writtenHeader_)
{
writeFileHeader<Type>(filePtrs_[fieldi]);
}
@ -183,7 +183,12 @@ bool Foam::binModels::singleDirectionUniformBin::processField
}
}
if (Pstream::master())
for (auto& binList : data)
{
reduce(binList, sumOp<List<Type>>());
}
if (writeToFile())
{
writeBinnedData(data, filePtrs_[fieldi]);
}

View File

@ -98,7 +98,7 @@ bool Foam::binModels::uniformBin::processField(const label fieldi)
return false;
}
if (Pstream::master() && !writtenHeader_)
if (writeToFile() && !writtenHeader_)
{
writeFileHeader<Type>(filePtrs_[fieldi]);
}
@ -166,7 +166,12 @@ bool Foam::binModels::uniformBin::processField(const label fieldi)
}
}
if (Pstream::master())
for (auto& binList : data)
{
reduce(binList, sumOp<List<Type>>());
}
if (writeToFile())
{
writeBinnedData(data, filePtrs_[fieldi]);
}

View File

@ -171,8 +171,8 @@ void Foam::functionObjects::forceCoeffs::calcForceCoeffs()
Cf_.reset
(
forceScaling.value()*coordSys.localVector(sumPatchForcesV_),
forceScaling.value()*coordSys.localVector(sumPatchForcesP_),
forceScaling.value()*coordSys.localVector(sumPatchForcesV_),
forceScaling.value()*coordSys.localVector(sumInternalForces_)
);
}