Skip to content

Conversation

xumi1993
Copy link
Owner

No description provided.

@xumi1993 xumi1993 requested a review from Copilot July 30, 2025 17:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements alpha-beta-rho inversion capabilities, allowing the inversion to handle three separate parameters (Vp, Vs, and density) instead of just Vs with empirical relationships. Key changes include:

  • Expansion of gradient and direction arrays from 3D to 4D to accommodate multiple kernel types
  • Addition of new configuration options for alpha-beta-rho inversion with optional density scaling
  • Extension of HDF5 interface to support 4D arrays

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/tomo.f90 Main tomography module updated to handle 4D arrays and conditional alpha-beta-rho processing
src/shared/shared_par.f90 Added global parameters for number of kernels and alpha-beta-rho support
src/shared/utils.f90 Added transpose_4 function for 4D array transposition
src/shared/hdf5_interface.f90 Extended HDF5 interface with 4D array read/write capabilities
src/para.f90 Added configuration parameters for alpha-beta-rho inversion and density scaling
src/optimize.f90 Updated optimization routines to work with 4D gradient and model arrays
src/model.f90 Enhanced model output to include Vp and density when using alpha-beta-rho mode
src/acqui.f90 Modified kernel computation and storage to support multiple parameter types
examples/ Updated example configurations and scripts for new inversion options
CMakeLists.txt Version bump to 1.6.0

am%vp3d = empirical_vp(am%vs3d)
am%rho3d = empirical_rho(am%vp3d)
else
am%vs3d = am%vs3d * (1 + gradient_s(1,:,:,:))
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the steepest_descent subroutine, when use_alpha_beta_rho is false, line 233 applies gradient_s(1,:,:,:) to vs3d, but this should be just gradient_s since the original code (line 228) used gradient_s directly without indexing.

Suggested change
am%vs3d = am%vs3d * (1 + gradient_s(1,:,:,:))
am%vs3d = am%vs3d * (1 + gradient_s)

Copilot uses AI. Check for mistakes.

am%vs3d_opt = am%vs3d * (1 + gradient_ls(1,:,:,:))
am%vp3d_opt = empirical_vp(am%vs3d_opt)
am%rho3d_opt = empirical_rho(am%vp3d_opt)
endif
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra 'endif' statement that doesn't match any corresponding 'if' statement in the prepare_fwd_linesearch subroutine, creating unbalanced control flow.

Suggested change
endif

Copilot uses AI. Check for mistakes.

! read vp model
deallocate(tmp_model)
write(key_name, '("/vp_",I3.3)') iter
call h5read(model_fname, key_name, tmp_model)
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tmp_model should be transposed before assignment, similar to how it's done for model(1,:,:,:) on line 104. It should be: model(2,:,:,:) = transpose_3(tmp_model)

Suggested change
call h5read(model_fname, key_name, tmp_model)
call h5read(model_fname, key_name, tmp_model)
tmp_model = transpose_3(tmp_model)

Copilot uses AI. Check for mistakes.

! read rho model
deallocate(tmp_model)
write(key_name, '("/rho_",I3.3)') iter
call h5read(model_fname, key_name, tmp_model)
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tmp_model should be transposed before assignment, similar to how it's done for model(1,:,:,:) on line 104. It should be: model(3,:,:,:) = transpose_3(tmp_model)

Suggested change
call h5read(model_fname, key_name, tmp_model)
call h5read(model_fname, key_name, tmp_model)
tmp_model = transpose_3(tmp_model)

Copilot uses AI. Check for mistakes.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@xumi1993 xumi1993 changed the base branch from main to devel August 1, 2025 05:18
@xumi1993 xumi1993 merged commit 8345b10 into devel Aug 2, 2025
@xumi1993 xumi1993 deleted the alpha_beta_rho branch August 2, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant