Skip to content

Commit

Permalink
More work on SCHISM_MeshCreateElement
Browse files Browse the repository at this point in the history
  • Loading branch information
josephzhang8 committed Nov 28, 2023
1 parent 5465074 commit 230de47
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/schism/schism_esmf_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1307,23 +1307,25 @@ subroutine SCHISM_MeshCreateElement(comp, kwe, rc)
nv(nvcount) = elnode(ii,ie)
end do !ii
elementcoords2d(2*indx) = sum(nodecoords2d(2*elLocalNode(1:i34(ie))))/i34(ie)
!elementcoords2d(2*indx-1) = sum(nodecoords2d(2*elLocalNode(1:i34(ie))-1))/i34(ie)
!lon needs care across jump
ownedCount=0
nd1=elLocalNode(1)
elementcoords2d(2*indx-1)=0.d0
do ii=2,i34(ie)
nd=elLocalNode(ii)
if(abs(nodecoords2d(2*nd1-1)-nodecoords2d(2*nd-1))<200.d0) then
ownedCount=ownedCount+1
elementcoords2d(2*indx-1)=elementcoords2d(2*indx-1)+nodecoords2d(2*nd-1)
if(ics==1) then
elementcoords2d(2*indx-1) = sum(nodecoords2d(2*elLocalNode(1:i34(ie))-1))/i34(ie)
else !lon needs care across jump
ownedCount=0
nd1=elLocalNode(1)
elementcoords2d(2*indx-1)=0.d0
do ii=2,i34(ie)
nd=elLocalNode(ii)
if(abs(nodecoords2d(2*nd1-1)-nodecoords2d(2*nd-1))<200.d0) then
ownedCount=ownedCount+1
elementcoords2d(2*indx-1)=elementcoords2d(2*indx-1)+nodecoords2d(2*nd-1)
endif
enddo !ii
if(ownedCount==0) then
!@Carsten: plz add fatal error here
else
elementcoords2d(2*indx-1)=elementcoords2d(2*indx-1)/ownedCount
endif
enddo !ii
if(ownedCount==0) then
!@Carsten: plz add fatal error here
else
elementcoords2d(2*indx-1)=elementcoords2d(2*indx-1)/ownedCount
endif
endif !ics

! mask
elementmask(indx) = idry_e(ie)
Expand Down

0 comments on commit 230de47

Please sign in to comment.