adjtomo/seisflows

adj_source

Closed this issue · 2 comments

my parameters.yaml is

workflow: inversion
system: workstation
solver: specfem2d
preprocess: pyaflowa
optimize: LBFGS
data_case: synthetic
stop_after: null
export_traces: False
export_residuals: False
export_gradient: True
export_kernels: False
start: 1
end: 1
export_model: True
thrifty: False
iteration: 1
ntask: 3
nproc: 1
mpiexec: null
log_level: DEBUG
verbose: False
syn_data_format: ascii
materials: elastic
density: False
attenuation: False
smooth_h: 1500.0
smooth_v: 750.0
components: ZX
source_prefix: SOURCE
multiples: False
min_period: 10.0
max_period: 200.0
filter_corners: 4
client: null
rotate: False
pyflex_preset: null
fix_windows: False
adj_src_type: cc_traveltime
plot: True
pyatoa_log_level: DEBUG
unit_output: DISP
export_datasets: True
export_figures: True
export_log_files: True
preconditioner: null
step_count_max: 5
step_len_init: 0.05
step_len_max: 0.5
line_search_method: Backtrack
LBFGS_mem: 3
LBFGS_max: inf
LBFGS_thresh: 0.0

after type seisflows submit in terminal, the traces filename in the "adj" folder such as "AA.S0001.HXZ.adj", rather than "AA.S0001.BXZ.adj". This issue can cause the following errors in seisflows.

================================================================================
                             EXTERNAL SOLVER ERROR                              
                             /////////////////////                              
The external numerical solver has returned a nonzero exit code (failure).
Consider stopping any currently running jobs to avoid wasted computational
resources. Check 'scratch/solver/mainsolver/adj_solver.log' for the solvers
stdout log message. The failing command and error message are:

exc: bin/xspecfem2D
err: Command 'bin/xspecfem2D' returned non-zero exit status 2.
================================================================================

the following error log in adj_solver.log

adjoint sources:
   adjoint source type:           1
   reading ASCII adjoint source files
At line 226 of file src/specfem2D/compute_arrays_source.f90 (unit = 40, file = 'SEM/AA.S0001.BXX.adj')
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x7f9417623ad0 in ???
#1  0x7f9417624649 in ???
#2  0x7f941762527f in ???
#3  0x7f94178784ab in ???
#4  0x7f9417871994 in ???
#5  0x7f94178725ba in ???
#6  0x556a063f3484 in read_adj_source_
	at src/specfem2D/compute_arrays_source.f90:226
#7  0x556a06533d10 in setup_adjoint_sources_
	at src/specfem2D/setup_sources_receivers.F90:620
#8  0x556a0653774b in setup_sources_receivers_
	at src/specfem2D/setup_sources_receivers.F90:50
#9  0x556a063c8834 in specfem2d
	at src/specfem2D/specfem2D.F90:380
#10  0x556a063c8834 in main
	at src/specfem2D/specfem2D.F90:357

How should I troubleshoot the error and solve this problem so that the file name generated in file A contains ‘B’ instead of 'H'

bch0w commented

Hi @AFULLBOTTLE-FAN, thanks for opening this issue, I'm sorry it's taken a few weeks to get around to it!

So my understanding of the issue is that SPECFEM is expecting a different channel code ("BX?") than what is written out by SeisFlows ("HX?"). Since you are using Pyaflowa as your preprocessing class, the adjoint source writing is taken care of by Pyadjoint under the hood, which uses the channel code of the observed data to name the adjoint source file.

However, during the preprocessing, the observed data should be resampled to the sampling rate of the synthetics, so that they share the same channel code.

Can you let me know what the sampling rate of your data and synthetics are for this problem? That will be a good start in finding the underlying issue.

Closing this issue for inactivity, if this issue persists please re-open as a new issue and reference this issue number, thanks!