Table of Contents
 Adjoint Simulations
 Adjoint Simulations for Sources Only (not for the Model)
 Adjoint Simulations for FiniteFrequency Kernels (Kernel Simulation)
 References
Adjoint Simulations
Adjoint simulations are generally performed for two distinct applications. First, they can be used in point source momenttensor inversions, or source imaging for earthquakes with large ruptures such as the Lander’s earthquake (Wald and Heaton 1994). Second, they can be used to generate finitefrequency sensitivity kernels that are a critical part of tomographic inversions based upon 3D reference models (Tromp, Tape, and Liu 2005; Qinya Liu and Tromp 2006; Tromp, Komatitsch, and Liu 2008; Q. Liu and Tromp 2008). In either case, source parameter or velocity structure updates are sought to minimize a specific misfit function (e.g., waveform or traveltime differences), and the adjoint simulation provides a means of computing the gradient of the misfit function and further reducing it in successive iterations. Applications and procedures pertaining to source studies and finitefrequency kernels are discussed in Sections 1.1 and 1.2, respectively. The two related parameters in the DATA/Par_file
are SIMULATION_TYPE
(1, 2 or 3) and the SAVE_FORWARD
(boolean).
Adjoint Simulations for Sources Only (not for the Model)
When a specific misfit function between data and synthetics is minimized to invert for earthquake source parameters, the gradient of the misfit function with respect to these source parameters can be computed by placing timereversed seismograms at the receivers as virtual sources in an adjoint simulation. Then the value of the gradient is obtained from the adjoint seismograms recorded at the original earthquake location.

Prepare the adjoint sources

First, run a regular forward simulation (
SIMULATION_TYPE = 1
andSAVE_FORWARD = .false.
). You can automatically set these two variables using theutils/change_simulation_type.pl
script:utils/change_simulation_type.pl f
and then collect the recorded seismograms at all the stations given in
DATA/STATIONS
. 
Then select the stations for which you want to compute the timereversed adjoint sources and run the adjoint simulation, and compile them into the
DATA/STATIONS_ADJOINT
file, which has the same format as the regularDATA/STATIONS
file.
Depending on what type of misfit function is used for the source inversion, adjoint sources need to be computed from the original recorded seismograms for the selected stations and saved in a subdirectory called
SEM/
in the root directory of the code, with the formatNT.STA.BX?.adj
, whereNT
,STA
are the network code and station name given in theDATA/STATIONS_ADJOINT
file, andBX?
represents the component name of a particular adjoint seismogram. Please note that the band code can change depending on your sampling rate (see Appendix [cha:channelcodes] for further details). 
The adjoint seismograms are in the same format as the original seismogram (
NT.STA.BX?.sem?
), with the same start time, time interval and record length.


Notice that even if you choose to time reverse only one component from one specific station, you still need to supply all three components because the code is expecting them (you can set the other two components to be zero).

Also note that since timereversal is done in the code itself, no explicit timereversing is needed for the preparation of the adjoint sources, i.e., the adjoint sources are in the same forward time sense as the original recorded seismograms.


Set the related parameters and run the adjoint simulation In the
DATA/Par_file
, set the two related parameters to beSIMULATION_TYPE = 2
andSAVE_FORWARD = .false.
. More conveniently, use the scriptsutils/change_simulation_type.pl
to modify theDATA/Par_file
automatically (change_simulation_type.pl a
). Then run the solver to launch the adjoint simulation. 
Collect the seismograms at the original source location
After the adjoint simulation has completed successfully, collect the seismograms from
LOCAL_PATH
.
These adjoint seismograms are recorded at the locations of the original earthquake sources given by the
DATA/CMTSOLUTION
file, and have names of the formNT.S?????.S??.sem
for the sixcomponent strain tensor (SNN,SEE,SZZ,SNE,SNZ,SEZ
) at these locations, andNT.S?????.BX?.sem
for the threecomponent displacements (BXN,BXE,BXZ
) recorded at these locations. 
S?????
denotes the source number; for example, if the originalCMTSOLUTION
provides only a point source, then the seismograms collected will start withS00001
. 
These adjoint seismograms provide critical information for the computation of the gradient of the misfit function.

Adjoint Simulations for FiniteFrequency Kernels (Kernel Simulation)
Finitefrequency sensitivity kernels are computed in two successive simulations (please refer to Qinya Liu and Tromp (2006) and Tromp, Komatitsch, and Liu (2008) for details).

Run a forward simulation with the state variables saved at the end of the simulation
Prepare the
CMTSOLUTION
andSTATIONS
files, set the parametersSIMULATION_TYPE
=
1
andSAVE_FORWARD =
.true.
in theDATA/Par_file
(change_simulation_type F
), and run the solver.
Notice that attenuation is not implemented yet for the computation of finitefrequency kernels; therefore set
ATTENUATION = .false.
in theDATA/Par_file
. 
We also suggest you modify the half duration of the
CMTSOLUTION
to be similar to the accuracy of the simulation (see Equation [eq:shortest_period]) to avoid too much highfrequency noise in the forward wavefield, although theoretically the highfrequency noise should be eliminated when convolved with an adjoint wavefield with the proper frequency content. 
This forward simulation differs from the regular simulations (
SIMULATION_TYPE
=
1
andSAVE_FORWARD
=
.false.
) described in the previous chapters in that the state variables for the last time step of the simulation, including wavefields of the displacement, velocity, acceleration, etc., are saved to theLOCAL_PATH
to be used for the subsequent simulation. 
For regional simulations, the files recording the absorbing boundary contribution are also written to the
LOCAL_PATH
whenSAVE_FORWARD = .true.
.


Prepare the adjoint sources
The adjoint sources need to be prepared the same way as described in the Section [enu:Preparetheadjoint].

In the case of traveltime finitefrequency kernel for one sourcereceiver pair, i.e., point source from the
CMTSOLUTION
, and one station in theSTATIONS_ADJOINT
list, we supply a sample program inutils/adjoint_sources/traveltime/xcreate_adjsrc_traveltime
to cut a certain portion of the original displacement seismograms and convert it into the proper adjoint source to compute the finitefrequency kernel.xcreate_adjsrc_traveltime t1 t2 ifile[05] E/N/Zasciifiles [baz]
where
t1
andt2
are the start and end time of the portion you are interested in,ifile
denotes the component of the seismograms to be used (0 for all three components, 1 for East, 2 for North, and 3 for vertical, 4 for transverse, and 5 for radial component),E/N/Zasciifiles
indicate the threecomponent displacement seismograms in the right order, andbaz
is the backazimuth of the station. Note thatbaz
is only supplied whenifile
= 4 or 5.
Similarly, a sample program to compute adjoint sources for amplitude finitefrequency kernels may be found in
utils/adjoint_sources/amplitude
and used in the same way as described for traveltime measurementsxcreate_adjsrc_amplitude t1 t2 ifile[05] E/N/Zasciifiles [baz]


Run the kernel simulation
With the successful forward simulation and the adjoint source ready in the
SEM/
directory, setSIMULATION_TYPE = 3
andSAVE_FORWARD = .false.
in theDATA/Par_file
(you can usechange_simulation_type.pl b
), and rerun the solver.
The adjoint simulation is launched together with the back reconstruction of the original forward wavefield from the state variables saved from the previous forward simulation, and the finitefrequency kernels are computed by the interaction of the reconstructed forward wavefield and the adjoint wavefield.

The backreconstructed seismograms at the original station locations are saved to the
LOCAL_PATH
at the end of the kernel simulations, and can be collected to the local disk. 
These backconstructed seismograms can be compared with the timereversed original seismograms to assess the accuracy of the backward reconstruction, and they should match very well.

The arrays for density, Pwave speed and Swave speed kernels are also saved in the
LOCAL_PATH
with the namesproc??????_rho(alpha,beta)_kernel.bin
, whereproc??????
represents the processor number,rho(alpha,beta)
are the different types of kernels.


Run the anisotropic kernel simulation
Instead of the kernels for the isotropic wave speeds, you can also compute the kernels for the 21 independent components $C_{IJ},\, I,J=1,...,6$ (using Voigt’s notation) of the elastic tensor in the cartesian coordinate system. This is done by setting
ANISOTROPIC_KL
=
.true.
inDATA/Par_file
before compiling the package. The definition of the parameters $C_{IJ}$ in terms of the corresponding components $c_{ijkl},ijkl,i,j,k,l=1,2,3$ of the elastic tensor in cartesian coordinates follows Chen and Tromp (2007). The 21 anisotropic kernels are saved in theLOCAL_PATH
in one file with the name ofproc??????_cijkl_kernel.bin
(withproc??????
the processor number). The output kernels correspond to absolute perturbations $\delta C_{IJ}$ of the elastic parameters and their unit is in $s/GPa/km^{3}$. For consistency, the output density kernels with this option turned on are for a perturbation $\delta\rho$ (and not $\frac{\delta\rho}{\rho}$) and their unit is in s / (kg/m$^{3}$) / km$^{3}$. These ‘primary’ anisotropic kernels can then be combined to obtain the kernels for different parameterizations of anisotropy. This can be done, for example, when combining the kernel files from slices into one mesh file (see Section [sec:FiniteFrequencyKernels]).If
ANISOTROPIC_KL
=
.true.
by additionally settingSAVE_TRANSVERSE_KL
=
.true.
inDATA/Par_file
the package will save anisotropic kernels parameterized as velocities related to transverse isotropy based on the the Chen and Tromp parameters Chen and Tromp (2007). The kernels are saved as relative perturbations for horizontal and vertical P and S velocities, $\alpha_{v},\alpha_{h},\beta_{v},\beta_{h}$. Explicit relations can be found in appendix B. of Sieminski et al. (2007)
In general, the three steps need to be run sequentially to assure proper access to the necessary files. If the simulations are run through some cluster scheduling system (e.g., LSF), and the forward simulation and the subsequent kernel simulations cannot be assigned to the same set of computer nodes, the kernel simulation will not be able to access the database files saved by the forward simulation. Solutions for this dilemma are provided in Chapter [cha:Scheduler]. Visualization of the finitefrequency kernels is discussed in Section [sec:FiniteFrequencyKernels].
References
Chen, Min, and Jeroen Tromp. 2007. “Theoretical and Numerical Investigations of Global and Regional Seismic Wave Propagation in Weakly Anisotropic Earth Models.” Geophys. J. Int. 168 (3): 1130–52. https://doi.org/10.1111/j.1365246X.2006.03218.x.
Liu, Qinya, and Jeroen Tromp. 2006. “FiniteFrequency Kernels Based on Adjoint Methods.” Bull. Seism. Soc. Am. 96 (6): 2383–97. https://doi.org/10.1785/0120060041.
Liu, Q., and J. Tromp. 2008. “FiniteFrequency Sensitivity Kernels for Global Seismic Wave Propagation Based Upon Adjoint Methods.” Geophys. J. Int. 174 (1): 265–86. https://doi.org/10.1111/j.1365246X.2008.03798.x.
Sieminski, Anne, Qinya Liu, Jeannot Trampert, and Jeroen Tromp. 2007. “FiniteFrequency Sensitivity of Body Waves to Anisotropy Based Upon Adjoint Methods.” Geophys. J. Int. 171: 368–89. https://doi.org/10.1111/j.1365246X.2007.03528.x.
Tromp, Jeroen, Dimitri Komatitsch, and Qinya Liu. 2008. “SpectralElement and Adjoint Methods in Seismology.” Communications in Computational Physics 3 (1): 1–32.
Tromp, Jeroen, Carl Tape, and Qinya Liu. 2005. “Seismic Tomography, Adjoint Methods, Time Reversal and BananaDoughnut Kernels.” Geophys. J. Int. 160 (1): 195–216. https://doi.org/10.1111/j.1365246X.2004.02453.x.
Wald, D. J., and T. H. Heaton. 1994. “Spatial and Temporal Distribution of Slip for the 1992 Landers, California Earthquake.” Bull. Seism. Soc. Am. 84: 668–91.
This documentation has been automatically generated by pandoc based on the User manual (LaTeX version) in folder doc/USER_MANUAL/ (Nov 21, 2022)