Skip to content

extend PhysicalParams#16

Open
apgahlot wants to merge 3 commits into
mainfrom
ext_PhyParams
Open

extend PhysicalParams#16
apgahlot wants to merge 3 commits into
mainfrom
ext_PhyParams

Conversation

@apgahlot

@apgahlot apgahlot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Added a dispatch for PhysicalParameter and made some changes in the adjoint operator so that it returns a PhysicalParameter. Included space_offset() to support lsqr.

Comment thread src/subsurface_gather.jl Outdated

import JUDI: AbstractSize

space_offset(N::NTuple{2,<:Integer}, nh::Integer) = AbstractSize((:h, :x, :z), (nh, N[1], N[2]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Likely need the 3d too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

Comment thread src/subsurface_gather.jl Outdated
JUDI.update!(F.options, options)
offsets = Vector{D}(offsets)
return judiExtendedJacobian{D, :born, typeof(F)}(F.m, space(F.model.n), F, q, offsets, omni)
#return judiExtendedJacobian{D, :born, typeof(F)}(F.m, space(F.model.n), F, q, offsets, omni)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Leftover?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

modified space_offset to include offset dimension

Comment thread src/subsurface_gather.jl Outdated


# --- Adjoint: loop over all sources, sum gradient volumes ---
function JUDI.multi_src_propagate(J::judiExtendedJacobian{T, :adjoint_born, O},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That doesn't look right this should still be in JUDI, because right now it bypasses all the parallelism and stuff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed this entirely and removed PhysicalParameter extension as it was creating JUDI compatibility issues especially with _project_to_physical_domain in propagation.jl. Adjoint born returns plain vector and lsqr works fine as I include a fix in a new commit. Appreciate your review!

@mloubout mloubout left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some comments, some simple test with PhysicalParameter would be good

Comment thread src/subsurface_gather.jl
end

# Avoids PhysicalParameter issue with lsqr!
import Base: similar

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

top of the file

Comment thread src/subsurface_gather.jl
end

# Handle both 1D and 2D offset dimensions
space_offset(N::NTuple{2,<:Integer}, nh::Integer, ndim::Integer) = ndim == 1 ? AbstractSize((:h, :x, :z), (nh, N[1], N[2])) : AbstractSize((:hx, :hz, :x, :z), (nh, nh, N[1], N[2]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is only 2D misses (x, y , z)

Comment thread src/subsurface_gather.jl
end

# Forward: multi_src_propagate redirects
function JUDI.multi_src_propagate(J::judiExtendedJacobian{T, :born, O},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this belongs in JUDI for judiComposedPropagator

Comment thread src/subsurface_gather.jl
return JUDI.multi_src_propagate(J, vec(dm))
end

function JUDI.multi_src_propagate(J::judiExtendedJacobian{T, :born, O},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

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.

2 participants