Skip to content

Commit

Permalink
Merge pull request #163 from antjost/devCartesianTrue
Browse files Browse the repository at this point in the history
[IBM] prepareIBMData-set cartesian=True as the new default.
  • Loading branch information
vincentcasseau authored Sep 3, 2024
2 parents f6007dc + 0b0d672 commit 50c51c1
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Cassiopee/Apps/test/FastIBMWireMeshModel_m1.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

X_IBM.prepareIBMData(tb , tFile , tcFile , tbox=tboffset,
snears=snears , dfars=dfars , vmin=vmin,
check=True , frontType=1)
check=True , frontType=1 , cartesian=False)
App._distribute(tFile, tcFile, NP=Cmpi.size)
t = Fast.loadTree(tFile , split='single', mpirun=True)
tc,graph= Fast.loadFile(tcFile, split='single', mpirun=True, graph=True)
Expand Down
4 changes: 2 additions & 2 deletions Cassiopee/Apps/test/FastIBMWireMeshModel_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
snears = 1
vmin = 11

t,tc = X_IBM.prepareIBMData(tb , None , None , tbox=tboffset,
t,tc = X_IBM.prepareIBMData(tb , None , None , tbox=tboffset,
snears=snears , dfars=dfars , vmin=vmin,
check=False , frontType=1)
check=False , frontType=1 , cartesian=False)
test.testT(t , 1)
test.testT(tc, 2)

Expand Down
4 changes: 2 additions & 2 deletions Cassiopee/Apps/test/IBMOutletControlPressure_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
cxSupport = 0.6, sSupport=0.1, itExtrctPrb=itExtrctPrb)
test.testT(tb,1)

t,tc=X_IBM.prepareIBMData(tb , None , None ,
snears=0.01, dfars=0, vmin=11)
t,tc=X_IBM.prepareIBMData(tb , None , None ,
snears=0.01, dfars=0, vmin=11, cartesian=False)

[RoInf, RouInf, RovInf, RowInf, RoeInf, PInf, TInf, cvInf, MInf,
ReInf, Cs, Gamma, RokInf, RoomegaInf, RonutildeInf,
Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/Apps/test/IBMrotation_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

t_out =None
tc_out=None
t_ibm, tc_ibm = X_IBM.prepareIBMData(tb, t_out, tc_out, t_ibm, frontType=frontType)
t_ibm, tc_ibm = X_IBM.prepareIBMData(tb, t_out, tc_out, t_ibm, frontType=frontType, cartesian=False)

C._rmBCOfType(t_ibm,'BCFarfield')
C._fillEmptyBCWith(t_ibm,'dummy','BCExtrapolate', dim=dimPb)
Expand Down
30 changes: 21 additions & 9 deletions Cassiopee/Connector/Connector/IBM.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _computeMeshInfo(t):
def prepareIBMData(t_case, t_out, tc_out, t_in=None, to=None, tbox=None, tinit=None, tbCurvi=None,
snears=0.01, snearsf=None, dfars=10., dfarDir=0, vmin=21, depth=2, frontType=1, octreeMode=0,
IBCType=1, verbose=True, expand=3,
check=False, twoFronts=False, cartesian=False,
check=False, twoFronts=False, cartesian=True,
yplus=100., Lref=1., correctionMultiCorpsF42=False, blankingF42=False, wallAdaptF42=None, heightMaxF42=-1.):

import Generator.IBM as G_IBM
Expand All @@ -193,6 +193,15 @@ def prepareIBMData(t_case, t_out, tc_out, t_in=None, to=None, tbox=None, tinit=N
if isinstance(t_case, str): tb = C.convertFile2PyTree(t_case)
else: tb = Internal.copyTree(t_case)

##THIS IS TEMPORARY -> a more comprehensive test is in the works and will make this
## print redundant.
if cartesian and t_in:
RED = "\033[1;31;40m"
END = "\033[0m"
print(RED + "===========================================" + END)
print("Note: Assuming " + RED + "CARTESIAN " + END + "grid")
print(RED + "===========================================" + END)

##[AJ] keep for now...will delete in the near future
##if isinstance(tc_out, str):
## if '/' in tc_out: fileoutpre = tc_out.split('/')
Expand Down Expand Up @@ -325,16 +334,19 @@ def prepareIBMData(t_case, t_out, tc_out, t_in=None, to=None, tbox=None, tinit=N
_redispatch__(t=t, tc=tc, tc2=tc2)

if isinstance(tc_out, str):
tcp = Compressor.compressCartesian(tc)
if cartesian: tcp = Compressor.compressCartesian(tc)
else: tcp = tc
Cmpi.convertPyTree2File(tcp, tc_out, ignoreProcNodes=True)

if tc2:
tcp2 = Compressor.compressCartesian(tc2)
if cartesian: tcp2 = Compressor.compressCartesian(tc2)
else: tcp2 = tc2
tc2_out = tc_out.replace('tc', 'tc2') if 'tc' in tc_out else 'tc2.cgns'
Cmpi.convertPyTree2File(tcp2, tc2_out, ignoreProcNodes=True)

if isinstance(t_out, str):
tp = Compressor.compressCartesian(t)
if cartesian: tp = Compressor.compressCartesian(t)
else: tp = t
Cmpi.convertPyTree2File(tp, t_out, ignoreProcNodes=True)

_computeMeshInfo(t)
Expand All @@ -347,7 +359,7 @@ def prepareIBMData(t_case, t_out, tc_out, t_in=None, to=None, tbox=None, tinit=N

#def prepareIBMDataExtrude(t_case, t_out, tc_out, t, to=None,
# depth=2, frontType=1, octreeMode=0, IBCType=1,
# verbose=True, check=False, balancing=False, distribute=False, twoFronts=False, cartesian=False,
# verbose=True, check=False, balancing=False, distribute=False, twoFronts=False, cartesian=True,
# yplus=100., Lref=1., correctionMultiCorpsF42=False, blankingF42=False, wallAdaptF42=None, heightMaxF42=-1.,
# tbox=None, extrusion='cart'):
# STILL IN DEV - DO NOT USE
Expand Down Expand Up @@ -1061,7 +1073,7 @@ def _blankingIBM(t, tb, dimPb=3, frontType=1, IBCType=1, depth=2, Reynolds=1.e6,
# OUT: front: front of image points
# OUT: front2: (optional): front of second image points
#=========================================================================
def _pushBackImageFront2__(t, tc, tbbc, cartesian=False):
def _pushBackImageFront2__(t, tc, tbbc, cartesian=True):
# bboxDict needed for optimised AddXZones (i.e. "layers" not None)
# Return a dict with the zones of t as keys and their specific bboxes as key values
bboxDict = Cmpi.createBboxDict(t)
Expand Down Expand Up @@ -1161,7 +1173,7 @@ def _pushBackImageFront2__(t, tc, tbbc, cartesian=False):

return None

def buildFrontIBM(t, tc, tb=None, dimPb=3, frontType=1, cartesian=False, twoFronts=False, check=False,
def buildFrontIBM(t, tc, tb=None, dimPb=3, frontType=1, cartesian=True, twoFronts=False, check=False,
tbFilament=None):
"""Build the IBM front for IBM pre-processing."""

Expand Down Expand Up @@ -1241,7 +1253,7 @@ def buildFrontIBM(t, tc, tb=None, dimPb=3, frontType=1, cartesian=False, twoFron
# OUT: (optional) 2_IBCD* zones inside tc
#=========================================================================
def setInterpDataIBM(t, tc, tb, front, front2=None, dimPb=3, frontType=1, IBCType=1, depth=2, Reynolds=1.e6,
yplus=100, Lref=1., cartesian=False, twoFronts=False, check=False,
yplus=100, Lref=1., cartesian=True, twoFronts=False, check=False,
tbFilament=None, frontWMM=None):
"""Compute the transfer coefficients and data for IBM pre-processing."""
tp = Internal.copyRef(t)
Expand All @@ -1252,7 +1264,7 @@ def setInterpDataIBM(t, tc, tb, front, front2=None, dimPb=3, frontType=1, IBCTyp
return tp

def _setInterpDataIBM(t, tc, tb, front, front2=None, dimPb=3, frontType=1, IBCType=1, depth=2, Reynolds=1.e6,
yplus=100, Lref=1., cartesian=False, twoFronts=False, check=False,
yplus=100, Lref=1., cartesian=True, twoFronts=False, check=False,
tbFilament=None, frontWMM=None):
"""Compute the transfer coefficients and data for IBM pre-processing."""

Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/Connector/test/IBMrectilinear_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

##IBM PREP
t,tc=X_IBM.prepareIBMData(tb , None , None , tbox=tbOneOver,
snears=0.01, dfars=dfar, vmin=vmin)
snears=0.01, dfars=dfar, vmin=vmin, cartesian=False)
os.remove(FileNameOneOver)

##NON-REGRESSION CHECK
Expand Down
6 changes: 3 additions & 3 deletions Cassiopee/Connector/test/adaptF42PT_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def _initYplusTargetPoints(tc):
D_IBM._setIBCType(tb, 'Musker')
D_IBM._setSnear(tb, 0.001)
D_IBM._setDfar(tb, 25.)
t,tc = X_IBM.prepareIBMData(tb, None, None, check=False, frontType=42, yplus=2000, vmin=21)
t,tc = X_IBM.prepareIBMData(tb, None, None, check=False, frontType=42, yplus=2000, vmin=21, cartesian=False)
test.testT(tc,1)
C.__ZoneNameServer__ = {}; C.__BCNameServer__ = {}; C.__BaseNameServer__ = {}
_initYplusTargetPoints(tc)
wallAdapt = X_IBM.createWallAdapt(tc)
t,tc = X_IBM.prepareIBMData(tb, None, None, check=False, frontType=42, yplus=2000, vmin=21, wallAdaptF42=wallAdapt)
test.testT(tc,2)
t,tc = X_IBM.prepareIBMData(tb, None, None, check=False, frontType=42, yplus=2000, vmin=21, wallAdaptF42=wallAdapt, cartesian=False)
test.testT(tc,2)
2 changes: 1 addition & 1 deletion Cassiopee/Connector/test/prepareIBMData_m1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
snears = 1
t, tc = X_IBM.prepareIBMData(tb , None , None ,
snears=snears , dfars=dfars , vmin=vmin,
check=False , frontType=1)
check=False , frontType=1 , cartesian=False)
if Cmpi.rank==0:
test.testT(t , 1)
test.testT(tc, 2)
2 changes: 1 addition & 1 deletion Cassiopee/Connector/test/prepareIBMData_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
snears = 1
t, tc = X_IBM.prepareIBMData(tb , None , None ,
snears=snears , dfars=dfars , vmin=vmin,
check=False , frontType=1)
check=False , frontType=1 , cartesian=False)
test.testT(t , 1)
test.testT(tc, 2)
#C.convertPyTree2File(t,'t_check.cgns')
20 changes: 10 additions & 10 deletions Cassiopee/Connector/test/setInterpDataIBMPT_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=2)
XIBM._blankingIBM(t, tb, dimPb=2)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=1)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=1, cartesian=False)
test.testT(t, 1)
test.testT(tc, 11)

Expand All @@ -42,8 +42,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=2, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=2, frontType=42)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=42, cartesian=False)
test.testT(t, 2)
test.testT(tc, 21)

Expand All @@ -64,8 +64,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=2, correctionMultiCorpsF42=True, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=2, correctionMultiCorpsF42=True, frontType=42)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=2, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=2, frontType=42, cartesian=False)
test.testT(t, 3)
test.testT(tc, 31)

Expand All @@ -84,8 +84,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=2, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=2, frontType=42, blankingF42=True)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=2, frontType=42, cartesian=False)
test.testT(t, 4)
test.testT(tc, 41)

Expand All @@ -104,7 +104,7 @@
XIBM._dist2wallIBM(t, tb, dimPb=2, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=2, frontType=42, twoFronts=True)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42, twoFronts=True)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=2, frontType=42, twoFronts=True)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=2, frontType=42, twoFronts=True, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=2, frontType=42, twoFronts=True, cartesian=False)
test.testT(t, 5)
test.testT(tc, 51)
20 changes: 10 additions & 10 deletions Cassiopee/Connector/test/setInterpDataIBMPT_t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=3)
XIBM._blankingIBM(t, tb, dimPb=3)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=1)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=1, cartesian=False)
test.testT(t, 1)
test.testT(tc, 11)

Expand All @@ -38,8 +38,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=3, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=3, frontType=42)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42, cartesian=False)
test.testT(t, 2)
test.testT(tc, 21)

Expand All @@ -58,8 +58,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=3, correctionMultiCorpsF42=True, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=3, correctionMultiCorpsF42=True, frontType=42)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42, cartesian=False)
test.testT(t, 3)
test.testT(tc, 31)

Expand All @@ -76,8 +76,8 @@
XIBM._dist2wallIBM(t, tb, dimPb=3, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=3, frontType=42, blankingF42=True)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, dimPb=3, frontType=42, cartesian=False)
test.testT(t, 4)
test.testT(tc, 41)

Expand All @@ -94,7 +94,7 @@
XIBM._dist2wallIBM(t, tb, dimPb=3, frontType=42)
XIBM._blankingIBM(t, tb, dimPb=3, frontType=42, twoFronts=True)
tc = C.node2Center(t)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42, twoFronts=True)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=3, frontType=42, twoFronts=True)
t, tc, front, front2, frontWMM = XIBM.buildFrontIBM(t, tc, dimPb=3, frontType=42, twoFronts=True, cartesian=False)
XIBM._setInterpDataIBM(t, tc, tb, front, front2=front2, dimPb=3, frontType=42, twoFronts=True, cartesian=False)
test.testT(t, 5)
test.testT(tc, 51)
2 changes: 1 addition & 1 deletion Cassiopee/Generator/test/IBMExtrude2Dto3D_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
snears = 1
t, tc = X_IBM.prepareIBMData(bodySurfaceFile, None , None ,
snears=snears , dfars=dfars , vmin=vmin,
check=False , frontType=1)
check=False , frontType=1 , cartesian=False)

test.testT(t ,1)
test.testT(tc,2)
Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/Generator/test/IBMExtrude2Dto3D_t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
snears = 1
t, tc = X_IBM.prepareIBMData(bodySurfaceFile, None , None ,
snears=snears , dfars=dfars , vmin=vmin,
check=False , frontType=1)
check=False , frontType=1 , cartesian=False)

test.testT(t ,1)
test.testT(tc,2)
Expand Down

0 comments on commit 50c51c1

Please sign in to comment.