diff --git a/Cassiopee/Apps/Apps/Fast/IBM.py b/Cassiopee/Apps/Apps/Fast/IBM.py index 6bb7559d8..84bb10152 100644 --- a/Cassiopee/Apps/Apps/Fast/IBM.py +++ b/Cassiopee/Apps/Apps/Fast/IBM.py @@ -1402,6 +1402,7 @@ def __init__(self): self.wallAdapt = None self.yplus = 100. self.yplusAdapt = 100. + self.ConservativeFlux = False class IBM(Common): """Prepare IBM for FastS""" @@ -1581,11 +1582,12 @@ def generateCartesian__(self, tb, ext_local=3, to=None): zones = Internal.getZones(t) coords = C.getFields(Internal.__GridCoordinates__, zones, api=2) - #print("extension LOCAL=", ext_local) - #coords, rinds = Generator.extendCartGrids(coords, ext=ext_local, optimized=1, extBnd=0) + #C.convertPyTree2File(zones,'verifOctree.cgns') + #print("extension LOCAL=", ext_local, 'optimized=',self.input_var.optimized ) coords, rinds = Generator.extendCartGrids(coords, ext=ext_local, optimized=self.input_var.optimized, extBnd=0) C.setFields(coords, zones, 'nodes') + for noz in range(len(zones)): #print("Rind", rinds[noz], "No zone=", noz) Internal.newRind(value=rinds[noz], parent=zones[noz]) @@ -1996,6 +1998,310 @@ def findIsoFront(cellNFront, Dist_1, Dist_2): return t + def buildConservativeFlux__(self, t, tc): + + ## determine dx=dy for each zone & store per zone + levelZone_loc={} + hmin = 1.e30 + for z in Internal.getZones(t): + h = abs(C.getValue(z,'CoordinateX',0)-C.getValue(z,'CoordinateX',1)) + levelZone_loc[z[0]]=h + if h < hmin : hmin = h + + ## go from dx to dx/dx_min + Nlevels=1 + for i in levelZone_loc: + levelZone_loc[i]= math.log( int(levelZone_loc[i]/hmin + 0.00000001) , 2) + if levelZone_loc[i] +1 > Nlevels : Nlevels = int(levelZone_loc[i]) +1 + + ## partage des info level en mpi + levelZone = Cmpi.allgather(levelZone_loc) + + for z in Internal.getZones(tc): + + zd_t = Internal.getNodeFromName(t, z[0]) + #tmp1 = Internal.getNodeFromName(zd_t, 'ConservativeFlux') + #if tmp1 ==None: + # Internal.createUniqueChild(zd_t, 'ConservativeFlux', 'UserDefinedData_t') + # tmp1 = Internal.getNodeFromName(zd_t, 'ConservativeFlux') + + levelD = levelZone[z[0]] + subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t') + for s in subRegions: + zRname = Internal.getValue(s) + levelR = levelZone[zRname] + if levelR > levelD: + + #print("raccord conservatif: levelRD", levelR , levelD,'zRD', zRname, z[0]) + zR = Internal.getNodeFromName2(tc,zRname) + zr_t= Internal.getNodeFromName(t, zRname) + dimD = Internal.getZoneDim(z) + dimR = Internal.getZoneDim(zR) + dimPb = dimR[4] + sh =[ dimR[1],dimR[2],dimR[3] ] + shD=[ dimD[1],dimD[2],dimD[3] ] + print("dimR", dimR, "dimD", dimD) + ptList = Internal.getNodeFromName1(s, 'PointList')[1] + ptListD= Internal.getNodeFromName1(s, 'PointListDonor')[1] + lmin = numpy.amin(ptListD) + min_l= numpy.argmin(ptListD, axis=0) + kmin = lmin//(sh[0]*sh[1]) + jmin = (lmin -kmin*sh[0]*sh[1])//sh[0] + imin = lmin -kmin*sh[0]*sh[1] -jmin*sh[0] + lmax = numpy.amax(ptListD) + kmax = lmax//(sh[0]*sh[1]) + jmax = (lmax -kmax*sh[0]*sh[1])//sh[0] + imax = lmax -kmax*sh[0]*sh[1] -jmax*sh[0] + + lminD = ptList[min_l] + + kminD = lminD//(shD[0]*shD[1]) + jminD = (lminD -kminD*shD[0]*shD[1])//shD[0] + iminD = lminD -kminD*shD[0]*shD[1] -jminD*shD[0] + + win = numpy.empty( (6,6), Internal.E_NpyInt) + winD = numpy.empty( (6,6), Internal.E_NpyInt) + win[0,:]=100000 ;win[2,:]=100000 ;win[4,:]=100000 + win[1,:]=-1 ;win[3,:]=-1 ;win[5,:]=-1 + + sz = (imax-imin+1)*(jmax-jmin+1)*(kmax-kmin+1) + if sz == -2*numpy.size(ptListD): #on skippe cette possibilité + k1= kmin+1 + k2= kmax+2 + k1D = kminD+1 + k2D = kminD+(kmax-kmin+1)*2 + if dimPb==2: k1=1; k2=2; k1D=1; k2D=2 + + if (imax-imin+1)==2: + if imin==0: + idir= 0 + name= 'imin' + #win[0,idir]=2; win[1,idir]=2; winD[0,idir]=iminD+3; winD[1,idir]=iminD+3 + win[0,idir]=1; win[1,idir]=1; winD[0,idir]=dimD[1]; winD[1,idir]= dimD[1] + else: + idir= 1 + name= 'imax' + #win[0,idir]=dimR[1]-2; win[1,idir]=dimR[1]-2; winD[0,idir]=iminD; winD[1,idir]=iminD + win[0,idir]=dimR[1]; win[1,idir]=dimR[1]; winD[0,idir]=1; winD[1,idir]=1 + + #win[2,idir]=jmin; win[3,idir]=jmax; win[4,idir]=k1; win[5,idir]=k2 + #winD[2,idir]=jminD; winD[3,idir]=jminD+(jmax-jmin)*2+ 1 ; winD[4,idir]=k1D; winD[5,idir]=k2D + win[ 2,idir]=jmin+1 ; win[3,idir]=jmax+2; win[4,idir]=k1; win[5,idir]=k2 + winD[2,idir]=jminD+1; winD[3,idir]=jminD+1+(imax-imin+1)*2 ; winD[4,idir]=k1D;winD[5,idir]=k2D + elif (jmax-jmin+1)==2: + if jmin==0: + idir= 2 + name= 'jmin' + #win[2,idir]=2; win[3,idir]=2; winD[2,idir]=jminD+3; winD[3,idir]=jminD+3 + win[2,idir]=1; win[3,idir]=1; winD[2,idir]=dimD[2]; winD[3,idir]=dimD[2] + else: + idir= 3 + name= 'jmax' + #win[2,idir]=dimR[2]-2; win[3,idir]=dimR[2]-2; winD[2,idir]=jminD; winD[3,idir]=jminD + win[2,idir]=dimR[2]; win[3,idir]=dimR[2]; winD[2,idir]=1; winD[3,idir]=1 + + #win[0,idir]=imin; win[1,idir]=imax; win[4,idir]=k1; win[5,idir]=k2 + #winD[0,idir]=iminD; winD[1,idir]=iminD+(imax-imin)*2+ 1 ; winD[4,idir]=k1D; winD[5,idir]=k2D + win[0 ,idir]=imin+1 ; win[1,idir]=imax+2; win[4,idir]=k1; win[5,idir]=k2 + winD[0,idir]=iminD+1; winD[1,idir]=iminD+1+(imax-imin+1)*2 ; winD[4,idir]=k1D;winD[5,idir]=k2D + elif (kmax-kmin+1)==2: + if kmin==0: + idir= 4 + name= 'kmin' + #win[4,idir]=2; win[5,idir]=2; winD[4,idir]=jminD+3; winD[5,idir]=jminD+3 + win[4,idir]=1; win[5,idir]=1; winD[4,idir]=dimD[3]; winD[5,idir]=dimD[3] + else: + idir= 5 + name= 'kmax' + #win[4,idir]=dimR[3]-2; win[5,idir]=dimR[3]-2; winD[4,idir]=jminD; winD[5,idir]=jminD + win[4,idir]=dimR[3]; win[5,idir]=dimR[3]; winD[4,idir]=1; winD[5,idir]=1 + + #win[0,idir]=imin; win[1,idir]=imax; win[2,idir]=jmin; win[3,idir]=jmax + #winD[0,idir]=iminD; winD[1,idir]=iminD+(imax-imin)*2+ 1 ; winD[2,idir]=kminD;winD[3,idir]=jminD+(jmax-jmin)*2+ 1 + win[0 ,idir]=imin+1 ; win[1,idir]=imax+2; win[2,idir]=jmin+1; win[3,idir]=jmax+2 + winD[0,idir]=iminD+1; winD[1,idir]=iminD+1+(imax-imin+1)*2 ; winD[2,idir]=kminD+1;winD[3,idir]=jminD+(jmax-jmin+1)*2 + + name1="#Flux_"+zRname+'_'+name + #Internal.createUniqueChild(tmp1 ,name1, 'UserDefinedData_t') + #tmp = Internal.getNodeFromName1(tmp1,name1) + #Internal.setValue(tmp,zRname) + #print('min ', imin,jmin,kmin, 'max ', imax, jmax,kmax, k1,k2) + #print('minD', iminD,jminD,kminD, k1D, k2D) + print("raccord conservatif: zD=", z[0], name1, 'win:', win[:,idir], 'winD:', winD[:,idir], 'taille win:', sz//2, 'min', imin,jmin,kmin) + #Internal.createUniqueChild( tmp, 'PointRange', 'DataArray_t', winD[:,idir]) + #Internal.createUniqueChild( tmp, 'PointRangeDonor', 'DataArray_t', win[:,idir]) + + C._addBC2Zone(zr_t, 'Flux_'+zd_t[0]+'_'+name, 'BCFluxOctree_C', wrange=win[:,idir]) + if name[2]=='i': + name2= name[0:2]+'ax' + else: + name2= name[0:2]+'in' + C._addBC2Zone(zd_t, 'Flux_'+zr_t[0]+'_'+name2, 'BCFluxOctree_F', wrange=winD[:,idir]) + + else: + + #print("lmin", lmin, kmin,jmin,imin, "lmax", lmax, kmax,jmax,imax, 'ptLsiz ', numpy.size(ptListD), 'sz_fen ', sz, zRname, z[0]) + + s1 = max( dimR[1],dimR[2]) + s2 = max( dimR[1],dimR[3]) + #fens = numpy.zeros( (s1*s2,6), Internal.E_NpyInt) + c0=0;c1=0;c2=0;c3=0;c4=0;c5=0 + count = numpy.zeros( 6, Internal.E_NpyInt) + lmin = numpy.zeros( 6, Internal.E_NpyInt) + for l in range( numpy.size(ptListD)): + #i,j,k receveur + k = ptListD[l]//(sh[0]*sh[1]) + j = (ptListD[l] -k*sh[0]*sh[1])//sh[0] + i = ptListD[l] -k*sh[0]*sh[1] -j*sh[0] + if dimPb==2: + if i==1 and j > 1 and j < dimR[2]-2: #flux en imin + idir=0 + if j < win[2,idir]: win[2,idir]=j; lmin[idir]= ptList[l] + if j > win[3,idir]: win[3,idir]=j + count[idir]+=1 + elif i==dimR[1]-2 and j > 1 and j < dimR[2]-2: #flux en imax + idir=1 + if j < win[2,idir]: win[2,idir]=j; lmin[idir]= ptList[l] + if j > win[3,idir]: win[3,idir]=j + count[idir]+=1 + elif j==1 and i > 1 and i < dimR[1]-2: #flux en jmin + idir=2 + if i < win[0,idir]: win[0,idir]=i; lmin[idir]= ptList[l] + if i > win[1,idir]: win[1,idir]=i + count[idir]+=1 + elif j== dimR[2]-2 and i > 1 and i < dimR[1]-2: #flux en jmax + idir=3 + if i < win[0,idir]: win[0,idir]=i; lmin[idir]= ptList[l] + if i > win[1,idir]: win[1,idir]=i + count[idir]+=1 + #print('ij, count', i,j ,'count',count[0:4], 'lmin', lmin[0:4]) + else: #Pb 3D + if j > 1 and j < dimR[2]-1 and k > 1 and k < dimR[3]-2: + + if i ==1 : idir=0 + elif i ==dimR[1]-2: idir=1 + else: idir=-1 + if idir !=-1: + if j < win[2,idir]: win[2,idir]=j + if j > win[3,idir]: win[3,idir]=j + if k < win[4,idir]: win[4,idir]=k + if k > win[5,idir]: win[5,idir]=k + if win[4,idir]==k and win[2,idir]==j: lmin[idir]= ptList[l] + count[idir]+=1 + elif i > 1 and i < dimR[1]-2 and k > 1 and k < dimR[3]-2: #flux en jmin + if j ==1 : idir=2 + elif j ==dimR[2]-2: idir=3 + else: idir=-1 + if idir !=-1: + if i < win[0,idir]: win[0,idir]=i + if i > win[1,idir]: win[1,idir]=i + if k < win[4,idir]: win[4,idir]=k + if k > win[5,idir]: win[5,idir]=k + if win[4,idir]==k and win[0,idir]==i: lmin[idir]= ptList[l] + count[idir]+=1 + elif j > 1 and j < dimR[2]-2 and i > 1 and i < dimR[1]-2: #flux en kmin + if k ==1 : idir=4 + elif k ==dimR[3]-2: idir=5 + else: idir=-1 + if idir !=-1: + if i < win[0,idir]: win[0,idir]=i + if i > win[1,idir]: win[1,idir]=i + if j < win[2,idir]: win[2,idir]=j + if j > win[3,idir]: win[3,idir]=j + if win[2,idir]==j and win[0,idir]==i: lmin[idir]= ptList[l] + count[idir]+=1 + + win[0,:]+=1 + win[1,:]+=2 + win[2,:]+=1 + win[3,:]+=2 + + if dimPb==2: + win[4,:]=1 + win[5,:]=2 + + idirs=[] + for i in range(6): + if count[i] !=0: idirs.append(i) + for idir in idirs: + + kminD = lmin[idir]//(shD[0]*shD[1]) + jminD = (lmin[idir] -kminD*shD[0]*shD[1])//shD[0] + iminD = lmin[idir] -kminD*shD[0]*shD[1] -jminD*shD[0] + k1D = kminD+1 + k2D = kminD+(kmax-kmin+1)*2 + if dimPb==2: k1D=1; k2D=2 + + if idir < 2: + sz=(win[3,idir]-win[2,idir])*(win[5,idir]-win[4,idir]) + i1 =dimR[1] + i1D=1 + name='imax' + if idir==0: + i1 =1 + i1D= dimD[1] + name='imin' + win[0:2 ,idir]=i1 + winD[0:2,idir]=i1D + winD[2,idir] =jminD+1 + winD[3,idir] =jminD+1+(win[3,idir]-win[2,idir])*2 + winD[4,idir] =k1D + winD[5,idir] =k2D + elif idir < 4: + sz=(win[1,idir]-win[0,idir])*(win[5,idir]-win[4,idir]) + j1 =dimR[2] + j1D=1 + name='jmax' + if idir==2: + j1 =1 + j1D= dimD[2] + name='jmin' + win[2:4 ,idir]=j1 + winD[2:4,idir]=j1D + winD[0,idir] =iminD+1 + winD[1,idir] =iminD+1+(win[1,idir]-win[0,idir])*2 + winD[4,idir] =k1D + winD[5,idir] =k2D + else: + sz=(win[1,idir]-win[0,idir])*(win[3,idir]-win[2,idir]) + k1 =dimR[3] + k1D=1 + name='kmax' + if idir==4: + k1 =1 + k1D= dimD[3] + name='kmin' + win[4:6 ,idir]=k1 + winD[4:6,idir]=k1D + winD[0,idir] =iminD+1 + winD[1,idir] =iminD+1+(win[1,idir]-win[0,idir])*2 + winD[2,idir] =jminD+1 + winD[3,idir] =jminD+1+(win[3,idir]-win[2,idir])*2 + + if sz== count[idir]: + name1="#Flux_"+zRname+'_'+name + #Internal.createUniqueChild(tmp1 ,name1, 'UserDefinedData_t') + #tmp = Internal.getNodeFromName1(tmp1,name1) + #Internal.setValue(tmp,zRname) + #print('min ', imin,jmin,kmin, 'max ', imax, jmax,kmax, k1,k2) + #print('minD', iminD,jminD,kminD, k1D, k2D) + print("raccord conservatif: zD=", z[0], name1, 'win:', win[:,idir], 'winD:', winD[:,idir], 'taille win:', count[idir] ) + #print("raccord conservatif: zD=", z[0], name1, win[:,idir], 'taille win:', count[idir]) + #Internal.createUniqueChild(tmp,'PointRange', 'DataArray_t', winD[:,idir]) + #Internal.createUniqueChild( tmp, 'PointRangeDonor', 'DataArray_t', win[:,idir]) + + C._addBC2Zone(zr_t, 'Flux_'+zd_t[0]+'_'+name, 'BCFluxOctree_C', wrange=win[:,idir]) + if name[2]=='i': + name2= name[0:2]+'ax' + else: + name2= name[0:2]+'in' + C._addBC2Zone(zd_t, 'Flux_'+zr_t[0]+'_'+name2, 'BCFluxOctree_F', wrange=winD[:,idir]) + + else: print("Error: build flux conservative octree"+name, sz, count[idir], win[:,idir]) + #stop + + + def setInterpDataAndSetInterpTransfer__(self, t): # setInterpData - Chimere @@ -2190,14 +2496,17 @@ def setInterpDataAndSetInterpTransfer__(self, t): if Internal.getValue(i) == zrname: IDs.append(i) if IDs != []: - if destProc == self.rank: - zD = Internal.getNodeFromName2(tc, zdname) - zD[2] += IDs - else: + if destProc != self.rank: if destProc not in datas: datas[destProc] = [[zdname,IDs]] else: datas[destProc].append([zdname,IDs]) + #else: + # En local rien a faire, les raccord sont deja dans zone donneuse tc apres X._setInterpData + # zD = Internal.getNodeFromName2(tc, zdname) + # zD[2] += IDs else: if destProc not in datas: datas[destProc] = [] + ''' + ''' #Fin Interp classique @@ -2919,6 +3228,8 @@ def prepare(self, t_case, t_out, tc_out): ##OUT - tbbc :pytree of the bounding box of tc tc=self.setInterpDataAndSetInterpTransfer__(t) + if self.input_var.ConservativeFlux==True: self.buildConservativeFlux__(t,tc) + ## ================================================ ## ======= Specific treatment for front 2 ========= ## ================================================ @@ -3229,7 +3540,7 @@ def computeSnearOpt(Re=None, tb=None, Lref=1., q=1.2, yplus=300., Cf_law='ANSYS' def prepare0(t_case, t_out, tc_out, snears=0.01, dfars=10., tbox=None, snearsf=None, yplus=100., vmin=21, check=False, format='single', frontType=1, recomputeDist=False, - expand=3, tinit=None, initWithBBox=-1., wallAdapt=None, dfarDir=0, check_snear=False): + expand=3, tinit=None, initWithBBox=-1., wallAdapt=None, dfarDir=0, check_snear=False, ConservativeFlux=False): prep_local=IBM() prep_local.input_var.snears =snears prep_local.input_var.dfars =dfars @@ -3247,6 +3558,7 @@ def prepare0(t_case, t_out, tc_out, snears=0.01, dfars=10., prep_local.input_var.initWithBBox =initWithBBox prep_local.input_var.wallAdapt =wallAdapt prep_local.input_var.dfarDir =dfarDir + prep_local.input_var.ConservativeFlux =ConservativeFlux t,tc = prep_local.prepare(t_case, t_out, tc_out) @@ -3260,7 +3572,8 @@ def prepare1(t_case, t_out, tc_out, t_in=None, to=None, snears=0.01, dfars=10., frontType=1, extrusion=None, smoothing=False, balancing=False, recomputeDist=False, distrib=True, expand=3, tinit=None, initWithBBox=-1., wallAdapt=None, yplusAdapt=100., dfarDir=0, correctionMultiCorpsF42=False, blankingF42=False, twoFronts=False, redistribute=False, IBCType=1, - height_in=-1.0,isFilamentOnly=False, cleanCellN=True, check_snear=False, generateCartesianMeshOnly=False, tbOneOver=None): + height_in=-1.0,isFilamentOnly=False, cleanCellN=True, check_snear=False, generateCartesianMeshOnly=False, + tbOneOver=None, ConservativeFlux=False): prep_local=IBM() prep_local.input_var.t_in =t_in prep_local.input_var.to =to @@ -3300,6 +3613,7 @@ def prepare1(t_case, t_out, tc_out, t_in=None, to=None, snears=0.01, dfars=10., prep_local.input_var.cleanCellN =cleanCellN prep_local.input_var.generateCartesianMeshOnly = generateCartesianMeshOnly prep_local.input_var.tbOneOver = tbOneOver + prep_local.input_var.ConservativeFlux =ConservativeFlux t,tc = prep_local.prepare(t_case, t_out, tc_out) return t, tc diff --git a/Cassiopee/Connector/Connector/IBM.py b/Cassiopee/Connector/Connector/IBM.py index a7cddfeff..3a508f31e 100644 --- a/Cassiopee/Connector/Connector/IBM.py +++ b/Cassiopee/Connector/Connector/IBM.py @@ -3504,10 +3504,10 @@ def doInterp2(t, tc, tbb, tb=None, typeI='ID', dim=3, dictOfADT=None, front=None transfo=numpy.zeros(3,dtype=Internal.E_NpyInt)#XOD.getTransfo(dnrZones[nod],zrcv) - connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1]+1,dim__[2]+1,dim__[3]+1) + connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1],dim__[2],dim__[3]) - #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1]+1 , dim__[2]+1 , dim__[3]+1) + #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1] , dim__[2] , dim__[3]) NMratio = numpy.zeros(3,dtype=Internal.E_NpyInt) NMratio[0]=1 @@ -3611,9 +3611,9 @@ def doInterp2(t, tc, tbb, tb=None, typeI='ID', dim=3, dictOfADT=None, front=None transfo=numpy.zeros(3,dtype=Internal.E_NpyInt)#XOD.getTransfo(dnrZones[nod],zrcv) - connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1]+1,dim__[2]+1,dim__[3]+1) + connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1],dim__[2],dim__[3]) - #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1]+1 , dim__[2]+1 , dim__[3]+1) + #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1] , dim__[2] , dim__[3]) NMratio = numpy.zeros(3,dtype=Internal.E_NpyInt) NMratio[0]=1 @@ -3990,10 +3990,10 @@ def doInterp3(t, tc, tbb, tb=None, typeI='ID', dim=3, dictOfADT=None, frontType= transfo = XOD.getTransfo(dnrZones[nod],zrcv) - connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1]+1,dim__[2]+1,dim__[3]+1) + connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1],dim__[2],dim__[3]) - #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1]+1 , dim__[2]+1 , dim__[3]+1) + #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1] , dim__[2] , dim__[3]) NMratio = numpy.zeros(3,dtype=Internal.E_NpyInt) NMratio[0]=1 @@ -4097,9 +4097,9 @@ def doInterp3(t, tc, tbb, tb=None, typeI='ID', dim=3, dictOfADT=None, frontType= transfo=XOD.getTransfo(dnrZones[nod],zrcv) - connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1]+1,dim__[2]+1,dim__[3]+1) + connector.indiceToCoord2(plist,prangedonor,transfo,profondeur,dirD,typ,dirR,plist.size,dim__[1],dim__[2],dim__[3]) - #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1]+1 , dim__[2]+1 , dim__[3]+1) + #connector.correctCoeffList(plist, coeff, typ, plist.size , dim__[1], dim__[2], dim__[3]) NMratio = numpy.zeros(3,dtype=Internal.E_NpyInt) NMratio[0]=1 diff --git a/Cassiopee/Connector/Connector/LBM/setInterpTransfers.cpp b/Cassiopee/Connector/Connector/LBM/setInterpTransfers.cpp index 64a22a7a5..791f994cc 100644 --- a/Cassiopee/Connector/Connector/LBM/setInterpTransfers.cpp +++ b/Cassiopee/Connector/Connector/LBM/setInterpTransfers.cpp @@ -176,8 +176,8 @@ PyObject* K_CONNECTOR::___setQintersectionLBM(PyObject* self, PyObject* args){ for (E_Int irac=irac_deb; irac< irac_fin; irac++){ E_Int shift_rac = ech + 4 + timelevel*2 + irac; - if( ipt_param_int[ shift_rac+ nrac*10 + 1] > nbRcvPts_mx) - nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 + 1]; + if( ipt_param_int[ shift_rac+ nrac*10 ] > nbRcvPts_mx) + nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 ]; if( ipt_param_int[shift_rac+nrac*3] > ibcTypeMax) ibcTypeMax = ipt_param_int[shift_rac+nrac*3]; @@ -226,10 +226,10 @@ PyObject* K_CONNECTOR::___setQintersectionLBM(PyObject* self, PyObject* args){ E_Int irac_auto= irac-irac_deb; if (autorisation_transferts[pass_inst][irac_auto]==1){ E_Int shift_rac = ech + 4 + timelevel*2 + irac; - E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; - E_Int loc = ipt_param_int[ shift_rac + nrac*9 +1 ]; //+1 a cause du nrac mpi - E_Int NoR = ipt_param_int[ shift_rac + nrac*11 +1 ]; - E_Int nvars_loc = ipt_param_int[ shift_rac + nrac*13 +1 ]; //neq fonction raccord rans/LES + E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; + E_Int loc = ipt_param_int[ shift_rac + nrac*9 ]; //+1 a cause du nrac mpi + E_Int NoR = ipt_param_int[ shift_rac + nrac*11 ]; + E_Int nvars_loc = ipt_param_int[ shift_rac + nrac*13 ]; //neq fonction raccord rans/LES E_Int meshtype = ipt_ndimdxD[NoD + nidomD*6]; E_Int cnNfldD = ipt_ndimdxD[NoD + nidomD*7]; @@ -258,13 +258,13 @@ PyObject* K_CONNECTOR::___setQintersectionLBM(PyObject* self, PyObject* args){ // Determine values needed for intersection of Q's //// - E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 + 1 ]; + E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 ]; E_Int pos; - pos = ipt_param_int[ shift_rac + nrac*7 ] ; E_Int* ntype = ipt_param_int + pos; - pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*12 + 1 ]; E_Int* rcvPts = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; + pos = ipt_param_int[ shift_rac + nrac*7 ] ; E_Int* ntype = ipt_param_int + pos; + pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*12 ]; E_Int* rcvPts = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; E_Int nbInterpD = ipt_param_int[ shift_rac + nrac ]; E_Float* xPC =NULL; @@ -560,6 +560,8 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ size_autorisation = K_FUNC::E_max(size_autorisation , nrac_inst+1); E_Int autorisation_transferts[pass_inst_fin][size_autorisation]; + E_Int ntab_int =18; + //on dimension tableau travail pour IBC E_Int nbRcvPts_mx =0; E_Int ibcTypeMax=0; for (E_Int pass_inst=pass_inst_deb; pass_inst< pass_inst_fin; pass_inst++){ @@ -570,7 +572,7 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ for (E_Int irac=irac_deb; irac< irac_fin; irac++){ E_Int shift_rac = ech + 4 + timelevel*2 + irac; - if( ipt_param_int[ shift_rac+ nrac*10 + 1] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 + 1]; + if( ipt_param_int[ shift_rac+ nrac*10] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10]; if( ipt_param_int[shift_rac+nrac*3] > ibcTypeMax) ibcTypeMax = ipt_param_int[shift_rac+nrac*3]; E_Int irac_auto= irac-irac_deb; autorisation_transferts[pass_inst][irac_auto]=0; @@ -578,7 +580,7 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ // Si on est en explicit local, on va autoriser les transferts entre certaines zones seulement en fonction de la ss-ite courante //printf("rk,exploc=%d %d\n",rk,exploc); if(rk==3 && exploc == 2){ - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; E_Int cyclD = nitmax/levelD; @@ -611,7 +613,7 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ else {continue;} } else if(exploc == 19){ - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; E_Int cyclD = nitmax/levelD; @@ -715,7 +717,7 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ for (E_Int irac=irac_deb; irac< irac_fin; irac++){ E_Int irac_auto= irac-irac_deb; - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; @@ -735,11 +737,11 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ E_Int ibc = 1; if (ibcType < 0) ibc = 0; if(1-ibc != ipass_typ) continue; - E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; - E_Int loc = ipt_param_int[ shift_rac + nrac*9 +1 ]; //+1 a cause du nrac mpi - E_Int NoR = ipt_param_int[ shift_rac + nrac*11 +1 ]; - E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 +1 ]; //neq fonction raccord rans/LES - E_Int rotation = ipt_param_int[ shift_rac + nrac*14 +1 ]; //flag pour periodicite azimutale + E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; + E_Int loc = ipt_param_int[ shift_rac + nrac*9 ]; + E_Int NoR = ipt_param_int[ shift_rac + nrac*11 ]; + E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 ]; //neq fonction raccord rans/LES + E_Int rotation = ipt_param_int[ shift_rac + nrac*14 ]; //flag pour periodicite azimutale @@ -835,14 +837,14 @@ PyObject* K_CONNECTOR::___setInterpTransfersLBM(PyObject* self, PyObject* args){ // Interpolation parallele //// - E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 + 1 ]; + E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 ]; E_Int pos; - pos = ipt_param_int[ shift_rac + nrac*7 ] ; E_Int* ntype = ipt_param_int + pos; - pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*12 + 1 ]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor - pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; + pos = ipt_param_int[ shift_rac + nrac*7 ]; E_Int* ntype = ipt_param_int + pos; + pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*12]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor + pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; E_Int nbInterpD = ipt_param_int[ shift_rac + nrac ]; diff --git a/Cassiopee/Connector/Connector/OversetDataDtlocal.py b/Cassiopee/Connector/Connector/OversetDataDtlocal.py index ed36ef9e1..b4cdf4229 100644 --- a/Cassiopee/Connector/Connector/OversetDataDtlocal.py +++ b/Cassiopee/Connector/Connector/OversetDataDtlocal.py @@ -175,33 +175,8 @@ def setInterpData3(tR, tD, double_wall=0, order=2, penalty=1, nature=0, nzonesDnrL = nzonesDnr nozr = -1 - #dico={} - #for z in zonesRcv: - # listofjoins = Internal.getNodesFromType2(z, 'GridConnectivity_t') - # if listofjoins is not None: - # prange_list=[] - # for join in listofjoins: - # prange = Internal.getNodeFromName1(join,'PointRange')[1] - # for i in range(3): - # if prange[i,1] == prange[i,0] and prange[i,1] != 1: - # prange[i,1] = prange[i,1]-1 - # prange[i,0] = prange[i,0]-1 - # elif prange[i,1] != prange[i,0] and prange[i,1] != 1 : - # prange[i,1] = prange[i,1]-1 - # prange=numpy.reshape(prange,6) - # #print prange - # prange_list.append(prange) - # dico[z[0]] = prange_list - #print dico.get('cart.0') - for z in zonesRcv: dim_ = Internal.getZoneDim(z) - #if nodes is not None: - #nodesname = nodes[0][0][0:6] - #if nodesname == 'nmatch': - #print 'ok' - #print nodes[0] - nozr += 1 if loc == 'nodes': cellNPresent = C.isNamePresent(z, 'cellN') @@ -335,40 +310,29 @@ def setInterpData3(tR, tD, double_wall=0, order=2, penalty=1, nature=0, resInterp[2][noz], numpy.array([],numpy.float64), \ extrapPts, resInterp[5], tag='Donor', loc=locR, EXDir=EXdir) + dim__ = Internal.getZoneDim(zonesDnr[noz]) + prange = numpy.zeros(6,dtype=Internal.E_NpyInt) + prangedonor = numpy.zeros(6,dtype=Internal.E_NpyInt) + profondeur = numpy.zeros(1,dtype=Internal.E_NpyInt) + dirR = numpy.zeros(1,dtype=Internal.E_NpyInt) + dirD = numpy.zeros(1,dtype=Internal.E_NpyInt) + prange = numpy.reshape(prange,(3,2)) + prangebis = numpy.reshape(prange,6) - dim__ = Internal.getZoneDim(zonesDnr[noz]) - prange = numpy.zeros(6,dtype=Internal.E_NpyInt) - dirR=numpy.zeros(1,dtype=Internal.E_NpyInt) leveldnr = niveaux_temps[zonesDnr[noz][0]] - #print('donneur= ', zonesDnr[noz][0],noz) - #print 'donneur= ', zonesRcv[noz][0],noz - #print('receveur= ', z[0]) - #connector.indiceToCoordbis(resInterp[0][noz],prange,dirR,resInterp[0][noz].size,resInterp[2][noz][0],dim_[1],dim_[2],dim_[3]) - - prange=numpy.reshape(prange,(3,2)) - #print prange - #dirR = GhostCells.getDirBorderStruct__(prange,dimPb) - #print dirR - prangebis=numpy.reshape(prange,6) - #print(prange) info = zonesDnr[noz][2][len(zonesDnr[noz][2])-1] info[2].append(['PointRange', prangebis , [], 'IndexArray_t']) transfo=getTransfo(zonesDnr[noz],z) + #resInterp[1]: pointList des point donneur + #resInterp[2]: type interp + #resInterp[3]: coef interp + connector.indiceToCoord2(resInterp[1][noz],prangedonor,transfo,profondeur,dirD,resInterp[2][noz],dirR[0],resInterp[2][noz].size,dim__[1],dim__[2],dim__[3]) - prangedonor = numpy.zeros(6,dtype=Internal.E_NpyInt) - profondeur=numpy.zeros(1,dtype=Internal.E_NpyInt) - dirD=numpy.zeros(1,dtype=Internal.E_NpyInt) - connector.indiceToCoord2(resInterp[1][noz],prangedonor,transfo,profondeur,dirD,resInterp[2][noz],dirR[0],resInterp[2][noz].size,dim__[1]+1,dim__[2]+1,dim__[3]+1) - - #print('dirR= ',dirR) - #print 'dimPb= ',dimPb - #print resInterp[3][noz] - - connector.correctCoeffList(resInterp[1][noz],resInterp[3][noz],resInterp[2][noz],resInterp[2][noz].size,dim__[1]+1,dim__[2]+1,dim__[3]+1) + connector.correctCoeffList(resInterp[1][noz],resInterp[3][noz],resInterp[2][noz],resInterp[2][noz].size,dim__[1],dim__[2],dim__[3]) ### Determination du point pivot symetrique dans zoneR du point (imin,jmin,kmin) de la zoneD pt_pivot=numpy.array(prange[0:3,0]) # Point (imin,jmin,kmin) de la zone R @@ -384,7 +348,7 @@ def setInterpData3(tR, tD, double_wall=0, order=2, penalty=1, nature=0, info[2].append(['PointRangeDonor', prangedonor , [], 'IndexArray_t']) - info[2].append(['DirDonneur', dirD , [], 'IndexArray_t']) + info[2].append(['DirDonneur', dirD , [], 'IndexArray_t']) #imin=1, imax=-1,jmin=2, jmax=-2...kmax=-3 info[2].append(['DirReceveur', dirR , [], 'IndexArray_t']) info[2].append(['Transform', transfo , [], 'IndexArray_t']) info[2].append(['PointPivot', pt_pivot , [], 'IndexArray_t']) @@ -396,20 +360,11 @@ def setInterpData3(tR, tD, double_wall=0, order=2, penalty=1, nature=0, NMratio[0] = int(round(float(dim_[abs(transfo[0])])/float(dim__[1]+1))) NMratio[1] = int(round(float(dim_[abs(transfo[1])])/float(dim__[2]+1))) NMratio[2] = int(round(float(dim_[abs(transfo[2])])/float(dim__[3]+1))) - #print dim_[abs(transfo[0])], dim__[1]+1 - #print dim_[abs(transfo[1])], dim__[2]+1 - #print dim_[abs(transfo[2])], dim__[3]+1 - #print profondeur NMratio[abs(dirD)-1]=1 - #print('NMratio= ',NMratio) info[2].append(['NMratio', NMratio , [], 'IndexArray_t']) info[2].append(['DnrZoneName', zonesDnr[noz][0] , [], 'IndexArray_t']) - - - - if storage != 'direct': OversetData._adaptForRANSLES__(tR, aD) @@ -879,32 +834,20 @@ def setInterpDataForGhostCells2__(tR, tD, storage='direct', loc='nodes'): sol = Internal.getNodeFromName1(node, 'niveaux_temps') leveldnr = Internal.getValue(sol)[0][0][0] - + info = zdonorp[2][len(zdonorp[2])-1] if storage == 'direct': info = zp[2][len(zp[2])-1] - info[2].append(['PointRange', prange , [], 'IndexArray_t']) - info[2].append(['PointRangeDonor', prangedonor , [], 'IndexArray_t']) - info[2].append(['DirReceveur', dirR , [], 'IndexArray_t']) - info[2].append(['DirDonneur', dirD , [], 'IndexArray_t']) - info[2].append(['Transform', transfo_inv , [], 'IndexArray_t']) - info[2].append(['PointPivot', pt_pivot , [], 'IndexArray_t']) - info[2].append(['Profondeur', profondeur , [], 'IndexArray_t']) - info[2].append(['NMratio', NMratio , [], 'IndexArray_t']) - info[2].append(['LevelZRcv', levelrcv , [], 'IndexArray_t']) - info[2].append(['LevelZDnr', leveldnr , [], 'IndexArray_t']) - else: - info = zdonorp[2][len(zdonorp[2])-1] - info[2].append(['PointRange', prange , [], 'IndexArray_t']) - info[2].append(['PointRangeDonor', prangedonor , [], 'IndexArray_t']) - info[2].append(['DirReceveur', dirR , [], 'IndexArray_t']) - info[2].append(['DirDonneur', dirD , [], 'IndexArray_t']) - info[2].append(['Transform', transfo_inv , [], 'IndexArray_t']) - info[2].append(['PointPivot', pt_pivot , [], 'IndexArray_t']) - info[2].append(['Profondeur', profondeur , [], 'IndexArray_t']) - info[2].append(['NMratio', NMratio , [], 'IndexArray_t']) - info[2].append(['LevelZRcv', levelrcv , [], 'IndexArray_t']) - info[2].append(['LevelZDnr', leveldnr , [], 'IndexArray_t']) + info[2].append(['PointRange', prange , [], 'IndexArray_t']) + info[2].append(['PointRangeDonor', prangedonor , [], 'IndexArray_t']) + info[2].append(['DirReceveur', dirR , [], 'IndexArray_t']) + info[2].append(['DirDonneur', dirD , [], 'IndexArray_t']) + info[2].append(['Transform', transfo_inv , [], 'IndexArray_t']) + info[2].append(['PointPivot', pt_pivot , [], 'IndexArray_t']) + info[2].append(['Profondeur', profondeur , [], 'IndexArray_t']) + info[2].append(['NMratio', NMratio , [], 'IndexArray_t']) + info[2].append(['LevelZRcv', levelrcv , [], 'IndexArray_t']) + info[2].append(['LevelZDnr', leveldnr , [], 'IndexArray_t']) if storage == 'direct': return aR else: return aD diff --git a/Cassiopee/Connector/Connector/compactTransfers.py b/Cassiopee/Connector/Connector/compactTransfers.py index abf076f78..d903f94b0 100644 --- a/Cassiopee/Connector/Connector/compactTransfers.py +++ b/Cassiopee/Connector/Connector/compactTransfers.py @@ -32,7 +32,6 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= if graph is not None and graphliste==False: procDict = graph['procDict'] - procList = graph['procList'] graphID = graph['graphID'] graphIBCD = graph['graphIBCD'] if 'graphID_Unsteady' in graph: @@ -42,18 +41,12 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= graphID_U = None; graphID_S = None elif graph is not None and graphliste==True: procDict = graph[0]['procDict'] - procList = graph[0]['procList'] graphID = graph[0]['graphID'] graphIBCD = graph[0]['graphIBCD'] graphID_U = None; graphID_S = None else: procDict=None; graphID=None; graphIBCD=None; graphID_U = None; graphID_S = None - # if Cmpi is not None and rank == 0: - # print("GRAPH IBC IS : ",graph['graphIBCD']) - # print("graphID IS :",graph['graphID']) - - # print("procDict is : ",procDict) size_int = 0 size_real = 0 listproc = [] @@ -61,7 +54,9 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= rac_inst = [] sizeI = [] sizeR = [] + sizeNb = [] sizeNbD = [] + sizeNbFlu = [] sizeType = [] nrac = 0 @@ -69,10 +64,14 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= neq_subRegions =[] No_zoneD =[] MeshTypeD=[] + infoZoneList={} inst = {} numero_max =-100000000 numero_min = 100000000 + ntab_int = 18 + sizefluxCons=4 + bases = Internal.getNodesFromType1(tc, 'CGNSBase_t') # noeud c = 0 for base in bases: @@ -99,12 +98,10 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= else: neq_trans = neq_base - #print(z[0]) subRegions = Internal.getNodesFromType1(z, 'ZoneSubRegion_t') meshtype = 1 zonetype = Internal.getNodeFromType1(z, 'ZoneType_t') tmp = Internal.getValue(zonetype) - #dimPb = Internal.getZoneDim(z)[4] if tmp != "Structured": meshtype = 2 for s in subRegions: zRname = Internal.getValue(s) @@ -155,34 +152,56 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= Interptype = Internal.getNodeFromName1(s, 'InterpolantsType') RotationAngle = Internal.getNodeFromName1(s, 'RotationAngle') RotationCenter= Internal.getNodeFromName1(s, 'RotationCenter') - prange = Internal.getNodeFromName1(s, 'PointRange') # Besoin des point range pour l'explicite local - pranged = Internal.getNodeFromName1(s, 'PointRangeDonor') # Besoin des point range pour l'explicite local - direction = Internal.getNodeFromName1(s, 'DirReceveur') # Besoin des directions pour l'explicite local - directiond = Internal.getNodeFromName1(s, 'DirDonneur') # Besoin des point directions pour l'explicite local - transfo = Internal.getNodeFromName1(s, 'Transform') # Besoin du transform pour l'explicite local - pt_pivot = Internal.getNodeFromName1(s, 'PointPivot') # Besoin du point pivot pour l'explicite local (conservativite) - profondeur = Internal.getNodeFromName1(s, 'Profondeur') # Besoin de la profondeur pour l'explicite local (nearmatch) - ratio = Internal.getNodeFromName1(s, 'NMratio') # Besoin des ratios entre les pas d espace des zones donneuse et receveuse (exp local) - levelrcv = Internal.getNodeFromName1(s, 'LevelZRcv') # Niveau en temps zone receveuse (exp local) - leveldnr = Internal.getNodeFromName1(s, 'LevelZDnr') # Niveau en temps zone donneuse (exp local) + prange = Internal.getNodeFromName1(s, 'PointRange') # Besoin des point range pour l'explicite local + pranged = Internal.getNodeFromName1(s, 'PointRangeDonor') # Besoin des point range pour l'explicite local + direction = Internal.getNodeFromName1(s, 'DirReceveur') # Besoin des directions pour l'explicite local + directiond = Internal.getNodeFromName1(s, 'DirDonneur') # Besoin des point directions pour l'explicite local + transfo = Internal.getNodeFromName1(s, 'Transform') # Besoin du transform pour l'explicite local + pt_pivot = Internal.getNodeFromName1(s, 'PointPivot') # Besoin du point pivot pour l'explicite local (conservativite) + profondeur = Internal.getNodeFromName1(s, 'Profondeur') # Besoin de la profondeur pour l'explicite local (nearmatch) + ratio = Internal.getNodeFromName1(s, 'NMratio') # Besoin des ratios entre les pas d espace des zones donneuse et receveuse (exp local) + levelrcv = Internal.getNodeFromName1(s, 'LevelZRcv') # Niveau en temps zone receveuse (exp local) + leveldnr = Internal.getNodeFromName1(s, 'LevelZDnr') # Niveau en temps zone donneuse (exp local) + + utau = Internal.getNodeFromName1(s, 'utau') + temp_local = Internal.getNodeFromName1(s, 'Temperature') + wmodel_local = Internal.getNodeFromName1(s, 'Density_WM') + gradxP = Internal.getNodeFromName1(s, 'gradxPressure') + gradxU = Internal.getNodeFromName1(s, 'gradxVelocityX') + xcInit = Internal.getNodeFromName1(s, 'CoordinateX_PC#Init') + motion_type = Internal.getNodeFromName1(s, 'MotionType') + kcurv = Internal.getNodeFromName1(s, XOD.__KCURV__) + sd1 = Internal.getNodeFromName1(s, 'StagnationEnthalpy') + yline = Internal.getNodeFromName1(s, 'CoordinateN_ODE') Nbpts = numpy.shape(pointlist[ 1])[0] Nbpts_D = numpy.shape(pointlistD[1])[0] Nbpts_InterpD = numpy.shape(InterpD[ 1 ])[0] sname = s[0][0:2] - utau = Internal.getNodeFromName1(s, 'utau') - temp_local = Internal.getNodeFromName1(s, 'Temperature') - wmodel_local = Internal.getNodeFromName1(s, 'Density_WM') - gradxP = Internal.getNodeFromName1(s, 'gradxPressure') - gradxU = Internal.getNodeFromName1(s, 'gradxVelocityX') - xcInit = Internal.getNodeFromName1(s, 'CoordinateX_PC#Init') - motion_type = Internal.getNodeFromName1(s, 'MotionType') - kcurv = Internal.getNodeFromName1(s, XOD.__KCURV__) - sd1 = Internal.getNodeFromName1(s, 'StagnationEnthalpy') - yline = Internal.getNodeFromName1(s, 'CoordinateN_ODE') + #recherche raccord conservatif + zd = zones[c] + nbfluCons=0 + bcs = Internal.getNodesFromType2(zd, 'BC_t') + bc_info=[] + for c4, bc in enumerate(bcs): + bcname = bc[0].split('_') # + btype = Internal.getValue(bc) + if 'BCFluxOctree_F' == btype and bcname[1]==zRname: nbfluCons+=1 #flux donneur(Fine) + if 'BCFluxOctree_C' == btype: #flux receveur (Coarse) + if bcname[2][0:5]=='imin': idir_tg=2 + elif bcname[2][0:5]=='imax': idir_tg=1 + elif bcname[2][0:5]=='jmin': idir_tg=4 + elif bcname[2][0:5]=='jmax': idir_tg=3 + elif bcname[2][0:5]=='kmin': idir_tg=6 + elif bcname[2][0:5]=='kmax': idir_tg=5 + bc_info.append( [ bcname[1], idir_tg, c4 ] ) + infoZoneList[zd[0]] = [ c , bc_info] #[ No zoneD, bcs(conservatif)] + + if nbfluCons !=0: print("flux cons: Z_D/R", z[0], zRname, 'nflux=', nbfluCons) + sname = s[0][0:2] # cas ou les vitesses n'ont pas ete ajoutees lors du prep (ancien tc) if sname == 'IB': vx = Internal.getNodeFromName1(s, 'VelocityX') @@ -266,39 +285,36 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= rac.append(1) if '#' in s[0]: rac_inst.append(1) else : rac_inst.append(0) - sizeI.append( Nbpts_D*2 + Nbpts + nbTypeSize+1 ) - sizeR.append( Nbpts_InterpD + size_IBC + rotation ) - sizeNbD.append( Nbpts_D ) - sizeType.append( Nbpts_D + nbTypeSize+1 ) + sizeI.append( Nbpts_D*2 + Nbpts + nbTypeSize+1 + nbfluCons*sizefluxCons) + sizeR.append( Nbpts_InterpD + size_IBC + rotation ) + sizeNbD.append( Nbpts_D ) + sizeNb.append( Nbpts ) + sizeType.append( Nbpts_D + nbTypeSize+1 ) + sizeNbFlu.append( nbfluCons*sizefluxCons) else: pos = listproc.index(proc) rac[pos] = rac[pos] + 1 if '#' in s[0]: rac_inst[pos]= rac_inst[pos] + 1 - sizeI[pos] = sizeI[pos] + Nbpts_D*2 + Nbpts + nbTypeSize+1 + sizeI[pos] = sizeI[pos] + Nbpts_D*2 + Nbpts + nbTypeSize+1 + nbfluCons*sizefluxCons sizeR[pos] = sizeR[pos] + Nbpts_InterpD + size_IBC + rotation sizeNbD[pos] = sizeNbD[pos] + Nbpts_D + sizeNb[pos] = sizeNb[pos] + Nbpts sizeType[pos] = sizeType[pos] + Nbpts_D + nbTypeSize+1 - + sizeNbFlu[pos]= sizeNbFlu[pos] + nbfluCons*sizefluxCons c += 1 - #for pos in range(len(rac)): - # print('RAC=', rac[pos], 'racInst', rac_inst[pos], pos,'rank=', rank, 'dest=',listproc[pos]) - base = Internal.getNodeFromType1(tc, 'CGNSBase_t') # noeud model = 'NSLaminar' a = Internal.getNodeFromName2(base, 'GoverningEquations') if a is not None: model = Internal.getValue(a) - NbP2P = len(listproc) + NbP2P = len(listproc) #nombre Comm MPI point a Point pour envoi sizeproc = [] - ntab_int = 16 + ntab_tot = ntab_int - if nrac != 0: - if prange is not None: - ntab_int = ntab_int + 27 + if nrac != 0 and prange is not None: ntab_tot += 27 - - for i in range(NbP2P): sizeproc.append(5 + TimeLevelNumber*2 + ntab_int*rac[i] + sizeI[i]) + for i in range(NbP2P): sizeproc.append(4 + TimeLevelNumber*2 + ntab_tot*rac[i] + sizeI[i]) size_int = 2 + NbP2P + sum(sizeproc) size_real = sum(sizeR) @@ -349,6 +365,10 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= graphIBCrcv = pos_IBC + graphIBCrcv_ graphIDrcv = pos_ID + graphIDrcv_ + + ## Recuperation info zone + infoZoneList = Cmpi.allgatherDict(infoZoneList) + #print("len graphIBCrcv is",len(graphIBCrcv)) #print("len graphIDrcv is",len(graphIDrcv)) #print("pos_IBC is",pos_IBC) @@ -371,15 +391,13 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= param_int[3+len(graphIBCrcv):4+len(graphIBCrcv)+len(graphIDrcv)] = _graphID # print("param_int is ",param_int[0:2+len(graphIBCrcv)+len(graphIDrcv)+1]) - # Dictionnaire pour optimisation - znd = [] - for z in zones: znd.append(z[0]) # #initialisation numpy # param_int[0] = 0 #flag pour init transfert couche C (X. Juvigny) param_int[1] = NbP2P + size_ptflux = [] size_ptlist = [] size_ptlistD= [] size_ptType = [] @@ -397,6 +415,7 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= param_int[i+shift_graph] = NbP2P + shift #adresse echange shift = shift + sizeproc[i] + size_ptflux.append(0) size_ptlist.append(0) size_ptlistD.append(0) size_ptType.append(0) @@ -415,15 +434,32 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= S = 0 for s in ordered_subRegions: + zRname = Internal.getValue(s) + NozoneD = No_zoneD[c] meshtype = MeshTypeD[c] neq_loc = neq_subRegions[c] - zRname = Internal.getValue(s) + #recherche raccord conservatif + zd = zones[NozoneD] + nbfluCons=0 + bcs = Internal.getNodesFromType2(zd, 'BC_t') + no_bc=[] + for c1, bc in enumerate(bcs): + bcname = bc[0].split('_') + btype = Internal.getValue(bc) + if 'BCFluxOctree_F' == btype and bcname[1]==zRname: + nbfluCons+=1 + no_bc.append(c1) + param_int_zD = Internal.getNodeFromName2( zd, 'Parameter_int' )[1] + #print("bc", s[0], bc[0]) + + #if nbfluCons !=0: print("Verif flux cons: Z_D/R", zd[0], zRname, 'nflux=', nbfluCons, 'NoZoneD:', NozoneD) + proc = 0 if procDict is not None: proc = procDict[zRname] pos = listproc.index(proc) - pt_ech = param_int[ pos + shift_graph] # adresse debut raccord pour l'echange pos + pt_ech = param_int[ pos + shift_graph] # adresse debut raccord pour l'echange pos pt_coef= adr_coef[pos] + size_coef[pos] # adresse debut coef pointlist = Internal.getNodeFromName1(s, 'PointList') @@ -449,12 +485,12 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= Nbpts_D = numpy.shape(pointlistD[1])[0] Nbpts_InterpD = numpy.shape(InterpD[ 1 ])[0] - param_int[ pt_ech ] = proc - param_int[ pt_ech +1 ] = rac[pos] - param_int[ pt_ech +2 ] = rac_inst[pos] + param_int[ pt_ech ] = proc #proc destination + param_int[ pt_ech +1 ] = rac[pos] #nbr de raccord a envoyer a proc destination + param_int[ pt_ech +2 ] = rac_inst[pos] #nbr de raccord instat a envoyer a proc destination nrac_steady = rac[pos] - rac_inst[pos] - param_int[ pt_ech +3 ] = TimeLevelNumber + param_int[ pt_ech +3 ] = TimeLevelNumber #nbr pas de temps instationnaire dans raccord nrac_inst_deb = nrac_steady for i in range(TimeLevelNumber): @@ -463,23 +499,25 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= for procSearch in inst[i+numero_min][3]: if procSearch==proc: NracInsta+=1 - #nrac_inst_fin = nrac_inst_deb + len(inst[i+numero_min][0]) nrac_inst_fin = nrac_inst_deb + NracInsta #print('NracInsta=',NracInsta,'TimeLevel=',i, 'dest=',proc) - param_int[ pt_ech +4 + i ] = nrac_inst_deb - param_int[ pt_ech +4 + i + TimeLevelNumber] = nrac_inst_fin + param_int[ pt_ech +4 + i ] = nrac_inst_deb #unsteadyJoins(No rac debut) + param_int[ pt_ech +4 + i + TimeLevelNumber] = nrac_inst_fin #unsteadyJoins(No rac fin) nrac_inst_deb = nrac_inst_fin - iadr = pt_ech + 4 + TimeLevelNumber*2 + nb_rac[pos] # ptr echange + dest + nrac + norac - iadr2= pt_ech + 4 + TimeLevelNumber*2 + 1 + iadr2 = pt_ech + 4 + TimeLevelNumber*2 + iadr = iadr2 + nb_rac[pos] # ptr echange + dest + nrac ... + iadr_ptr = iadr2 + ntab_tot*rac[pos] param_int[ iadr ] = Nbpts param_int[ iadr + rac[pos] ] = Nbpts_InterpD #on recupere le nombre de type different + #NbType = numpy.unique(Interptype[1]) + #NbTypeSize = NbType.size typecell = Interptype[1][0] Nbtype= [ typecell ] for i in range(Nbpts_D): @@ -816,20 +854,55 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= size_IBC += 2*Nbpts_D; inc += 2 - - tmp = Internal.getNodeFromName1(s, 'ZoneRole') if tmp[1][0] == b'D': param_int[ iadr +rac[pos]*4 ] = 0 # role= Donor else : param_int[ iadr +rac[pos]*4 ] = 1 # role= Receiver param_int[ iadr +rac[pos]*5 ] = NozoneD # No zone donneuse - lst = iadr + 1 -nb_rac[pos] +ntab_int*rac[pos] + sizeNbD[pos] + sizeType[pos] + size_ptlist[pos] - param_int[ iadr +rac[pos]*6 ] = lst # PointlistAdr - ptTy = iadr + 1 -nb_rac[pos] +ntab_int*rac[pos] + sizeNbD[pos] + size_ptType[pos] - param_int[ iadr +rac[pos]*7 ] = ptTy # TypAdr - lstD = iadr + 1 -nb_rac[pos] +ntab_int*rac[pos] + size_ptlistD[pos] - param_int[ iadr +rac[pos]*12 +1] = lstD # PointlistDAdr + lstD = iadr_ptr + size_ptlistD[pos] + ptTy = iadr_ptr + sizeNbD[pos] + size_ptType[pos] + lst = iadr_ptr + sizeNbD[pos] + sizeType[pos] + size_ptlist[pos] + ptFlux= iadr_ptr + sizeNbD[pos] + sizeType[pos] + sizeNb[pos] + size_ptflux[pos] + param_int[ iadr +rac[pos]*6 ] = lst # PointlistAdr + param_int[ iadr +rac[pos]*7 ] = ptTy # TypAdr + param_int[ iadr +rac[pos]*12] = lstD # PointlistDAdr + param_int[ iadr +rac[pos]*17] = ptFlux # Ptr_flux + + # + #construction info flux conservatif + # + zd = zones[NozoneD] + nbfluCons=0 + bcs = Internal.getNodesFromType2(zd, 'BC_t') + no_bc=[] + for c1, bc in enumerate(bcs): + bcname = bc[0].split('_') + btype = Internal.getValue(bc) + if 'BCFluxOctree_F' == btype and bcname[1]==zRname: + nbfluCons+=1 + no_bc.append(c1) + param_int_zD = Internal.getNodeFromName2( zd, 'Parameter_int' )[1] + + for c2 , no in enumerate(no_bc): + pt_bcs = param_int_zD[70] #70=PT_BC + pt_bc = param_int_zD[pt_bcs + 1 + no] + idir_bc= param_int_zD[pt_bc + 1] + sz_bc =(param_int_zD[pt_bc +3]-param_int_zD[pt_bc+2]+1)*(param_int_zD[pt_bc +5]-param_int_zD[pt_bc+4]+1)*(param_int_zD[pt_bc +7]-param_int_zD[pt_bc+6]+1) + + pt_flu = ptFlux + c2*sizefluxCons + param_int[ pt_flu ]= idir_bc + param_int[ pt_flu +1]= sz_bc + param_int[ pt_flu +2]= no + + #determination No Bc sur zone receuveuse a partir du nom du noeud bc + for bc in infoZoneList[zRname][1]: + if bc[0]==zd[0] and bc[1]== idir_bc: param_int[pt_flu +3] = bc[2] + + print("Flux compact: zr=", zRname, "zd=", zd[0], 'idir', idir_bc, 'sz_bc', sz_bc, 'ptbc', pt_bc, 'NobcR', param_int[pt_flu +3] ) + # + #Fin flux conservatif + # Nbtot += Nbpts @@ -1059,25 +1132,18 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= param_int[ iadr +rac[pos]*8 ] = adr_coef[pos] + size_coef[pos] # PtcoefAdr - iadr = iadr +1 - param_int[ iadr +rac[pos]*8 ] = rac[pos] # nrac pour mpi - - tmp = Internal.getNodeFromName1(s , 'GridLocation') if tmp[1][4] == b'C': param_int[ iadr +rac[pos]*9 ] = 1 # location= CellCenter else : param_int[ iadr +rac[pos]*9 ] = 0 # location= Vertex param_int[ iadr +rac[pos]*10 ] = Nbpts_D - #chercher No zone receveuse grace a tc ou dico (si mpi) - if procDict is None: - param_int[ iadr +rac[pos]*11 ] = znd.index( zRname ) # No zone receveuse - else: - param_int[ iadr +rac[pos]*11 ]= procList[proc].index( zRname ) # No zone raccord + NoR = infoZoneList[zRname][0] + param_int[ iadr +rac[pos]*11 ]= NoR # No zone receveuse - #print( 'rac', s[0], 'zoneR=', zRname, 'NoR=', param_int[ iadr +rac[pos]*11 ], 'adr=',iadr +rac[pos]*11, 'NoD=', param_int[ iadr-1 +rac[pos]*5 ], 'adr=',iadr-1 +rac[pos]*5,'rank=', rank, 'dest=', proc) + #print('rac',s[0],'zoneR=',zRname,'NoR=',NoR ,'adr=',iadr +rac[pos]*11, 'NoD=', param_int[ iadr-1 +rac[pos]*5 ], 'adr=',iadr-1 +rac[pos]*5,'rank=',rank,'dest=', proc) - #print 'model=',model,'zoneR',zones_tc[param_int[ iadr +rac[pos]*11 ]][0], 'NoR=', param_int[ iadr +rac[pos]*11 ], 'NoD=', c + #print 'model=',model,'zoneR',zones_tc[param_int[ iadr +rac[pos]*11 ]][0], 'NoR=', NoR, 'NoD=', c tmp = Internal.getNodeFromName1(s , 'RANSLES') if tmp is not None: param_int[ iadr +rac[pos]*13 ] = min (5, neq_loc) # RANSLES else: param_int[ iadr +rac[pos]*13 ] = neq_loc @@ -1103,40 +1169,47 @@ def miseAPlatDonorTree__(zones, tc, graph=None, list_graph=None, nbpts_linelets= param_int[ iadr +rac[pos]*14 ] = 0 shiftRotation = 0 - #print('rac*14= ',iadr +rac[pos]*14) - # raccord instationnaire + #Ivan: rac*15: inutile?? On affecte levelReceveur pour preparer nettoyage dtloc + param_int[ iadr + rac[pos]*15 ] = 1 # valeur par defaut niveau temps zone receveuse + if levelrcv is not None: + param_int[ iadr +rac[pos]*15 ] = int(levelrcv[1]) + + # nombre de flux conservatif a corriger + param_int[ iadr + rac[pos]*16 ] = nbfluCons + + ''' param_int[ iadr +rac[pos]*15 ] =-1 if '#' in s[0]: numero_iter = int( s[0].split('#')[1].split('_')[0] ) param_int[ iadr +rac[pos]*15 ] = numero_iter + ''' if nrac != 0: if pranged is not None and prange is not None : #Si on est en explicite local, on rajoute des choses dans param_int - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] : iadr2 + rac[pos]*16 + 27*nb_rac[pos]+6 ] = prange[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 6] = direction[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 7 : iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 13 ] = pranged[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 13] = directiond[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 14 : iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 17 ] = transfo[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 17 : iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 20 ] = pt_pivot[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 20 : iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 21 ] = profondeur[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 21 : iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 24 ] = ratio[1] - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 24] = int(levelrcv[1]) - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 25] = int(leveldnr[1]) - param_int[ iadr2 + rac[pos]*16 + 27*nb_rac[pos] + 26] = S + adr = iadr2 + rac[pos]*ntab_int + 27*nb_rac[pos] + param_int[ adr : adr+ 6 ] = prange[1] + param_int[ adr+ 7 : adr+ 13] = pranged[1] + param_int[ adr+ 14 : adr+ 17] = transfo[1] + param_int[ adr+ 17 : adr+ 20] = pt_pivot[1] + param_int[ adr+ 20 : adr+ 21] = profondeur[1] + param_int[ adr+ 21 : adr+ 24] = ratio[1] + param_int[ adr+ 6] = direction[1] + param_int[ adr+ 13] = directiond[1] + param_int[ adr+ 24] = int(levelrcv[1]) + param_int[ adr+ 25] = int(leveldnr[1]) + param_int[ adr+ 26] = S if int(levelrcv[1]) != int(leveldnr[1]): S=S + 3*5*(pranged[1][1]-pranged[1][0]+1)*(pranged[1][3]-pranged[1][2]+1)*(pranged[1][5]-pranged[1][4]+1)*(profondeur[1][0]+1) - #print [int(levelrcv[1])], [int(leveldnr[1])],'--' - #print int([1] - #print('model=', model, 'tmp=', tmp, 'neq_loc=', neq_loc) ### Verifier position et choix entre Nbpts et NbptsD size_ptlistD[pos] = size_ptlistD[pos] + Nbpts_D size_ptlist[pos] = size_ptlist[pos] + Nbpts size_ptType[pos] = size_ptType[pos] + Nbpts_D + len(Nbtype)+1 + size_ptflux[pos] = size_ptflux[pos] + nbfluCons*sizefluxCons size_coef[pos] = size_coef[pos] + Nbpts_InterpD + size_IBC + shiftRotation nb_rac[pos] = nb_rac[pos] + 1 diff --git a/Cassiopee/Connector/Connector/correctCoeffList.cpp b/Cassiopee/Connector/Connector/correctCoeffList.cpp index 16c5f665e..b2f8f57ca 100644 --- a/Cassiopee/Connector/Connector/correctCoeffList.cpp +++ b/Cassiopee/Connector/Connector/correctCoeffList.cpp @@ -57,32 +57,18 @@ PyObject* K_CONNECTOR::correctCoeffList(PyObject* self, PyObject* args) return NULL; } - ni = ni-1; - nj = nj-1; - nk = nk-1; E_Int i, j, k; E_Int compt=0; - //E_Int imin=ni; - //E_Int imax=1; - //E_Int jmin=nj; - //E_Int jmax=1; - //E_Int kmin=nk; - //E_Int kmax=1; E_Int indCoef=0; E_Float a; E_Float b; E_Float xc; E_Float yc; E_Float zc; - //E_Float S=0.0; E_Float tab[8][3]; E_Int tab_[8]; - //E_Int dirD; /// Recuperation du tableau de stockage des valeurs - //PyObject* indiceslist = PyList_GetItem(indiceslist,0); FldArrayF* drodm; - //K_NUMPY::getFromNumpyArray(drodmArray, drodm, true); E_Float* iptdrodm = drodm->begin(); - FldArrayI* ind_list; K_NUMPY::getFromNumpyArray(indiceslist, ind_list, true); E_Int* ipt_ind_list = ind_list->begin(); @@ -95,13 +81,8 @@ PyObject* K_CONNECTOR::correctCoeffList(PyObject* self, PyObject* args) //cout << "nb_ind= " << nb_ind << endl; for (E_Int ind = 0 ; ind < nb_ind ; ind++) - { - - //cout << "type= " << int(ipt_typ[ind]) << endl; - if (ipt_typ[ind]==22) - { k = floor(ipt_ind_list[ind]/(ni*nj)) + 1; @@ -109,8 +90,7 @@ PyObject* K_CONNECTOR::correctCoeffList(PyObject* self, PyObject* args) j = floor(j/ni) + 1; i = ipt_ind_list[ind] - (k-1)*ni*nj - (j-1)*ni + 1; - - + //donneur (i=2) = ghost car (i,j,k) = fortran if (i == 2 and j > 2 and j < nj- 2) // bande imin { a = ipt_coefflist[indCoef] ; @@ -297,13 +277,9 @@ PyObject* K_CONNECTOR::correctCoeffList(PyObject* self, PyObject* args) } - // if (compt==0) - // { - // cout <<"Danger"<< endl; - // } - - if (compt == 1 or compt == 2 or compt == 3 or compt == 4 or compt == 5 or compt == 6 or compt == 7) // On corrige les coeffs des molecules qui contiennent les deux types de cellules + // On corrige les coeffs des molecules qui contiennent les deux types de cellules + if (compt == 1 or compt == 2 or compt == 3 or compt == 4 or compt == 5 or compt == 6 or compt == 7) { for ( j=0; j < 8; j++) { diff --git a/Cassiopee/Connector/Connector/indiceToCoord2.cpp b/Cassiopee/Connector/Connector/indiceToCoord2.cpp index dec3208c9..029583dbf 100644 --- a/Cassiopee/Connector/Connector/indiceToCoord2.cpp +++ b/Cassiopee/Connector/Connector/indiceToCoord2.cpp @@ -61,10 +61,6 @@ PyObject* K_CONNECTOR::indiceToCoord2(PyObject* self, PyObject* args) return NULL; } - ni=ni-1; - nj=nj-1; - nk=nk-1; - //cout <<"ni= "<< ni <<" "<<"nj= "< nj-2 or imax > ni-2){cout << "danger_max" << endl;} - - //cout <<"indices pas corriges= "<< imin <<" "<< imax <<" "< fortran Fast?? kmin=kmin-2; - if (kmin == -1 or kmin== 0) - { - kmin = 1; - } - //kmax = kmin + lk; + if (kmin == -1 or kmin== 0) { kmin = 1; } + ///proposition kmax = kmax - 2; - if (kmax > nk-4) - { - kmax = nk -4; - } - if (kmax <= 0) - { - kmax = 1; - } - + if (kmax > nk-4) { kmax = nk-4;} + if (kmax <= 0 ) { kmax = 1; } jmin=jmin-2; - if (jmin == -1 or jmin== 0) - { - jmin = 1; - } - //jmax = jmin + lj; + if (jmin == -1 or jmin== 0) { jmin = 1; } ///proposition jmax = jmax - 2; - if (jmax > nj - 4) - { - jmax = nj -4; - } - if (jmax <= 0) - { - jmax = 1; - } + if (jmax > nj - 4) { jmax = nj -4;} + if (jmax <= 0 ) { jmax = 1; } imin=imin-2; - if (imin == -1 or imin== 0) - { - imin = 1; - } - //imax = imin + li; + if (imin == -1 or imin== 0) { imin = 1; } + ///proposition imax = imax - 2; - if (imax > ni-4) - { - imax = ni -4; - } - if (imax <= 0) - { - imax = 1; - } + if (imax > ni-4) { imax = ni -4;} + if (imax <= 0 ) { imax = 1; } cout <<"indices corriges= "<< imin <<" "<< imax <<" "<= li and imax > (ni-1)/2) // dirR = +1 - { - ipt_dirD[0] = 1; - } - else if (lj >= li and imin < (ni-1)/2) // dirR = -1 - { - ipt_dirD[0] = -1; - } - else if (li >= lj and jmax > (nj-1)/2) // dirR = +2 - { - ipt_dirD[0] = 2; - } - else if (li >= lj and jmin < (nj-1)/2) // dirR = -2 - { - ipt_dirD[0] = -2; - } - + if (lj >= li and imax > (ni-1)/2) + { ipt_dirD[0] = 1; + ipt_profondeur[0] = imax - imin ; + imin = imax; + } + else if (lj >= li and imin < (ni-1)/2) + { ipt_dirD[0] =-1; + ipt_profondeur[0] = imax - imin ; + imax = imin; + } + else if (li >= lj and jmax > (nj-1)/2) + { ipt_dirD[0] = 2; + ipt_profondeur[0] = jmax - jmin ; + jmin = jmax; + } + else if (li >= lj and jmin < (nj-1)/2) + { ipt_dirD[0] =-2; + ipt_profondeur[0] = jmax - jmin ; + jmax = jmin; + } } - else //3D - { - - if (lk == min(min(li,lj),lk) and kmax > (nk-1)/2) // dirR = +3 - { - ipt_dirD[0] = 3; - } - else if (lk == min(min(li,lj),lk) and kmin < (nk-1)/2) // dirR = -3 - { - ipt_dirD[0] = -3; - } - else if (lj == min(min(li,lj),lk) and jmax > (nj-1)/2) // dirR = +2 - { - ipt_dirD[0] = 2; - } - else if (lj == min(min(li,lj),lk) and jmin < (nj-1)/2) // dirR = -2 - { - ipt_dirD[0] = -2; - } - else if (li == min(min(li,lj),lk) and imax > (ni-1)/2) // dirR = +2 - { - ipt_dirD[0] = 1; - } - else if (li == min(min(li,lj),lk) and imin < (ni-1)/2) // dirR = -2 - { - ipt_dirD[0] = -1; - } - - - + if (lk == min(min(li,lj),lk) and kmax > (nk-1)/2) + { ipt_dirD[0] = 3; + ipt_profondeur[0] = kmax - kmin ; + kmin = kmax; + } + else if (lk == min(min(li,lj),lk) and kmin < (nk-1)/2) + { ipt_dirD[0] =-3; + ipt_profondeur[0] = kmax - kmin ; + kmax = kmin; + } + else if (lj == min(min(li,lj),lk) and jmax > (nj-1)/2) + { ipt_dirD[0] = 2; + ipt_profondeur[0] = jmax - jmin ; + jmin = jmax; + } + else if (lj == min(min(li,lj),lk) and jmin < (nj-1)/2) + { ipt_dirD[0] =-2; + ipt_profondeur[0] = jmax - jmin ; + jmax = jmin; + } + else if (li == min(min(li,lj),lk) and imax > (ni-1)/2) + { ipt_dirD[0] = 1; + ipt_profondeur[0] = imax - imin ; + imin = imax; + } + else if (li == min(min(li,lj),lk) and imin < (ni-1)/2) + { ipt_dirD[0] =-1; + ipt_profondeur[0] = imax - imin ; + imax = imin; + } } - cout <<"dirD= "<< ipt_dirD[0] << endl; - - if (ipt_dirD[0]==1) - { - ipt_profondeur[0] = imax - imin ; - imin = imax; - } - else if (ipt_dirD[0]==-1) - { - ipt_profondeur[0] = imax - imin ; - imax = imin; - } - else if (ipt_dirD[0]==2) - { - ipt_profondeur[0] = jmax - jmin ; - jmin = jmax; - } - else if (ipt_dirD[0]==-2) - { - ipt_profondeur[0] = jmax - jmin ; - jmax = jmin; - } - else if (ipt_dirD[0]==3) - { - ipt_profondeur[0] = kmax - kmin ; - kmin = kmax; - } - else if (ipt_dirD[0]==-3) - { - ipt_profondeur[0] = kmax - kmin ; - kmax = kmin; - } - - cout << "profondeur= " << ipt_profondeur[0] << endl; - /* - kmax=kmax-2; - if (kmax == nk-2 or kmax == nk-3) - { - kmax = nk -4; - } - if (kmax <= 0) - { - kmax = 1; - } - - kmin=kmin-2; - if (kmin == -1 or kmin== 0) - { - kmin = 1; - } - - jmax=jmax-2; - if (jmax == nj-2 or jmax== nj-3) - { - jmax = nj -4; - } - if (jmax <= 0) - { - jmax = 1; - } - - - jmin=jmin-2; - if (jmin == -1 or jmin== 0) - { - jmin = 1; - } - - imax=imax-2; - if (imax == ni-2 or imax== ni-3) - { - imax = ni -4; - } - if (imax <= 0) - { - imax = 1; - } - - imin=imin-2; - if (imin == -1 or imin== 0) - { - imin = 1; - } - - */ + cout <<"dirD= "<< ipt_dirD[0] << endl; + cout << "profondeur= " << ipt_profondeur[0] << endl; ipt_rangedonor[0]=imin; ipt_rangedonor[1]=imax; diff --git a/Cassiopee/Connector/Connector/setInterpTransfers.cpp b/Cassiopee/Connector/Connector/setInterpTransfers.cpp index 1d6cd4619..a072da18e 100644 --- a/Cassiopee/Connector/Connector/setInterpTransfers.cpp +++ b/Cassiopee/Connector/Connector/setInterpTransfers.cpp @@ -903,6 +903,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) } + E_Int nbcomIBC = ipt_param_int[2]; E_Int nbcomID = ipt_param_int[3+nbcomIBC]; @@ -960,6 +961,8 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) size_autorisation = K_FUNC::E_max(size_autorisation , nrac_inst+1); E_Int autorisation_transferts[pass_inst_fin][size_autorisation]; + E_Int ntab_int =18; + // printf("nrac = %d, nrac_inst = %d, level= %d, it_target= %d , nitrun= %d \n", nrac, nrac_inst, timelevel,it_target, NitRun); //on dimension tableau travail pour IBC E_Int nbRcvPts_mx =0; E_Int ibcTypeMax=0; @@ -972,7 +975,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) for (E_Int irac=irac_deb; irac< irac_fin; irac++) { E_Int shift_rac = ech + 4 + timelevel*2 + irac; - if (ipt_param_int[ shift_rac+ nrac*10 + 1] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 + 1]; + if (ipt_param_int[ shift_rac+ nrac*10 ] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 ]; if (ipt_param_int[shift_rac+nrac*3] > ibcTypeMax) ibcTypeMax = ipt_param_int[shift_rac+nrac*3]; @@ -981,7 +984,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) if (exploc == 1) //if(rk==3 && exploc == 2) // Si on est en explicit local, on va autoriser les transferts entre certaines zones seulement en fonction de la ss-ite courante { - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; E_Int cyclD = nitmax/levelD; @@ -1010,7 +1013,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) else {continue;} } // Le pas de temps de la zone donneuse est egal a celui de la zone receveuse (cas du deuxieme passage) - else if (levelD == ipt_param_int[debut_rac +24] && num_passage == 2) + else if (levelD == levelR && num_passage == 2) { if (nstep%cyclD==cyclD/2 && (nstep/cyclD)%2==1) { autorisation_transferts[pass_inst][irac_auto]=1; } @@ -1089,11 +1092,11 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) if (ibcType < 0) ibc = 0; if(1-ibc != ipass_typ) continue; - E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; - E_Int loc = ipt_param_int[ shift_rac + nrac*9 +1 ]; //+1 a cause du nrac mpi - E_Int NoR = ipt_param_int[ shift_rac + nrac*11 +1 ]; - E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 +1 ]; //neq fonction raccord rans/LES - E_Int rotation = ipt_param_int[ shift_rac + nrac*14 +1 ]; //flag pour periodicite azimutale + E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; + E_Int loc = ipt_param_int[ shift_rac + nrac*9 ]; + E_Int NoR = ipt_param_int[ shift_rac + nrac*11 ]; + E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 ]; //neq fonction raccord rans/LES + E_Int rotation = ipt_param_int[ shift_rac + nrac*14 ]; //flag pour periodicite azimutale // COUPLAGE NS LBM - Recupere les solveurs des zones R et D E_Int solver_D=2; E_Int solver_R=2; @@ -1211,14 +1214,14 @@ PyObject* K_CONNECTOR::___setInterpTransfers(PyObject* self, PyObject* args) //// //// - E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 + 1 ]; + E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 ]; E_Int pos; - pos = ipt_param_int[ shift_rac + nrac*7 ] ; E_Int* ntype = ipt_param_int + pos; - pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*12 + 1 ]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor - pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; + pos = ipt_param_int[ shift_rac + nrac*7 ]; E_Int* ntype = ipt_param_int + pos; + pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*12]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor + pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; E_Int nbInterpD = ipt_param_int[ shift_rac + nrac ]; E_Float* xPC=NULL; E_Float* xPI=NULL; E_Float* xPW=NULL; E_Float* densPtr=NULL; if (ibc == 1) @@ -1555,6 +1558,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg size_autorisation = K_FUNC::E_max(size_autorisation , nrac_inst+1); E_Int autorisation_transferts[pass_inst_fin][size_autorisation]; + E_Int ntab_int =18; // printf("nrac = %d, nrac_inst = %d, level= %d, it_target= %d , nitrun= %d \n", nrac, nrac_inst, timelevel,it_target, NitRun); //on dimension tableau travail pour IBC @@ -1568,7 +1572,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg for (E_Int irac=irac_deb; irac< irac_fin; irac++) { E_Int shift_rac = ech + 4 + timelevel*2 + irac; - if (ipt_param_int[ shift_rac+ nrac*10 + 1] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10 + 1]; + if (ipt_param_int[ shift_rac+ nrac*10 ] > nbRcvPts_mx) nbRcvPts_mx = ipt_param_int[ shift_rac+ nrac*10]; if (ipt_param_int[shift_rac+nrac*3] > ibcTypeMax) ibcTypeMax = ipt_param_int[shift_rac+nrac*3]; @@ -1578,7 +1582,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg if (exploc == 1) //if(rk==3 && exploc == 2) // Si on est en explicit local, on va autoriser les transferts entre certaines zones seulement en fonction de la ss-ite courante { - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; E_Int cyclD = nitmax/levelD; @@ -1607,7 +1611,7 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg else {continue;} } // Le pas de temps de la zone donneuse est egal a celui de la zone receveuse (cas du deuxieme passage) - else if (levelD == ipt_param_int[debut_rac +24] && num_passage == 2) + else if (levelD == levelR && num_passage == 2) { if (nstep%cyclD==cyclD/2 && (nstep/cyclD)%2==1) { autorisation_transferts[pass_inst][irac_auto]=1; } @@ -1687,11 +1691,11 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg if (ibcType < 0) ibc = 0; if(1-ibc != ipass_typ) continue; - E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; - E_Int loc = ipt_param_int[ shift_rac + nrac*9 +1 ]; //+1 a cause du nrac mpi - E_Int NoR = ipt_param_int[ shift_rac + nrac*11 +1 ]; - E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 +1 ]; //neq fonction raccord rans/LES - E_Int rotation = ipt_param_int[ shift_rac + nrac*14 +1 ]; //flag pour periodicite azimutale + E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; + E_Int loc = ipt_param_int[ shift_rac + nrac*9 ]; + E_Int NoR = ipt_param_int[ shift_rac + nrac*11 ]; + E_Int nvars_loc= ipt_param_int[ shift_rac + nrac*13 ]; //neq fonction raccord rans/LES + E_Int rotation = ipt_param_int[ shift_rac + nrac*14 ]; //flag pour periodicite azimutale //printf("irac= %d, nvar_loc= %d, ithread= %d \n",irac , nvars_loc, ithread ); @@ -1737,14 +1741,14 @@ PyObject* K_CONNECTOR::___setInterpTransfers4GradP(PyObject* self, PyObject* arg //// //// - E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10 + 1 ]; + E_Int nbRcvPts = ipt_param_int[ shift_rac + nrac*10]; E_Int pos; - pos = ipt_param_int[ shift_rac + nrac*7 ] ; E_Int* ntype = ipt_param_int + pos; - pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; - pos = ipt_param_int[ shift_rac + nrac*12 + 1 ]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor - pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; + pos = ipt_param_int[ shift_rac + nrac*7 ]; E_Int* ntype = ipt_param_int + pos; + pos = pos +1 + ntype[0] ; E_Int* types = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*6 ]; E_Int* donorPts = ipt_param_int + pos; + pos = ipt_param_int[ shift_rac + nrac*12]; E_Int* rcvPts = ipt_param_int + pos; // donor et receveur inverser car storage donor + pos = ipt_param_int[ shift_rac + nrac*8 ]; E_Float* ptrCoefs = ipt_param_real + pos; //printf("%d %d\n", ibcType, pos); E_Int nbInterpD = ipt_param_int[ shift_rac + nrac ]; E_Float* xPC=NULL; E_Float* xPI=NULL; E_Float* xPW=NULL; E_Float* densPtr=NULL; diff --git a/Cassiopee/Connector/Connector/setInterpTransfersD.cpp b/Cassiopee/Connector/Connector/setInterpTransfersD.cpp index d45ce63ac..3c5095a50 100644 --- a/Cassiopee/Connector/Connector/setInterpTransfersD.cpp +++ b/Cassiopee/Connector/Connector/setInterpTransfersD.cpp @@ -530,6 +530,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) // 2eme pass_inst: les raccord instationnaire E_Int nbRcvPts_mx = 0; E_Int ibcTypeMax = 0; + E_Int ntab_int =18; E_Int count_rac = 0; for (E_Int pass_inst=pass_inst_deb; pass_inst< pass_inst_fin; pass_inst++) @@ -545,7 +546,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) for ( E_Int irac = irac_deb; irac < irac_fin; irac++ ) { E_Int shift_rac = ech + 4 + timelevel * 2 + irac; - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10]; if ( nbRcvPts > nbRcvPts_mx ) nbRcvPts_mx = nbRcvPts; @@ -561,7 +562,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) if(exploc == 1)// Si on est en explicit local, on va autoriser les transferts entre certaines zones seulement en fonction de la ss-ite courante { - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; @@ -589,7 +590,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) else {continue;} } // Le pas de temps de la zone donneuse est egal a celui de la zone receveuse (cas du deuxieme passage) - else if (levelD == ipt_param_int[debut_rac +24] and num_passage == 2) + else if (levelD == levelR and num_passage == 2) { if (nstep%cyclD==cyclD/2 and (nstep/cyclD)%2==1) { autorisation_transferts[pass_inst][irac_auto]=1; } else {continue;} @@ -609,9 +610,9 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) if ( TypeTransfert == 0 && ibc == 1 ) { continue;} else if ( TypeTransfert == 1 && ibc == 0 ) { continue;} - E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 + 1]; //nbre variable a transferer pour rans/LES + E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 ]; //nbre variable a transferer pour rans/LES - E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; + E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; E_Int overset = ipt_param_intD[NoD][LBM_OVERSET]; //flag pour overset en LBM recuper� sur param_int donneuse if (nvars_loc==19 && overset==0) nvars_loc = nvars_loc + 5; @@ -797,13 +798,13 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) if ( 1-ibc != ipass_typ ) continue; //printf("ipass= %d, irac= %d, ibc= %d, envoie vers: %d, size_rac= %d \n", ipass, irac, ibc, - //ipt_param_int[ ech ], ipt_param_int[ shift_rac + nrac*10 +1 ]); + //ipt_param_int[ ech ], ipt_param_int[ shift_rac + nrac*10 ]); - E_Int NoD = ipt_param_int[shift_rac + nrac * 5 ]; - E_Int loc = ipt_param_int[shift_rac + nrac * 9 + 1]; //+1 a cause du nrac mpi - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; - E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 + 1]; // neq fonction raccord rans/LES - E_Int rotation = ipt_param_int[shift_rac + nrac * 14 + 1]; // flag pour periodicite azymuthal + E_Int NoD = ipt_param_int[shift_rac + nrac * 5 ]; + E_Int loc = ipt_param_int[shift_rac + nrac * 9 ]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 ]; + E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 ]; // neq fonction raccord rans/LES + E_Int rotation = ipt_param_int[shift_rac + nrac * 14 ]; // flag pour periodicite azymuthal // COUPLAGE NS LBM - Recupere les solveurs des zones R et D E_Int solver_D=2; E_Int solver_R=2; @@ -956,7 +957,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) noi = shiftDonor; // compteur sur le tableau d indices donneur indCoef = ( pt_deb - ideb ) * sizecoefs + shiftCoef; - E_Int NoR = ipt_param_int[shift_rac + nrac * 11 + 1]; + E_Int NoR = ipt_param_int[shift_rac + nrac*11]; if (isWireModel==1){ if (ibcType==141){ @@ -1075,18 +1076,18 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) if (autorisation_transferts[pass_inst][irac_auto]==1) { E_Int shift_rac = ech + 4 + timelevel * 2 + irac; - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac*10]; E_Int nbRcvPts_loc = nbRcvPts; E_Int NoD = ipt_param_int[ shift_rac + nrac*5 ]; - E_Int ibcType = ipt_param_int[shift_rac + nrac * 3]; + E_Int ibcType = ipt_param_int[shift_rac + nrac*3]; E_Int ibc = 1; if (ibcType < 0) ibc = 0; if ( TypeTransfert == 0 && ibc == 1 ) { continue; } else if ( TypeTransfert == 1 && ibc == 0 ) { continue; } - E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 + 1]; + E_Int nvars_loc = ipt_param_int[shift_rac + nrac*13]; if (nvars_loc==19) nvars_loc = 24; if ( nvars_loc == 5 || nvars_loc == 6 ) @@ -1094,13 +1095,13 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) PyObject* info = PyList_New( 0 ); PyObject* Nozone; - Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac * 11 + 1] ); + Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac*11] ); PyList_Append( info, Nozone ); // No Zone receuveuse PyList_Append( info, list_tpl[count_rac] ); Py_DECREF( list_tpl[count_rac] ); // tableau data - E_Int PtlistDonor = ipt_param_int[shift_rac + nrac * 12 + 1]; + E_Int PtlistDonor = ipt_param_int[shift_rac + nrac*12]; E_Int* ipt_listRcv = ipt_param_int + PtlistDonor; PyObject* listRcv = K_NUMPY::buildNumpyArray( ipt_listRcv, nbRcvPts_loc, 1, 1 ); @@ -1114,8 +1115,8 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) { // ON DOIT GERER DEUX JEUX DE VARIABLES PyObject* Nozone; - Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac * 11 + 1] ); - E_Int PtlistDonor = ipt_param_int[shift_rac + nrac * 12 + 1]; + Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac*11] ); + E_Int PtlistDonor = ipt_param_int[shift_rac + nrac*12 ]; E_Int* ipt_listRcv = ipt_param_int + PtlistDonor; PyObject* listRcv = K_NUMPY::buildNumpyArray( ipt_listRcv, nbRcvPts_loc, 1, 1 ); @@ -1142,8 +1143,8 @@ PyObject* K_CONNECTOR::__setInterpTransfersD(PyObject* self, PyObject* args) { // ON DOIT GERER DEUX JEUX DE VARIABLES PyObject* Nozone; - Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac * 11 + 1] ); - E_Int PtlistDonor = ipt_param_int[shift_rac + nrac * 12 + 1]; + Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac*11] ); + E_Int PtlistDonor = ipt_param_int[shift_rac + nrac*12 ]; E_Int* ipt_listRcv = ipt_param_int + PtlistDonor; PyObject* listRcv = K_NUMPY::buildNumpyArray( ipt_listRcv, nbRcvPts_loc, 1, 1 ); @@ -1366,7 +1367,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg E_Int nbRcvPts_mx = 0; E_Int ibcTypeMax = 0; E_Int count_rac = 0; - + E_Int ntab_int =18; @@ -1383,13 +1384,13 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg for ( E_Int irac = irac_deb; irac < irac_fin; irac++ ) { E_Int shift_rac = ech + 4 + timelevel * 2 + irac; - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac*10]; if ( nbRcvPts > nbRcvPts_mx ) nbRcvPts_mx = nbRcvPts; if( ipt_param_int[shift_rac+nrac*3] > ibcTypeMax) ibcTypeMax = ipt_param_int[shift_rac+nrac*3]; - E_Int ibcType = ipt_param_int[shift_rac + nrac * 3]; + E_Int ibcType = ipt_param_int[shift_rac + nrac*3]; E_Int ibc = 1; if ( ibcType < 0) ibc = 0; @@ -1400,7 +1401,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg { - E_Int debut_rac = ech + 4 + timelevel*2 + 1 + nrac*16 + 27*irac; + E_Int debut_rac = ech + 4 + timelevel*2 + nrac*ntab_int + 27*irac; E_Int levelD = ipt_param_int[debut_rac + 25]; E_Int levelR = ipt_param_int[debut_rac + 24]; @@ -1428,7 +1429,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg else {continue;} } // Le pas de temps de la zone donneuse est egal a celui de la zone receveuse (cas du deuxieme passage) - else if (levelD == ipt_param_int[debut_rac +24] and num_passage == 2) + else if (levelD == levelR and num_passage == 2) { if (nstep%cyclD==cyclD/2 and (nstep/cyclD)%2==1) { autorisation_transferts[pass_inst][irac_auto]=1; } else {continue;} @@ -1447,7 +1448,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg continue; } - E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 + 1]; //nbre variable a transferer pour rans/LES + E_Int nvars_loc = ipt_param_int[shift_rac + nrac*13]; //nbre variable a transferer pour rans/LES if ( strcmp( varname, "Density" ) == 0 ) { if ( nvars_loc == 5 ) @@ -1554,14 +1555,14 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg // printf("ipass= %d, irac= %d, ibc= %d, envoie vers: %d, size_rac= %d \n", ipass, irac, ibc, - // ipt_param_int[ ech ], ipt_param_int[ shift_rac + nrac*10 +1 ]); + // ipt_param_int[ ech ], ipt_param_int[ shift_rac + nrac*10 ]); if ( 1-ibc!= ipass_typ ) continue; - E_Int NoD = ipt_param_int[shift_rac + nrac * 5 ]; - E_Int loc = ipt_param_int[shift_rac + nrac * 9 + 1]; //+1 a cause du nrac mpi - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; - E_Int nvars_loc = ipt_param_int[shift_rac + nrac * 13 + 1]; // neq fonction raccord rans/LES - E_Int rotation = ipt_param_int[shift_rac + nrac * 14 + 1]; // flag pour periodicite azymuthal + E_Int NoD = ipt_param_int[shift_rac + nrac*5 ]; + E_Int loc = ipt_param_int[shift_rac + nrac*9 ]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac*10 ]; + E_Int nvars_loc = ipt_param_int[shift_rac + nrac*13 ]; // neq fonction raccord rans/LES + E_Int rotation = ipt_param_int[shift_rac + nrac*14 ]; // flag pour periodicite azymuthal E_Int meshtype = ipt_ndimdxD[NoD + nidomD * 6]; @@ -1602,13 +1603,13 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg //// //// E_Int pos; - pos = ipt_param_int[shift_rac + nrac * 7]; + pos = ipt_param_int[shift_rac + nrac*7]; E_Int* ntype = ipt_param_int + pos; pos = pos + 1 + ntype[0]; E_Int* types = ipt_param_int + pos; - pos = ipt_param_int[shift_rac + nrac * 6]; + pos = ipt_param_int[shift_rac + nrac*6]; E_Int* donorPts = ipt_param_int + pos; - pos = ipt_param_int[shift_rac + nrac * 8]; + pos = ipt_param_int[shift_rac + nrac*8]; E_Float* ptrCoefs = ipt_param_real + pos; E_Int nbInterpD = ipt_param_int[shift_rac + nrac]; @@ -1666,13 +1667,13 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg noi = shiftDonor; // compteur sur le tableau d indices donneur indCoef = ( pt_deb - ideb ) * sizecoefs + shiftCoef; - //E_Int NoR = ipt_param_int[shift_rac + nrac * 11 + 1]; + //E_Int NoR = ipt_param_int[shift_rac + nrac*11 ]; //if (ipt_param_int[ech]==0) printf("No rac= %d , NoR= %d, NoD= %d, Ntype= %d, ptdeb= %d, ptfin= %d, NptD= %d, neq= %d, skip= %d, rank= %d, dest= %d, thread= %d\n", //irac, NoR,NoD, ntype[ 1 + ndtyp],pt_deb,pt_fin , - //ipt_param_int[ shift_rac + nrac*10+1 ], ipt_param_int[ shift_rac + nrac*13+1 ], ipt_param_int[ shift_rac + nrac*15+1 ], + //ipt_param_int[ shift_rac + nrac*10 ], ipt_param_int[ shift_rac + nrac*13 ], ipt_param_int[ shift_rac + nrac*15 ], //rank, ipt_param_int[ ech ], ithread ); @@ -1771,12 +1772,12 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg { E_Int shift_rac = ech + 4 + timelevel * 2 + irac; - E_Int nbRcvPts = ipt_param_int[shift_rac + nrac * 10 + 1]; + E_Int nbRcvPts = ipt_param_int[shift_rac + nrac*10]; //E_Int NoD = ipt_param_int[shift_rac + nrac * 5 ]; if ( nbRcvPts > nbRcvPts_mx ) nbRcvPts_mx = nbRcvPts; - E_Int ibcType = ipt_param_int[shift_rac + nrac * 3]; + E_Int ibcType = ipt_param_int[shift_rac + nrac*3]; E_Int ibc = 1; if (ibcType < 0) ibc = 0; if ( TypeTransfert == 0 && ibc == 1 ) { continue; } @@ -1788,7 +1789,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg PyObject* infoGrad = PyList_New( 0 ); PyObject* Nozone; - Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac * 11 + 1] ); + Nozone = PyInt_FromLong( ipt_param_int[shift_rac + nrac*11] ); PyList_Append( info, Nozone ); // No Zone receuveuse PyList_Append( infoGrad, Nozone ); // No Zone receuveuse @@ -1798,7 +1799,7 @@ PyObject* K_CONNECTOR::__setInterpTransfersD4GradP(PyObject* self, PyObject* arg PyList_Append( infoGrad, list_tplGrad[count_rac] ); Py_DECREF( list_tplGrad[count_rac] ); // tableau data - E_Int PtlistDonor = ipt_param_int[shift_rac + nrac * 12 + 1]; + E_Int PtlistDonor = ipt_param_int[shift_rac + nrac*12]; E_Int* ipt_listRcv = ipt_param_int + PtlistDonor; PyObject* listRcv = K_NUMPY::buildNumpyArray( ipt_listRcv, nbRcvPts, 1, 1 ); diff --git a/Cassiopee/Generator/Generator/extendCartGrids.cpp b/Cassiopee/Generator/Generator/extendCartGrids.cpp index 6127e7c0c..923856511 100644 --- a/Cassiopee/Generator/Generator/extendCartGrids.cpp +++ b/Cassiopee/Generator/Generator/extendCartGrids.cpp @@ -39,7 +39,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) return NULL; } if (ext == 0) return arrays; - if (optimized != 0 && optimized != 1) + if (optimized != 0 && optimized != 1 && optimized != -1) {printf("Warning: extendCartGrids: optimized is set to 1.\n"); optimized = 1;} // Extract infos from arrays @@ -107,8 +107,9 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) } // Determination des extensions pour chq zone a partir de l'octree - E_Int extg = ext; E_Int extf = ext; - if (optimized == 1) {extg = ext-1;} + E_Int extg = ext; E_Int extf = ext; E_Int extff= ext; + if (optimized == 1) {extg = ext-1; extff = extg;} + if (optimized ==-1) {extg = ext+1;} FldArrayI extension(nzones, 6); extension.setAllValuesAtNull(); vector indicesBB; @@ -201,7 +202,8 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext1[v1] = K_FUNC::E_max(ext1[v1],extf); - ext2[v2] = K_FUNC::E_max(ext2[v2],extg); + ext2[v2] = K_FUNC::E_max(ext2[v2],extff); + //ext2[v2] = K_FUNC::E_max(ext2[v2],extg); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -272,7 +274,8 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext2[v1] = K_FUNC::E_max(ext2[v1],extf); - ext1[v2] = K_FUNC::E_max(ext1[v2],extg); + ext1[v2] = K_FUNC::E_max(ext1[v2],extff); + //ext1[v2] = K_FUNC::E_max(ext1[v2],extg); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -345,7 +348,8 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext3[v1] = K_FUNC::E_max(ext3[v1],extf); - ext4[v2] = K_FUNC::E_max(ext4[v2],extg); + ext4[v2] = K_FUNC::E_max(ext4[v2],extff); + //ext4[v2] = K_FUNC::E_max(ext4[v2],extg); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -416,7 +420,8 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext4[v1] = K_FUNC::E_max(ext4[v1],extf); - ext3[v2] = K_FUNC::E_max(ext3[v2],extg); + ext3[v2] = K_FUNC::E_max(ext3[v2],extff); + //ext3[v2] = K_FUNC::E_max(ext3[v2],extg); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -534,7 +539,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext1[v1] = K_FUNC::E_max(ext1[v1],extf); - ext2[v2] = K_FUNC::E_max(ext2[v2],extg); + ext2[v2] = K_FUNC::E_max(ext2[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -633,7 +638,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext2[v1] = K_FUNC::E_max(ext2[v1],extf); - ext1[v2] = K_FUNC::E_max(ext1[v2],extg); + ext1[v2] = K_FUNC::E_max(ext1[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -734,7 +739,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext3[v1] = K_FUNC::E_max(ext3[v1],extf); - ext4[v2] = K_FUNC::E_max(ext4[v2],extg); + ext4[v2] = K_FUNC::E_max(ext4[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -832,7 +837,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext4[v1] = K_FUNC::E_max(ext4[v1],extf); - ext3[v2] = K_FUNC::E_max(ext3[v2],extg); + ext3[v2] = K_FUNC::E_max(ext3[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -929,7 +934,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext5[v1] = K_FUNC::E_max(ext5[v1],extf); - ext6[v2] = K_FUNC::E_max(ext6[v2],extg); + ext6[v2] = K_FUNC::E_max(ext6[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids { @@ -1027,7 +1032,7 @@ PyObject* K_GENERATOR::extendCartGrids(PyObject* self, PyObject* args) if ( K_FUNC::fEqualZero(diff,tol2) == true ) //F/F : 3/2 if possible { ext6[v1] = K_FUNC::E_max(ext6[v1],extf); - ext5[v2] = K_FUNC::E_max(ext5[v2],extg); + ext5[v2] = K_FUNC::E_max(ext5[v2],extff); } else if ( s1 < dhmax - tol2) // current grid is finer than all its opposite grids {