[cig-commits] r20323 - in seismo/2D/SPECFEM2D/trunk: setup src/specfem2D
dkomati1 at geodynamics.org
dkomati1 at geodynamics.org
Tue Jun 5 17:15:58 PDT 2012
Author: dkomati1
Date: 2012-06-05 17:15:58 -0700 (Tue, 05 Jun 2012)
New Revision: 20323
Modified:
seismo/2D/SPECFEM2D/trunk/setup/constants.h.in
seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90
seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90
seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90
seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
Log:
option DRAW_SOURCES_AND_RECEIVERS is now implemented
Modified: seismo/2D/SPECFEM2D/trunk/setup/constants.h.in
===================================================================
--- seismo/2D/SPECFEM2D/trunk/setup/constants.h.in 2012-06-05 21:58:10 UTC (rev 20322)
+++ seismo/2D/SPECFEM2D/trunk/setup/constants.h.in 2012-06-06 00:15:58 UTC (rev 20323)
@@ -146,6 +146,9 @@
! was found by trial and error
double precision, parameter :: SOURCE_DECAY_MIMIC_TRIANGLE = 1.628d0
+! size of cross and square in pixels drawn to represent the source and the receivers in JPEG pictures
+ integer, parameter :: width_cross = 5, thickness_cross = 1, size_square = 3
+
! X and Z axis origin of PostScript plot in centimeters
double precision, parameter :: ORIG_X = 2.4d0
double precision, parameter :: ORIG_Z = 2.9d0
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90 2012-06-05 21:58:10 UTC (rev 20322)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/create_color_image.f90 2012-06-06 00:15:58 UTC (rev 20323)
@@ -44,7 +44,9 @@
subroutine create_color_image(color_image_2D_data,iglob_image_color_2D, &
NX,NY,it,isnapshot_number,cutsnaps,image_color_vp_display, &
- USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR)
+ USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR, &
+ DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec, &
+ ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
! display a given field as a red and blue color JPEG image
@@ -63,7 +65,14 @@
double precision, dimension(NX,NY) :: color_image_2D_data
double precision, dimension(NX,NY) :: image_color_vp_display
-! for JPEG
+! to draw the sources and receivers
+ integer, intent(in) :: NSOURCES,nrec
+ logical, intent(in) :: DRAW_SOURCES_AND_RECEIVERS
+ integer, dimension(NSOURCES), intent(in) :: ix_image_color_source,iy_image_color_source
+ integer, dimension(nrec), intent(in) :: ix_image_color_receiver,iy_image_color_receiver
+ integer :: i
+
+! for the JPEG library
character(len=1), dimension(3,NX,NY) :: JPEG_raw_image
integer :: ix,iy,R,G,B
@@ -186,7 +195,61 @@
enddo
enddo
+!
+!---- draw position of the sources and receivers
+!
+ if (DRAW_SOURCES_AND_RECEIVERS) then
+
+! draw position of the sources with orange crosses
+ do i=1,NSOURCES
+
+ do iy = iy_image_color_source(i) - width_cross, iy_image_color_source(i) + width_cross
+ do ix = ix_image_color_source(i) - thickness_cross, ix_image_color_source(i) + thickness_cross
+! use orange color
+ R = 255
+ G = 157
+ B = 0
! for JPEG
+ JPEG_raw_image(1,ix,NY-iy+1) = char(R)
+ JPEG_raw_image(2,ix,NY-iy+1) = char(G)
+ JPEG_raw_image(3,ix,NY-iy+1) = char(B)
+ enddo
+ enddo
+
+ do iy = iy_image_color_source(i) - thickness_cross, iy_image_color_source(i) + thickness_cross
+ do ix = ix_image_color_source(i) - width_cross, ix_image_color_source(i) + width_cross
+! use orange color
+ R = 255
+ G = 157
+ B = 0
+! for JPEG
+ JPEG_raw_image(1,ix,NY-iy+1) = char(R)
+ JPEG_raw_image(2,ix,NY-iy+1) = char(G)
+ JPEG_raw_image(3,ix,NY-iy+1) = char(B)
+ enddo
+ enddo
+
+ enddo
+
+! draw position of the receivers with green squares
+ do i=1,nrec
+ do iy = iy_image_color_receiver(i) - size_square, iy_image_color_receiver(i) + size_square
+ do ix = ix_image_color_receiver(i) - size_square, ix_image_color_receiver(i) + size_square
+! use dark green color
+ R = 30
+ G = 180
+ B = 60
+! for JPEG
+ JPEG_raw_image(1,ix,NY-iy+1) = char(R)
+ JPEG_raw_image(2,ix,NY-iy+1) = char(G)
+ JPEG_raw_image(3,ix,NY-iy+1) = char(B)
+ enddo
+ enddo
+ enddo
+
+ endif
+
+! for JPEG
call write_jpeg_image(JPEG_raw_image,NX,NY,filename)
end subroutine create_color_image
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90 2012-06-05 21:58:10 UTC (rev 20322)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/locate_receivers.F90 2012-06-06 00:15:58 UTC (rev 20323)
@@ -231,7 +231,7 @@
! close receiver file
close(1)
-! elect one process for each receiver.
+! select one mesh slice for each receiver
#ifdef USE_MPI
call MPI_GATHER(final_distance(1),nrec,MPI_DOUBLE_PRECISION,&
gather_final_distance(1,1),nrec,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ierror)
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90 2012-06-05 21:58:10 UTC (rev 20322)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/prepare_color_image.F90 2012-06-06 00:15:58 UTC (rev 20323)
@@ -134,7 +134,9 @@
xmin_color_image,xmax_color_image, &
zmin_color_image,zmax_color_image, &
coord,nglob,coorg,npgeo,nspec,ngnod,knods,ibool, &
- nb_pixel_loc,iglob_image_color)
+ nb_pixel_loc,iglob_image_color, &
+ DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec,x_source,z_source,st_xval,st_zval, &
+ ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
implicit none
include "constants.h"
@@ -154,6 +156,14 @@
integer :: nb_pixel_loc
integer, dimension(NX_IMAGE_color,NZ_IMAGE_color) :: iglob_image_color
+! to draw the sources and receivers
+ integer, intent(in) :: NSOURCES,nrec
+ logical, intent(in) :: DRAW_SOURCES_AND_RECEIVERS
+ double precision, dimension(NSOURCES), intent(in) :: x_source,z_source
+ double precision, dimension(nrec), intent(in) :: st_xval,st_zval
+ integer, dimension(NSOURCES), intent(out) :: ix_image_color_source,iy_image_color_source
+ integer, dimension(nrec), intent(out) :: ix_image_color_receiver,iy_image_color_receiver
+
! local parameters
double precision :: size_pixel_horizontal,size_pixel_vertical
double precision, dimension(2,4) :: elmnt_coords
@@ -174,7 +184,7 @@
iglob_image_color(:,:) = -1
- ! checking which pixels are inside each elements
+ ! checking which pixels are inside each element
nb_pixel_loc = 0
do ispec = 1, nspec
@@ -232,6 +242,39 @@
enddo
enddo
+!
+!---- find pixel position of the sources and receivers
+!
+ if (DRAW_SOURCES_AND_RECEIVERS .and. myrank == 0) then
+
+! find pixel position of the sources with orange crosses
+ do i=1,NSOURCES
+ ix_image_color_source(i) = (x_source(i) - xmin_color_image) / size_pixel_horizontal + 1
+ iy_image_color_source(i) = (z_source(i) - zmin_color_image) / size_pixel_vertical + 1
+
+ ! avoid edge effects
+ if(ix_image_color_source(i) < 1) ix_image_color_source(i) = 1
+ if(iy_image_color_source(i) < 1) iy_image_color_source(i) = 1
+
+ if(ix_image_color_source(i) > NX_IMAGE_color) ix_image_color_source(i) = NX_IMAGE_color
+ if(iy_image_color_source(i) > NZ_IMAGE_color) iy_image_color_source(i) = NZ_IMAGE_color
+ enddo
+
+! find pixel position of the receivers with green squares
+ do i=1,nrec
+ ix_image_color_receiver(i) = (st_xval(i) - xmin_color_image) / size_pixel_horizontal + 1
+ iy_image_color_receiver(i) = (st_zval(i) - zmin_color_image) / size_pixel_vertical + 1
+
+ ! avoid edge effects
+ if(ix_image_color_receiver(i) < 1) ix_image_color_receiver(i) = 1
+ if(iy_image_color_receiver(i) < 1) iy_image_color_receiver(i) = 1
+
+ if(ix_image_color_receiver(i) > NX_IMAGE_color) ix_image_color_receiver(i) = NX_IMAGE_color
+ if(iy_image_color_receiver(i) > NZ_IMAGE_color) iy_image_color_receiver(i) = NZ_IMAGE_color
+ enddo
+
+ endif
+
end subroutine prepare_color_image_pixels
Modified: seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90
===================================================================
--- seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90 2012-06-05 21:58:10 UTC (rev 20322)
+++ seismo/2D/SPECFEM2D/trunk/src/specfem2D/specfem2D.F90 2012-06-06 00:15:58 UTC (rev 20323)
@@ -333,12 +333,11 @@
include "mpif.h"
#endif
-! character(len=80) datlin
-
integer NSOURCES,i_source
integer, dimension(:), allocatable :: source_type,time_function_type
double precision, dimension(:), allocatable :: x_source,z_source,xi_source,gamma_source,&
Mxx,Mzz,Mxz,f0,tshift_src,factor,angleforce
+ integer, dimension(:), allocatable :: ix_image_color_source,iy_image_color_source
real(kind=CUSTOM_REAL), dimension(:,:,:,:),allocatable :: sourcearray
double precision :: t0
@@ -819,6 +818,7 @@
double precision, dimension(:), allocatable :: anglerec_irec
double precision, dimension(:), allocatable :: cosrot_irec, sinrot_irec
double precision, dimension(:), allocatable :: x_final_receiver, z_final_receiver
+ integer, dimension(:), allocatable :: ix_image_color_receiver,iy_image_color_receiver
logical :: force_normal_to_surface,rec_normal_to_surface
integer, dimension(:), allocatable :: source_courbe_eros
@@ -1031,6 +1031,8 @@
allocate( time_function_type(NSOURCES) )
allocate( x_source(NSOURCES) )
allocate( z_source(NSOURCES) )
+ allocate( ix_image_color_source(NSOURCES) )
+ allocate( iy_image_color_source(NSOURCES) )
allocate( f0(NSOURCES) )
allocate( tshift_src(NSOURCES) )
allocate( factor(NSOURCES) )
@@ -1854,6 +1856,8 @@
allocate(which_proc_receiver(nrec))
allocate(x_final_receiver(nrec))
allocate(z_final_receiver(nrec))
+ allocate(ix_image_color_receiver(nrec))
+ allocate(iy_image_color_receiver(nrec))
! allocate 1-D Lagrange interpolators and derivatives
allocate(hxir(NGLLX))
@@ -2996,9 +3000,10 @@
xmin_color_image,xmax_color_image, &
zmin_color_image,zmax_color_image, &
coord,nglob,coorg,npgeo,nspec,ngnod,knods,ibool, &
- nb_pixel_loc,iglob_image_color)
+ nb_pixel_loc,iglob_image_color, &
+ DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec,x_source,z_source,st_xval,st_zval, &
+ ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
-
! creating and filling array num_pixel_loc with the positions of each colored
! pixel owned by the local process (useful for parallel jobs)
allocate(num_pixel_loc(nb_pixel_loc))
@@ -7699,7 +7704,7 @@
nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
numat,kmato,density,rhoext,assign_external_model)
- call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
+ call plotpost(vector_field_display,coord,vpext,x_source,z_source,st_xval,st_zval, &
it,deltat,coorg,xinterp,zinterp,shape2D_display, &
Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
poroelastcoef,knods,kmato,ibool, &
@@ -7743,7 +7748,7 @@
nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
numat,kmato,density,rhoext,assign_external_model)
- call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
+ call plotpost(vector_field_display,coord,vpext,x_source,z_source,st_xval,st_zval, &
it,deltat,coorg,xinterp,zinterp,shape2D_display, &
Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
poroelastcoef,knods,kmato,ibool, &
@@ -7787,7 +7792,7 @@
nspec,nglob,nglob_acoustic,nglob_elastic,nglob_poroelastic, &
numat,kmato,density,rhoext,assign_external_model)
- call plotpost(vector_field_display,coord,vpext,x_source,z_source,x_final_receiver,z_final_receiver, &
+ call plotpost(vector_field_display,coord,vpext,x_source,z_source,st_xval,st_zval, &
it,deltat,coorg,xinterp,zinterp,shape2D_display, &
Uxinterp,Uzinterp,flagrange,density,porosity,tortuosity,&
poroelastcoef,knods,kmato,ibool, &
@@ -7993,7 +7998,9 @@
if (myrank == 0) then
call create_color_image(image_color_data,iglob_image_color, &
NX_IMAGE_color,NZ_IMAGE_color,it,isnapshot_number,cutsnaps,image_color_vp_display, &
- USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR)
+ USE_SNAPSHOT_NUMBER_IN_FILENAME,POWER_DISPLAY_COLOR, &
+ DRAW_SOURCES_AND_RECEIVERS,NSOURCES,nrec, &
+ ix_image_color_source,iy_image_color_source,ix_image_color_receiver,iy_image_color_receiver)
write(IOUT,*) 'Color image created'
endif
More information about the CIG-COMMITS
mailing list