Skip to content

Commit

Permalink
OpenFOAM9-specific changes (#222)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeff Heylmun <heylmun@synthetik-technologies.com>
  • Loading branch information
MakisH and jheylmun committed Apr 26, 2024
1 parent f0c120a commit a288580
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 33 deletions.
3 changes: 2 additions & 1 deletion Adapter.H
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ public:
//- Called by the functionObject's execute()
void execute();

//- Called by the functionObject's setTimeStep()
//- Not called by OpenFOAM.org since OpenFOAM 9
// See https://github.com/precice/openfoam-adapter/issues/261
void setTimeStep();

//- Called by the functionObject's end()
Expand Down
3 changes: 1 addition & 2 deletions CHT/KappaEffective.H
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#ifndef CHT_COMMON_KAPPAEFF_H
#define CHT_COMMON_KAPPAEFF_H

#include "fluidThermoMomentumTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "momentumTransportModel.H"
#include "thermophysicalTransportModel.H"

namespace preciceAdapter
Expand Down
7 changes: 4 additions & 3 deletions FSI/ForceBase.C
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ForceBase.H"
#include "fluidThermo.H"

using namespace Foam;

Expand Down Expand Up @@ -27,8 +28,8 @@ preciceAdapter::FSI::ForceBase::ForceBase(
Foam::tmp<Foam::volSymmTensorField> preciceAdapter::FSI::ForceBase::devRhoReff() const
{
//For turbulent flows
typedef compressible::momentumTransportModel cmpTurbModel;
typedef incompressible::momentumTransportModel icoTurbModel;
typedef compressibleMomentumTransportModel cmpTurbModel;
typedef incompressibleMomentumTransportModel icoTurbModel;

if (mesh_.foundObject<cmpTurbModel>(cmpTurbModel::typeName))
{
Expand All @@ -39,7 +40,7 @@ Foam::tmp<Foam::volSymmTensorField> preciceAdapter::FSI::ForceBase::devRhoReff()
}
else if (mesh_.foundObject<icoTurbModel>(icoTurbModel::typeName))
{
const incompressible::momentumTransportModel& turb =
const icoTurbModel& turb =
mesh_.lookupObject<icoTurbModel>(icoTurbModel::typeName);

return rho() * turb.devSigma();
Expand Down
2 changes: 1 addition & 1 deletion FSI/ForceBase.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "pointFields.H"
#include "vectorField.H"
#include "fluidThermoMomentumTransportModel.H"
#include "compressibleMomentumTransportModel.H"
#include "kinematicMomentumTransportModel.H"

namespace preciceAdapter
Expand Down
7 changes: 3 additions & 4 deletions Interface.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Interface.H"
#include "Utilities.H"
#include "faceTriangulation.H"
#include "polygonTriangulate.H"
#include "cellSet.H"


Expand Down Expand Up @@ -303,16 +303,15 @@ void preciceAdapter::Interface::configureMesh(const fvMesh& mesh, const std::str
{
const face& faceQuad = faceField[facei];

// Triangulate the face
faceTriangulation faceTri(pointCoords, faceQuad, false);
triEngine.triangulate(UIndirectList<point>(pointCoords, faceQuad));

// Iterate over all triangles generated out of each (quad) face
for (uint triIndex = 0; triIndex < triaPerQuad; triIndex++)
{
// Get the vertex that corresponds to the x,y,z coordinates of each node of a triangle
for (uint nodeIndex = 0; nodeIndex < nodesPerTria; nodeIndex++)
{
triVertIDs.push_back(verticesMap.at(std::make_tuple(pointCoords[faceTri[triIndex][nodeIndex]][0], pointCoords[faceTri[triIndex][nodeIndex]][1], pointCoords[faceTri[triIndex][nodeIndex]][2])));
triVertIDs.push_back(verticesMap.at(std::make_tuple(pointCoords[triEngine.triPoints()[triIndex][nodeIndex]][0], pointCoords[triEngine.triPoints()[triIndex][nodeIndex]][1], pointCoords[triEngine.triPoints()[triIndex][nodeIndex]][2])));
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions Make/options
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lthermophysicalTransportModels \
-lfluidThermoMomentumTransportModels \
-ltransportModels \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
-limmiscibleIncompressibleTwoPhaseMixture \
$(ADAPTER_PKG_CONFIG_LIBS) \
-lprecice
17 changes: 0 additions & 17 deletions preciceAdapterFunctionObject.C
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,4 @@ bool Foam::functionObjects::preciceAdapterFunctionObject::write()
return true;
}

bool Foam::functionObjects::preciceAdapterFunctionObject::setTimeStep()
{
#ifdef ADAPTER_ENABLE_TIMINGS
clockValue clock;
clock.update();
#endif

adapter_.setTimeStep();

#ifdef ADAPTER_ENABLE_TIMINGS
timeInAll_ += clock.elapsed();
timeInExecute_ += clock.elapsed();
#endif

return true;
}

// ************************************************************************* //
3 changes: 0 additions & 3 deletions preciceAdapterFunctionObject.H
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ public:
//- Write the preciceAdapterFunctionObject
bool write() final;

//- Called at the end of Time::adjustDeltaT() if adjustTime is true
bool setTimeStep() final;

/*
// NOTE: If you add a new module that needs to execute methods
// whenever the mesh is updated or its points moved,
Expand Down

0 comments on commit a288580

Please sign in to comment.