From 0b0d6725e72b7cc5017665a5a879d147ef3bd4e6 Mon Sep 17 00:00:00 2001 From: antjost Date: Tue, 3 Sep 2024 20:01:29 +0200 Subject: [PATCH] [IBM] prepareIBMData-set cartesian=True as the new default. This is more appropriate than cartesian=False. Add cartesian=False to the non-regression test cases to avoid regressions. --- .../Apps/test/FastIBMWireMeshModel_m1.py | 2 +- .../Apps/test/FastIBMWireMeshModel_t1.py | 4 +-- .../Apps/test/IBMOutletControlPressure_t1.py | 4 +-- Cassiopee/Apps/test/IBMrotation_t1.py | 2 +- Cassiopee/Connector/Connector/IBM.py | 30 +++++++++++++------ Cassiopee/Connector/test/IBMrectilinear_t1.py | 2 +- Cassiopee/Connector/test/adaptF42PT_t1.py | 6 ++-- Cassiopee/Connector/test/prepareIBMData_m1.py | 2 +- Cassiopee/Connector/test/prepareIBMData_t1.py | 2 +- .../Connector/test/setInterpDataIBMPT_t1.py | 20 ++++++------- .../Connector/test/setInterpDataIBMPT_t2.py | 20 ++++++------- .../Generator/test/IBMExtrude2Dto3D_t1.py | 2 +- .../Generator/test/IBMExtrude2Dto3D_t2.py | 2 +- 13 files changed, 55 insertions(+), 43 deletions(-) diff --git a/Cassiopee/Apps/test/FastIBMWireMeshModel_m1.py b/Cassiopee/Apps/test/FastIBMWireMeshModel_m1.py index a72ccc810..6e0d5d2ca 100644 --- a/Cassiopee/Apps/test/FastIBMWireMeshModel_m1.py +++ b/Cassiopee/Apps/test/FastIBMWireMeshModel_m1.py @@ -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) diff --git a/Cassiopee/Apps/test/FastIBMWireMeshModel_t1.py b/Cassiopee/Apps/test/FastIBMWireMeshModel_t1.py index aec61d2bc..fbfc7b2aa 100644 --- a/Cassiopee/Apps/test/FastIBMWireMeshModel_t1.py +++ b/Cassiopee/Apps/test/FastIBMWireMeshModel_t1.py @@ -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) diff --git a/Cassiopee/Apps/test/IBMOutletControlPressure_t1.py b/Cassiopee/Apps/test/IBMOutletControlPressure_t1.py index 5ef7c269e..228821c7e 100644 --- a/Cassiopee/Apps/test/IBMOutletControlPressure_t1.py +++ b/Cassiopee/Apps/test/IBMOutletControlPressure_t1.py @@ -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, diff --git a/Cassiopee/Apps/test/IBMrotation_t1.py b/Cassiopee/Apps/test/IBMrotation_t1.py index 78bd9437a..f05a2e8e8 100644 --- a/Cassiopee/Apps/test/IBMrotation_t1.py +++ b/Cassiopee/Apps/test/IBMrotation_t1.py @@ -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) diff --git a/Cassiopee/Connector/Connector/IBM.py b/Cassiopee/Connector/Connector/IBM.py index 35a85d819..d50b1c24a 100644 --- a/Cassiopee/Connector/Connector/IBM.py +++ b/Cassiopee/Connector/Connector/IBM.py @@ -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 @@ -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('/') @@ -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) @@ -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 @@ -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) @@ -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.""" @@ -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) @@ -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.""" diff --git a/Cassiopee/Connector/test/IBMrectilinear_t1.py b/Cassiopee/Connector/test/IBMrectilinear_t1.py index 1c01855d9..a749dbba8 100644 --- a/Cassiopee/Connector/test/IBMrectilinear_t1.py +++ b/Cassiopee/Connector/test/IBMrectilinear_t1.py @@ -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 diff --git a/Cassiopee/Connector/test/adaptF42PT_t1.py b/Cassiopee/Connector/test/adaptF42PT_t1.py index 58738bf81..3ea175de3 100644 --- a/Cassiopee/Connector/test/adaptF42PT_t1.py +++ b/Cassiopee/Connector/test/adaptF42PT_t1.py @@ -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) \ No newline at end of file +t,tc = X_IBM.prepareIBMData(tb, None, None, check=False, frontType=42, yplus=2000, vmin=21, wallAdaptF42=wallAdapt, cartesian=False) +test.testT(tc,2) diff --git a/Cassiopee/Connector/test/prepareIBMData_m1.py b/Cassiopee/Connector/test/prepareIBMData_m1.py index 8fbe2b14c..017a31346 100644 --- a/Cassiopee/Connector/test/prepareIBMData_m1.py +++ b/Cassiopee/Connector/test/prepareIBMData_m1.py @@ -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) diff --git a/Cassiopee/Connector/test/prepareIBMData_t1.py b/Cassiopee/Connector/test/prepareIBMData_t1.py index d157edfe1..0f92e5904 100644 --- a/Cassiopee/Connector/test/prepareIBMData_t1.py +++ b/Cassiopee/Connector/test/prepareIBMData_t1.py @@ -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') diff --git a/Cassiopee/Connector/test/setInterpDataIBMPT_t1.py b/Cassiopee/Connector/test/setInterpDataIBMPT_t1.py index 631093f27..5e0bc2eee 100755 --- a/Cassiopee/Connector/test/setInterpDataIBMPT_t1.py +++ b/Cassiopee/Connector/test/setInterpDataIBMPT_t1.py @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/Cassiopee/Connector/test/setInterpDataIBMPT_t2.py b/Cassiopee/Connector/test/setInterpDataIBMPT_t2.py index 7d0edb066..a7623679a 100755 --- a/Cassiopee/Connector/test/setInterpDataIBMPT_t2.py +++ b/Cassiopee/Connector/test/setInterpDataIBMPT_t2.py @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/Cassiopee/Generator/test/IBMExtrude2Dto3D_t1.py b/Cassiopee/Generator/test/IBMExtrude2Dto3D_t1.py index 891566cb0..74da18d6f 100644 --- a/Cassiopee/Generator/test/IBMExtrude2Dto3D_t1.py +++ b/Cassiopee/Generator/test/IBMExtrude2Dto3D_t1.py @@ -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) diff --git a/Cassiopee/Generator/test/IBMExtrude2Dto3D_t2.py b/Cassiopee/Generator/test/IBMExtrude2Dto3D_t2.py index 583821144..86717e86f 100644 --- a/Cassiopee/Generator/test/IBMExtrude2Dto3D_t2.py +++ b/Cassiopee/Generator/test/IBMExtrude2Dto3D_t2.py @@ -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)