@@ -36,8 +36,19 @@ DAInputThermalCoupling::DAInputThermalCoupling(
36
36
// NOTE: always sort the patch because the order of the patch element matters in CHT coupling
37
37
sort (patches_ );
38
38
39
+ // check discipline
39
40
discipline_ = daOption_ .getAllOptions ().getWord ("discipline" );
40
41
42
+ // check coupling mode and validate
43
+ distanceMode_ = daOption_ .getAllOptions ().getWord ("wallDistanceMethod" );
44
+ if (distanceMode_ != "daCustom" && distanceMode_ != "default" )
45
+ {
46
+ FatalErrorIn (" " ) << "wallDistanceMethod: "
47
+ << distanceMode_ << " not supported!"
48
+ << " Options are: default and daCustom."
49
+ << abort (FatalError );
50
+ }
51
+
41
52
size_ = 0 ;
42
53
forAll (patches_ , idxI )
43
54
{
@@ -83,6 +94,7 @@ void DAInputThermalCoupling::run(const scalarList& input)
83
94
84
95
// ********* second loop, set the valueFraction:
85
96
// neighKDeltaCoeffs / ( neighKDeltaCoeffs + myKDeltaCoeffs)
97
+ scalar deltaCoeffs = 0 ;
86
98
87
99
if (discipline_ == "aero" )
88
100
{
@@ -116,8 +128,19 @@ void DAInputThermalCoupling::run(const scalarList& input)
116
128
117
129
forAll (mesh_ .boundaryMesh ()[patchI ], faceI )
118
130
{
119
- // deltaCoeffs = 1 / d
120
- scalar deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
131
+ if (distanceMode_ == "default" )
132
+ {
133
+ // deltaCoeffs = 1 / d
134
+ deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
135
+ }
136
+ else if (distanceMode_ == "daCustom" )
137
+ {
138
+ label nearWallCellIndex = mesh_ .boundaryMesh ()[patchI ].faceCells ()[faceI ];
139
+ vector c1 = mesh_ .Cf ().boundaryField ()[patchI ][faceI ];
140
+ vector c2 = mesh_ .C ()[nearWallCellIndex ];
141
+ scalar d = mag (c1 - c2 );
142
+ deltaCoeffs = 1 / d ;
143
+ }
121
144
scalar alphaEffBf = alphaEff .boundaryField ()[patchI ][faceI ];
122
145
scalar myKDeltaCoeffs = Cp * alphaEffBf * deltaCoeffs ;
123
146
// NOTE: we continue to use the counterI from the first loop
@@ -175,8 +198,19 @@ void DAInputThermalCoupling::run(const scalarList& input)
175
198
176
199
forAll (mesh_ .boundaryMesh ()[patchI ], faceI )
177
200
{
178
- // deltaCoeffs = 1 / d
179
- scalar deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
201
+ if (distanceMode_ == "default" )
202
+ {
203
+ // deltaCoeffs = 1 / d
204
+ deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
205
+ }
206
+ else if (distanceMode_ == "daCustom" )
207
+ {
208
+ label nearWallCellIndex = mesh_ .boundaryMesh ()[patchI ].faceCells ()[faceI ];
209
+ vector c1 = mesh_ .Cf ().boundaryField ()[patchI ][faceI ];
210
+ vector c2 = mesh_ .C ()[nearWallCellIndex ];
211
+ scalar d = mag (c1 - c2 );
212
+ deltaCoeffs = 1 / d ;
213
+ }
180
214
scalar alphaEffBf = alphaEff .boundaryField ()[patchI ][faceI ];
181
215
scalar myKDeltaCoeffs = tmpVal * alphaEffBf * deltaCoeffs ;
182
216
// NOTE: we continue to use the counterI from the first loop
@@ -206,13 +240,22 @@ void DAInputThermalCoupling::run(const scalarList& input)
206
240
word patchName = patches_ [idxI ];
207
241
label patchI = mesh_ .boundaryMesh ().findPatchID (patchName );
208
242
209
- mixedFvPatchField < scalar > & mixedPatch =
210
- refCast < mixedFvPatchField < scalar >>(T .boundaryFieldRef ()[patchI ]);
211
-
212
243
forAll (mesh_ .boundaryMesh ()[patchI ], faceI )
213
244
{
214
- // deltaCoeffs = 1 / d
215
- scalar deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
245
+ if (distanceMode_ == "default" )
246
+ {
247
+ // deltaCoeffs = 1 / d
248
+ deltaCoeffs = T .boundaryField ()[patchI ].patch ().deltaCoeffs ()[faceI ];
249
+ }
250
+ else if (distanceMode_ == "daCustom" )
251
+ {
252
+ label nearWallCellIndex = mesh_ .boundaryMesh ()[patchI ].faceCells ()[faceI ];
253
+ vector c1 = mesh_ .Cf ().boundaryField ()[patchI ][faceI ];
254
+ vector c2 = mesh_ .C ()[nearWallCellIndex ];
255
+ scalar d = mag (c1 - c2 );
256
+ deltaCoeffs = 1 / d ;
257
+ }
258
+ mixedFvPatchField < scalar > & mixedPatch = refCast < mixedFvPatchField < scalar >>(T .boundaryFieldRef ()[patchI ]);
216
259
scalar myKDeltaCoeffs = k * deltaCoeffs ;
217
260
// NOTE: we continue to use the counterI from the first loop
218
261
scalar neighKDeltaCoeffs = input [counterI ];
0 commit comments