165 ,tg_elastic_material&
171 ,ig_hexa_material_number&
173 ,lg_output_medium_vtk&
187 ,tg_viscoelastic_material&
199 real,
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: var1
200 real,
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: var2
217 logical :: is_file_exist
219 character(len=255) :: info
228 ios =
init_array_real(rg_hexa_gll_rho,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,
"rg_hexa_gll_rho")
230 ios =
init_array_real(rg_hexa_gll_rhovs2,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,
"rg_hexa_gll_rhovs2")
232 ios =
init_array_real(rg_hexa_gll_rhovp2,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,
"rg_hexa_gll_rhovp2")
237 ios =
init_array_real(rg_hexa_gll_ksixx,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksixx")
239 ios =
init_array_real(rg_hexa_gll_ksiyy,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksiyy")
241 ios =
init_array_real(rg_hexa_gll_ksizz,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksizz")
243 ios =
init_array_real(rg_hexa_gll_ksixy,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksixy")
245 ios =
init_array_real(rg_hexa_gll_ksixz,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksixz")
247 ios =
init_array_real(rg_hexa_gll_ksiyz,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_ksiyz")
249 ios =
init_array_real(rg_hexa_gll_wkqs,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_wkqs")
251 ios =
init_array_real(rg_hexa_gll_wkqp,ig_nhexa,ig_ngll,ig_ngll,ig_ngll,ig_nrelax,
"rg_hexa_gll_wkqp")
255 do imem_var = 1,ig_nrelax
256 rg_mem_var_exp(imem_var) = exp(-rg_dt/rg_relax_coeff(imem_var,1))
267 is_file_exist = .false.
269 inquire(file=trim(cg_prefix)//
".cpu."//trim(cg_myrank)//
".mat", exist=is_file_exist)
270 if (is_file_exist)
then
271 if (ig_myrank == 0)
then
272 write(ig_lst_unit,
'(a)')
" --> medium generated from geomodeler's material (file *.mat)"
277 if ( .not.(is_file_exist) .and. (ig_myrank == 0) )
then
278 write(ig_lst_unit,
'(a)')
" --> medium generated from cubit block's information"
289 imat = ig_hexa_material_number(iel)
291 if ( (imat <= 0) .or. (imat > ig_nmaterial) )
then
292 write(info,
'(a)')
"error in subroutine init_hexa_medium: undefined material for hexa"
293 call error_stop(info)
304 do imat = 1,ig_nmaterial
308 tg_elastic_material(imat)%lam2 = tg_elastic_material(imat)%dens*tg_elastic_material(imat)%svel**2
309 tg_elastic_material(imat)%lam1 = tg_elastic_material(imat)%dens*tg_elastic_material(imat)%pvel**2 - 2.0*tg_elastic_material(imat)%lam2
310 tg_elastic_material(imat)%pois = (tg_elastic_material(imat)%pvel**2 - 2.0*tg_elastic_material(imat)%svel**2)/(2.0*(tg_elastic_material(imat)%pvel**2-tg_elastic_material(imat)%svel**2))
311 tg_elastic_material(imat)%youn = 2.0*tg_elastic_material(imat)%lam2*(1.0+tg_elastic_material(imat)%pois)
312 tg_elastic_material(imat)%bulk = tg_elastic_material(imat)%lam1+2.0/3.0*tg_elastic_material(imat)%lam2
313 tg_elastic_material(imat)%rvel = (0.862+1.14*tg_elastic_material(imat)%pois)/(1.0+tg_elastic_material(imat)%pois)*tg_elastic_material(imat)%svel
314 tg_elastic_material(imat)%pwmo = tg_elastic_material(imat)%lam1 + 2.0*tg_elastic_material(imat)%lam2
316 if (ig_myrank == 0)
then
317 if (ig_material_type(imat) == 1)
write(ig_lst_unit,
'(" ",/,a,i0,a)')
"material ",imat,
" is elastic"
318 if (ig_material_type(imat) == 2)
write(ig_lst_unit,
'(" ",/,a,i0,a)')
"material ",imat,
" is viscoelactic"
319 write(ig_lst_unit,
'(a,f15.8 ,a)')
"s-wave velocity = ",tg_elastic_material(imat)%svel,
" m/s"
320 write(ig_lst_unit,
'(a,f15.8 ,a)')
"p-wave velocity = ",tg_elastic_material(imat)%pvel,
" m/s"
321 write(ig_lst_unit,
'(a,f15.8 ,a)')
"poisson ratio = ",tg_elastic_material(imat)%pois,
" "
322 write(ig_lst_unit,
'(a,f15.8 ,a)')
"density = ",tg_elastic_material(imat)%dens,
" kg/m3"
323 write(ig_lst_unit,
'(a,e15.7e3,a)')
"lambda (first lame coef.) = ",tg_elastic_material(imat)%lam1,
" Pa"
324 write(ig_lst_unit,
'(a,e15.7e3,a)')
"s-wave modulus = ",tg_elastic_material(imat)%lam2,
" Pa"
325 write(ig_lst_unit,
'(a,e15.7e3,a)')
"p-wave modulus = ",tg_elastic_material(imat)%pwmo,
" Pa"
326 write(ig_lst_unit,
'(a,e15.7e3,a)')
"bulk-modulus = ",tg_elastic_material(imat)%bulk,
" Pa"
333 allocate(tg_viscoelastic_material(imat)%wkqs(ig_nrelax),tg_viscoelastic_material(imat)%wkqp(ig_nrelax))
335 dtmpqs = (3.071+1.433*tg_viscoelastic_material(imat)%qs**(-1.158)*log(tg_viscoelastic_material(imat)%qs/5.0))/(1.0+0.415*tg_viscoelastic_material(imat)%qs)
336 dtmpqp = (3.071+1.433*tg_viscoelastic_material(imat)%qp**(-1.158)*log(tg_viscoelastic_material(imat)%qp/5.0))/(1.0+0.415*tg_viscoelastic_material(imat)%qp)
338 tg_viscoelastic_material(imat)%wkqs(k) = dtmpqs*(dtmpqs*rg_relax_coeff(k,2)+rg_relax_coeff(k,3))
339 tg_viscoelastic_material(imat)%wkqp(k) = dtmpqp*(dtmpqp*rg_relax_coeff(k,2)+rg_relax_coeff(k,3))
342 ctmpqs = cmplx(0.0,0.0)
343 ctmpqp = cmplx(0.0,0.0)
345 ctmpqs = ctmpqs + cmplx(tg_viscoelastic_material(imat)%wkqs(k),0.0)/(1.0 + cmplx(0.0,1.0)*2.0*rg_pi*tg_viscoelastic_material(imat)%freq*rg_relax_coeff(k,1))
346 ctmpqp = ctmpqp + cmplx(tg_viscoelastic_material(imat)%wkqp(k),0.0)/(1.0 + cmplx(0.0,1.0)*2.0*rg_pi*tg_viscoelastic_material(imat)%freq*rg_relax_coeff(k,1))
349 tg_viscoelastic_material(imat)%uswm = tg_elastic_material(imat)%lam2/abs(1.0-ctmpqs)
350 tg_viscoelastic_material(imat)%upwm = tg_elastic_material(imat)%pwmo/abs(1.0-ctmpqp)
351 if (ig_myrank == 0)
then
352 write(ig_lst_unit,
'(a,f15.8 ,a)')
"frequency for viscosity = ",tg_viscoelastic_material(imat)%freq,
" hz"
353 write(ig_lst_unit,
'(a,f15.8 ,a)')
"s-wave quality factor = ",tg_viscoelastic_material(imat)%qs ,
" "
354 write(ig_lst_unit,
'(a,f15.8 ,a)')
"p-wave quality factor = ",tg_viscoelastic_material(imat)%qp ,
" "
355 write(ig_lst_unit,
'(a,e15.7e3,a)')
"unrelaxed s-wave modulus = ",tg_viscoelastic_material(imat)%uswm,
" pa"
356 write(ig_lst_unit,
'(a,e15.7e3,a)')
"unrelaxed p-wave modulus = ",tg_viscoelastic_material(imat)%upwm,
" pa"
372 if (.not.lg_visco)
then
378 imat = ig_hexa_material_number(iel)
379 rg_hexa_gll_rho(m,l,k,iel) = tg_elastic_material(imat)%dens
380 rg_hexa_gll_rhovs2(m,l,k,iel) = tg_elastic_material(imat)%dens*tg_elastic_material(imat)%svel**2
381 rg_hexa_gll_rhovp2(m,l,k,iel) = tg_elastic_material(imat)%dens*tg_elastic_material(imat)%pvel**2
396 imat = ig_hexa_material_number(iel)
397 rg_hexa_gll_rho(m,l,k,iel) = tg_elastic_material(imat)%dens
398 rg_hexa_gll_rhovs2(m,l,k,iel) = tg_viscoelastic_material(imat)%uswm
399 rg_hexa_gll_rhovp2(m,l,k,iel) = tg_viscoelastic_material(imat)%upwm
402 rg_hexa_gll_wkqs(n,m,l,k,iel) = tg_viscoelastic_material(imat)%wkqs(n)
403 rg_hexa_gll_wkqp(n,m,l,k,iel) = tg_viscoelastic_material(imat)%wkqp(n)
440 ,ig_quadp_neighbor_hexa&
441 ,ig_quadp_neighbor_hexaface&
448 ,lg_boundary_absorption
462 character(len=255) :: info
468 if (ig_nquad_parax > 0 .and. lg_boundary_absorption)
then
470 ios =
init_array_real(rg_quadp_gll_rhovs,ig_nquad_parax,ig_ngll,ig_ngll,
"rg_quadp_gll_rhovs")
472 ios =
init_array_real(rg_quadp_gll_rhovp,ig_nquad_parax,ig_ngll,ig_ngll,
"rg_quadp_gll_rhovp")
474 do iquad = 1,ig_nquad_parax
476 ihexa = ig_quadp_neighbor_hexa(iquad)
477 iface = ig_quadp_neighbor_hexaface(iquad)
483 rg_quadp_gll_rhovs(i,j,iquad) = rg_hexa_gll_rho(i,j,1,ihexa)*sqrt(rg_hexa_gll_rhovs2(i,j,1,ihexa)/rg_hexa_gll_rho(i,j,1,ihexa))
484 rg_quadp_gll_rhovp(i,j,iquad) = rg_hexa_gll_rho(i,j,1,ihexa)*sqrt(rg_hexa_gll_rhovp2(i,j,1,ihexa)/rg_hexa_gll_rho(i,j,1,ihexa))
491 rg_quadp_gll_rhovs(k,i,iquad) = rg_hexa_gll_rho(i,1,k,ihexa)*sqrt(rg_hexa_gll_rhovs2(i,1,k,ihexa)/rg_hexa_gll_rho(i,1,k,ihexa))
492 rg_quadp_gll_rhovp(k,i,iquad) = rg_hexa_gll_rho(i,1,k,ihexa)*sqrt(rg_hexa_gll_rhovp2(i,1,k,ihexa)/rg_hexa_gll_rho(i,1,k,ihexa))
499 rg_quadp_gll_rhovs(k,j,iquad) = rg_hexa_gll_rho(ig_ngll,j,k,ihexa)*sqrt(rg_hexa_gll_rhovs2(ig_ngll,j,k,ihexa)/rg_hexa_gll_rho(ig_ngll,j,k,ihexa))
500 rg_quadp_gll_rhovp(k,j,iquad) = rg_hexa_gll_rho(ig_ngll,j,k,ihexa)*sqrt(rg_hexa_gll_rhovp2(ig_ngll,j,k,ihexa)/rg_hexa_gll_rho(ig_ngll,j,k,ihexa))
507 rg_quadp_gll_rhovs(i,k,iquad) = rg_hexa_gll_rho(i,ig_ngll,k,ihexa)*sqrt(rg_hexa_gll_rhovs2(i,ig_ngll,k,ihexa)/rg_hexa_gll_rho(i,ig_ngll,k,ihexa))
508 rg_quadp_gll_rhovp(i,k,iquad) = rg_hexa_gll_rho(i,ig_ngll,k,ihexa)*sqrt(rg_hexa_gll_rhovp2(i,ig_ngll,k,ihexa)/rg_hexa_gll_rho(i,ig_ngll,k,ihexa))
515 rg_quadp_gll_rhovs(j,k,iquad) = rg_hexa_gll_rho(1,j,k,ihexa)*sqrt(rg_hexa_gll_rhovs2(1,j,k,ihexa)/rg_hexa_gll_rho(1,j,k,ihexa))
516 rg_quadp_gll_rhovp(j,k,iquad) = rg_hexa_gll_rho(1,j,k,ihexa)*sqrt(rg_hexa_gll_rhovp2(1,j,k,ihexa)/rg_hexa_gll_rho(1,j,k,ihexa))
523 rg_quadp_gll_rhovs(j,i,iquad) = rg_hexa_gll_rho(i,j,ig_ngll,ihexa)*sqrt(rg_hexa_gll_rhovs2(i,j,ig_ngll,ihexa)/rg_hexa_gll_rho(i,j,ig_ngll,ihexa))
524 rg_quadp_gll_rhovp(j,i,iquad) = rg_hexa_gll_rho(i,j,ig_ngll,ihexa)*sqrt(rg_hexa_gll_rhovp2(i,j,ig_ngll,ihexa)/rg_hexa_gll_rho(i,j,ig_ngll,ihexa))
529 write(info,
'(a)')
"error in subroutine init_quadp_medium: invalid face number"
530 call error_stop(info)
538 if (
allocated(ig_quadp_neighbor_hexa ))
deallocate(ig_quadp_neighbor_hexa)
539 if (
allocated(ig_quadp_neighbor_hexaface))
deallocate(ig_quadp_neighbor_hexaface)
564 integer,
intent(out) :: il_mat_num_of_hexa(:)
568 open(unit=90,file=trim(cg_prefix)//
".cpu."//trim(cg_myrank)//
".mat")
569 do ihexa = 1,ig_nhexa
570 read(unit=90,fmt=*) il_mat_num_of_hexa(ihexa)
591 ig_hexa_material_number&
594 ,ig_hexa_gnode_glonum&
599 ,tg_elastic_material&
608 real ,
dimension(ig_nhexa) :: var
610 integer(kind=1),
dimension(ig_nhexa) :: cell_type
611 integer ,
dimension(ig_nhexa) :: offset
612 integer ,
dimension(ig_hexa_nnode*ig_nhexa) :: connectivity
619 character(len=255) :: fname
623 fname = trim(cg_prefix)//
'.medium.cpu.'//trim(cg_myrank)//
".vtu"
627 do ihexa = 1,ig_nhexa
628 cell_type(ihexa) = 12
633 do ihexa = 1,ig_nhexa
634 offset(ihexa) = ihexa*ig_hexa_nnode
640 do ihexa = 1,ig_nhexa
641 do inode = 1,ig_hexa_nnode
644 connectivity(icon) = ig_hexa_gnode_glonum(inode,ihexa) - 1
650 output_format =
'BINARY' &
652 ,mesh_topology =
'UnstructuredGrid' )
663 ,connect = connectivity &
665 ,cell_type = cell_type )
668 var_location =
'CELL' &
669 ,var_block_action =
'OPEN' )
673 do ihexa = 1,ig_nhexa
675 imat = ig_hexa_material_number(ihexa)
676 var(ihexa) = tg_elastic_material(imat)%pvel
687 do ihexa = 1,ig_nhexa
688 imat = ig_hexa_material_number(ihexa)
689 var(ihexa) = tg_elastic_material(imat)%svel
699 var_location =
'CELL' &
700 ,var_block_action =
'CLOSE' &
726 ig_hexa_material_number&
730 ,ig_hexa_gnode_glonum&
746 real,
intent(in),
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: var1
747 real,
intent(in),
dimension(IG_NGLL,IG_NGLL,IG_NGLL,ig_nhexa) :: var2
749 real ,
dimension(ig_mesh_nnode) :: var
752 integer(kind=1),
dimension(ig_nhexa) :: cell_type
753 integer ,
dimension(ig_nhexa) :: offset
754 integer ,
dimension(ig_hexa_nnode*ig_nhexa) :: connectivity
757 integer :: global_gnode
764 character(len=255) :: fname
768 fname = trim(cg_prefix)//
'.medium.cpu.'//trim(cg_myrank)//
".vtu"
772 do ihexa = 1,ig_nhexa
773 cell_type(ihexa) = 12
778 do ihexa = 1,ig_nhexa
779 offset(ihexa) = ihexa*ig_hexa_nnode
785 do ihexa = 1,ig_nhexa
786 do inode = 1,ig_hexa_nnode
789 connectivity(icon) = ig_hexa_gnode_glonum(inode,ihexa) - 1
797 output_format =
'BINARY' &
799 ,mesh_topology =
'UnstructuredGrid' )
815 ,connect = connectivity &
817 ,cell_type = cell_type &
823 var_location =
'NODE' &
824 ,var_block_action =
'OPEN' &
830 do ihexa = 1,ig_nhexa
832 do inode = 1,ig_hexa_nnode
834 k = ig_hexa_node2gll(1,inode)
835 l = ig_hexa_node2gll(2,inode)
836 m = ig_hexa_node2gll(3,inode)
838 global_gnode = ig_hexa_gnode_glonum(inode,ihexa)
840 myvar = var1(m,l,k,ihexa)
842 var(global_gnode) = myvar
851 nc_nn = ig_mesh_nnode &
859 do ihexa = 1,ig_nhexa
861 do inode = 1,ig_hexa_nnode
863 k = ig_hexa_node2gll(1,inode)
864 l = ig_hexa_node2gll(2,inode)
865 m = ig_hexa_node2gll(3,inode)
867 global_gnode = ig_hexa_gnode_glonum(inode,ihexa)
869 myvar = var2(m,l,k,ihexa)
871 var(global_gnode) = myvar
880 nc_nn = ig_mesh_nnode &
888 var_location =
'NODE' &
889 ,var_block_action =
'CLOSE' &
922 character(len=255) :: fname
923 character(len=6 ) :: cpart
925 open(unit=get_newunit(myunit),file=trim(cg_prefix)//
".medium.collection.pvd")
927 write(unit=myunit,fmt=
'(a)')
"<?xml version=""1.0""?>"
928 write(unit=myunit,fmt=
'(a)')
"<VTKFile type=""Collection"" version=""0.1"" byte_order=""BigEndian"">"
929 write(unit=myunit,fmt=
'(a)')
" <Collection>"
933 write(cpart,
'(I6.6)') icpu-1
935 fname = trim(cg_prefix)//
".medium.cpu."//trim(cpart)//
".vtu"
937 write(unit=myunit,fmt=
'(3a)')
" <DataSet group="""" part=""0"" file=""",trim(fname),
"""/>"
941 write(unit=myunit,fmt=
'(a)')
" </Collection>"
942 write(unit=myunit,fmt=
'(a)')
"</VTKFile>"
This module contains subroutines to allocate arrays and to compute an approximation of the total RAM ...
integer(i4p) function, public vtk_end_xml()
The VTK_END_XML function finalizes opened files.
This module contains subroutines to initialize medium for hexahedron and quadrangle elements...
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, public init_quadp_medium()
This subroutine fills medium properties at GLL nodes of paraxial quadrangle elements (i...
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 write_medium_vtk_node_xml(var1, var2)
This subroutine writes S and P-wave velocities of the physical domain of cpu myrank in UnstructuredGr...
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, private write_medium_vtk_cell_xml()
This subroutine writes S and P-wave velocities of the physical domain of cpu myrank in UnstructuredGr...
subroutine, private init_medium_from_mat_file(il_mat_num_of_hexa)
This subroutine fills medium properties at GLL nodes of hexahedron elements based on material number ...
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 write_medium_collection()
This subroutine writes a VTK xml collection file *.pvd which contains all *.vtu files generated by wr...
This module programmed by S. Zaghi (https://github.com/szaghi/Lib_VTK_IO) contains functions to write...
overloading of VTK_VAR_XML
subroutine, public init_hexa_medium()
This subroutine fills medium properties (elastic or viscoelastic) at GLL nodes of hexahedron elements...