@@ -959,7 +959,7 @@ end subroutine crm_ext_allocate_arrays
959959
960960 subroutine crm_ext_setup_jacobian (nodes_coords_ext_mesh , nnodes_ext_mesh , elmnts_ext_mesh , nelmnts_ext_mesh )
961961
962- use constants, only: myrank,NDIM,NGLLX,NGLLY,NGLLZ,CUSTOM_REAL,MAX_STRING_LEN,OUTPUT_FILES
962+ use constants, only: myrank,NDIM,NGLLX,NGLLY,NGLLZ,CUSTOM_REAL,MAX_STRING_LEN,OUTPUT_FILES,HUGEVAL,IMAIN
963963
964964 use generate_databases_par, only: NGNOD
965965
@@ -987,6 +987,9 @@ subroutine crm_ext_setup_jacobian(nodes_coords_ext_mesh, nnodes_ext_mesh, elmnts
987987 double precision , dimension (NGNOD) :: xelm,yelm,zelm
988988 double precision ,parameter :: threshold_zero = 1.e-25
989989
990+ ! stats
991+ real (kind= CUSTOM_REAL) :: jacobian_min,jacobian_min_glob,jacobian_max,jacobian_max_glob
992+
990993 ! debug
991994 logical , parameter :: DEBUG_ELEMENT = .false.
992995 character (len= MAX_STRING_LEN) :: filename
@@ -1002,6 +1005,9 @@ subroutine crm_ext_setup_jacobian(nodes_coords_ext_mesh, nnodes_ext_mesh, elmnts
10021005 xix_regular = 0.0_CUSTOM_REAL
10031006 jacobian_regular = 0.0_CUSTOM_REAL
10041007
1008+ jacobian_min = + HUGEVAL
1009+ jacobian_max = - HUGEVAL
1010+
10051011 ! determines regular elements
10061012 do ispec = 1 , nspec
10071013 do ia = 1 ,NGNOD
@@ -1023,6 +1029,10 @@ subroutine crm_ext_setup_jacobian(nodes_coords_ext_mesh, nnodes_ext_mesh, elmnts
10231029 etaxstore(1 ,1 ,1 ,ispec_irreg),etaystore(1 ,1 ,1 ,ispec_irreg),etazstore(1 ,1 ,1 ,ispec_irreg), &
10241030 gammaxstore(1 ,1 ,1 ,ispec_irreg),gammaystore(1 ,1 ,1 ,ispec_irreg),gammazstore(1 ,1 ,1 ,ispec_irreg), &
10251031 jacobianstore(1 ,1 ,1 ,ispec_irreg),xelm,yelm,zelm,dershape3D)
1032+
1033+ ! stats
1034+ if (minval (jacobianstore(:,:,:,ispec_irreg)) < jacobian_min) jacobian_min = minval (jacobianstore(:,:,:,ispec_irreg))
1035+ if (maxval (jacobianstore(:,:,:,ispec_irreg)) > jacobian_max) jacobian_max = maxval (jacobianstore(:,:,:,ispec_irreg))
10261036 else
10271037 ! sets flag for regular elements
10281038 any_regular_elem = .true.
@@ -1035,7 +1045,7 @@ subroutine crm_ext_setup_jacobian(nodes_coords_ext_mesh, nnodes_ext_mesh, elmnts
10351045 if (myrank == 0 .and. ispec == 1 ) then
10361046 write (filename,' (a,i6.6,a)' ) trim (OUTPUT_FILES)// ' /proc' ,myrank,' _debug_element'
10371047 call write_VTK_data_points_elem(NGNOD,xelm,yelm,zelm,dble (jacobianstore(1 ,1 ,1 ,ispec_irreg)),filename)
1038- print * ,' written out:' ,trim (filename)
1048+ print * ,' written out: ' ,trim (filename)
10391049 endif
10401050 endif
10411051 enddo
@@ -1100,6 +1110,20 @@ subroutine crm_ext_setup_jacobian(nodes_coords_ext_mesh, nnodes_ext_mesh, elmnts
11001110 ! saves regular values
11011111 xix_regular = xix_reg(1 ,1 ,1 )
11021112 jacobian_regular = jacobian_reg(1 ,1 ,1 )
1113+
1114+ ! stats
1115+ if (jacobian_regular < jacobian_min) jacobian_min = jacobian_regular
1116+ if (jacobian_regular > jacobian_max) jacobian_max = jacobian_regular
1117+
1118+ endif
1119+
1120+ ! stats info
1121+ call min_all_cr(jacobian_min,jacobian_min_glob)
1122+ call max_all_cr(jacobian_max,jacobian_max_glob)
1123+ if (myrank == 0 ) then
1124+ write (IMAIN,* ) ' mesh jacobian: min/max = ' ,jacobian_min_glob,' /' ,jacobian_max_glob
1125+ write (IMAIN,* )
1126+ call flush_IMAIN()
11031127 endif
11041128
11051129 end subroutine crm_ext_setup_jacobian
0 commit comments