Skip to content

Commit f2569f1

Browse files
committed
adds Berkeley UCB source time function feature
1 parent 71decbc commit f2569f1

File tree

8 files changed

+2806
-7
lines changed

8 files changed

+2806
-7
lines changed

src/shared/broadcast_computed_parameters.f90

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
subroutine broadcast_computed_parameters()
2929

30-
use constants, only: myrank
30+
use constants, only: myrank,STF_IS_UCB_HEAVISIDE
3131
use shared_parameters
3232

3333
implicit none
@@ -205,6 +205,15 @@ subroutine broadcast_computed_parameters()
205205
call bcast_all_singlei(NZ_DOUBLING_4)
206206
call bcast_all_singlei(NZ_DOUBLING_5)
207207

208+
! (optional) Berkeley UCB stf
209+
if (STF_IS_UCB_HEAVISIDE) then
210+
call bcast_all_singledp(UCB_SOURCE_T1)
211+
call bcast_all_singledp(UCB_SOURCE_T2)
212+
call bcast_all_singledp(UCB_SOURCE_T3)
213+
call bcast_all_singledp(UCB_SOURCE_T4)
214+
call bcast_all_singledp(UCB_TAU)
215+
endif
216+
208217
! (optional) scattering perturbations
209218
call bcast_all_singlel(ADD_SCATTERING_PERTURBATIONS)
210219
call bcast_all_singledp(SCATTERING_STRENGTH)

src/shared/read_parameter_file.F90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,15 @@ subroutine read_parameter_file()
220220
call read_value_logical(USE_MONOCHROMATIC_CMT_SOURCE, 'USE_MONOCHROMATIC_CMT_SOURCE', ier)
221221
if (ier /= 0) stop 'an error occurred while reading the parameter file: USE_MONOCHROMATIC_CMT_SOURCE'
222222

223+
! (optional) Berkeley UCB STF parameters
224+
if (STF_IS_UCB_HEAVISIDE) then
225+
call read_value_double_precision(UCB_SOURCE_T1,'SOURCE_T1', ier); ier = 0
226+
call read_value_double_precision(UCB_SOURCE_T2,'SOURCE_T2', ier); ier = 0
227+
call read_value_double_precision(UCB_SOURCE_T3,'SOURCE_T3', ier); ier = 0
228+
call read_value_double_precision(UCB_SOURCE_T4,'SOURCE_T4', ier); ier = 0
229+
call read_value_double_precision(UCB_TAU,'TAU', ier); ier = 0
230+
endif
231+
223232
! option to save strain seismograms
224233
call read_value_logical(SAVE_SEISMOGRAMS_STRAIN, 'SAVE_SEISMOGRAMS_STRAIN', ier)
225234
if (ier /= 0) stop 'an error occurred while reading the parameter file: SAVE_SEISMOGRAMS_STRAIN'

src/shared/shared_par.f90

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ module shared_input_parameters
208208
logical :: SHIFT_SIMULTANEOUS_RUNS = .false.
209209
double precision :: FILESYSTEM_IO_BANDWIDTH = 0.d0
210210

211+
! UCB Source time function parameters
212+
double precision :: UCB_SOURCE_T1 = 400.d0, UCB_SOURCE_T2 = 250.d0, UCB_SOURCE_T3 = 53.d0, UCB_SOURCE_T4 = 40.d0
213+
double precision :: UCB_TAU = 400.d0
214+
211215
end module shared_input_parameters
212216

213217
!

src/specfem3D/comp_source_time_function.f90

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727

2828
double precision function comp_source_time_function(t,hdur,it_index)
2929

30-
use constants, only: EXTERNAL_SOURCE_TIME_FUNCTION
30+
use constants, only: EXTERNAL_SOURCE_TIME_FUNCTION, &
31+
STF_IS_UCB_HEAVISIDE
32+
33+
! for berkeley source time function
34+
use ucb_heaviside, only: comp_source_time_function_ucb_stf
3135

3236
implicit none
3337

@@ -38,7 +42,10 @@ double precision function comp_source_time_function(t,hdur,it_index)
3842
double precision, external :: comp_source_time_function_heavi
3943
double precision, external :: comp_source_time_function_ext
4044

41-
if (EXTERNAL_SOURCE_TIME_FUNCTION) then
45+
if (STF_IS_UCB_HEAVISIDE) then
46+
! Berkeley stf
47+
comp_source_time_function = comp_source_time_function_ucb_stf(t)
48+
else if (EXTERNAL_SOURCE_TIME_FUNCTION) then
4249
! external stf
4350
comp_source_time_function = comp_source_time_function_ext(it_index)
4451
else

src/specfem3D/locate_sources.f90

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ subroutine locate_sources()
5959

6060
use specfem_par_movie, only: vtkdata_source_x,vtkdata_source_y,vtkdata_source_z
6161

62+
! for Berkeley stf
63+
use shared_parameters, only: UCB_SOURCE_T1,UCB_SOURCE_T2,UCB_SOURCE_T3,UCB_SOURCE_T4,UCB_TAU
64+
6265
implicit none
6366

6467
! local parameters
@@ -549,8 +552,17 @@ subroutine locate_sources()
549552
write(IMAIN,*) ' half duration in frequency: ',hdur(isource),' seconds**(-1)'
550553
case (2)
551554
! Heaviside
552-
write(IMAIN,*) ' using (quasi) Heaviside source time function'
553-
write(IMAIN,*) ' half duration: ',hdur(isource),' seconds'
555+
if (STF_IS_UCB_HEAVISIDE) then
556+
! Berkeley UCB stf
557+
write(IMAIN,*) ' using Berkeley UCB (quasi) Heaviside source time function'
558+
write(IMAIN,*) ' source T1/T2/T3/T4: ',sngl(UCB_SOURCE_T1),'/',sngl(UCB_SOURCE_T2),'/', &
559+
sngl(UCB_SOURCE_T3),'/',sngl(UCB_SOURCE_T4)
560+
write(IMAIN,*) ' source time-shift : ',sngl(UCB_TAU)
561+
else
562+
! default Heaviside
563+
write(IMAIN,*) ' using (quasi) Heaviside source time function'
564+
write(IMAIN,*) ' half duration: ',hdur(isource),' seconds'
565+
endif
554566
case (3)
555567
! Monochromatic
556568
write(IMAIN,*) ' using monochromatic source time function'
@@ -567,14 +579,21 @@ subroutine locate_sources()
567579
case default
568580
stop 'unsupported force_stf value!'
569581
end select
582+
else if (STF_IS_UCB_HEAVISIDE) then
583+
! moment tensor
584+
! Berkeley UCB stf
585+
write(IMAIN,*) ' using Berkeley UCB (quasi) Heaviside source time function'
586+
write(IMAIN,*) ' source T1/T2/T3/T4: ',sngl(UCB_SOURCE_T1),'/',sngl(UCB_SOURCE_T2),'/', &
587+
sngl(UCB_SOURCE_T3),'/',sngl(UCB_SOURCE_T4)
588+
write(IMAIN,*) ' source time-shift : ',sngl(UCB_TAU)
570589
else if (USE_MONOCHROMATIC_CMT_SOURCE) then
571590
! moment tensor
572591
write(IMAIN,*) ' using monochromatic source time function'
573592
! add message if source is monochromatic
574593
write(IMAIN,*)
575594
write(IMAIN,*) ' period: ',hdur(isource),' seconds'
576595
else
577-
! moment tensor
596+
! default quasi Heaviside
578597
write(IMAIN,*) ' using (quasi) Heaviside source time function'
579598
! add message if source is a Heaviside
580599
if (hdur(isource) <= 5.0*DT) then

src/specfem3D/rules.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ specfem3D_SOLVER_OBJECTS += \
130130
$O/setup_GLL_points.solverstatic.o \
131131
$O/setup_sources_receivers.solverstatic.o \
132132
$O/specfem3D_par.solverstatic_module.o \
133+
$O/ucb_heaviside.solverstatic.o \
133134
$O/update_displacement_LDDRK.solverstatic.o \
134135
$O/update_displacement_Newmark.solverstatic.o \
135136
$O/write_movie_output.solverstatic.o \
@@ -160,6 +161,7 @@ specfem3D_MODULES = \
160161
$(FC_MODDIR)/siem_poisson.$(FC_MODEXT) \
161162
$(FC_MODDIR)/siem_solver_mpi.$(FC_MODEXT) \
162163
$(FC_MODDIR)/siem_solver_petsc.$(FC_MODEXT) \
164+
$(FC_MODDIR)/ucb_heaviside.$(FC_MODEXT) \
163165
$(EMPTY_MACRO)
164166

165167
# These files come from the shared directory
@@ -404,6 +406,10 @@ $O/locate_point.solverstatic.o: $O/search_kdtree.shared.o
404406

405407
$O/make_gravity.solver.o: $O/model_prem.shared.o $O/model_Sohl.shared.o $O/model_vpremoon.shared.o
406408

409+
# for Berkeley ucb stf
410+
$O/comp_source_time_function.solverstatic.o: $O/ucb_heaviside.solverstatic.o
411+
$O/setup_sources_receivers.solverstatic.o: $O/ucb_heaviside.solverstatic.o
412+
407413
$O/compute_forces_crust_mantle_Dev.solverstatic.o: $O/compute_element.solverstatic.o $O/compute_element_att_memory.solverstatic.o
408414
$O/compute_forces_crust_mantle_noDev.solverstatic.o: $O/compute_element.solverstatic.o $O/compute_element_att_memory.solverstatic.o
409415
$O/compute_forces_inner_core_Dev.solverstatic.o: $O/compute_element.solverstatic.o $O/compute_element_att_memory.solverstatic.o

src/specfem3D/setup_sources_receivers.f90

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,10 @@ subroutine setup_sources()
580580
use specfem_par
581581
use specfem_par_crustmantle
582582
use specfem_par_movie
583+
584+
! for berkeley ucb stf
585+
use ucb_heaviside, only: init_ucb_heaviside
586+
583587
implicit none
584588

585589
! local parameters
@@ -639,11 +643,16 @@ subroutine setup_sources()
639643
comp_dir_vect_source_Z_UP(:) = 0.d0
640644
endif
641645

646+
! initialize Berkeley stf if needed (for ucb heaviside)
647+
if (STF_IS_UCB_HEAVISIDE) then
648+
call init_ucb_heaviside(NSTEP,DT)
649+
endif
650+
642651
! sources
643652
! moved open statement and writing of first lines into sr.vtk before the
644653
! call to locate_sources, where further write statements to that file follow
645654
if (myrank == 0) then
646-
! write source and receiver VTK files for Paraview
655+
! write source and receiver VTK files for Paraview
647656
filename = trim(OUTPUT_FILES)//'/sr_tmp.vtk'
648657
open(IOUT_VTK,file=trim(filename),status='unknown',iostat=ier)
649658
if (ier /= 0 ) call exit_MPI(myrank,'Error opening temporary file sr_temp.vtk')
@@ -794,6 +803,11 @@ subroutine setup_stf_constants()
794803
t0 = 0.d0
795804
endif
796805

806+
! Berkeley stf
807+
if (STF_IS_UCB_HEAVISIDE) then
808+
t0 = 0.d0
809+
endif
810+
797811
! checks if user set USER_T0 to fix simulation start time
798812
! note: USER_T0 has to be positive
799813
if (USER_T0 > 0.d0) then

0 commit comments

Comments
 (0)