Skip to content

Commit df2a9e9

Browse files
Merge pull request aurora-multiphysics#41 from hsaunders1904/hsaunders1904/remove_foam_interface_singleton
Remove foam interface singleton
2 parents 35d8335 + 363b9ba commit df2a9e9

File tree

531 files changed

+6142
-423278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

531 files changed

+6142
-423278
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
shell: bash
4343
run: |
4444
. /opt/openfoam/OpenFOAM-12/etc/bashrc || true
45+
unset FOAM_SIGFPE && unset FOAM_SETNAN
4546
./run_tests
4647
4748
- name: Docs

include/base/FoamInterface.h

Lines changed: 0 additions & 84 deletions
This file was deleted.

include/base/FoamInterfaceImpl.h

Lines changed: 0 additions & 92 deletions
This file was deleted.

include/base/FoamRuntime.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include "ArgsUtil.h"
4+
#include "fvCFD_moose.h"
5+
6+
#include <mpi.h>
7+
8+
namespace Hippo
9+
{
10+
11+
class FoamRuntime
12+
{
13+
public:
14+
FoamRuntime(const std::string & case_dir, MPI_Comm const & comm);
15+
FoamRuntime(const FoamRuntime & rt);
16+
17+
Foam::Time & runTime() { return _runtime; }
18+
19+
private:
20+
cArgs _argv;
21+
Foam::Time _runtime;
22+
};
23+
24+
}

include/base/FoamSolver.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "fvCFD_moose.h"
44

5-
#include <scalar.H>
6-
75
#include <vector>
86

97
namespace Hippo
@@ -17,17 +15,28 @@ class FoamSolver
1715
// Run a timestep of the OpenFOAM solver.
1816
void run();
1917

20-
// Append temperature values from the OpenFOAM patch (boundary) to the end of the given vector.
18+
// Append temperature values from the OpenFOAM patch (boundary) to the end of
19+
// the given vector.
2120
std::size_t appendPatchTemperatures(int patch_id, std::vector<double> & foam_t);
2221
// Return the number of faces in the given patch (boundary).
2322
std::size_t patchSize(int patch_id);
2423
// Set the temperature values of the OpenFOAM patch (boundary).
2524
void setPatchTemperatures(int patch_id, const std::vector<double> & moose_t);
2625
// Set the negative heat flux values on the OpenFOAM patch (boundary).
2726
void setPatchNegativeHeatFlux(int patch_id, std::vector<double> & negative_hf);
27+
// Get or calculate the wall heat flux for the given patch.
28+
std::size_t wallHeatFlux(int patch_id, std::vector<double> & fill_vector);
29+
// Set the solver's time step size.
30+
void setTimeDelta(double dt) { runTime().setDeltaTNoAdjust(dt); }
31+
// Set the solver to the given time.
32+
void setCurrentTime(double time) { runTime().setTime(time, runTime().timeIndex()); }
33+
// Set the time at which the solver should terminate.
34+
void setEndTime(double time) { runTime().setEndTime(time); }
2835

2936
private:
3037
Foam::solver * _solver = nullptr;
38+
39+
Foam::Time & runTime() { return const_cast<Foam::Time &>(_solver->runTime); }
3140
};
3241

33-
}
42+
} // namespace Hippo

include/base/foam/fvCFD_moose.h

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
#pragma once
2-
// Need to play some games to prevent name clashes
3-
// hence the undef and to define namespaceFoam to
4-
// prevnet a using namespace Foam; in header (sigh)
2+
// This file is a workaround for a name clash between OpenFOAM and libMesh,
3+
// which both define the symbol 'NotImplemented'. If you see some cryptic
4+
// build errors in libMesh, then this is likely the problem.
5+
// The solution here is to include what we need from OpenFOAM and then undef
6+
// NotImplemented, which will be redefined by libMesh later. Source files can
7+
// include this file instead of directly including OpenFOAM headers.
8+
// Not a huge amount of science went into what's included here and what's
9+
// included in source files. It was pretty much a case of 'move things until it
10+
// works'.
511

612
#define namespaceFoam
13+
// Foam2MooseMeshGen.h
14+
#include <distributionMapBase.H>
15+
#include <fvMesh.H>
16+
717
// Foam2MooseMeshGen.C
18+
#include <IOobject.H>
19+
#include <PrimitivePatch.H>
820
#include <error.H>
921
#include <fvMesh.H>
10-
#include <IOobject.H>
1122
#include <polyPatch.H>
1223

13-
// FoamInterfaceImpl.H
14-
#include <argList.H>
15-
1624
// FoamSolver.h
25+
#include <scalar.H>
1726
#include <solver.H>
1827

28+
// FoamRuntime.h
29+
#include <Time.H>
30+
31+
// FoamRuntime.C
32+
#include <Pstream/mpi/PstreamGlobals.H>
33+
#include <argList.H>
34+
#include <fvMesh.H>
35+
1936
#undef NotImplemented

0 commit comments

Comments
 (0)