Nek5000 / nekRS

our next generation fast and scalable CFD code
https://nek5000.mcs.anl.gov/
Other
284 stars 75 forks source link

Incorrect boundary chk in nrsSetup #504

Open yslan opened 1 year ago

yslan commented 1 year ago

Describe the bug

We should only call bcMap::checkBoundaryAlignment with v-mesh.

https://github.com/Nek5000/nekRS/blob/4f87e0e2ec0492e2a3edf27791252d6886814d00/src/setup/setup.cpp#L253-L262

To Reproduce This bug can be observed in the conj_ht example with the following changes where the number of boundary IDs are different between v-mesh and t-mesh.

(usrdat2)
      ! reconstruct boundary tags 
      do iel=1,nelv
      do ifc=1,2*ndim
         if (cbc(ifc,iel,1) .eq. 'v  ') boundaryID(ifc,iel) = 1
         if (cbc(ifc,iel,1) .eq. 'O  ') boundaryID(ifc,iel) = 2
         if (cbc(ifc,iel,1) .eq. 'W  ') boundaryID(ifc,iel) = 1 ! change it to inlet with value 0
      enddo
      enddo

      do iel=1,nelt
      do ifc=1,2*ndim
         if (cbc(ifc,iel,2) .eq. 't  ') boundaryIDt(ifc,iel) = 1
         if (cbc(ifc,iel,2) .eq. 'O  ') boundaryIDt(ifc,iel) = 2
         if (cbc(ifc,iel,2) .eq. 'I  ') boundaryIDt(ifc,iel) = 3
      enddo
      enddo

(par)
[VELOCITY]
boundaryTypeMap = v, O

[TEMPERATURE]
boundaryTypeMap = t, O, I

(error)
generating t-mesh ...
loading mesh from nek ... Nelements: 192, NboundaryIDs: 3, NboundaryFaces: 96 done (2.3564e-05s)
polynomial order N: 7, over-integration order cubN: 10
meshParallelGatherScatterSetup N=7
timing gs: 2.27e-04s
used config: local
generating v-mesh ...
loading mesh from nek ... Nelements: 96, NboundaryIDs: 2, NboundaryFaces: 72 done (2.5134e-05s)
meshParallelGatherScatterSetup N=7
timing gs: 1.14e-04s 
used config: local
Error in id: lookup of bid 3 field velocity failed!

Desktop (please complete the following information):

Workaround

The code runs if we manually replace the loop between lines 253 to 262 with the single check.
However, further inspection is needed since this case doesn't have SYM with non-aligned BC

      bcMap::checkBoundaryAlignment(mesh);
      bcMap::remapUnalignedBoundaries(mesh);