Skip to content

Commit f5862a3

Browse files
authored
Merge pull request #307 from antjost/devChangeIBCType
[IBM] Mod to changeIBCType.
2 parents 4013d4c + e48daba commit f5862a3

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

Cassiopee/Geom/Geom/IBM.py

+23-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@
1212
'gradxVelocityX','gradyVelocityX','gradzVelocityX',
1313
'gradxVelocityY','gradyVelocityY','gradzVelocityY',
1414
'gradxVelocityZ','gradyVelocityZ','gradzVelocityZ',
15-
'KCurv' ,'yplus']
15+
'KCurv' ,'yplus' ,
16+
't11_model' ,'t12_model' ,'t22_model',
17+
't13_model' ,'t23_model' ,'t33_model']
18+
varsDeleteIBMRotTmp=['CoordinateX_PC#Init','CoordinateX_PC#Init','CoordinateX_PC#Init',
19+
'CoordinateX_PW#Init','CoordinateX_PW#Init','CoordinateX_PW#Init',
20+
'CoordinateX_PI#Init','CoordinateX_PI#Init','CoordinateX_PI#Init',
21+
'MotionType','omega',
22+
'transl_speedX','transl_speedY','transl_speedZ',
23+
'axis_pntX' ,'axis_pntY' ,'axis_pntZ' ,
24+
'axis_vctX' ,'axis_vctY' ,'axis_vctZ' ]
1625
#==============================================================================
1726
# Creation of a case with a symmetry plane
1827
#==============================================================================
@@ -423,11 +432,18 @@ def _initInj(tc, familyName, PTot, HTot, injDir=[1.,0.,0.], InterpolPlane=None,
423432
#==============================================================================
424433
# Add variables to the IBC
425434
#==============================================================================
426-
def _addVariablesTcIbc(zsr, ibctype, nIBC):
435+
def _addVariablesTcIbc(zsr, ibctype, nIBC, nsModel='NSLaminar'):
427436
Nlength = numpy.zeros((nIBC),numpy.float64)
428-
if ibctype in [2, 3, 6, 10, 11]:
437+
if ibctype in [2, 3, 6, 10, 11, 31, 32, 331, 332]:
429438
zsr[2].append(['utau' , copy.copy(Nlength), [], 'DataArray_t'])
430439
zsr[2].append(['yplus', copy.copy(Nlength), [], 'DataArray_t'])
440+
if ibctype in [331, 332] and nsModel=='NSLaminar':
441+
zsr[2].append(['t11_model' , copy.copy(Nlength), [], 'DataArray_t'])
442+
zsr[2].append(['t12_model' , copy.copy(Nlength), [], 'DataArray_t'])
443+
zsr[2].append(['t22_model' , copy.copy(Nlength), [], 'DataArray_t'])
444+
zsr[2].append(['t13_model' , copy.copy(Nlength), [], 'DataArray_t'])
445+
zsr[2].append(['t23_model' , copy.copy(Nlength), [], 'DataArray_t'])
446+
zsr[2].append(['t33_model' , copy.copy(Nlength), [], 'DataArray_t'])
431447

432448
if ibctype == 5:
433449
Internal._createChild(zsr, 'StagnationEnthalpy', 'DataArray_t', value=copy.copy(Nlength))
@@ -474,6 +490,9 @@ def _changeIBCType(tc, oldIBCType, newIBCType):
474490
"""Change the IBC type in a connectivity tree from oldIBCType to newIBCType.
475491
Usage: changeIBCType(tc, oldIBCType, newIBCType)"""
476492
for z in Internal.getZones(tc):
493+
govEqn = Internal.getNodeFromName(z, 'GoverningEquations')
494+
nsModel = 'NSLaminar'
495+
if govEqn: nsModel = Internal.getValue(govEqn)
477496
subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t')
478497
for zsr in subRegions:
479498
nameSubRegion = zsr[0]
@@ -487,7 +506,7 @@ def _changeIBCType(tc, oldIBCType, newIBCType):
487506
for var_local in varsDeleteIBM:
488507
Internal._rmNodesByName(zsr, var_local)
489508

490-
_addVariablesTcIbc(zsr, newIBCType, nIBC)
509+
_addVariablesTcIbc(zsr, newIBCType, nIBC, nsModel)
491510

492511
return None
493512

Cassiopee/Geom/test/changeIBCTypePT_t1.py

+8
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@
2525

2626
D_IBM._changeIBCType(a,2,3)
2727
test.testT(a, 1)
28+
29+
C.addState2Node__(a, 'GoverningEquations', 'NSLaminar')
30+
D_IBM._changeIBCType(a,3,331)
31+
test.testT(a, 2)
32+
33+
C.addState2Node__(a, 'GoverningEquations', 'NSTurbulent')
34+
D_IBM._changeIBCType(a,331,332)
35+
test.testT(a, 3)

0 commit comments

Comments
 (0)