Compare commits

...

14 Commits

Author SHA1 Message Date
d3f7f91f6c ENH: track old output times for lumpedPoint output (#1793)
- now also tracks the previous output time, which aids on restarts
  since it allows the FEA side the possibility of determining
  the effective deltaT between the output of forces
2020-08-06 09:24:50 +02:00
6461eec886 CONFIG: increment patch level 2020-07-27 10:28:44 +02:00
3455d556c4 BUG: potential memory leaks in HashPtrTable::set (#1787)
- backported fix from develop

COMP: incorrect variable names in PtrListOpsTemplates.C
2020-07-27 10:28:40 +02:00
540589fc22 SUBMODULE: visualization installation prefix on older ubuntu (#1757) 2020-07-27 09:58:24 +02:00
c411c0cc09 SUBMODULE: adios (style), external-solver (bugfix), visualization (style) 2020-07-23 18:12:06 +02:00
e8b06ac222 STYLE: remove incorrect branch condition in setExprFields 2020-07-23 16:52:15 +02:00
dc6c3c8add TUT: Correction for Alltest 2020-07-20 10:19:54 +01:00
fa86a98482 BUG: Minor correction to lumpedPointState.C for debug build 2020-07-17 14:09:34 +01:00
5dc04530d9 COMP: additional linkage libraries for AMD compiler (#1627) 2020-07-14 12:17:09 +02:00
a86860430a BUG: checkMesh: index into surfaceScalarField. Fixes #1771. 2020-07-13 13:02:07 +01:00
9b78472e06 DOC: Updated header doc - see #1756 2020-07-02 09:17:48 +01:00
6d965d699b BUG: mergeOrSplitBaffles -dict option ignored (fixes #1759)
- regression from f721b5344f
2020-07-01 18:41:31 +02:00
0b41521d98 CONFIG: avoid triggering dash expansion bug (fixes #1757)
- use long form to avoid dash 0.5.8 error (ubuntu bionic)

- consolidate the prefix handling into modules/Allwmake
2020-07-01 16:20:13 +02:00
968ce0290d DOC: Corrected header documentation - see #1756 2020-07-01 14:59:11 +01:00
23 changed files with 138 additions and 88 deletions

View File

@ -80,18 +80,6 @@ then
echo
elif [ -d "$WM_PROJECT_DIR/modules" ]
then
echo "========================================"
echo "Compile OpenFOAM modules"
echo " ignoring possible compilation errors"
echo " make certain to check the output file"
echo
set +e
export WM_CONTINUE_ON_ERROR=true
# Default build into OpenFOAM project locations
: "${FOAM_MODULE_PREFIX:=${FOAM_LIBBIN%/*}}"
export FOAM_MODULE_PREFIX
(cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all)
fi

View File

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

View File

@ -26,6 +26,8 @@ EXE_INC = \
EXE_LIBS = \
${CGAL_LIBS} \
-lconformalVoronoiMesh \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-ldecompositionMethods \
-ldecompose \

View File

@ -616,6 +616,17 @@ void Foam::writeFields
}
if (selectedFields.found("faceZone"))
{
// Determine for each face the zone index (scalar for ease of
// manipulation)
scalarField zoneID(mesh.nFaces(), -1);
const faceZoneMesh& czs = mesh.faceZones();
for (const auto& zone : czs)
{
UIndirectList<scalar>(zoneID, zone) = zone.index();
}
// Split into internal and boundary values
surfaceScalarField faceZone
(
IOobject
@ -632,10 +643,13 @@ void Foam::writeFields
calculatedFvsPatchScalarField::typeName
);
const faceZoneMesh& czs = mesh.faceZones();
for (const auto& zone : czs)
faceZone.primitiveFieldRef() =
SubField<scalar>(zoneID, mesh.nInternalFaces());
surfaceScalarField::Boundary& bfld = faceZone.boundaryFieldRef();
for (auto& pfld : bfld)
{
UIndirectList<scalar>(faceZone, zone) = zone.index();
const fvPatch& fvp = pfld.patch();
pfld == SubField<scalar>(zoneID, fvp.size(), fvp.start());
}
//faceZone.correctBoundaryConditions();

View File

@ -286,7 +286,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::addBoolOption
argList::addOption
(
"dict",
"file",

View File

@ -6,5 +6,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lmeshTools \
-llumpedPointMotion

View File

@ -6,5 +6,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lmeshTools \
-llumpedPointMotion

View File

@ -898,7 +898,7 @@ int main(int argc, char *argv[])
);
}
}
else if (exprDictPtr.valid())
else
{
FatalErrorInFunction
<< "No command-line or dictionary??" << nl << endl

View File

@ -7,9 +7,22 @@ targetType=libso
# Default build into OpenFOAM project locations unless specified with
# -prefix or FOAM_MODULE_PREFIX env varable
: "${FOAM_MODULE_PREFIX:=${FOAM_LIBBIN%/*}}"
# Long form to avoid dash 0.5.8 error (issue #1757)
[ -n "$FOAM_MODULE_PREFIX" ] || FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
export FOAM_MODULE_PREFIX
echo "========================================"
echo "Compile OpenFOAM modules"
echo "prefix = $FOAM_MODULE_PREFIX"
echo
echo " ignoring possible compilation errors"
echo " make certain to check the output file"
echo
set +e
export WM_CONTINUE_ON_ERROR=true
#------------------------------------------------------------------------------
for moduleName in $(./list-modules)
do
if [ -d "$moduleName" ]

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -86,7 +86,19 @@ inline bool Foam::HashPtrTable<T, Key, Hash>::set
T* ptr
)
{
return this->parent_type::set(key, ptr);
// Newer: const T* old = this->get(key);
iterator iter(this->find(key));
const T* old = (iter.good() ? iter.val() : nullptr);
const bool ok = this->parent_type::set(key, ptr);
if (ok && old != ptr)
{
delete const_cast<T*>(old);
}
return ok;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -79,7 +79,7 @@ void Foam::sortedOrder
template<class T>
void Foam::sort(UPtrList<T>& list)
{
labelList order(input.size());
labelList order(list.size());
sortedOrder(list, order);
list.sortOrder(order, false); // false = allow nullptr
}
@ -88,7 +88,7 @@ void Foam::sort(UPtrList<T>& list)
template<class T, class Compare>
void Foam::sort(UPtrList<T>& list, const Compare& comp)
{
labelList order(input.size());
labelList order(list.size());
sortedOrder(list, order, comp);
list.sortOrder(order, false); // false = allow nullptr
}

View File

@ -34,7 +34,7 @@ Description
calculated as:
\f[
p = pa - \vec{g} & \vec{r}
p = pa - \vec{g} \cdot \vec{r}
\f]
where

View File

@ -30,7 +30,7 @@ Group
grpInletBoundaryConditions grpOutletBoundaryConditions
Description
This velocity inlet/outlet boundary condition is applied to pressure
This velocity inlet/outlet boundary condition is applied to velocity
boundaries where the pressure is specified. A zero-gradient condition is
applied for outflow (as defined by the flux); for inflow, the velocity
is obtained from the flux with the specified inlet direction.

View File

@ -30,7 +30,7 @@ Group
grpInletBoundaryConditions grpOutletBoundaryConditions
Description
This velocity inlet/outlet boundary condition is applied to pressure
This velocity inlet/outlet boundary condition is applied to velocity
boundaries where the pressure is specified. A zero-gradient condition is
applied for outflow (as defined by the flux); for inflow, the velocity is
obtained from the patch-face normal component of the internal-cell value.

View File

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

View File

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

View File

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

View File

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

View File

@ -152,7 +152,7 @@ Foam::lumpedPointState::lumpedPointState
FatalErrorInFunction
<< "Have " << points_.size() << " points but "
<< angles_.size() << " angles" << nl
exit(FatalError);
<< exit(FatalError);
#else
WarningInFunction
<< "Have " << points_.size() << " points but "

View File

@ -7,6 +7,9 @@ cd "${0%/*}" || exit # Run from this directory
runApplication $(getApplication)
./createGraphs
if notTest "$@"
then
./createGraphs
fi
#------------------------------------------------------------------------------