161 ,rg_snapshot_volume_xmin&
162 ,rg_snapshot_volume_xmax&
163 ,rg_snapshot_volume_ymin&
164 ,rg_snapshot_volume_ymax&
165 ,rg_snapshot_volume_zmin&
166 ,rg_snapshot_volume_zmax&
167 ,ig_vtk_hexa_conn_snapshot&
168 ,ig_vtk_node_gll_glonum_snapshot&
169 ,rg_vtk_node_x_snapshot&
170 ,rg_vtk_node_y_snapshot&
171 ,rg_vtk_node_z_snapshot&
172 ,ig_vtk_cell_type_snapshot&
173 ,ig_vtk_offset_snapshot&
174 ,ig_vtk_nhexa_snapshot&
175 ,ig_vtk_nnode_snapshot
185 ,rg_snapshot_volume_xmin &
186 ,rg_snapshot_volume_xmax &
187 ,rg_snapshot_volume_ymin &
188 ,rg_snapshot_volume_ymax &
189 ,rg_snapshot_volume_zmin &
190 ,rg_snapshot_volume_zmax )
193 ,ig_hexa_gll_glonum &
194 ,ig_vtk_hexa_conn_snapshot &
195 ,rg_vtk_node_x_snapshot &
196 ,rg_vtk_node_y_snapshot &
197 ,rg_vtk_node_z_snapshot &
198 ,ig_vtk_node_gll_glonum_snapshot &
199 ,ig_vtk_cell_type_snapshot &
200 ,ig_vtk_offset_snapshot &
201 ,ig_vtk_nhexa_snapshot &
202 ,ig_vtk_nnode_snapshot )
204 deallocate(ig_hexa_snapshot)
228 subroutine get_efi_hexa(efi_hexa,efi_nhexa,xmin,xmax,ymin,ymax,zmin,zmax)
237 integer,
intent(out),
dimension(:),
allocatable :: efi_hexa
238 integer,
intent( in) :: efi_nhexa
239 real ,
intent( in) :: xmin
240 real ,
intent( in) :: xmax
241 real ,
intent( in) :: ymin
242 real ,
intent( in) :: ymax
243 real ,
intent( in) :: zmin
244 real ,
intent( in) :: zmax
254 logical ,
dimension(efi_nhexa) :: is_snapshot
260 is_snapshot(:) = .false.
262 do ihexa = 1,efi_nhexa
266 if ( x >= xmin .and. x <= xmax .and.&
267 y >= ymin .and. y <= ymax .and.&
268 z >= zmin .and. z <= zmax )
then
270 is_snapshot(ihexa) = .true.
284 do ihexa = 1,efi_nhexa
286 if (is_snapshot(ihexa))
then
290 efi_hexa(nhexa) = ihexa
328 subroutine init_vtk_mesh(efi_hexa,efi_hexa_gll_glonum,vtk_hexa_conn,vtk_node_x,vtk_node_y,vtk_node_z,vtk_node_gll_glonum,vtk_cell_type,vtk_offset,vtk_nhexa,vtk_nnode)
343 integer ,
intent( in),
dimension(:) :: efi_hexa
344 integer ,
intent( in),
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: efi_hexa_gll_glonum
345 integer ,
intent(out),
dimension(:),
allocatable :: vtk_hexa_conn
346 integer ,
intent(out),
dimension(:),
allocatable :: vtk_node_gll_glonum
347 integer(kind=1),
intent(out),
dimension(:),
allocatable :: vtk_cell_type
348 integer ,
intent(out),
dimension(:),
allocatable :: vtk_offset
349 real ,
intent(out),
dimension(:),
allocatable :: vtk_node_x
350 real ,
intent(out),
dimension(:),
allocatable :: vtk_node_y
351 real ,
intent(out),
dimension(:),
allocatable :: vtk_node_z
352 integer ,
intent(out) :: vtk_nhexa
353 integer ,
intent(out) :: vtk_nnode
355 integer ,
dimension(ig_ngll_total) :: vtk_node
360 efi_nhexa =
size(efi_hexa)
367 call
init_vtk_node(efi_hexa,efi_nhexa,efi_hexa_gll_glonum,vtk_node,ig_ngll_total,vtk_nnode)
401 allocate(vtk_cell_type(vtk_nhexa))
403 do ihexa = 1,vtk_nhexa
404 vtk_cell_type(ihexa) = 12
414 do ihexa = 1,vtk_nhexa
415 vtk_offset(ihexa) = ihexa*8
437 subroutine init_vtk_node(hexa,nhexa,efi_hexa_gll_glonum,gll,ngll,ngll_unique)
446 integer,
intent( in) :: nhexa
447 integer,
intent( in) :: ngll
448 integer,
intent( in),
dimension(nhexa) :: hexa
449 integer,
intent( in),
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: efi_hexa_gll_glonum
450 integer,
intent(out),
dimension(ngll) :: gll
451 integer,
intent(out) :: ngll_unique
476 igll = efi_hexa_gll_glonum(m,l,k,myhexa)
490 ngll_unique = ngll_unique + gll(igll)
523 integer,
intent( in) :: ngll
524 integer,
intent( in) :: nnode
525 integer,
intent(out),
dimension(ngll) :: node
526 integer,
intent(out),
dimension(:),
allocatable :: gll
538 if (node(igll) == 1)
then
542 node(igll) = jgll - 1
582 integer,
intent( in) :: efi_nhexa
583 integer,
intent( in) :: ngll
584 integer,
intent( in),
dimension(ngll) :: node
585 integer,
intent( in),
dimension(efi_nhexa) :: hexa
586 integer,
intent( in),
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: efi_hexa_gll_glonum
587 integer,
intent(out),
dimension(:),
allocatable :: vtk_hexa
588 integer,
intent(out) :: vtk_nhexa
590 integer,
dimension(8) :: mygll
599 vtk_nhexa = efi_nhexa*(ig_ngll-1)**ig_ndof
603 do ihexa = 1,efi_nhexa
613 mygll(1) = efi_hexa_gll_glonum(m ,l ,k ,myhexa)
614 mygll(2) = efi_hexa_gll_glonum(m+1,l ,k ,myhexa)
615 mygll(3) = efi_hexa_gll_glonum(m+1,l+1,k ,myhexa)
616 mygll(4) = efi_hexa_gll_glonum(m ,l+1,k ,myhexa)
617 mygll(5) = efi_hexa_gll_glonum(m ,l ,k+1,myhexa)
618 mygll(6) = efi_hexa_gll_glonum(m+1,l ,k+1,myhexa)
619 mygll(7) = efi_hexa_gll_glonum(m+1,l+1,k+1,myhexa)
620 mygll(8) = efi_hexa_gll_glonum(m ,l+1,k+1,myhexa)
622 vtk_hexa((jhexa-1)*8+1) = node(mygll(1))
623 vtk_hexa((jhexa-1)*8+2) = node(mygll(2))
624 vtk_hexa((jhexa-1)*8+3) = node(mygll(3))
625 vtk_hexa((jhexa-1)*8+4) = node(mygll(4))
626 vtk_hexa((jhexa-1)*8+5) = node(mygll(5))
627 vtk_hexa((jhexa-1)*8+6) = node(mygll(6))
628 vtk_hexa((jhexa-1)*8+7) = node(mygll(7))
629 vtk_hexa((jhexa-1)*8+8) = node(mygll(8))
656 ,rg_gll_displacement&
658 ,rg_gll_acceleration&
659 ,ig_vtk_nhexa_snapshot&
660 ,ig_snapshot_volume_saving_incr&
661 ,lg_snapshot_volume_displacement&
662 ,lg_snapshot_volume_velocity&
663 ,lg_snapshot_volume_acceleration
667 character(len=255) :: fname
668 character(len= 6) :: csnapshot
671 write(csnapshot,
'(i6.6)') ig_idt
676 if ( lg_snapshot_volume_displacement .and. (mod(ig_idt-1,ig_snapshot_volume_saving_incr) == 0) .and. (ig_vtk_nhexa_snapshot > 0) )
then
678 fname = trim(cg_prefix)//
".volume.snapshot.uxyz."//trim(csnapshot)//
".cpu."//trim(cg_myrank)//
".vtu"
680 call
write_snapshot_volume_vtk(fname,rg_gll_displacement(1,:),
"ux",rg_gll_displacement(2,:),
"uy",rg_gll_displacement(3,:),
"uz")
687 if ( lg_snapshot_volume_velocity .and. (mod(ig_idt-1,ig_snapshot_volume_saving_incr) == 0) .and. (ig_vtk_nhexa_snapshot > 0) )
then
689 fname = trim(cg_prefix)//
".volume.snapshot.vxyz."//trim(csnapshot)//
".cpu."//trim(cg_myrank)//
".vtu"
698 if ( lg_snapshot_volume_acceleration .and. (mod(ig_idt-1,ig_snapshot_volume_saving_incr) == 0) .and. (ig_vtk_nhexa_snapshot > 0) )
then
700 fname = trim(cg_prefix)//
".volume.snapshot.axyz."//trim(csnapshot)//
".cpu."//trim(cg_myrank)//
".vtu"
702 call
write_snapshot_volume_vtk(fname,rg_gll_acceleration(1,:),
"ax",rg_gll_acceleration(2,:),
"ay",rg_gll_acceleration(3,:),
"az")
733 ,rg_gll_displacement&
735 ,rg_gll_acceleration&
736 ,ig_snapshot_volume_saving_incr&
737 ,ig_vtk_hexa_conn_snapshot&
738 ,ig_vtk_node_gll_glonum_snapshot&
739 ,rg_vtk_node_x_snapshot&
740 ,rg_vtk_node_y_snapshot&
741 ,rg_vtk_node_z_snapshot&
742 ,ig_vtk_cell_type_snapshot&
743 ,ig_vtk_offset_snapshot&
744 ,ig_vtk_nhexa_snapshot&
745 ,ig_vtk_nnode_snapshot
753 character(len=255) ,
intent(in) :: fname
754 real ,
optional,
intent(in),
dimension(ig_ngll_total) :: gll_var_x
755 real ,
optional,
intent(in),
dimension(ig_ngll_total) :: gll_var_y
756 real ,
optional,
intent(in),
dimension(ig_ngll_total) :: gll_var_z
758 character(len=*) ,
optional,
intent(in) :: name_var_x
759 character(len=*) ,
optional,
intent(in) :: name_var_y
760 character(len=*) ,
optional,
intent(in) :: name_var_z
762 real,
dimension(ig_vtk_nnode_snapshot) :: vtk_var_x
763 real,
dimension(ig_vtk_nnode_snapshot) :: vtk_var_y
764 real,
dimension(ig_vtk_nnode_snapshot) :: vtk_var_z
770 if (present(gll_var_x)) call
get_node_gll_value(gll_var_x,ig_vtk_node_gll_glonum_snapshot,vtk_var_x)
771 if (present(gll_var_y)) call
get_node_gll_value(gll_var_y,ig_vtk_node_gll_glonum_snapshot,vtk_var_y)
772 if (present(gll_var_z)) call
get_node_gll_value(gll_var_z,ig_vtk_node_gll_glonum_snapshot,vtk_var_z)
778 output_format =
'BINARY' &
779 ,filename = trim(fname) &
780 ,mesh_topology =
'UnstructuredGrid' )
783 nn = ig_vtk_nnode_snapshot &
784 ,nc = ig_vtk_nhexa_snapshot &
785 ,x = rg_vtk_node_x_snapshot &
786 ,y = rg_vtk_node_y_snapshot &
787 ,z = rg_vtk_node_z_snapshot )
790 nc = ig_vtk_nhexa_snapshot &
791 ,connect = ig_vtk_hexa_conn_snapshot &
792 ,offset = ig_vtk_offset_snapshot &
793 ,cell_type = ig_vtk_cell_type_snapshot )
796 var_location =
'NODE' &
797 ,var_block_action =
'OPEN' )
801 if (present(gll_var_x))
then
804 nc_nn = ig_vtk_nnode_snapshot &
805 ,varname = name_var_x &
810 if (present(gll_var_y))
then
813 nc_nn = ig_vtk_nnode_snapshot &
814 ,varname = name_var_y &
819 if (present(gll_var_z))
then
822 nc_nn = ig_vtk_nnode_snapshot &
823 ,varname = name_var_z &
831 var_location =
'NODE' &
832 ,var_block_action =
'CLOSE')
858 ,ig_vtk_nhexa_snapshot&
866 real,
dimension(ig_ngll_total) :: gll_vs
867 real,
dimension(ig_ngll_total) :: gll_vp
868 real,
dimension(ig_ngll_total) :: gll_rho
876 character(len=255) :: fname
878 do ihexa = 1,ig_nhexa
884 igll = ig_hexa_gll_glonum(m,l,k,ihexa)
886 gll_vs(igll) = sqrt(rg_hexa_gll_rhovs2(m,l,k,ihexa)/rg_hexa_gll_rho(m,l,k,ihexa))
887 gll_vp(igll) = sqrt(rg_hexa_gll_rhovp2(m,l,k,ihexa)/rg_hexa_gll_rho(m,l,k,ihexa))
888 gll_rho(igll) = rg_hexa_gll_rho(m,l,k,ihexa)
897 if (ig_vtk_nhexa_snapshot > 0)
then
899 fname = trim(cg_prefix)//
".medium.cpu."//trim(cg_myrank)//
".vtu"
923 lg_snapshot_volume_displacement&
924 ,lg_snapshot_volume_velocity&
925 ,lg_snapshot_volume_acceleration
929 if (lg_snapshot_volume_displacement)
then
933 if (lg_snapshot_volume_velocity)
then
937 if (lg_snapshot_volume_acceleration)
then
965 ,ig_snapshot_volume_saving_incr&
966 ,ig_vtk_nhexa_snapshot
970 character(len=*),
intent(in) :: varname
974 integer,
dimension(ig_ncpu) :: vtk_nhexa
980 character(len=255) :: fname
981 character(len=6 ) :: csnapshot
982 character(len=6 ) :: crank
987 call mpi_gather(ig_vtk_nhexa_snapshot,1,mpi_integer,vtk_nhexa,1,mpi_integer,0,mpi_comm_world,ios)
989 if (ig_myrank == 0)
then
991 open(unit=get_newunit(myunit),file=trim(cg_prefix)//
".collection."//trim(varname)//
".pvd")
993 write(unit=myunit,fmt=
'(a)')
"<?xml version=""1.0""?>"
994 write(unit=myunit,fmt=
'(a)')
"<VTKFile type=""Collection"" version=""0.1"" byte_order=""BigEndian"">"
995 write(unit=myunit,fmt=
'(a)')
" <Collection>"
997 do istep = 1,ig_ndt,ig_snapshot_volume_saving_incr
999 write(csnapshot,
'(I6.6)') istep
1001 time =
real(istep-1)*rg_dt
1005 if (vtk_nhexa(icpu) > 0)
then
1007 write(crank,
'(I6.6)') icpu-1
1009 fname = trim(cg_prefix)//
"."//trim(varname)//
"."//trim(csnapshot)//
".cpu."//trim(crank)//
".vtu"
1011 write(unit=myunit,fmt=
'(a,E14.7,3a)')
" <DataSet timestep=""",time,
""" group="""" part=""0"" file=""",trim(fname),
"""/>"
1019 write(unit=myunit,fmt=
'(a)')
" </Collection>"
1020 write(unit=myunit,fmt=
'(a)')
"</VTKFile>"
This module contains subroutines to allocate arrays and to compute an approximation of the total RAM ...
subroutine, private init_vtk_node_numbering(node, gll, nnode, ngll)
This subroutine generates i) VTK nodes' numbering from 0 to n-1 and ii) indirection array from VTK's ...
integer(i4p) function, public vtk_end_xml()
The VTK_END_XML function finalizes opened files.
integer(i4p) function, public vtk_con_xml(NC, connect, offset, cell_type)
The VTK_CON_XML function must be called when unstructured grid topology is used. It saves the connect...
subroutine, private write_medium()
This subroutine prepares the arrays for writing elastic properties of the medium. ...
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...
subroutine, private init_vtk_hexa_connectivity(hexa, efi_nhexa, node, ngll, efi_hexa_gll_glonum, vtk_hexa, vtk_nhexa)
This subroutine creates the connectivity array for defining VTK hexahedron elements from VTK geometri...
This module contains subroutines to compute and write snapshots of a mesh composed by hexahedron elem...
overloading of VTK_GEO_XML
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 write_snapshot_volume_vtk(fname, gll_var_x, name_var_x, gll_var_y, name_var_y, gll_var_z, name_var_z)
This subroutine writes volume snapshot in a VTK XML file that contains a maximum of three vectors...
Interface for redirection to subroutines mod_gll_value::get_node_gll_value_x or mod_gll_value::get_no...
integer(i4p) function, public vtk_dat_xml(var_location, var_block_action)
The VTK_DAT_XML function opens or closes CellData/PointData structures.
This module contains subroutines to compute global -coordinates of a given point in the physical doma...
subroutine, public compute_hexa_point_coord(ihexa, xi, eta, zeta, x, y, z)
subroutine to compute -coordinates of a point knowing to which hexahedron element it belongs and its ...
This module programmed by S. Zaghi (https://github.com/szaghi/Lib_VTK_IO) contains functions to write...
subroutine, public write_collection_vtk_vol()
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_volume_displacement, mod_global_variables::lg_snapshot_volume_velocity and mod_global_variables::lg_snapshot_volume_acceleration.
subroutine, private collection_vtk_volume(varname)
This subroutine write Paraview collection file *.pvd of VTK XML volume snapshot files *...
subroutine, private get_efi_hexa(efi_hexa, efi_nhexa, xmin, xmax, ymin, ymax, zmin, zmax)
This subroutine finds and stores the number of EFISPEC's hexahedron elements used for generating VTK ...
This module contains subroutines to get GLL nodes values from global GLL nodes numbering.
subroutine, public init_snapshot_volume()
This subroutine intializes the VTK mesh used for volume snapshots by calling 'get_efi_hexa' and 'init...
subroutine, private init_vtk_mesh(efi_hexa, efi_hexa_gll_glonum, vtk_hexa_conn, vtk_node_x, vtk_node_y, vtk_node_z, vtk_node_gll_glonum, vtk_cell_type, vtk_offset, vtk_nhexa, vtk_nnode)
This subroutines manages the generation of a VTK mesh from spectral elements GLL nodes.
Interface init_array_int to redirect allocation to n-rank arrays.
overloading of VTK_VAR_XML
subroutine, private init_vtk_node(hexa, nhexa, efi_hexa_gll_glonum, gll, ngll, ngll_unique)
This subroutine finds which GLL nodes to use for generating a VTK mesh.
subroutine, public write_snapshot_volume()
This subroutine manages output format for volume snapshot. For now, only VTK format is available...