[cig-commits] r18334 - in seismo/3D/FAULT_SOURCE/branches/new_fault_db: decompose_mesh_SCOTCH src

ampuero at geodynamics.org ampuero at geodynamics.org
Sun May 8 01:12:31 PDT 2011


Author: ampuero
Date: 2011-05-08 01:12:31 -0700 (Sun, 08 May 2011)
New Revision: 18334

Modified:
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/fault_scotch.f90
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/create_regions_mesh.f90
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/fault_object.f90
Log:
read inodes from CUBIT instead of ifaces

Modified: seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90	2011-05-06 22:32:26 UTC (rev 18333)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/decompose_mesh_SCOTCH.f90	2011-05-08 08:12:31 UTC (rev 18334)
@@ -659,7 +659,8 @@
          print*,'check if path exists:',outputpath_name(1:len_trim(outputpath_name))
          stop 
        endif
-       call write_fault_database(16, ipart, nspec, glob2loc_elmnts,part)
+       call write_fault_database(16, ipart, nspec, &
+                                 glob2loc_elmnts, glob2loc_nodes_nparts, glob2loc_nodes_parts, part)
        close(16)
        
 

Modified: seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/fault_scotch.f90
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/fault_scotch.f90	2011-05-06 22:32:26 UTC (rev 18333)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/decompose_mesh_SCOTCH/fault_scotch.f90	2011-05-08 08:12:31 UTC (rev 18334)
@@ -6,18 +6,15 @@
   type fault_type
     private 
     integer :: nspec
-    integer, dimension(:), pointer  :: ispec1, ispec2, iface1, iface2 
+    integer, dimension(:), pointer  :: ispec1, ispec2 !, iface1, iface2 
+    integer, dimension(:,:), pointer  :: inodes1, inodes2 
   end type fault_type
 
   type(fault_type), allocatable, save :: faults(:) 
 
- ! PRESICION
-  integer, parameter :: SIZE_REAL = 4   ! single precision
-  integer, parameter :: SIZE_DOUBLE = 8 ! double precision
-  integer, parameter :: CUSTOM_REAL = SIZE_REAL
-  integer, parameter :: short = SELECTED_INT_KIND(4), long = SELECTED_INT_KIND(18)
+  integer, parameter :: long = SELECTED_INT_KIND(18)
   
-  real(kind=CUSTOM_REAL), parameter :: FAULT_GAP_TOLERANCE = 1e-2_CUSTOM_REAL
+  double precision, parameter :: FAULT_GAP_TOLERANCE = 1e-2_CUSTOM_REAL
 
   public :: read_fault_files, fault_collect_elements, close_faults, write_fault_database
 
@@ -49,14 +46,14 @@
 
 !---------------------------------------------------------------------------------------------------
 
-  Subroutine read_single_fault_file(bcfault,ifault)
+  Subroutine read_single_fault_file(f,ifault)
 
 !    INPUTS :
-  type(fault_type), intent(inout) :: bcfault
+  type(fault_type), intent(inout) :: f
 
   integer,intent(in) :: ifault
   character(len=5) :: NTchar
-  integer :: i,j,ier 
+  integer :: e,ier 
 
   write(NTchar,'(I5)') ifault
   NTchar = adjustl(NTchar)
@@ -65,14 +62,27 @@
                  status='old',action='read',iostat=ier)  
        
   if( ier == 0 ) then
-    read(101,*) bcfault%nspec
-    allocate(bcfault%ispec1(bcfault%nspec))
-    allocate(bcfault%ispec2(bcfault%nspec))
-    allocate(bcfault%iface1(bcfault%nspec))
-    allocate(bcfault%iface2(bcfault%nspec))
-    do j=1,bcfault%nspec
-      read(101,*) bcfault%ispec1(j),bcfault%ispec2(j),bcfault%iface1(j),bcfault%iface2(j)
+    read(101,*) f%nspec
+    allocate(f%ispec1(f%nspec))
+    allocate(f%ispec2(f%nspec))
+    allocate(f%inodes1(4,f%nspec))
+    allocate(f%inodes2(4,f%nspec))
+   ! format: 
+   ! #id_(element containing the face) #id_node1_face .. #id_node4_face
+   ! First for all faces on side 1, then side 2
+   ! Note: element ids start at 1, not 0. Check that in cubit2specfem3d.py
+    do e=1,f%nspec
+      read(101,*) f%ispec1(e),f%inodes1(:,e)
     enddo
+    do e=1,f%nspec
+      read(101,*) f%ispec2(e),f%inodes2(:,e)
+    enddo
+   ! If we ever figure out how to export "ifaces" from CUBIT:
+    !allocate(f%iface1(f%nspec))
+    !allocate(f%iface2(f%nspec))
+    !do e=1,f%nspec
+    !  read(101,*) f%ispec1(e),f%ispec2(e),f%iface1(e),f%iface2(e)
+    !enddo
   else        
     write(6,*) 'Fatal error: file ../DATA/FAULT/fault_elements_'//NTCHAR//'.dat not found' 
     write(6,*) 'Abort'
@@ -88,8 +98,9 @@
 
   subroutine close_faults(nodes_coords,elmnts,nelmnts,nnodes,esize)
     
-  integer ,intent(in)  :: nnodes, esize, nelmnts
-  real(kind=CUSTOM_REAL), dimension(3,nnodes), intent(inout) :: nodes_coords
+  integer ,intent(in) :: nnodes, esize
+  integer(long), intent(in) :: nelmnts
+  double precision, dimension(3,nnodes), intent(inout) :: nodes_coords
   integer, dimension(esize,nelmnts), intent(in) :: elmnts
 
   integer  :: iflt
@@ -102,17 +113,30 @@
   end subroutine close_faults
 
 ! ---------------------------------------------------------------------------------------------------
+!jpa: to do this much faster:
+!     1. create a list of unique nodes from inodes1 and inodes2, 
+!          inodes1_u = unique(isort1)
+!          inodes2_u = unique(isort2)
+!     2. sort the nodes by coordinates. Now both faces correspond.
+!          [coord,k1] = sort(coords(inodes1_u))
+!          k1 = inodes1_u(k1)
+!          [coord,k2] = sort(coords(inodes2_u))
+!          k2 = inodes2_u(k2)
+!     3. set the coordinates on both sides equal to their average
+!          coords(k1) = 0.5*( coords(k1)+coords(k2) )
+!          coords(k2) = coords(k1)
   subroutine close_fault_single(ispec1,ispec2,elmnts,nodes_coords,nnodes,esize,nelmnts)
  
-  integer ,intent(in)  :: nnodes, esize, nelmnts
+  integer ,intent(in)  :: nnodes, esize
+  integer(long), intent(in) :: nelmnts
   integer, dimension(esize,nelmnts), intent(in) :: elmnts
   integer , dimension(:), intent(in) :: ispec1,ispec2
-  real(kind=CUSTOM_REAL),dimension(3,nnodes), intent(inout) :: nodes_coords 
+  double precision,dimension(3,nnodes), intent(inout) :: nodes_coords 
     
-  real(kind=CUSTOM_REAL), dimension(3) :: xyz_1, xyz_2 
-  real(kind=CUSTOM_REAL), dimension(3) :: xyz
+  double precision, dimension(3) :: xyz_1, xyz_2 
+  double precision, dimension(3) :: xyz
   
-  real(kind=CUSTOM_REAL) :: dist
+  double precision :: dist
   integer :: iglob1, iglob2, i, j, k1, k2
   logical :: found_it
 
@@ -160,8 +184,7 @@
                                    sup_neighbour,esize,nsize,nproc,part)
 
 ! INPUTS
-  integer(long),intent(in) :: nelmnts,nsize
-  integer(long),intent(in) :: sup_neighbour 
+  integer(long), intent(in) :: nelmnts,nsize,sup_neighbour 
   integer, dimension(0:esize*nelmnts-1),intent(in)  :: elmnts
   integer, intent(in)  :: nnodes, nproc, esize
 ! OUTPUTS :
@@ -191,10 +214,9 @@
 !     Part, once is altered , will be input for write_partition_database.
 
 !INPUTS
-  integer(long),intent(in) :: nelmnts
+  integer(long), intent(in) :: nelmnts,sup_neighbour,nsize
   integer, intent(in)  :: nnodes, nproc, esize 
   integer, dimension(0:esize*nelmnts-1), intent(in) :: elmnts
-  integer(long), intent(in) :: sup_neighbour,nsize
   logical , dimension(nelmnts), intent(in) :: is_on_fault
 !OUTPUTS :
   integer, dimension(0:nelmnts-1), intent(inout)    :: part
@@ -278,69 +300,141 @@
   end subroutine fault_repartition
 
 ! ---------------------------------------------------------------------------------------------------
-! write one block for each fault
+! See subroutine write_boundaries_database in part_decompose_mesh_SCOTCH.f90
+!
+! File format: 
+! one block for each fault
+! first line of each block = number of fault elements in this processor
+! next lines: #id_(element containing the face) #id_node1_face .. #id_node4_face
+! first for all faces on side 1, then side 2
 
   subroutine write_fault_database(IIN_database, iproc, nelmnts, &
-                                      glob2loc_elmnts, part)
+                                  glob2loc_elmnts,glob2loc_nodes_nparts,glob2loc_nodes_parts,part)
 
-!    include './constants_decompose_mesh_SCOTCH.h'
-
   integer, intent(in)  :: IIN_database
-  integer, intent(in)  :: iproc,nelmnts
-  integer, dimension(0:nelmnts-1), intent(in)  :: part,glob2loc_elmnts
+  integer, intent(in)  :: iproc
+  integer(long), intent(in) :: nelmnts
+  integer, dimension(1:nelmnts), intent(in)  :: part
+  integer, dimension(0:nelmnts-1), intent(in)  :: glob2loc_elmnts
+  integer, dimension(:), pointer  :: glob2loc_nodes_nparts
+  integer, dimension(:), pointer  :: glob2loc_nodes_parts
+  integer, dimension(:), pointer  :: glob2loc_nodes
 
-  integer, dimension(:), allocatable :: ispec1, ispec2, iface1, iface2 
-  integer  :: i,iflt,ispec_fault 
-  integer  :: nspec_fault_side1,nspec_fault_side2,nspec_fault
-  integer  :: k1,k2
+  integer  :: i,j,k,iflt,e
+  integer  :: nspec_fault_1,nspec_fault_2
+  integer :: loc_nodes(4),inodes(4)
 
   do iflt=1,size(faults)
  
-   ! check number of fault elements in this partition
-    nspec_fault_side1 = count( part(faults(iflt)%ispec1-1) == iproc )
-    nspec_fault_side2 = count( part(faults(iflt)%ispec2-1) == iproc )
-    print *, 'Fault # ',iflt
-    print *, '  ispec1 : ', nspec_fault_side1
-    print *, '  ispec2 : ', nspec_fault_side2
-    if (nspec_fault_side1 /= nspec_fault_side2) then
-      print *, 'Fatal error: Number of fault elements on ',iproc,' do not coincide. Abort.'
+   ! get number of fault elements in this partition
+    nspec_fault_1 = count( part(faults(iflt)%ispec1) == iproc )
+    nspec_fault_2 = count( part(faults(iflt)%ispec2) == iproc )
+    if (nspec_fault_1 /= nspec_fault_2) then
+      print *, 'Fault # ',iflt,', proc # ',iproc
+      print *, '  ispec1 : ', nspec_fault_1
+      print *, '  ispec2 : ', nspec_fault_2
+      print *, 'Fatal error: Number of fault elements do not coincide. Abort.'
       stop 
     end if
-    nspec_fault = nspec_fault_side1 
 
-    write(IIN_database,*) nspec_fault
+    write(IIN_database,*) nspec_fault_1
 
-    if (nspec_fault==0) cycle 
+    if (nspec_fault_1==0) cycle 
 
-    allocate(ispec1(nspec_fault))
-    allocate(iface1(nspec_fault))
-    allocate(ispec2(nspec_fault))
-    allocate(iface2(nspec_fault))
-    k1 = 0
-    k2 = 0
-    do i = 1,faults(iflt)%nspec   
-      if ( part(faults(iflt)%ispec1(i)-1) == iproc ) then
-        k1 = k1 + 1
-        ispec1(k1)=glob2loc_elmnts(faults(iflt)%ispec1(i))
-        iface1(k1)=faults(iflt)%iface1(i)
-      endif
-      if ( part(faults(iflt)%ispec2(i)-1) == iproc ) then
-        k2 = k2 + 1
-        ispec2(k2)=glob2loc_elmnts(faults(iflt)%ispec2(i))
-        iface2(k2)=faults(iflt)%iface2(i)
-      endif
+    do i=1,faults(iflt)%nspec
+      e = faults(iflt)%ispec1(i)
+      if(part(e) == iproc) then
+        inodes = faults(iflt)%inodes1(:,i)
+        do k=1,4
+          do j = glob2loc_nodes_nparts(inodes(k)-1), glob2loc_nodes_nparts(inodes(k))-1
+            if (glob2loc_nodes_parts(j) == iproc ) then
+              loc_nodes(k) = glob2loc_nodes(j)+1
+            end if
+          end do
+        end do
+        write(IIN_database,*) glob2loc_elmnts(e-1)+1, loc_nodes
+      end if
     enddo
 
-   ! Writes ispec1 , ispec2 , iface1 , iface2
-    do i = 1,nspec_fault
-      write(IIN_database,*) ispec1(i), ispec2(i), iface1(i), iface2(i)
+    do i=1,faults(iflt)%nspec
+      e = faults(iflt)%ispec2(i)
+      if(part(e) == iproc) then
+        inodes = faults(iflt)%inodes2(:,i)
+        do k=1,4
+          do j = glob2loc_nodes_nparts(inodes(k)-1), glob2loc_nodes_nparts(inodes(k))-1
+            if (glob2loc_nodes_parts(j) == iproc ) then
+              loc_nodes(k) = glob2loc_nodes(j)+1
+            end if
+          end do
+        end do
+        write(IIN_database,*) glob2loc_elmnts(e-1)+1, loc_nodes
+      end if
     enddo
-   ! NOTE: the solver does not need ispec1 and ispec2 to be facing each other across the fault
-    deallocate(ispec1,ispec2,iface1,iface2)
 
   enddo
 
   end subroutine write_fault_database
 
+!-----------
+!  subroutine write_fault_database_iface(IIN_database, iproc, nelmnts, &
+!                                      glob2loc_elmnts, part)
+!
+!  integer, intent(in)  :: IIN_database
+!  integer, intent(in)  :: iproc
+!  integer(long), intent(in) :: nelmnts
+!  integer, dimension(0:nelmnts-1), intent(in)  :: part,glob2loc_elmnts
+!
+!  integer, dimension(:), allocatable :: ispec1, ispec2, iface1, iface2 
+!  integer  :: i,iflt,ispec_fault 
+!  integer  :: nspec_fault_1,nspec_fault_2,nspec_fault
+!  integer  :: k1,k2
+!
+!  do iflt=1,size(faults)
+! 
+!   ! check number of fault elements in this partition
+!    nspec_fault_1 = count( part(faults(iflt)%ispec1-1) == iproc )
+!    nspec_fault_2 = count( part(faults(iflt)%ispec2-1) == iproc )
+!    print *, 'Fault # ',iflt
+!    print *, '  ispec1 : ', nspec_fault_1
+!    print *, '  ispec2 : ', nspec_fault_2
+!    if (nspec_fault_1 /= nspec_fault_2) then
+!      print *, 'Fatal error: Number of fault elements on ',iproc,' do not coincide. Abort.'
+!      stop 
+!    end if
+!    nspec_fault = nspec_fault_1 
+!
+!    write(IIN_database,*) nspec_fault
+!
+!    if (nspec_fault==0) cycle 
+!
+!    allocate(ispec1(nspec_fault))
+!    allocate(iface1(nspec_fault))
+!    allocate(ispec2(nspec_fault))
+!    allocate(iface2(nspec_fault))
+!    k1 = 0
+!    k2 = 0
+!    do i = 1,faults(iflt)%nspec   
+!      if ( part(faults(iflt)%ispec1(i)-1) == iproc ) then
+!        k1 = k1 + 1
+!        ispec1(k1)=glob2loc_elmnts(faults(iflt)%ispec1(i))
+!        iface1(k1)=faults(iflt)%iface1(i)
+!      endif
+!      if ( part(faults(iflt)%ispec2(i)-1) == iproc ) then
+!        k2 = k2 + 1
+!        ispec2(k2)=glob2loc_elmnts(faults(iflt)%ispec2(i))
+!        iface2(k2)=faults(iflt)%iface2(i)
+!      endif
+!    enddo
+!
+!   ! Writes ispec1 , ispec2 , iface1 , iface2
+!    do i = 1,nspec_fault
+!      write(IIN_database,*) ispec1(i), ispec2(i), iface1(i), iface2(i)
+!    enddo
+!   ! NOTE: the solver does not need ispec1 and ispec2 to be facing each other across the fault
+!    deallocate(ispec1,ispec2,iface1,iface2)
+!
+!  enddo
+!
+!  end subroutine write_fault_database_iface
 
- end module fault_scotch
+end module fault_scotch

Modified: seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/create_regions_mesh.f90
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/create_regions_mesh.f90	2011-05-06 22:32:26 UTC (rev 18333)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/create_regions_mesh.f90	2011-05-08 08:12:31 UTC (rev 18334)
@@ -195,8 +195,8 @@
                       nnodes_ext_mesh,nodes_coords_ext_mesh,myrank)
 
   call fault_read_input(prname)
-  call fault_setup (ibool,xstore,ystore,zstore,nspec,nglob,myrank)
-
+  call fault_setup (ibool,nnodes_ext_mesh,nodes_coords_ext_mesh, &
+                    xstore,ystore,zstore,nspec,nglob,myrank)
  
 ! sets up MPI interfaces between partitions
   call sync_all()

Modified: seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/fault_object.f90
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/fault_object.f90	2011-05-06 22:32:26 UTC (rev 18333)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/src/fault_object.f90	2011-05-08 08:12:31 UTC (rev 18334)
@@ -41,7 +41,7 @@
     real(kind=CUSTOM_REAL) :: eta
     integer, dimension(:), pointer:: ispec1, ispec2, ibulk1, ibulk2, iface1, iface2
     real(kind=CUSTOM_REAL), dimension(:), pointer :: xcoordbulk1,ycoordbulk1,zcoordbulk1,xcoordbulk2,ycoordbulk2,zcoordbulk2
-    integer, dimension(:,:), pointer :: ibool1, ibool2
+    integer, dimension(:,:), pointer :: ibool1, ibool2, inodes1, inodes2
     integer, dimension(:,:,:), pointer :: ijk1, ijk2
     real(kind=CUSTOM_REAL), dimension(:,:), pointer:: jacobian2Dw
     real(kind=CUSTOM_REAL), dimension(:,:,:), pointer:: normal
@@ -78,7 +78,7 @@
 
   character(len=256), intent(in) :: prname 
   
-  integer :: nb,i,iflt,ier
+  integer :: nb,i,iflt,ier,nspec
   integer, parameter :: IIN = 100  
   real(kind=CUSTOM_REAL) :: eta
   
@@ -110,21 +110,31 @@
 
   do iflt=1,size(fault_db) 
 
-    read(IIN,*) fault_db(iflt)%nspec 
+    read(IIN,*) nspec 
+    fault_db(iflt)%nspec  = nspec
 
-    if (fault_db(iflt)%nspec == 0) cycle
+    if (nspec == 0) cycle
 
-    allocate(fault_db(iflt)%ispec1(fdb%nspec))
-    allocate(fault_db(iflt)%iface1(fdb%nspec))
-    allocate(fault_db(iflt)%ispec2(fdb%nspec))
-    allocate(fault_db(iflt)%iface2(fdb%nspec))
+    allocate(fault_db(iflt)%ispec1(nspec))
+    allocate(fault_db(iflt)%inodes1(4,nspec))
+    allocate(fault_db(iflt)%ispec2(nspec))
+    allocate(fault_db(iflt)%inodes2(4,nspec))
 
-   ! loading ispec1 ispec2 iface1 iface2 of fault elements.
-    do i=1,fault_db(iflt)%nspec
-      read(IIN,*) fault_db(iflt)%ispec1(i), fault_db(iflt)%ispec2(i), &
-                  fault_db(iflt)%iface1(i), fault_db(iflt)%iface2(i)
+    do i=1,nspec
+      read(IIN,*) fault_db(iflt)%ispec1(i), fault_db(iflt)%inodes1(:,i)
     enddo
+    do i=1,nspec
+      read(IIN,*) fault_db(iflt)%ispec2(i), fault_db(iflt)%inodes2(:,i)
+    enddo
 
+   ! loading ispec1 ispec2 iface1 iface2 of fault elements.
+!    allocate(fault_db(iflt)%iface1(nspec))
+!    allocate(fault_db(iflt)%iface2(nspec))
+!    do i=1,fault_db(iflt)%nspec
+!      read(IIN,*) fault_db(iflt)%ispec1(i), fault_db(iflt)%ispec2(i), &
+!                  fault_db(iflt)%iface1(i), fault_db(iflt)%iface2(i)
+!    enddo
+
   enddo
 
   close(IIN)
@@ -132,7 +142,8 @@
 end subroutine fault_read_input
 
 !==================================================================================================================
-subroutine fault_setup(ibool,xstore,ystore,zstore,nspec,nglob,myrank)
+subroutine fault_setup(ibool,nnodes_ext_mesh,nodes_coords_ext_mesh, &
+                       xstore,ystore,zstore,nspec,nglob,myrank)
 
   integer, intent(in) :: nspec ! number of spectral elements in each block
   double precision, dimension(NGLLX,NGLLY,NGLLZ,nspec), intent(in) :: xstore,ystore,zstore
@@ -161,6 +172,8 @@
   
   do iflt=1,size(fault_db)
 
+    call setup_iface(fault_db(iflt),nnodes_ext_mesh,nodes_coords_ext_mesh,nspec,nglob,ibool)
+
     ! saving gll indices for each fault face, needed for ibulks
     call setup_ijk(fault_db(iflt))
 
@@ -180,7 +193,49 @@
 
 end subroutine fault_setup
 
+!=============================================================================================================
+    ! looks for i,j,k indices of GLL points on boundary face
+    ! determines element face by given CUBIT corners
+    ! sets face id of reference element associated with this face
+subroutine setup_iface(fdb,nnodes_ext_mesh,nodes_coords_ext_mesh,nspec,nglob,ibool)
 
+  use create_regions_mesh_ext_par, only: xstore_dummy,ystore_dummy,zstore_dummy
+
+  type(fault_db_type), intent(inout) :: fdb  
+  integer, intent(in) :: nnodes_ext_mesh,nspec,nglob 
+  double precision, dimension(NDIM,nnodes_ext_mesh), intent(in) :: nodes_coords_ext_mesh
+  integer, dimension(NGLLX,NGLLY,NGLLZ,nspec) :: ibool
+
+  real(kind=CUSTOM_REAL), dimension(NGNOD2D) :: xcoord,ycoord,zcoord    
+  integer :: icorner,e
+
+  allocate(fdb%iface1(fdb%nspec))
+  allocate(fdb%iface2(fdb%nspec))
+  do e=1,fdb%nspec
+   ! side 1
+    do icorner=1,NGNOD2D
+      xcoord(icorner) = nodes_coords_ext_mesh(1,fdb%inodes1(icorner,e))
+      ycoord(icorner) = nodes_coords_ext_mesh(2,fdb%inodes1(icorner,e))
+      zcoord(icorner) = nodes_coords_ext_mesh(3,fdb%inodes1(icorner,e))
+    enddo
+    call get_element_face_id(fdb%ispec1(e),xcoord,ycoord,zcoord, &
+                            ibool,nspec,nglob, &
+                            xstore_dummy,ystore_dummy,zstore_dummy, &
+                            fdb%iface1(e))
+   ! side 2
+    do icorner=1,NGNOD2D
+      xcoord(icorner) = nodes_coords_ext_mesh(1,fdb%inodes2(icorner,e))
+      ycoord(icorner) = nodes_coords_ext_mesh(2,fdb%inodes2(icorner,e))
+      zcoord(icorner) = nodes_coords_ext_mesh(3,fdb%inodes2(icorner,e))
+    enddo
+    call get_element_face_id(fdb%ispec2(e),xcoord,ycoord,zcoord, &
+                            ibool,nspec,nglob, &
+                            xstore_dummy,ystore_dummy,zstore_dummy, &
+                            fdb%iface2(e))
+  enddo
+
+end subroutine setup_iface
+
 !=============================================================================================================
 subroutine setup_ijk(fdb)
 



More information about the CIG-COMMITS mailing list