Compare commits

...

35 Commits

Author SHA1 Message Date
0a04de8661 CONFIG: bump patch level (240625) 2024-06-26 13:12:55 +02:00
5802d22470 BUG: Nastran reading of free format truncates last field (fixes #3189)
- the old logic relied on the presence/absence of a comma to decide
  whether to parse as fixed or free format. This logic is faulty when
  handling the final (trailing) entry and will generally lead to the
  last field being truncated when read in.
  Now the caller decides on fixed vs free.

FIX: inconsistent Nastran surface output format

- use FREE format by default. Previously had an odd mix of SHORT
  format when created without options and LONG format (as default)
  when created with format options.
2024-06-26 13:12:26 +02:00
1679c5f157 BUG: SlicedGeometricField, slices into field instead of shallow copy (#3080)
- regression introduced by e98acdc4fc

  Affected versions: (v2206, v2212, v2306, v2312)
2024-01-19 20:19:12 +01:00
d5607b2f28 COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:18:28 +01:00
b0ed2a254b BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:29:50 +01:00
0085b60946 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:36:46 +02:00
45e9db3489 BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:55:07 +02:00
68bed4f1dc BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:23:44 +02:00
fe97c8fee9 Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-05-22 09:41:24 +01:00
324ce9adec BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:08:36 +02:00
a8cba8ba8f COMP: code adjustments for gcc-13 (#2714) 2023-02-28 16:03:12 +01:00
58a5587ca8 BUG: globalIndex gather/scatter fails with multi-world (fixes #2706)
- was using UPstream::procIDs(), which returns the sub-ranks with
  respect to the parent communicator. This is normally just an
  identity list (single-world) but with multi-world the indexing
  is incorrect.  Use UPstream::allProcs() instead.
2023-02-21 12:24:15 +01:00
6d045eabc1 BUG: inconsistent faceArea on processor boundaries (fixes #2683)
- was missing evaluateCoupled on the initial faceAreaNormals field
  (related to #2507)

ENH: simplify/consistent geometry updating
2023-02-21 12:24:01 +01:00
d45b9b4e41 COMP: backslash instead of slash in Make/options 2023-02-20 18:04:13 +01:00
dae13bfae8 BUG: expression field functionObject 'store' keyword ignored 2023-02-20 18:04:13 +01:00
5894f2ed95 BUG: vtk::coordSetWriter produces incorrect VTK legacy format (fixes #2678)
- has a special purpose beginPiece() method, but was missing an update
  on the numberOfPoints, numberOfCells values required by the base class.
2023-01-13 09:39:23 +01:00
d0151570a1 BUG: inconsistent finiteArea proc-boundary contributions (fixes #2672) 2023-01-13 09:38:45 +01:00
8993af73ac CONFIG: bump patch level 2022-11-20 18:16:53 +01:00
a4d235af6b BUG: porousBafflePressure: read fixedJump entries - apply under-relaxation (fixes #2626) 2022-11-09 14:18:06 +00:00
dffac4d887 BUG: distributedTriSurfaceMesh: locally empty surface. Fixes #2612 2022-10-13 11:57:27 +01:00
f1da147925 CONFIG: bump patch level 2022-09-07 16:02:10 +02:00
d3123a1107 BUG: redistributePar fails with some area fields (fixes #2574)
- this is especially evident in -reconstruct mode when
  the fields have several processor boundaries.

  Testing for an existing patch edge mapping must use the `test`
  method (with range-checking) instead of the more common `set`
  method since the source field will likely have many more boundaries
  than physical edge mappings.
2022-09-07 16:00:54 +02:00
4965dc4cfb COMP: declare forceCoeffs operator<< in Foam namespace (fixes #2576) 2022-09-07 16:00:50 +02:00
a39b50d783 COMP: incorrect type in valueAverageBase (fixes #2568)
- caused inadvertent truncation of label types
2022-09-07 16:00:50 +02:00
2a007b007e BUG: PPCR: check outstanding request. Fixes #2577
If the exit is through maxIter it should still wait
for outstanding requests
2022-09-07 14:16:43 +01:00
b6a6e40c27 BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 11:46:08 +02:00
bc3bff8ef5 BUG: binModels: ensure main processor writes out binned data (fixes #2530) 2022-08-09 16:03:55 +01:00
b0cd2ea991 BUG: binModels: read and use writeFile settings (fixes #2553) 2022-08-09 16:03:48 +01:00
9f40db8977 BUG: forceCoeffs: correct the order of pressure and viscous components (fixes #2552) 2022-08-02 16:59:41 +01:00
a72d4a1708 BUG: externalHeatFluxSource: memory leakage (fixes #2545) 2022-07-27 13:11:21 +01:00
71a612085b BUG: caseDicts: fix pressureDifferencePatch and pressureDifferenceSurface scripts (fixes #2482) 2022-07-25 14:41:31 +01:00
92f38b589a BUG: solidBodyMotionFunction: avoid reading model name from subdictionary (fixes #2526) 2022-07-08 09:20:51 +01:00
ce486da6bd Merge branch 'issue-2527-setTurbulenceFields' into 'master'
BUG: setTurbulenceFields: update processor boundaries (fixes #2527)

Closes #2527

See merge request Development/openfoam!554
2022-07-04 15:26:53 +00:00
de21a6bc0e BUG: setTurbulenceFields: update processor boundaries (fixes #2527) 2022-07-04 13:34:13 +01:00
76d719d1e6 RELEASE: Updated version to v2206 2022-06-24 15:41:02 +01:00
66 changed files with 630 additions and 661 deletions

View File

@ -1,2 +1,2 @@
api=2206 api=2206
patch=0 patch=240625

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -19,7 +19,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \

View File

@ -8,7 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude -I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

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

View File

@ -109,6 +109,7 @@ Note
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "processorFvPatchField.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "fixedValueFvPatchFields.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 IOobject createIOobject
( (
const fvMesh& mesh, const fvMesh& mesh,
@ -447,22 +482,26 @@ int main(int argc, char *argv[])
// (M:Eq. 9) // (M:Eq. 9)
const dimensionedScalar maxU(dimVelocity, SMALL); const dimensionedScalar maxU(dimVelocity, SMALL);
U *= min(scalar(1), fRei*uTau/max(mag(U), maxU)); U *= min(scalar(1), fRei*uTau/max(mag(U), maxU));
correctProcessorPatches<vector>(U);
} }
if (tepsilon.valid()) if (tepsilon.valid())
{ {
tepsilon.ref() = epsilon; tepsilon.ref() = epsilon;
correctProcessorPatches<scalar>(tepsilon.ref());
} }
if (tk.valid()) if (tk.valid())
{ {
tk.ref() = k; tk.ref() = k;
correctProcessorPatches<scalar>(tk.ref());
} }
if (tomega.valid()) if (tomega.valid())
{ {
const dimensionedScalar k0(sqr(dimLength/dimTime), SMALL); const dimensionedScalar k0(sqr(dimLength/dimTime), SMALL);
tomega.ref() = Cmu*epsilon/(k + k0); tomega.ref() = Cmu*epsilon/(k + k0);
correctProcessorPatches<scalar>(tomega.ref());
} }
if (tR.valid()) if (tR.valid())
@ -475,6 +514,7 @@ int main(int argc, char *argv[])
{ {
R[celli] = Rdiag[celli]; R[celli] = Rdiag[celli];
} }
correctProcessorPatches<symmTensor>(R);
} }

View File

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

View File

@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name # [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com # A development version is often named 'com' - as in www.openfoam.com
export WM_PROJECT_VERSION=com export WM_PROJECT_VERSION=v2206
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Configuration environment variables. # Configuration environment variables.

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name # [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com # A development version is often named 'com' - as in www.openfoam.com
setenv WM_PROJECT_VERSION com setenv WM_PROJECT_VERSION v2206
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Configuration environment variables. # Configuration environment variables.

View File

@ -174,7 +174,7 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
result.writeField(toks); result.writeField(toks);
} }
return std::move(toks); return tokenList(std::move(toks.tokens()));
} }

View File

@ -117,8 +117,8 @@ bool Foam::functionObjects::valueAverageBase::calc
auto timeIter = windowTimes.cbegin(); auto timeIter = windowTimes.cbegin();
auto valueIter = windowValues.cbegin(); auto valueIter = windowValues.cbegin();
meanValue = pTraits<Type2>::zero; meanValue = Zero;
Type valueOld(pTraits<Type2>::zero); Type2 valueOld(Zero);
for for
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,9 +41,11 @@ void Foam::expressions::exprDriver::fill_random
{ {
if (seed <= 0) if (seed <= 0)
{ {
if (timeStatePtr_) const TimeState* ts = this->timeState();
if (ts)
{ {
seed = (timeStatePtr_->timeIndex() - seed); seed = (ts->timeIndex() - seed);
} }
else else
{ {

View File

@ -152,10 +152,11 @@ slicedBoundaryField
new SlicedPatchField<Type> new SlicedPatchField<Type>
( (
mesh.boundary()[patchi], mesh.boundary()[patchi],
DimensionedField<Type, GeoMesh>::null(), DimensionedField<Type, GeoMesh>::null()
bField[patchi]
) )
); );
bf[patchi].UList<Type>::shallowCopy(bField[patchi]);
} }
} }

View File

@ -202,7 +202,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();
@ -224,7 +225,8 @@ inline Foam::Matrix<Form, Type>::Matrix
) )
: :
mRows_(Mb.m()), mRows_(Mb.m()),
nCols_(Mb.n()) nCols_(Mb.n()),
v_(nullptr)
{ {
doAlloc(); doAlloc();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 Mattijs Janssens Copyright (C) 2019-2020 Mattijs Janssens
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -170,7 +170,7 @@ Foam::solverPerformance Foam::PPCG::scalarSolveCG
) )
{ {
// Make sure gamma,delta are available // Make sure gamma,delta are available
if (Pstream::parRun()) if (Pstream::parRun() && outstandingRequest != -1)
{ {
Pstream::waitRequest(outstandingRequest); Pstream::waitRequest(outstandingRequest);
outstandingRequest = -1; outstandingRequest = -1;
@ -248,6 +248,12 @@ Foam::solverPerformance Foam::PPCG::scalarSolveCG
matrix_.Amul(n, m, interfaceBouCoeffs_, interfaces_, cmpt); matrix_.Amul(n, m, interfaceBouCoeffs_, interfaces_, cmpt);
} }
// Cleanup any outstanding requests
if (Pstream::parRun() && outstandingRequest != -1)
{
Pstream::waitRequest(outstandingRequest);
}
return solverPerf; return solverPerf;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -440,12 +440,12 @@ public:
//- Collect indirect data in processor order on master //- Collect indirect data in processor order on master
// Handles contiguous/non-contiguous data, skips empty fields. // Handles contiguous/non-contiguous data, skips empty fields.
template<class Type, class Addr> template<class ProcIDsContainer, class Type, class Addr>
static void gather static void gather
( (
const labelUList& offsets, //!< offsets (master only) const labelUList& offsets, //!< offsets (master only)
const label comm, //!< communicator const label comm, //!< communicator
const UList<int>& procIDs, const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld, const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld, //! output field (master only) List<Type>& allFld, //! output field (master only)
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -248,12 +248,12 @@ void Foam::globalIndex::gather
} }
template<class Type, class Addr> template<class ProcIDsContainer, class Type, class Addr>
void Foam::globalIndex::gather void Foam::globalIndex::gather
( (
const labelUList& off, // needed on master only const labelUList& off, // needed on master only
const label comm, const label comm,
const UList<int>& procIDs, const ProcIDsContainer& procIDs,
const IndirectListBase<Type, Addr>& fld, const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld, List<Type>& allFld,
const int tag, const int tag,
@ -368,7 +368,7 @@ void Foam::globalIndex::gather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -404,7 +404,7 @@ void Foam::globalIndex::gather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -622,7 +622,7 @@ void Foam::globalIndex::mpiGather
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
sendData, sendData,
allData, allData,
tag, tag,
@ -967,7 +967,7 @@ void Foam::globalIndex::scatter
( (
offsets_, // needed on master only offsets_, // needed on master only
comm, comm,
UPstream::procID(comm), UPstream::allProcs(comm), // All communicator ranks
allData, allData,
localData, localData,
tag, tag,

View File

@ -535,6 +535,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{ {
@ -558,6 +562,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt> inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{ {
@ -993,6 +1001,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor //- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -1007,6 +1019,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor //- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{ {
@ -1021,6 +1037,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor //- Inner-product of a SymmTensor and a Tensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2) operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{ {
@ -1043,6 +1063,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor //- Inner-product of a Tensor and a SymmTensor
template<class Cmpt> template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt> inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2) operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{ {
@ -1069,7 +1093,7 @@ template<class Cmpt>
// Workaround for gcc (11+) that fails to handle tensor dot vector // Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize"))) __attribute__((optimize("no-tree-vectorize")))
#endif #endif
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v) operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{ {
return Vector<Cmpt> return Vector<Cmpt>
@ -1083,7 +1107,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor //- Inner-product of a Vector and a Tensor
template<class Cmpt> template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type #if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t) operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{ {
return Vector<Cmpt> return Vector<Cmpt>

View File

@ -29,6 +29,7 @@ License
#include "word.H" #include "word.H"
#include "debug.H" #include "debug.H"
#include <cctype> #include <cctype>
#include <cstdint>
#include <sstream> #include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -593,7 +593,17 @@ void Foam::UPstream::allocatePstreamCommunicator
void Foam::UPstream::freePstreamCommunicator(const label communicator) void Foam::UPstream::freePstreamCommunicator(const label communicator)
{ {
if (communicator != 0) // Not touching the first communicator (WORLD)
// or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 0
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{ {
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL) if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,10 +53,11 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict const dictionary& dict,
const bool valueRequired
) )
: :
fixedJumpFvPatchField<scalar>(p, iF), fixedJumpFvPatchField<scalar>(p, iF, dict, false),
phiName_(dict.getOrDefault<word>("phi", "phi")), phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")), rhoName_(dict.getOrDefault<word>("rho", "rho")),
D_(Function1<scalar>::New("D", dict, &db())), D_(Function1<scalar>::New("D", dict, &db())),
@ -64,10 +65,20 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
length_(dict.get<scalar>("length")), length_(dict.get<scalar>("length")),
uniformJump_(dict.getOrDefault("uniformJump", false)) uniformJump_(dict.getOrDefault("uniformJump", false))
{ {
fvPatchField<scalar>::operator= if (valueRequired)
( {
Field<scalar>("value", dict, p.size()) if (dict.found("value"))
); {
fvPatchField<scalar>::operator=
(
Field<scalar>("value", dict, p.size())
);
}
else
{
this->evaluate(Pstream::commsTypes::blocking);
}
}
} }
@ -178,6 +189,8 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
); );
} }
this->relax();
if (debug) if (debug)
{ {
scalar avePressureJump = gAverage(jump()); scalar avePressureJump = gAverage(jump());

View File

@ -162,7 +162,8 @@ public:
( (
const fvPatch&, const fvPatch&,
const DimensionedField<scalar, volMesh>&, const DimensionedField<scalar, volMesh>&,
const dictionary& const dictionary&,
const bool valueRequired = true
); );
//- Construct by mapping given porousBafflePressureFvPatchField //- Construct by mapping given porousBafflePressureFvPatchField

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -122,7 +122,8 @@ std::string Foam::fileFormats::NASCore::nextNasField
( (
const std::string& str, const std::string& str,
std::string::size_type& pos, std::string::size_type& pos,
std::string::size_type len const std::string::size_type width,
const bool free_format
) )
{ {
const auto beg = pos; const auto beg = pos;
@ -130,15 +131,23 @@ std::string Foam::fileFormats::NASCore::nextNasField
if (end == std::string::npos) if (end == std::string::npos)
{ {
pos = beg + len; // Continue after field width if (free_format)
{
// Nothing left
pos = str.size();
return str.substr(beg);
}
// Fixed format - continue after field width
pos = beg + width;
return str.substr(beg, width);
} }
else else
{ {
len = (end - beg); // Efffective width // Free format - continue after comma
pos = end + 1; // Continue after comma pos = end + 1;
return str.substr(beg, (end - beg));
} }
return str.substr(beg, len);
} }
@ -235,8 +244,8 @@ void Foam::fileFormats::NASCore::writeCoord
// 2 ID : point ID - requires starting index of 1 // 2 ID : point ID - requires starting index of 1
// 3 CP : coordinate system ID (blank) // 3 CP : coordinate system ID (blank)
// 4 X1 : point x coordinate // 4 X1 : point x coordinate
// 5 X2 : point x coordinate // 5 X2 : point y coordinate
// 6 X3 : point x coordinate // 6 X3 : point z coordinate
// 7 CD : coordinate system for displacements (blank) // 7 CD : coordinate system for displacements (blank)
// 8 PS : single point constraints (blank) // 8 PS : single point constraints (blank)
// 9 SEID : super-element ID // 9 SEID : super-element ID

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,7 +48,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace fileFormats namespace fileFormats
{ {
@ -74,18 +73,18 @@ public:
//- Output load format //- Output load format
enum loadFormat enum loadFormat
{ {
PLOAD2, PLOAD2, //!< Face load (eg, pressure)
PLOAD4 PLOAD4 //!< Vertex load
}; };
//- Selection names for the NASTRAN file field formats //- Selection names for the NASTRAN load formats
static const Enum<loadFormat> loadFormatNames; static const Enum<loadFormat> loadFormatNames;
// Constructors // Constructors
//- Default construct //- Default construct
NASCore() = default; NASCore() noexcept = default;
// Public Static Member Functions // Public Static Member Functions
@ -93,18 +92,20 @@ public:
//- Extract numbers from things like "-2.358-8" (same as "-2.358e-8") //- Extract numbers from things like "-2.358-8" (same as "-2.358e-8")
static scalar readNasScalar(const std::string& str); static scalar readNasScalar(const std::string& str);
//- A string::substr() to handle fixed-format and free-format NASTRAN. //- A std::string::substr() variant to handle fixed-format and
// Returns the substr to the next comma (if found) or the given length //- free-format NASTRAN.
// // Returns the substr until the next comma (if found)
// \param str The string to extract from // or the given fixed width
// \param pos On input, the position of the first character of the
// substring. On output, advances to the next position to use.
// \param len The fixed-format length to use if a comma is not found.
static std::string nextNasField static std::string nextNasField
( (
//! The string to extract from
const std::string& str, const std::string& str,
//! [in,out] The parse position within \p str
std::string::size_type& pos, std::string::size_type& pos,
std::string::size_type len //! The fixed-format width to use (if comma is not found)
const std::string::size_type width,
//! The input is known to be free-format
const bool free_format = false
); );

View File

@ -53,7 +53,6 @@ $(basicFaPatchFields)/transform/transformFaPatchScalarField.C
constraintFaPatchFields = $(faPatchFields)/constraint constraintFaPatchFields = $(faPatchFields)/constraint
$(constraintFaPatchFields)/empty/emptyFaPatchFields.C $(constraintFaPatchFields)/empty/emptyFaPatchFields.C
$(constraintFaPatchFields)/processor/processorFaPatchFields.C $(constraintFaPatchFields)/processor/processorFaPatchFields.C
$(constraintFaPatchFields)/processor/processorFaPatchScalarField.C
$(constraintFaPatchFields)/wedge/wedgeFaPatchFields.C $(constraintFaPatchFields)/wedge/wedgeFaPatchFields.C
$(constraintFaPatchFields)/wedge/wedgeFaPatchScalarField.C $(constraintFaPatchFields)/wedge/wedgeFaPatchScalarField.C
$(constraintFaPatchFields)/cyclic/cyclicFaPatchFields.C $(constraintFaPatchFields)/cyclic/cyclicFaPatchFields.C

View File

@ -93,7 +93,7 @@ Foam::faMeshDistributor::distributeField
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
if (patchEdgeMaps_.set(patchi)) if (patchEdgeMaps_.test(patchi))
{ {
// Clone local patch field // Clone local patch field
@ -203,7 +203,7 @@ Foam::faMeshDistributor::distributeField
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
if (patchEdgeMaps_.set(patchi)) if (patchEdgeMaps_.test(patchi))
{ {
// Clone local patch field // Clone local patch field

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -185,12 +185,26 @@ Foam::faBoundaryMesh::faBoundaryMesh
void Foam::faBoundaryMesh::calcGeometry() void Foam::faBoundaryMesh::calcGeometry()
{ {
// processorFaPatch geometry triggers calculation of pointNormals. // processor initGeometry send/recv the following:
// - edgeCentres() : faMesh::edgeCentres()
// - edgeLengths() : faMesh::Le()
// - edgeFaceCentres() : faMesh::areaCentres()
//
// faMesh::Le() has its own point-to-point communication (OK) but
// triggers either/or edgeAreaNormals(), pointAreaNormals()
// with their own communication that can block.
// This uses parallel comms and hence will not be trigggered // This uses parallel comms and hence will not be trigggered
// on processors that do not have a processorFaPatch so instead // on processors that do not have a processorFaPatch so instead
// force construction. // force construction.
(void)mesh_.edgeAreaNormals();
(void)mesh_.pointAreaNormals(); (void)mesh_.pointAreaNormals();
(void)mesh_.areaCentres();
(void)mesh_.faceAreaNormals();
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs(Pstream::defaultCommsType);
if if
@ -780,12 +794,15 @@ bool Foam::faBoundaryMesh::checkDefinition(const bool report) const
void Foam::faBoundaryMesh::movePoints(const pointField& p) void Foam::faBoundaryMesh::movePoints(const pointField& p)
{ {
// processorFaPatch geometry triggers calculation of pointNormals. // See comments in calcGeometry()
// This uses parallel comms and hence will not be trigggered
// on processors that do not have a processorFaPatch so instead (void)mesh_.edgeAreaNormals();
// force construction.
(void)mesh_.pointAreaNormals(); (void)mesh_.pointAreaNormals();
(void)mesh_.areaCentres();
(void)mesh_.faceAreaNormals();
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs(Pstream::defaultCommsType);
if if

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2020-2022 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -265,6 +265,27 @@ void Foam::faMesh::clearOut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
void Foam::faMesh::syncGeom()
{
if (UPstream::parRun())
{
// areaCentres()
if (centresPtr_)
{
centresPtr_->boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
}
// faceAreaNormals()
if (faceAreaNormalsPtr_)
{
faceAreaNormalsPtr_->boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
}
}
}
bool Foam::faMesh::init(const bool doInit) bool Foam::faMesh::init(const bool doInit)
{ {
if (doInit) if (doInit)
@ -284,18 +305,7 @@ bool Foam::faMesh::init(const bool doInit)
// Calculate the geometry for the patches (transformation tensors etc.) // Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry(); boundary_.calcGeometry();
// Ensure processor/processor information is properly synchronised syncGeom();
if (Pstream::parRun())
{
const_cast<areaVectorField&>(areaCentres()).boundaryFieldRef()
.evaluateCoupled<processorFaPatch>();
// This roughly corresponds to what OpenFOAM-v2112 (and earlier) had,
// but should nominally be unnecessary.
//
/// const_cast<areaVectorField&>(faceAreaNormals()).boundaryFieldRef()
/// .evaluateCoupled<processorFaPatch>();
}
return false; return false;
} }
@ -955,7 +965,6 @@ bool Foam::faMesh::movePoints()
clearGeomNotAreas(); clearGeomNotAreas();
// To satisfy the motion interface for MeshObject, const cast is needed
if (patchPtr_) if (patchPtr_)
{ {
patchPtr_->movePoints(newPoints); patchPtr_->movePoints(newPoints);
@ -969,6 +978,8 @@ bool Foam::faMesh::movePoints()
// Note: Fluxes were dummy? // Note: Fluxes were dummy?
syncGeom();
return true; return true;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -599,6 +599,10 @@ public:
//- Initialise non-demand-driven data etc //- Initialise non-demand-driven data etc
bool init(const bool doInit); bool init(const bool doInit);
//- Processor/processor synchronisation for geometry fields.
// Largely internal use only (slightly hacky).
void syncGeom();
// Database // Database

View File

@ -603,6 +603,12 @@ void Foam::faMesh::calcAreaCentres() const
} }
} }
} }
// Parallel consistency, exchange on processor patches
if (UPstream::parRun())
{
centres.boundaryFieldRef().evaluateCoupled<processorFaPatch>();
}
} }
@ -750,6 +756,12 @@ void Foam::faMesh::calcFaceAreaNormals() const
{ {
faceNormals.boundaryFieldRef()[patchI] = edgeNormalsBoundary[patchI]; faceNormals.boundaryFieldRef()[patchI] = edgeNormalsBoundary[patchI];
} }
// Parallel consistency, exchange on processor patches
if (UPstream::parRun())
{
faceNormals.boundaryFieldRef().evaluateCoupled<processorFaPatch>();
}
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,6 +61,8 @@ void Foam::faMeshTools::forceDemandDriven(faMesh& mesh)
(void)mesh.pointAreaNormals(); (void)mesh.pointAreaNormals();
(void)mesh.faceCurvatures(); (void)mesh.faceCurvatures();
(void)mesh.edgeTransformTensors(); (void)mesh.edgeTransformTensors();
mesh.syncGeom();
} }

View File

@ -181,13 +181,6 @@ public:
// Coupled interface functionality // Coupled interface functionality
//- Transform given patch component field
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const = 0;
//- Update result field based on interface functionality //- Update result field based on interface functionality
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (

View File

@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki 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/>.
\*---------------------------------------------------------------------------*/
#ifndef transformFaPatchFieldsFwd_H
#define transformFaPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class transformFaPatchField;
// typedef transformFaPatchField<scalar> transformFaPatchScalarField;
// typedef transformFaPatchField<vector> transformFaPatchVectorField;
// typedef transformFaPatchField<tensor> transformFaPatchTensorField;
// template<class Type> class transformFaPatchField;
makeFaPatchTypeFieldTypedefs(transform)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -187,20 +187,7 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
transformCoupleField(pnf, cmpt); transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
if (add) this->addToInternalField(result, !add, faceCells, coeffs, pnf);
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
} }
@ -227,21 +214,11 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
} }
// Transform according to the transformation tensors
transformCoupleField(pnf);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
if (add) this->addToInternalField(result, !add, faceCells, coeffs, pnf);
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
} }

View File

@ -164,16 +164,6 @@ public:
// Coupled interface functionality // Coupled interface functionality
//- Transform neighbour field
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{
cyclicLduInterfaceField::transformCoupleField(f, cmpt);
}
//- Update result field based on interface functionality //- Update result field based on interface functionality
virtual void updateInterfaceMatrix virtual void updateInterfaceMatrix
( (

View File

@ -130,13 +130,6 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
{} {}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorFaPatchField<Type>::~processorFaPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -203,6 +196,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
commsType, commsType,
this->patch().patchInternalField(psiInternal)() this->patch().patchInternalField(psiInternal)()
); );
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
} }
@ -219,32 +214,28 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
if (this->updatedMatrix())
{
return;
}
const labelUList& faceCells = this->patch().edgeFaces();
solveScalarField pnf solveScalarField pnf
( (
procPatch_.receive<solveScalar>(commsType, this->size())() procPatch_.receive<solveScalar>(commsType, this->size())
); );
// Transform according to the transformation tensor if (!std::is_arithmetic<Type>::value)
transformCoupleField(pnf, cmpt); {
// Transform non-scalar data according to the transformation tensor
transformCoupleField(pnf, cmpt);
}
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
const labelUList& edgeFaces = this->patch().edgeFaces(); const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
if (add)
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
} }
@ -265,6 +256,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
commsType, commsType,
this->patch().patchInternalField(psiInternal)() this->patch().patchInternalField(psiInternal)()
); );
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
} }
@ -280,29 +273,25 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
if (this->updatedMatrix())
{
return;
}
const labelUList& faceCells = this->patch().edgeFaces();
Field<Type> pnf Field<Type> pnf
( (
procPatch_.receive<Type>(commsType, this->size())() procPatch_.receive<Type>(commsType, this->size())
); );
// Transform according to the transformation tensor
transformCoupleField(pnf);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
const labelUList& edgeFaces = this->patch().edgeFaces(); const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
if (add)
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
}
}
else
{
forAll(edgeFaces, elemI)
{
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFaPatchField_H #ifndef Foam_processorFaPatchField_H
#define processorFaPatchField_H #define Foam_processorFaPatchField_H
#include "coupledFaPatchField.H" #include "coupledFaPatchField.H"
#include "processorLduInterfaceField.H" #include "processorLduInterfaceField.H"
@ -139,9 +139,8 @@ public:
} }
// Destructor //- Destructor
~processorFaPatchField() = default;
~processorFaPatchField();
// Member functions // Member functions
@ -169,17 +168,8 @@ public:
//- Return patch-normal gradient //- Return patch-normal gradient
virtual tmp<Field<Type>> snGrad() const; virtual tmp<Field<Type>> snGrad() const;
// Coupled interface functionality
//- Transform neighbour field // Coupled interface functionality
virtual void transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{
processorLduInterfaceField::transformCoupleField(f, cmpt);
}
//- Initialise neighbour matrix update //- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate virtual void initInterfaceMatrixUpdate

View File

@ -25,10 +25,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFaPatchFields_H #ifndef Foam_processorFaPatchFields_H
#define processorFaPatchFields_H #define Foam_processorFaPatchFields_H
#include "processorFaPatchScalarField.H" #include "processorFaPatchField.H"
#include "fieldTypes.H" #include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,52 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki 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/>.
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchFieldsFwd_H
#define processorFaPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorFaPatchField;
makeFaPatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
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 "processorFaPatchScalarField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void Foam::processorFaPatchField<Foam::scalar>::transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const
{}
template<>
void Foam::processorFaPatchField<Foam::scalar>::initInterfaceMatrixUpdate
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField& psiInternal,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{
procPatch_.send
(
commsType,
patch().patchInternalField(psiInternal)()
);
}
template<>
void Foam::processorFaPatchField<Foam::scalar>::updateInterfaceMatrix
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{
solveScalarField pnf
(
procPatch_.receive<solveScalar>(commsType, this->size())()
);
const labelUList& edgeFaces = patch().edgeFaces();
if (add)
{
forAll(edgeFaces, facei)
{
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
}
}
else
{
forAll(edgeFaces, facei)
{
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
}
}
}
// ************************************************************************* //

View File

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
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/>.
\*---------------------------------------------------------------------------*/
#ifndef processorFaPatchScalarField_H
#define processorFaPatchScalarField_H
#include "processorFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void processorFaPatchField<scalar>::transformCoupleField
(
solveScalarField& f,
const direction cmpt
) const;
template<>
void processorFaPatchField<scalar>::initInterfaceMatrixUpdate
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const;
template<>
void processorFaPatchField<scalar>::updateInterfaceMatrix
(
solveScalarField& result,
const bool add,
const lduAddressing& lduAddr,
const label patchId,
const solveScalarField&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -104,7 +104,7 @@ bool Foam::binModels::singleDirectionUniformBin::processField
return false; return false;
} }
if (Pstream::master() && !writtenHeader_) if (writeToFile() && !writtenHeader_)
{ {
writeFileHeader<Type>(filePtrs_[fieldi]); 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]); writeBinnedData(data, filePtrs_[fieldi]);
} }

View File

@ -98,7 +98,7 @@ bool Foam::binModels::uniformBin::processField(const label fieldi)
return false; return false;
} }
if (Pstream::master() && !writtenHeader_) if (writeToFile() && !writtenHeader_)
{ {
writeFileHeader<Type>(filePtrs_[fieldi]); 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]); writeBinnedData(data, filePtrs_[fieldi]);
} }

View File

@ -389,7 +389,7 @@ bool Foam::functionObjects::fvExpressionField::read(const dictionary& dict)
} }
autowrite_ = dict.getOrDefault("autowrite", false); autowrite_ = dict.getOrDefault("autowrite", false);
store_ = dict.getOrDefault("autowrite", true); store_ = dict.getOrDefault("store", true);
// "dimensions" is optional // "dimensions" is optional
dimensions_.clear(); dimensions_.clear();

View File

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

View File

@ -318,7 +318,7 @@ public:
}; };
// Coefficients description //- Coefficients description
struct coeffDesc struct coeffDesc
{ {
enum splitType enum splitType
@ -366,6 +366,12 @@ public:
return name_ + "(r)"; return name_ + "(r)";
} }
//- Print description
void print(Ostream& os) const
{
os << desc_.c_str() << ": " << name_;
}
//- Return force/moment components based on the specified split type //- Return force/moment components based on the specified split type
vector value(const forceComponents& f, const forceComponents& m) const vector value(const forceComponents& f, const forceComponents& m) const
{ {
@ -546,18 +552,25 @@ public:
virtual bool write(); virtual bool write();
}; };
} // End namespace functionObjects
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const forceCoeffs::coeffDesc& coeff) // Output operator
inline Ostream& operator<<
(
Ostream& os,
const functionObjects::forceCoeffs::coeffDesc& coeff
)
{ {
os << coeff.desc_.c_str() << ": " << coeff.name_; coeff.print(os);
return os; return os;
} }
} // End namespace functionObjects // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,6 +62,53 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
template<class filmType>
void Foam::ThermoSurfaceFilm<CloudType>::absorbInteraction
(
filmType& film,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
)
{
DebugInfo<< "Parcel " << p.origId() << " absorbInteraction" << endl;
// Patch face normal
const vector& nf = pp.faceNormals()[facei];
// Patch velocity
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
// Relative parcel velocity
const vector Urel(p.U() - Up);
// Parcel normal velocity
const vector Un(nf*(Urel & nf));
// Parcel tangential velocity
const vector Ut(Urel - Un);
film.addSources
(
pp.index(),
facei,
mass, // mass
mass*Ut, // tangential momentum
mass*mag(Un), // impingement pressure
mass*p.hs() // energy
);
this->nParcelsTransferred()++;
this->totalMassTransferred() += mass;
keepParticle = false;
}
template<class CloudType> template<class CloudType>
bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
( (

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -141,6 +141,21 @@ public:
// Member Functions // Member Functions
// Interaction models
//- Absorb parcel into film
template<class filmType>
void absorbInteraction
(
filmType&,
const parcelType& p,
const polyPatch& pp,
const label facei,
const scalar mass,
bool& keepParticle
);
// Evaluation // Evaluation
//- Transfer parcel from cloud to surface film //- Transfer parcel from cloud to surface film

View File

@ -80,6 +80,19 @@ void Foam::vtk::coordSetWriter::beginPiece()
} }
} }
// Update sizes, similar to
// vtk::polyWriter::beginPiece(const pointField&, const edgeList&)
numberOfPoints_ = nLocalPoints_;
numberOfCells_ = nLocalLines_;
// if (parallel_)
// {
// reduce(numberOfPoints_, sumOp<label>());
// reduce(numberOfCells_, sumOp<label>());
// }
// Nothing else to do for legacy // Nothing else to do for legacy
if (legacy()) return; if (legacy()) return;
@ -88,7 +101,7 @@ void Foam::vtk::coordSetWriter::beginPiece()
format().openTag format().openTag
( (
vtk::fileTag::PIECE, vtk::fileTag::PIECE,
vtk::fileAttr::NUMBER_OF_POINTS, nLocalPoints_ vtk::fileAttr::NUMBER_OF_POINTS, numberOfPoints_
); );
if (nLocalVerts_) if (nLocalVerts_)
{ {
@ -105,7 +118,7 @@ void Foam::vtk::coordSetWriter::beginPiece()
void Foam::vtk::coordSetWriter::writePoints() void Foam::vtk::coordSetWriter::writePoints()
{ {
this->beginPoints(nLocalPoints_); this->beginPoints(numberOfPoints_); //<- same as nLocalPoints_
{ {
for (const pointField& pts : points_) for (const pointField& pts : points_)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,13 +62,17 @@ bool Foam::fileFormats::NASedgeFormat::read
while (is.good()) while (is.good())
{ {
string::size_type linei = 0; // parsing position within current line
string line; string line;
is.getLine(line); is.getLine(line);
if (line.empty() || line[0] == '$') if (line.empty())
{ {
continue; // Skip empty or comment continue; // Ignore empty
}
else if (line[0] == '$')
{
// Ignore comment
continue;
} }
// Check if character 72 is continuation // Check if character 72 is continuation
@ -94,38 +98,66 @@ bool Foam::fileFormats::NASedgeFormat::read
} }
// Parsing position within current line
std::string::size_type linei = 0;
// Is free format if line contains a comma
const bool freeFormat = (line.find(',') != std::string::npos);
// First word (column 0-8) // First word (column 0-8)
const word cmd(word::validate(nextNasField(line, linei, 8))); const word cmd(word::validate(nextNasField(line, linei, 8)));
if (cmd == "CBEAM" || cmd == "CROD") if (cmd == "CBEAM" || cmd == "CROD")
{ {
// discard elementId (8-16) // Fixed format:
(void) nextNasField(line, linei, 8); // 8-16 // 8-16 : element id
// discard groupId (16-24) // 16-24 : group id
(void) nextNasField(line, linei, 8); // 16-24 // 24-32 : vertex
// 32-40 : vertex
label a = readLabel(nextNasField(line, linei, 8)); // 24-32 // discard elementId
label b = readLabel(nextNasField(line, linei, 8)); // 32-40 (void) nextNasField(line, linei, 8, freeFormat);
// discard groupId
(void) nextNasField(line, linei, 8, freeFormat);
label a = readLabel(nextNasField(line, linei, 8, freeFormat));
label b = readLabel(nextNasField(line, linei, 8, freeFormat));
dynEdges.append(edge(a,b)); dynEdges.append(edge(a,b));
} }
else if (cmd == "PLOTEL") else if (cmd == "PLOTEL")
{ {
// discard elementId (8-16) // Fixed format:
(void) nextNasField(line, linei, 8); // 8-16 // 8-16 : element id
// 16-24 : vertex
// 24-32 : vertex
// 32-40 : vertex
label a = readLabel(nextNasField(line, linei, 8)); // 16-24 // discard elementId (8-16)
label b = readLabel(nextNasField(line, linei, 8)); // 24-32 (void) nextNasField(line, linei, 8, freeFormat);
label a = readLabel(nextNasField(line, linei, 8, freeFormat));
label b = readLabel(nextNasField(line, linei, 8, freeFormat));
dynEdges.append(edge(a,b)); dynEdges.append(edge(a,b));
} }
else if (cmd == "GRID") else if (cmd == "GRID")
{ {
label index = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed (short) format:
(void) nextNasField(line, linei, 8); // 16-24 // 8-16 : point id
scalar x = readNasScalar(nextNasField(line, linei, 8)); // 24-32 // 16-24 : coordinate system (unsupported)
scalar y = readNasScalar(nextNasField(line, linei, 8)); // 32-40 // 24-32 : point x coordinate
scalar z = readNasScalar(nextNasField(line, linei, 8)); // 40-48 // 32-40 : point y coordinate
// 40-48 : point z coordinate
// 48-56 : displacement coordinate system (optional, unsupported)
// 56-64 : single point constraints (optional, unsupported)
// 64-70 : super-element id (optional, unsupported)
label index = readLabel(nextNasField(line, linei, 8, freeFormat));
(void) nextNasField(line, linei, 8, freeFormat);
scalar x = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar y = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar z = readNasScalar(nextNasField(line, linei, 8, freeFormat));
pointId.append(index); pointId.append(index);
dynPoints.append(point(x, y, z)); dynPoints.append(point(x, y, z));
@ -138,6 +170,8 @@ bool Foam::fileFormats::NASedgeFormat::read
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02 // GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02 // * 2.14897901E+02
// Cannot be long format and free format at the same time!
label index = readLabel(nextNasField(line, linei, 16)); // 8-24 label index = readLabel(nextNasField(line, linei, 16)); // 8-24
(void) nextNasField(line, linei, 16); // 24-40 (void) nextNasField(line, linei, 16); // 24-40
scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56 scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56

View File

@ -155,7 +155,7 @@ bool Foam::vtk::writePointSet
if (parallel) if (parallel)
{ {
vtk::writeListParallel(format(), mesh.points(), pointLabels); vtk::writeListParallel(format.ref(), mesh.points(), pointLabels);
} }
else else
{ {

View File

@ -1650,8 +1650,8 @@ Foam::volumeType Foam::distributedTriSurfaceMesh::cachedVolumeType
// Recurse // Recurse
volumeType subType = cachedVolumeType volumeType subType = cachedVolumeType
( (
indexedOctree<treeDataTriSurface>::getNode(index), indexedOctree<treeDataTriSurface>::getNode(index),
sample sample
); );
return subType; return subType;
@ -1950,7 +1950,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.gather // //globalBorderTris.gather
// //( // //(
// // UPstream::worldComm, // // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm), // // UPstream::allProcs(UPstream::worldComm),
// // globalBorderCentres // // globalBorderCentres
// //); // //);
// pointField globalBorderCentres(allCentres); // pointField globalBorderCentres(allCentres);
@ -1997,7 +1997,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// //globalBorderTris.scatter // //globalBorderTris.scatter
// //( // //(
// // UPstream::worldComm, // // UPstream::worldComm,
// // UPstream::procID(Pstream::worldComm), // // UPstream::allProcs(UPstream::worldComm),
// // isMasterPoint // // isMasterPoint
// //); // //);
// //boolList isMasterBorder(s.size(), false); // //boolList isMasterBorder(s.size(), false);
@ -2095,7 +2095,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().gather globalTris().gather
( (
UPstream::worldComm, UPstream::worldComm,
UPstream::procID(Pstream::worldComm), UPstream::allProcs(UPstream::worldComm),
allCentres allCentres
); );
} }
@ -2145,7 +2145,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
globalTris().scatter globalTris().scatter
( (
UPstream::worldComm, UPstream::worldComm,
UPstream::procID(Pstream::worldComm), UPstream::allProcs(UPstream::worldComm),
allDistribution, allDistribution,
distribution distribution
); );
@ -4162,7 +4162,10 @@ void Foam::distributedTriSurfaceMesh::getVolumeType
// Collect midpoints // Collect midpoints
DynamicField<point> midPoints(label(0.5*nodes.size())); DynamicField<point> midPoints(label(0.5*nodes.size()));
collectLeafMids(0, midPoints); if (nodes.size())
{
collectLeafMids(0, midPoints);
}
if (debug) if (debug)
{ {
@ -4190,14 +4193,17 @@ void Foam::distributedTriSurfaceMesh::getVolumeType
} }
// Cache on local tree // Cache on local tree
label index = 0; if (nodes.size())
calcVolumeType {
( label index = 0;
midVolTypes, calcVolumeType
index, (
nt, midVolTypes,
0 // nodeI index,
); nt,
0 // nodeI
);
}
if (debug) if (debug)
{ {
Pout<< "distributedTriSurfaceMesh::getVolumeType :" Pout<< "distributedTriSurfaceMesh::getVolumeType :"
@ -4294,7 +4300,10 @@ void Foam::distributedTriSurfaceMesh::getVolumeType
DynamicList<label> fullSearchMap(localPoints.size()); DynamicList<label> fullSearchMap(localPoints.size());
forAll(localPoints, i) forAll(localPoints, i)
{ {
volType[i] = cachedVolumeType(0, localPoints[i]); if (tree().nodes().size())
{
volType[i] = cachedVolumeType(0, localPoints[i]);
}
if (volType[i] == volumeType::UNKNOWN) if (volType[i] == volumeType::UNKNOWN)
{ {
fullSearchMap.append(i); fullSearchMap.append(i);

View File

@ -834,15 +834,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i]; label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i]; label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi)) if (!srcPatchFields.set(srcPatchi))
{ {
srcPatchFields.set srcPatchFields.set
( (
srcPatchi, srcPatchi,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
tgtBfld[srcPatchi], tgtBfld[tgtPatchi],
srcMesh.boundary()[tgtPatchi], srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(), DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper directFvPatchFieldMapper
( (

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -149,7 +149,6 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
string line; string line;
while (is.good()) while (is.good())
{ {
string::size_type linei = 0; // Parsing position within current line
is.getLine(line); is.getLine(line);
// ANSA extension // ANSA extension
@ -223,16 +222,30 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
} }
} }
// Parsing position within current line
std::string::size_type linei = 0;
// Is free format if line contains a comma
const bool freeFormat = (line.find(',') != std::string::npos);
// First word (column 0-8) // First word (column 0-8)
const word cmd(word::validate(nextNasField(line, linei, 8))); const word cmd(word::validate(nextNasField(line, linei, 8)));
if (cmd == "CTRIA3") if (cmd == "CTRIA3")
{ {
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed format:
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24 // 8-16 : element id
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32 // 16-24 : group id
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40 // 24-32 : vertex
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48 // 32-40 : vertex
// 40-48 : vertex
label elemId = readLabel(nextNasField(line, linei, 8, freeFormat));
label groupId = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto a = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto b = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto c = readLabel(nextNasField(line, linei, 8, freeFormat));
// Convert groupId into zoneId // Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId); const auto iterZone = zoneLookup.cfind(groupId);
@ -261,12 +274,20 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
} }
else if (cmd == "CQUAD4") else if (cmd == "CQUAD4")
{ {
label elemId = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed format:
label groupId = readLabel(nextNasField(line, linei, 8)); // 16-24 // 8-16 : element id
const auto a = readLabel(nextNasField(line, linei, 8)); // 24-32 // 16-24 : group id
const auto b = readLabel(nextNasField(line, linei, 8)); // 32-40 // 24-32 : vertex
const auto c = readLabel(nextNasField(line, linei, 8)); // 40-48 // 32-40 : vertex
const auto d = readLabel(nextNasField(line, linei, 8)); // 48-56 // 40-48 : vertex
// 48-56 : vertex
label elemId = readLabel(nextNasField(line, linei, 8, freeFormat));
label groupId = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto a = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto b = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto c = readLabel(nextNasField(line, linei, 8, freeFormat));
const auto d = readLabel(nextNasField(line, linei, 8, freeFormat));
// Convert groupId into zoneId // Convert groupId into zoneId
const auto iterZone = zoneLookup.cfind(groupId); const auto iterZone = zoneLookup.cfind(groupId);
@ -310,11 +331,21 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
} }
else if (cmd == "GRID") else if (cmd == "GRID")
{ {
label index = readLabel(nextNasField(line, linei, 8)); // 8-16 // Fixed (short) format:
(void) nextNasField(line, linei, 8); // 16-24 // 8-16 : point id
scalar x = readNasScalar(nextNasField(line, linei, 8)); // 24-32 // 16-24 : coordinate system (not supported)
scalar y = readNasScalar(nextNasField(line, linei, 8)); // 32-40 // 24-32 : point x coordinate
scalar z = readNasScalar(nextNasField(line, linei, 8)); // 40-48 // 32-40 : point y coordinate
// 40-48 : point z coordinate
// 48-56 : displacement coordinate system (optional, unsupported)
// 56-64 : single point constraints (optional, unsupported)
// 64-70 : super-element id (optional, unsupported)
label index = readLabel(nextNasField(line, linei, 8, freeFormat));
(void) nextNasField(line, linei, 8, freeFormat);
scalar x = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar y = readNasScalar(nextNasField(line, linei, 8, freeFormat));
scalar z = readNasScalar(nextNasField(line, linei, 8, freeFormat));
pointId.append(index); pointId.append(index);
dynPoints.append(point(x, y, z)); dynPoints.append(point(x, y, z));
@ -327,6 +358,8 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
// GRID* 126 0 -5.55999875E+02 -5.68730474E+02 // GRID* 126 0 -5.55999875E+02 -5.68730474E+02
// * 2.14897901E+02 // * 2.14897901E+02
// Cannot be long format and free format at the same time!
label index = readLabel(nextNasField(line, linei, 16)); // 8-24 label index = readLabel(nextNasField(line, linei, 16)); // 8-24
(void) nextNasField(line, linei, 16); // 24-40 (void) nextNasField(line, linei, 16); // 24-40
scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56 scalar x = readNasScalar(nextNasField(line, linei, 16)); // 40-56

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -307,16 +307,10 @@ void Foam::surfaceWriters::nastranWriter::writeGeometry
Foam::surfaceWriters::nastranWriter::nastranWriter() Foam::surfaceWriters::nastranWriter::nastranWriter()
: :
surfaceWriter(), surfaceWriter(),
writeFormat_(fieldFormat::SHORT), writeFormat_(fieldFormat::FREE),
fieldMap_(),
commonGeometry_(false), commonGeometry_(false),
separator_() separator_(",") // FREE format
{ {}
// if (writeFormat_ == fieldFormat::FREE)
// {
// separator_ = ",";
// }
}
Foam::surfaceWriters::nastranWriter::nastranWriter Foam::surfaceWriters::nastranWriter::nastranWriter
@ -331,12 +325,10 @@ Foam::surfaceWriters::nastranWriter::nastranWriter
( (
"format", "format",
options, options,
fieldFormat::LONG fieldFormat::FREE
) )
), ),
fieldMap_(), commonGeometry_(options.getOrDefault("commonGeometry", false))
commonGeometry_(options.getOrDefault("commonGeometry", false)),
separator_()
{ {
if (writeFormat_ == fieldFormat::FREE) if (writeFormat_ == fieldFormat::FREE)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,13 +33,13 @@ Description
The formatOptions for nastran: The formatOptions for nastran:
\table \table
Property | Description | Reqd | Default Property | Description | Reqd | Default
fields | Field pairs for PLOAD2/PLOAD4 | yes | format | Nastran format (short/long/free) | no | free
format | Nastran format (short/long/free) | no | long
scale | Output geometry scaling | no | 1 scale | Output geometry scaling | no | 1
transform | Output coordinate transform | no | transform | Output coordinate transform | no |
fieldLevel | Subtract field level before scaling | no | empty dict fieldLevel | Subtract field level before scaling | no | empty dict
fieldScale | Output field scaling | no | empty dict fieldScale | Output field scaling | no | empty dict
commonGeometry | use separate geometry files | no | false commonGeometry | use separate geometry files | no | false
fields | Field pairs for PLOAD2/PLOAD4 | yes |
\endtable \endtable
For example, For example,
@ -48,13 +48,6 @@ Description
{ {
nastran nastran
{ {
// OpenFOAM field name to NASTRAN load types
fields
(
(pMean PLOAD2)
(p PLOAD4)
);
format free; // format type format free; // format type
scale 1000; // [m] -> [mm] scale 1000; // [m] -> [mm]
@ -62,6 +55,13 @@ Description
{ {
"p.*" 0.01; // [Pa] -> [mbar] "p.*" 0.01; // [Pa] -> [mbar]
} }
// OpenFOAM field name to NASTRAN load types
fields
(
(pMean PLOAD2)
(p PLOAD4)
);
} }
} }
\endverbatim \endverbatim
@ -93,7 +93,6 @@ Description
Note Note
Output variable scaling does not apply to integer types such as Ids. Output variable scaling does not apply to integer types such as Ids.
Field pairs default to PLOAD2 for scalars and PLOAD4 for vectors etc.
SourceFiles SourceFiles
nastranSurfaceWriter.C nastranSurfaceWriter.C
@ -221,10 +220,10 @@ public:
// Constructors // Constructors
//- Default construct. Default SHORT format //- Default construct. Default FREE format
nastranWriter(); nastranWriter();
//- Construct with some output options. Default LONG format //- Construct with some output options. Default FREE format
explicit nastranWriter(const dictionary& options); explicit nastranWriter(const dictionary& options);
//- Construct from components //- Construct from components

View File

@ -140,17 +140,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
if (mesh_.nSolutionD() == 2) if (mesh_.nSolutionD() == 2)
{ {
// Omega for 2D
omega_ = deltaPhi;
// dAve for 2D
dAve_ = vector
(
2*sinPhi*Foam::sin(0.5*deltaPhi),
2*cosPhi*Foam::sin(0.5*deltaPhi),
0
);
vector meshDir(Zero); vector meshDir(Zero);
if (dom_.meshOrientation() != vector::zero) if (dom_.meshOrientation() != vector::zero)
{ {
@ -172,7 +161,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = coordRot & dAve_; dAve_ = coordRot & dAve_;
d_ = coordRot & d_; d_ = coordRot & d_;
} }
else if (mesh_.nSolutionD() == 1) else if (mesh_.nSolutionD() == 1)
{ {
@ -195,9 +183,6 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
dAve_ = (dAve_ & normal)*meshDir; dAve_ = (dAve_ & normal)*meshDir;
d_ = (d_ & normal)*meshDir; d_ = (d_ & normal)*meshDir;
// Omega normalization for 1D
omega_ /= 2;
} }
autoPtr<volScalarField> IDefaultPtr; autoPtr<volScalarField> IDefaultPtr;