-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathTemperature.C
61 lines (52 loc) · 1.62 KB
/
Temperature.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "Temperature.H"
using namespace Foam;
preciceAdapter::FF::Temperature::Temperature(
const Foam::fvMesh& mesh,
const std::string nameT)
: T_(
const_cast<volScalarField*>(
&mesh.lookupObject<volScalarField>(nameT)))
{
dataType_ = scalar;
}
std::size_t preciceAdapter::FF::Temperature::write(double* buffer, bool meshConnectivity, const unsigned int dim)
{
int bufferIndex = 0;
// For every boundary patch of the interface
for (uint j = 0; j < patchIDs_.size(); j++)
{
int patchID = patchIDs_.at(j);
scalarField gradientPatch((T_->boundaryFieldRef()[patchID])
.snGrad());
// For every cell of the patch
forAll(T_->boundaryFieldRef()[patchID], i)
{
// Copy the pressure into the buffer
buffer[bufferIndex++] =
T_->boundaryFieldRef()[patchID][i];
}
}
return bufferIndex;
}
void preciceAdapter::FF::Temperature::read(double* buffer, const unsigned int dim)
{
int bufferIndex = 0;
// For every boundary patch of the interface
for (uint j = 0; j < patchIDs_.size(); j++)
{
int patchID = patchIDs_.at(j);
// For every cell of the patch
forAll(T_->boundaryFieldRef()[patchID], i)
{
T_->boundaryFieldRef()[patchID][i] = buffer[bufferIndex++];
}
}
}
bool preciceAdapter::FF::Temperature::isLocationTypeSupported(const bool meshConnectivity) const
{
return (this->locationType_ == LocationType::faceCenters);
}
std::string preciceAdapter::FF::Temperature::getDataName() const
{
return "Temperature";
}