Compare commits
14 Commits
OpenFOAM-v
...
lumpedPoin
| Author | SHA1 | Date | |
|---|---|---|---|
| d3f7f91f6c | |||
| 6461eec886 | |||
| 3455d556c4 | |||
| 540589fc22 | |||
| c411c0cc09 | |||
| e8b06ac222 | |||
| dc6c3c8add | |||
| fa86a98482 | |||
| 5dc04530d9 | |||
| a86860430a | |||
| 9b78472e06 | |||
| 6d965d699b | |||
| 0b41521d98 | |||
| 968ce0290d |
12
Allwmake
12
Allwmake
@ -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
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2006
|
||||
patch=0
|
||||
patch=200727
|
||||
|
||||
@ -26,6 +26,8 @@ EXE_INC = \
|
||||
EXE_LIBS = \
|
||||
${CGAL_LIBS} \
|
||||
-lconformalVoronoiMesh \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-ldecompositionMethods \
|
||||
-ldecompose \
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -286,7 +286,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
argList::addBoolOption
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
|
||||
@ -6,5 +6,6 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats \
|
||||
-lmeshTools \
|
||||
-llumpedPointMotion
|
||||
|
||||
@ -6,5 +6,6 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats \
|
||||
-lmeshTools \
|
||||
-llumpedPointMotion
|
||||
|
||||
@ -898,7 +898,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (exprDictPtr.valid())
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No command-line or dictionary??" << nl << endl
|
||||
|
||||
@ -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" ]
|
||||
|
||||
Submodule modules/adios updated: da20135092...f635fe3375
Submodule modules/external-solver updated: 8ebbdb6319...302f251828
Submodule modules/visualization updated: 07cd1156fa...766c82b8d9
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ Description
|
||||
calculated as:
|
||||
|
||||
\f[
|
||||
p = pa - \vec{g} & \vec{r}
|
||||
p = pa - \vec{g} \cdot \vec{r}
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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 "
|
||||
|
||||
@ -7,6 +7,9 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
./createGraphs
|
||||
if notTest "$@"
|
||||
then
|
||||
./createGraphs
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user