156 tg_receiver_snapshot_quad&
159 ,ig_quadf_gll_glonum&
160 ,ig_quadf_gnode_glonum&
161 ,ig_nreceiver_snapshot&
162 ,ig_receiver_snapshot_glonum&
163 ,rg_receiver_snapshot_z&
164 ,ig_receiver_snapshot_locnum&
165 ,ig_receiver_snapshot_total_number&
166 ,ig_receiver_snapshot_mpi_shift&
172 ,ig_receiver_snapshot_nx&
173 ,ig_receiver_snapshot_ny&
178 ,rg_receiver_snapshot_dxdy&
179 ,rg_receiver_snapshot_dx&
180 ,rg_receiver_snapshot_dy
188 real ,
allocatable,
dimension(:) :: rldum2
189 real ,
allocatable,
dimension(:) :: rldum3
195 integer,
allocatable,
dimension(:) :: ildum1
213 logical,
allocatable,
dimension(:) :: is_rec_in_cpu
214 logical,
allocatable,
dimension(:) :: is_rec_in_all_cpu
216 logical,
dimension(ig_ncpu) :: is_inside_all_cpu
218 character(len=255) :: info
220 if (ig_myrank == 0)
then
221 write(ig_lst_unit,
'(" ",/,a)')
"checking if receivers for snapshot are inside quadrangle elements..."
222 call flush(ig_lst_unit)
227 rg_receiver_snapshot_dx = (rg_mesh_xmax - rg_mesh_xmin)/int((rg_mesh_xmax - rg_mesh_xmin)/rg_receiver_snapshot_dxdy)
228 rg_receiver_snapshot_dy = (rg_mesh_ymax - rg_mesh_ymin)/int((rg_mesh_ymax - rg_mesh_ymin)/rg_receiver_snapshot_dxdy)
232 nx = int((rg_mesh_xmax - rg_mesh_xmin)/rg_receiver_snapshot_dx)+1
233 ny = int((rg_mesh_ymax - rg_mesh_ymin)/rg_receiver_snapshot_dy)+1
235 ig_receiver_snapshot_nx = nx
236 ig_receiver_snapshot_ny = ny
238 allocate(is_rec_in_cpu(nx*ny),stat=ios)
240 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating is_rec_in_cpu"
241 call error_stop(info)
244 is_rec_in_cpu(ix) = .false.
248 allocate(is_rec_in_all_cpu(nx*ny),stat=ios)
250 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating is_rec_in_all_cpu"
251 call error_stop(info)
254 is_rec_in_all_cpu(ix) = .false.
258 if (ig_myrank == 0)
then
259 write(ig_lst_unit,
'(2(a,F10.3))')
" -->space increment dx,dy between receivers for snapshot = ",rg_receiver_snapshot_dx,
",",rg_receiver_snapshot_dy
260 write(ig_lst_unit,
'(3(a,i0))')
" -->number of receivers for snapshot = ",nx,
"*",ny,
" = ",nx * ny
261 call flush(ig_lst_unit)
273 rec_x = rg_mesh_xmin +
real(ix-1)*rg_receiver_snapshot_dx
274 rec_y = rg_mesh_ymax -
real(iy-1)*rg_receiver_snapshot_dy
278 if (ig_nquad_fsurf > 0)
then
280 call
is_inside_quad(rec_x,rec_y,ig_quadf_gnode_glonum,ig_nquad_fsurf,ig_quad_nnode,rec_dmin,rec_lgll,rec_mgll,rec_iel,is_inside)
290 call mpi_gather(is_inside,1,mpi_logical,is_inside_all_cpu,1,mpi_logical,0,mpi_comm_world,ios)
292 if (ig_myrank == 0)
then
298 if (is_inside_all_cpu(icpu))
then
309 write(info,
'(a)')
"error in subroutine init_snapshot_surface: receiver for snapshot not found over all cpus"
310 call error_stop(info)
314 do icpu = iloc+1,ig_ncpu
315 is_inside_all_cpu(icpu) = .false.
324 call mpi_scatter(is_inside_all_cpu,1,mpi_logical,is_inside,1,mpi_logical,0,mpi_comm_world,ios)
329 is_rec_in_cpu(irec) = .true.
333 if ( (ig_myrank == 0) .and. ( (irec == 1) .or. (mod(irec,5000) == 0) .or. (irec == nx*ny) ) )
then
334 write(ig_lst_unit,
'(a,i10)')
"checking receiver ",irec
335 call flush(ig_lst_unit)
344 ig_nreceiver_snapshot = nrec
346 if (ig_nreceiver_snapshot > 0)
then
348 allocate(tg_receiver_snapshot_quad(ig_nreceiver_snapshot),stat=ios)
352 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating tg_receiver_snapshot_quad"
353 call error_stop(info)
357 do irec = 1,ig_nreceiver_snapshot
359 tg_receiver_snapshot_quad(irec)%x = 0.0
360 tg_receiver_snapshot_quad(irec)%y = 0.0
361 tg_receiver_snapshot_quad(irec)%z = 0.0
362 tg_receiver_snapshot_quad(irec)%xi = 0.0
363 tg_receiver_snapshot_quad(irec)%eta = 0.0
364 tg_receiver_snapshot_quad(irec)%dmin = huge(rec_dmin)
365 tg_receiver_snapshot_quad(irec)%lag(:,:) = 0.0
366 tg_receiver_snapshot_quad(irec)%pgd_x = 0.0
367 tg_receiver_snapshot_quad(irec)%pgd_y = 0.0
368 tg_receiver_snapshot_quad(irec)%pgd_z = 0.0
369 tg_receiver_snapshot_quad(irec)%pgv_x = 0.0
370 tg_receiver_snapshot_quad(irec)%pgv_y = 0.0
371 tg_receiver_snapshot_quad(irec)%pgv_z = 0.0
372 tg_receiver_snapshot_quad(irec)%pgv_xyz = 0.0
373 tg_receiver_snapshot_quad(irec)%pga_x = 0.0
374 tg_receiver_snapshot_quad(irec)%pga_y = 0.0
375 tg_receiver_snapshot_quad(irec)%pga_z = 0.0
376 tg_receiver_snapshot_quad(irec)%gll(:,:) = 0
377 tg_receiver_snapshot_quad(irec)%cpu = 0
378 tg_receiver_snapshot_quad(irec)%iel = 0
379 tg_receiver_snapshot_quad(irec)%lgll = 0
380 tg_receiver_snapshot_quad(irec)%mgll = 0
381 tg_receiver_snapshot_quad(irec)%rglo = 0
393 if ( (ig_nquad_fsurf > 0) .and. (ig_nreceiver_snapshot > 0) )
then
400 if (is_rec_in_cpu(irec))
then
403 rec_x = rg_mesh_xmin +
real(ix-1)*rg_receiver_snapshot_dx
404 rec_y = rg_mesh_ymax -
real(iy-1)*rg_receiver_snapshot_dy
408 call
is_inside_quad(rec_x,rec_y,ig_quadf_gnode_glonum,ig_nquad_fsurf,ig_quad_nnode,rec_dmin,rec_lgll,rec_mgll,rec_iel,is_inside)
413 tg_receiver_snapshot_quad(jrec)%x = rec_x
414 tg_receiver_snapshot_quad(jrec)%y = rec_y
415 tg_receiver_snapshot_quad(jrec)%dmin = rec_dmin
416 tg_receiver_snapshot_quad(jrec)%cpu = ig_myrank+1
417 tg_receiver_snapshot_quad(jrec)%iel = rec_iel
418 tg_receiver_snapshot_quad(jrec)%lgll = rec_lgll
419 tg_receiver_snapshot_quad(jrec)%mgll = rec_mgll
420 tg_receiver_snapshot_quad(jrec)%rglo = irec
431 deallocate(is_rec_in_cpu)
434 if (ig_myrank == 0)
then
435 write(ig_lst_unit,
'(a)')
" -->computing local coordinates of receivers"
436 call flush(ig_lst_unit)
439 do irec = 1,ig_nreceiver_snapshot
447 if (ig_myrank == 0)
then
448 allocate(ig_receiver_snapshot_total_number(ig_ncpu))
449 allocate(ig_receiver_snapshot_mpi_shift(ig_ncpu))
452 call mpi_gather(ig_nreceiver_snapshot,1,mpi_integer,ig_receiver_snapshot_total_number,1,mpi_integer,0,mpi_comm_world,ios)
456 if (ig_myrank == 0)
then
458 ig_receiver_snapshot_mpi_shift(1) = 0
461 ig_receiver_snapshot_mpi_shift(icpu) = ig_receiver_snapshot_mpi_shift(icpu-1) + ig_receiver_snapshot_total_number(icpu-1)
467 allocate(ig_receiver_snapshot_glonum(nx*ny),stat=ios)
469 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating ig_receiver_snapshot_glonum"
470 call error_stop(info)
474 allocate(rldum3(nx*ny),stat=ios)
476 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating rldum3"
477 call error_stop(info)
481 allocate(ildum1(ig_nreceiver_snapshot),stat=ios)
482 allocate(rldum2(ig_nreceiver_snapshot),stat=ios)
486 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating *dum*"
487 call error_stop(info)
491 do irec = 1,ig_nreceiver_snapshot
492 ildum1(irec) = tg_receiver_snapshot_quad(irec)%rglo
493 rldum2(irec) = tg_receiver_snapshot_quad(irec)%z
498 call mpi_gatherv(ildum1 &
499 ,ig_nreceiver_snapshot &
501 ,ig_receiver_snapshot_glonum &
502 ,ig_receiver_snapshot_total_number &
503 ,ig_receiver_snapshot_mpi_shift &
509 call mpi_gatherv(rldum2 &
510 ,ig_nreceiver_snapshot &
513 ,ig_receiver_snapshot_total_number &
514 ,ig_receiver_snapshot_mpi_shift &
522 if (ig_myrank == 0)
then
524 allocate(rg_receiver_snapshot_z(nx*ny),stat=ios)
526 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating rg_receiver_snapshot_z"
527 call error_stop(info)
530 allocate(ig_receiver_snapshot_locnum(nx*ny),stat=ios)
532 write(info,
'(a)')
"error in subroutine init_snapshot_surface while allocating ig_receiver_snapshot_locnum"
533 call error_stop(info)
545 if (ig_receiver_snapshot_glonum(iz) == irec)
then
547 ig_receiver_snapshot_locnum(irec) = iz
548 rg_receiver_snapshot_z(irec) = rldum3(iz)
561 if (ig_myrank == 0)
then
562 write(ig_lst_unit,
'(a)')
"done"
563 call flush(ig_lst_unit)
591 ,lg_snapshot_displacement&
592 ,lg_snapshot_velocity&
593 ,lg_snapshot_acceleration&
594 ,ig_nreceiver_snapshot&
595 ,ig_snapshot_saving_incr&
596 ,tg_receiver_snapshot_quad&
597 ,rg_gll_displacement&
599 ,rg_gll_acceleration&
608 real,
dimension(IG_NDOF,IG_NGLL,IG_NGLL,IG_NGLL) :: gll_dis
609 real,
dimension(IG_NDOF,IG_NGLL,IG_NGLL,IG_NGLL) :: gll_vel
610 real,
dimension(IG_NDOF,IG_NGLL,IG_NGLL,IG_NGLL) :: gll_acc
612 real,
dimension(ig_nreceiver_snapshot) :: ux
613 real,
dimension(ig_nreceiver_snapshot) :: uy
614 real,
dimension(ig_nreceiver_snapshot) :: uz
615 real,
dimension(ig_nreceiver_snapshot) :: vx
616 real,
dimension(ig_nreceiver_snapshot) :: vy
617 real,
dimension(ig_nreceiver_snapshot) :: vz
618 real,
dimension(ig_nreceiver_snapshot) :: ax
619 real,
dimension(ig_nreceiver_snapshot) :: ay
620 real,
dimension(ig_nreceiver_snapshot) :: az
624 character(len=255) :: fname
625 character(len= 6) :: csnapshot
626 character(len= 4) :: vname
633 do irec = 1,ig_nreceiver_snapshot
637 call
get_quad_gll_value(rg_gll_displacement,tg_receiver_snapshot_quad(irec)%gll,gll_dis)
639 call
get_quad_gll_value(rg_gll_acceleration,tg_receiver_snapshot_quad(irec)%gll,gll_acc)
643 call
quad_lagrange_interp(gll_dis,tg_receiver_snapshot_quad(irec)%lag,ux(irec),uy(irec),uz(irec))
646 if ( abs(ux(irec)) > tg_receiver_snapshot_quad(irec)%pgd_x ) tg_receiver_snapshot_quad(irec)%pgd_x = abs(ux(irec))
647 if ( abs(uy(irec)) > tg_receiver_snapshot_quad(irec)%pgd_y ) tg_receiver_snapshot_quad(irec)%pgd_y = abs(uy(irec))
648 if ( abs(uz(irec)) > tg_receiver_snapshot_quad(irec)%pgd_z ) tg_receiver_snapshot_quad(irec)%pgd_z = abs(uz(irec))
651 call
quad_lagrange_interp(gll_vel,tg_receiver_snapshot_quad(irec)%lag,vx(irec),vy(irec),vz(irec))
654 if ( abs(vx(irec)) > tg_receiver_snapshot_quad(irec)%pgv_x ) tg_receiver_snapshot_quad(irec)%pgv_x = abs(vx(irec))
655 if ( abs(vy(irec)) > tg_receiver_snapshot_quad(irec)%pgv_y ) tg_receiver_snapshot_quad(irec)%pgv_y = abs(vy(irec))
656 if ( abs(vz(irec)) > tg_receiver_snapshot_quad(irec)%pgv_z ) tg_receiver_snapshot_quad(irec)%pgv_z = abs(vz(irec))
657 if ( sqrt(vx(irec)**2 + vy(irec)**2 + vz(irec)**2) > tg_receiver_snapshot_quad(irec)%pgv_xyz ) tg_receiver_snapshot_quad(irec)%pgv_xyz = sqrt(vx(irec)**2 + vy(irec)**2 + vz(irec)**2)
660 call
quad_lagrange_interp(gll_acc,tg_receiver_snapshot_quad(irec)%lag,ax(irec),ay(irec),az(irec))
663 if ( abs(ax(irec)) > tg_receiver_snapshot_quad(irec)%pga_x ) tg_receiver_snapshot_quad(irec)%pga_x = abs(ax(irec))
664 if ( abs(ay(irec)) > tg_receiver_snapshot_quad(irec)%pga_y ) tg_receiver_snapshot_quad(irec)%pga_y = abs(ay(irec))
665 if ( abs(az(irec)) > tg_receiver_snapshot_quad(irec)%pga_z ) tg_receiver_snapshot_quad(irec)%pga_z = abs(az(irec))
673 write(csnapshot,
'(i6.6)') ig_idt
677 if ( lg_snapshot_displacement .and. (mod(ig_idt-1,ig_snapshot_saving_incr) == 0) )
then
679 if (lg_snapshot_gmt)
then
681 fname = trim(cg_prefix)//
".snapshot.ux."//trim(csnapshot)//
".grd"
684 fname = trim(cg_prefix)//
".snapshot.uy."//trim(csnapshot)//
".grd"
687 fname = trim(cg_prefix)//
".snapshot.uz."//trim(csnapshot)//
".grd"
692 if (lg_snapshot_vtk)
then
694 fname = trim(cg_prefix)//
".snapshot.uxyz."//trim(csnapshot)//
".vts"
704 if ( lg_snapshot_velocity .and. (mod(ig_idt-1,ig_snapshot_saving_incr) == 0) )
then
706 if (lg_snapshot_gmt)
then
708 fname = trim(cg_prefix)//
".snapshot.vx."//trim(csnapshot)//
".grd"
711 fname = trim(cg_prefix)//
".snapshot.vy."//trim(csnapshot)//
".grd"
714 fname = trim(cg_prefix)//
".snapshot.vz."//trim(csnapshot)//
".grd"
719 if (lg_snapshot_vtk)
then
721 fname = trim(cg_prefix)//
".snapshot.vxyz."//trim(csnapshot)//
".vts"
731 if ( lg_snapshot_acceleration .and. (mod(ig_idt-1,ig_snapshot_saving_incr) == 0) )
then
733 if (lg_snapshot_gmt)
then
735 fname = trim(cg_prefix)//
".snapshot.ax."//trim(csnapshot)//
".grd"
738 fname = trim(cg_prefix)//
".snapshot.ay."//trim(csnapshot)//
".grd"
741 fname = trim(cg_prefix)//
".snapshot.az."//trim(csnapshot)//
".grd"
746 if (lg_snapshot_vtk)
then
748 fname = trim(cg_prefix)//
".snapshot.axyz."//trim(csnapshot)//
".vts"
775 ig_nreceiver_snapshot&
776 ,tg_receiver_snapshot_quad&
777 ,ig_receiver_snapshot_glonum&
778 ,ig_receiver_snapshot_total_number&
779 ,ig_receiver_snapshot_mpi_shift&
780 ,rg_receiver_snapshot_dx&
781 ,rg_receiver_snapshot_dy&
786 ,ig_receiver_snapshot_nx&
787 ,ig_receiver_snapshot_ny&
795 character(len=255),
intent(in) :: fname
796 real ,
intent(in) :: val(ig_nreceiver_snapshot)
798 integer ,
parameter :: header_size = 892
802 real :: val_max_all_cpu
803 real :: val_min_all_cpu
804 real,
allocatable,
dimension(:) :: val_all_cpu
805 real,
allocatable,
dimension(:) :: val_all_cpu_order
807 integer :: nboctet_real
812 integer(kind=mpi_offset_kind) :: pos
813 integer,
dimension(mpi_status_size) :: statut
817 if (ig_nreceiver_snapshot > 0)
then
818 val_max = maxval(val)
819 val_min = minval(val)
824 call mpi_reduce(val_max,val_max_all_cpu,1,mpi_real,mpi_max,0,mpi_comm_world,ios)
825 call mpi_reduce(val_min,val_min_all_cpu,1,mpi_real,mpi_min,0,mpi_comm_world,ios)
828 call mpi_file_open(mpi_comm_world,fname,mpi_mode_wronly + mpi_mode_create,mpi_info_null,desc,ios)
829 call mpi_type_size(mpi_real,nboctet_real,ios)
831 if (ig_myrank == 0)
then
835 ,ig_receiver_snapshot_nx,ig_receiver_snapshot_ny &
836 ,rg_mesh_xmin,rg_mesh_xmax &
837 ,rg_mesh_ymin,rg_mesh_ymax &
838 ,val_min_all_cpu,val_max_all_cpu &
839 ,rg_receiver_snapshot_dx,rg_receiver_snapshot_dy )
841 ios =
init_array_real(val_all_cpu,ig_receiver_snapshot_nx*ig_receiver_snapshot_ny,
"val_all_cpu")
843 ios =
init_array_real(val_all_cpu_order,ig_receiver_snapshot_nx*ig_receiver_snapshot_ny,
"val_all_cpu_order")
849 call mpi_gatherv(val &
850 ,ig_nreceiver_snapshot &
853 ,ig_receiver_snapshot_total_number &
854 ,ig_receiver_snapshot_mpi_shift &
861 if (ig_myrank == 0)
then
865 do irec = 1,ig_receiver_snapshot_nx*ig_receiver_snapshot_ny
867 rglo = ig_receiver_snapshot_glonum(irec)
869 val_all_cpu_order(rglo) = val_all_cpu(irec)
876 call mpi_file_write_at(desc,pos,val_all_cpu_order,ig_receiver_snapshot_nx*ig_receiver_snapshot_ny,mpi_real,statut,ios)
881 call mpi_file_close(desc,ios)
905 subroutine write_header_gmt_nat_fmt(desc,nx,ny,x_min,x_max,y_min,y_max,z_min,z_max,x_inc,y_inc)
914 integer,
intent(in) :: desc
915 integer,
intent(in) :: nx
916 integer,
intent(in) :: ny
917 real ,
intent(in) :: x_min
918 real ,
intent(in) :: x_max
919 real ,
intent(in) :: y_min
920 real ,
intent(in) :: y_max
921 real ,
intent(in) :: z_min
922 real ,
intent(in) :: z_max
923 real ,
intent(in) :: x_inc
924 real ,
intent(in) :: y_inc
926 integer,
parameter :: grd_command_len = 320
927 integer,
parameter :: grd_remark_len = 160
928 integer,
parameter :: grd_title_len = 80
929 integer,
parameter :: grd_unit_len = 80
930 integer,
parameter :: grd_varname_len = 80
931 integer,
parameter :: node_offset = 1
932 real ,
parameter :: z_scale_factor = 1.0
933 real ,
parameter :: z_add_offset = 0.0
935 double precision,
dimension(10) :: ddum
937 integer,
dimension(3) :: idum
938 integer :: nboctet_double_precision
939 integer :: nboctet_char
940 integer :: nboctet_int
942 integer(kind=mpi_offset_kind) :: pos
943 integer,
dimension(mpi_status_size) :: statut
945 character(len=GRD_UNIT_LEN) :: x_units
946 character(len=GRD_UNIT_LEN) :: y_units
947 character(len=GRD_UNIT_LEN) :: z_units
948 character(len=GRD_TITLE_LEN) :: title
949 character(len=GRD_COMMAND_LEN) :: command
950 character(len=GRD_REMARK_LEN) :: remark
953 call mpi_type_size(mpi_double_precision,nboctet_double_precision,ios)
954 call mpi_type_size(mpi_character ,nboctet_char ,ios)
955 call mpi_type_size(mpi_integer ,nboctet_int ,ios)
957 x_units =
"m"//char(0)
958 y_units =
"m"//char(0)
959 z_units =
" "//char(0)
960 title =
"EFISPEC3D snapshot"//char(0)
961 command =
"mpi_file_write_at()"//char(0)
962 remark =
"create by EFISPEC3D: http://efispec.free.fr"//char(0)
966 idum(3) = node_offset
968 ddum(1) = dble(x_min)
969 if (node_offset == 1)
then
970 ddum(2) = dble(x_max)+dble(x_inc)
971 ddum(4) = dble(y_max)+dble(y_inc)
973 ddum(2) = dble(x_max)
974 ddum(4) = dble(y_max)
976 ddum( 3) = dble(y_min)
977 ddum( 5) = dble(z_min)
978 ddum( 6) = dble(z_max)
979 ddum( 7) = dble(x_inc)
980 ddum( 8) = dble(y_inc)
981 ddum( 9) = dble(z_scale_factor)
982 ddum(10) = dble(z_add_offset)
985 call mpi_file_write_at(desc,pos,idum,3,mpi_integer,statut,ios)
987 pos = pos + 3*nboctet_int
988 call mpi_file_write_at(desc,pos,ddum,10,mpi_double_precision,statut,ios)
990 pos = pos + 10*nboctet_double_precision
991 call mpi_file_write_at(desc,pos,x_units,grd_unit_len,mpi_character,statut,ios)
993 pos = pos + nboctet_char*grd_unit_len
994 call mpi_file_write_at(desc,pos,y_units,grd_unit_len,mpi_character,statut,ios)
996 pos = pos + nboctet_char*grd_unit_len
997 call mpi_file_write_at(desc,pos,z_units,grd_unit_len,mpi_character,statut,ios)
999 pos = pos + nboctet_char*grd_unit_len
1000 call mpi_file_write_at(desc,pos,title,grd_title_len,mpi_character,statut,ios)
1002 pos = pos + nboctet_char*grd_title_len
1003 call mpi_file_write_at(desc,pos,command,grd_command_len,mpi_character,statut,ios)
1005 pos = pos + nboctet_char*grd_command_len
1006 call mpi_file_write_at(desc,pos,remark,grd_remark_len,mpi_character,statut,ios)
1030 ig_nreceiver_snapshot&
1031 ,ig_receiver_snapshot_total_number&
1032 ,ig_receiver_snapshot_mpi_shift&
1033 ,ig_receiver_snapshot_locnum&
1034 ,rg_receiver_snapshot_z&
1037 ,ig_receiver_snapshot_nx&
1038 ,ig_receiver_snapshot_ny&
1039 ,rg_receiver_snapshot_dx&
1040 ,rg_receiver_snapshot_dy&
1048 character(len=255),
intent(in) :: fname
1049 character(len= 4),
intent(in) :: varname
1051 real ,
intent(in) :: valx(ig_nreceiver_snapshot)
1052 real ,
intent(in) :: valy(ig_nreceiver_snapshot)
1053 real ,
intent(in) :: valz(ig_nreceiver_snapshot)
1055 real :: val_all_cpu(ig_receiver_snapshot_nx*ig_receiver_snapshot_ny)
1056 real :: val_all_cpu_order(ig_receiver_snapshot_nx*ig_receiver_snapshot_ny)
1057 real :: xrec(ig_receiver_snapshot_nx*ig_receiver_snapshot_ny)
1058 real :: yrec(ig_receiver_snapshot_nx*ig_receiver_snapshot_ny)
1063 integer :: irec_gatherv
1066 character(len=255) :: info
1070 call mpi_gatherv(valx &
1071 ,ig_nreceiver_snapshot &
1074 ,ig_receiver_snapshot_total_number &
1075 ,ig_receiver_snapshot_mpi_shift &
1082 if (ig_myrank == 0)
then
1088 do iy = 1,ig_receiver_snapshot_ny
1089 do ix = 1,ig_receiver_snapshot_nx
1092 irec_gatherv = ig_receiver_snapshot_locnum(irec)
1094 xrec(irec) = rg_mesh_xmin +
real(ix-1)*rg_receiver_snapshot_dx
1095 yrec(irec) = rg_mesh_ymax -
real(iy-1)*rg_receiver_snapshot_dy
1097 val_all_cpu_order(irec) = val_all_cpu(irec_gatherv)
1105 output_format =
'BINARY' &
1106 ,filename = trim(fname) &
1107 ,mesh_topology =
'StructuredGrid' &
1109 ,nx2 = ig_receiver_snapshot_nx &
1111 ,ny2 = ig_receiver_snapshot_ny &
1116 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_INI_XML"
1117 call error_stop(info)
1124 ,nx2 = ig_receiver_snapshot_nx &
1126 ,ny2 = ig_receiver_snapshot_ny &
1129 ,nn = ig_receiver_snapshot_nx*ig_receiver_snapshot_ny &
1132 ,z = rg_receiver_snapshot_z )
1135 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_GEO_XML (init)"
1136 call error_stop(info)
1142 var_location =
'NODE'&
1143 ,var_block_action =
'OPEN')
1146 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_DAT_XML (open)"
1147 call error_stop(info)
1151 nc_nn = ig_receiver_snapshot_nx*ig_receiver_snapshot_ny &
1152 ,varname =
"X-"//trim(varname) &
1153 ,var = val_all_cpu_order &
1157 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_VAR_XML X-component"
1158 call error_stop(info)
1165 call mpi_gatherv(valy &
1166 ,ig_nreceiver_snapshot &
1169 ,ig_receiver_snapshot_total_number &
1170 ,ig_receiver_snapshot_mpi_shift &
1177 if (ig_myrank == 0)
then
1182 do iy = 1,ig_receiver_snapshot_ny
1183 do ix = 1,ig_receiver_snapshot_nx
1186 irec_gatherv = ig_receiver_snapshot_locnum(irec)
1187 val_all_cpu_order(irec) = val_all_cpu(irec_gatherv)
1195 nc_nn = ig_receiver_snapshot_nx*ig_receiver_snapshot_ny &
1196 ,varname =
"Y-"//trim(varname) &
1197 ,var = val_all_cpu_order &
1200 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_VAR_XML Y-component"
1201 call error_stop(info)
1208 call mpi_gatherv(valz &
1209 ,ig_nreceiver_snapshot &
1212 ,ig_receiver_snapshot_total_number &
1213 ,ig_receiver_snapshot_mpi_shift &
1219 if (ig_myrank == 0)
then
1224 do iy = 1,ig_receiver_snapshot_ny
1225 do ix = 1,ig_receiver_snapshot_nx
1228 irec_gatherv = ig_receiver_snapshot_locnum(irec)
1229 val_all_cpu_order(irec) = val_all_cpu(irec_gatherv)
1236 nc_nn = ig_receiver_snapshot_nx*ig_receiver_snapshot_ny &
1237 ,varname =
"Z-"//trim(varname) &
1238 ,var = val_all_cpu_order &
1242 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_VAR_XML Z-component"
1243 call error_stop(info)
1249 var_location =
'NODE' &
1250 ,var_block_action =
'CLOSE')
1253 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_DAT_XML (close)"
1254 call error_stop(info)
1260 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_GEO_XML (finalize)"
1261 call error_stop(info)
1267 write(info,
'(a)')
"error in subroutine write_snapshot_vtk: VTK_END_XML"
1268 call error_stop(info)
1288 lg_snapshot_displacement&
1289 ,lg_snapshot_velocity&
1290 ,lg_snapshot_acceleration&
1291 ,lg_snapshot_volume_displacement&
1292 ,lg_snapshot_volume_velocity&
1293 ,lg_snapshot_volume_acceleration
1297 if (lg_snapshot_displacement)
then
1301 if (lg_snapshot_velocity)
then
1305 if (lg_snapshot_acceleration)
then
1328 ,ig_snapshot_saving_incr
1332 character(len=*),
intent(in) :: varname
1339 character(len=255) :: fname
1340 character(len=6 ) :: csnapshot
1342 open(unit=get_newunit(myunit),file=trim(cg_prefix)//
".collection."//trim(varname)//
".pvd")
1344 write(unit=myunit,fmt=
'(a)')
"<?xml version=""1.0""?>"
1345 write(unit=myunit,fmt=
'(a)')
"<VTKFile type=""Collection"" version=""0.1"" byte_order=""BigEndian"">"
1346 write(unit=myunit,fmt=
'(a)')
" <Collection>"
1348 do istep = 1,ig_ndt,ig_snapshot_saving_incr
1350 write(csnapshot,
'(I6.6)') istep
1352 time =
real(istep-1)*rg_dt
1354 fname = trim(cg_prefix)//
"."//trim(varname)//
"."//trim(csnapshot)//
".vts"
1356 write(unit=myunit,fmt=
'(a,E14.7,3a)')
" <DataSet timestep=""",time,
""" group="""" part=""0"" file=""",trim(fname),
"""/>"
1360 write(unit=myunit,fmt=
'(a)')
" </Collection>"
1361 write(unit=myunit,fmt=
'(a)')
"</VTKFile>"
1381 tg_receiver_snapshot_quad&
1383 ,ig_nreceiver_snapshot&
1389 real,
dimension(ig_nreceiver_snapshot) :: pgd_x
1390 real,
dimension(ig_nreceiver_snapshot) :: pgd_y
1391 real,
dimension(ig_nreceiver_snapshot) :: pgd_z
1392 real,
dimension(ig_nreceiver_snapshot) :: pgv_x
1393 real,
dimension(ig_nreceiver_snapshot) :: pgv_y
1394 real,
dimension(ig_nreceiver_snapshot) :: pgv_z
1395 real,
dimension(ig_nreceiver_snapshot) :: pga_x
1396 real,
dimension(ig_nreceiver_snapshot) :: pga_y
1397 real,
dimension(ig_nreceiver_snapshot) :: pga_z
1401 character(len=255) :: fname
1403 if (ig_myrank == 0)
then
1404 write(ig_lst_unit,
'(" ",/,a)')
"writing snapshots of peak ground motion..."
1405 call flush(ig_lst_unit)
1408 do irec = 1,ig_nreceiver_snapshot
1409 pgd_x(irec) = tg_receiver_snapshot_quad(irec)%pgd_x
1412 do irec = 1,ig_nreceiver_snapshot
1413 pgd_y(irec) = tg_receiver_snapshot_quad(irec)%pgd_y
1416 do irec = 1,ig_nreceiver_snapshot
1417 pgd_z(irec) = tg_receiver_snapshot_quad(irec)%pgd_z
1420 do irec = 1,ig_nreceiver_snapshot
1421 pgv_x(irec) = tg_receiver_snapshot_quad(irec)%pgv_x
1424 do irec = 1,ig_nreceiver_snapshot
1425 pgv_y(irec) = tg_receiver_snapshot_quad(irec)%pgv_y
1428 do irec = 1,ig_nreceiver_snapshot
1429 pgv_z(irec) = tg_receiver_snapshot_quad(irec)%pgv_z
1432 do irec = 1,ig_nreceiver_snapshot
1433 pga_x(irec) = tg_receiver_snapshot_quad(irec)%pga_x
1436 do irec = 1,ig_nreceiver_snapshot
1437 pga_y(irec) = tg_receiver_snapshot_quad(irec)%pga_y
1440 do irec = 1,ig_nreceiver_snapshot
1441 pga_z(irec) = tg_receiver_snapshot_quad(irec)%pga_z
1446 fname = trim(cg_prefix)//
".snapshot.PGDx.grd"
1449 fname = trim(cg_prefix)//
".snapshot.PGDy.grd"
1452 fname = trim(cg_prefix)//
".snapshot.PGDz.grd"
1455 fname = trim(cg_prefix)//
".snapshot.PGVx.grd"
1458 fname = trim(cg_prefix)//
".snapshot.PGVy.grd"
1461 fname = trim(cg_prefix)//
".snapshot.PGVz.grd"
1464 fname = trim(cg_prefix)//
".snapshot.PGAx.grd"
1467 fname = trim(cg_prefix)//
".snapshot.PGAy.grd"
1470 fname = trim(cg_prefix)//
".snapshot.PGAz.grd"
1475 fname = trim(cg_prefix)//
".snapshot.PGDxyz.vts"
1478 fname = trim(cg_prefix)//
".snapshot.PGVxyz.vts"
1481 fname = trim(cg_prefix)//
".snapshot.PGAxyz.vts"
1484 if (ig_myrank == 0)
then
1485 write(ig_lst_unit,
'(a)')
"done"
1486 call flush(ig_lst_unit)
This module contains subroutines to allocate arrays and to compute an approximation of the total RAM ...
This module contains subroutines to compute information about receivers and to write receivers' time ...
subroutine, private write_snapshot_vtk(fname, varname, valx, valy, valz)
This subroutine writes structured grid snapshot in binary VTK xml format.
integer(i4p) function, public vtk_end_xml()
The VTK_END_XML function finalizes opened files.
integer(i4p) function, public vtk_ini_xml(output_format, filename, mesh_topology, nx1, nx2, ny1, ny2, nz1, nz2)
The VTK_INI_XML function is used for initializing file. This function must be the first to be called...
overloading of VTK_GEO_XML
subroutine, private write_snapshot_gmt_nat_fmt(fname, val)
This subroutine writes structured grid snapshot in binary native GMT format.
This module defines all global variables of EFISPEC3D. Scalar variables are initialized directly in t...
Interface init_array_real to redirect allocation to n-rank arrays.
subroutine, public init_snapshot_surface()
This subroutine generates a structured grid of receivers on the free surface.
subroutine, public compute_info_quad_receiver(tlxinf)
This subroutine computes local coordinates of a receiver in the quadrangle element it belongs...
subroutine, private write_header_gmt_nat_fmt(desc, nx, ny, x_min, x_max, y_min, y_max, z_min, z_max, x_inc, y_inc)
This subroutine writes header of binary native GMT files.
integer(i4p) function, public vtk_dat_xml(var_location, var_block_action)
The VTK_DAT_XML function opens or closes CellData/PointData structures.
subroutine, private collection_vtk_surface(varname)
This subroutine write Paraview collection file *.pvd of VTK xml snapshot files *.vts.
This module programmed by S. Zaghi (https://github.com/szaghi/Lib_VTK_IO) contains functions to write...
subroutine, public quad_lagrange_interp(gll_values, lag, x, y, z)
This subroutine interpolates GLL nodes -values of a quadrangle element using Lagrange polynomials...
subroutine, public write_peak_ground_motion()
This subroutine writes peak ground motions files in GMT or VTK formats.
subroutine, public write_collection_vtk_surf()
This subroutine selects which ParaView collection files should be written (displacement, velocity and/or acceleration collections) depending on value of variables mod_global_variables::lg_snapshot_displacement, mod_global_variables::lg_snapshot_velocity and mod_global_variables::lg_snapshot_acceleration.
This module contains subroutines to get GLL nodes values from global GLL nodes numbering.
subroutine, public get_quad_gll_value(gll_all_values, gll_global_number, gll_selected_values)
subroutine to get quadrangle element GLL values from an array ordered by global GLL nodes numbering...
subroutine, public is_inside_quad(x, y, quad_gnode, nquad, quad_nnode, dmin, lgll, mgll, quad_num, is_inside)
This subroutine finds which quadrangle element contains a receiver.
This module contains functions to compute Lagrange polynomials and its derivatives; and to interpolat...
overloading of VTK_VAR_XML
This module contains subroutines to compute and write snapshots of the free surface (either in GMT or...
subroutine, public write_snapshot_surface()
This subroutine computes and writes -displacements, velocities and accelerations at receivers used fo...