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

This commit is contained in:
Mark Olesen
2022-08-19 12:50:50 +02:00
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);