Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fields #3

Open
rowanc1 opened this issue Apr 9, 2018 · 6 comments
Open

fields #3

rowanc1 opened this issue Apr 9, 2018 · 6 comments

Comments

@rowanc1
Copy link
Member

rowanc1 commented Apr 9, 2018

Sometime we pass around fields? Do we need to?

@lheagy
Copy link
Member

lheagy commented Apr 9, 2018

In the current implementation we need to... for the data misfit it is important, otherwise they will be recomputed: https://github.com/simpeg/simpeg/blob/master/SimPEG/DataMisfit.py#L147

@lheagy
Copy link
Member

lheagy commented Apr 9, 2018

We could think about attaching the fields to the simulation object in future implementations

@rowanc1
Copy link
Member Author

rowanc1 commented Apr 10, 2018

I think that this pulling out is showing where some of the holes are. Fields should be closer to where they are used. The objective functions really shouldn't care that there are dependencies to an operation. These should be captured elsewhere (like the simulation).

I think that we would also have difficulty in the current implementation for a multiphysics inversion? if fields get passed to both objects? Not sure if @thast got around this or it was fine.

@thast
Copy link

thast commented Apr 10, 2018

I do not remember having to change anything and have not notice significant problem.
Here is an example on how I work with 2 data misfit:

Load Data

survey_grav = PF.Gravity.readUBCgravObs(
    "./GRAV_Synthetic_data.obs"
)
survey_mag = PF.Magnetics.readMagneticsObservations(
    "./MAG_Synthetic_data.obs"
)

Wires and mapping

actv = Utils.surface2ind_topo(mesh, topo, gridLoc='N')
actvMap = Maps.InjectActiveCells(mesh, actv, ndv)
wires = Maps.Wires(('den', actvMap.nP), ('sus', actvMap.nP))
gravmap = actvMap * wires.den
magmap = actvMap * wires.sus

Grav problem

prob_grav = PF.Gravity.GravityIntegral(mesh, rhoMap=wires.den, actInd=actv)
# Pair the survey and problem
survey_grav.pair(prob_grav)

Mag problem

prob_mag = PF.Magnetics.MagneticIntegral(mesh, chiMap=wires.sus, actInd=actv)
# Pair the survey and problem
survey_mag.pair(prob_mag)

Data Misfit

dmis_grav = DataMisfit.l2_DataMisfit(survey_grav)
wd_grav = np.ones_like(survey_grav.dobs) * 0.01
dmis_grav.W = 1 / wd_grav
 
dmis_mag = DataMisfit.l2_DataMisfit(survey_mag)
wd_mag = np.ones_like(survey_mag.dobs) * 1.
dmis_mag.W = 1 / wd_mag
 
dmis = dmis_grav + dmis_mag

@rowanc1
Copy link
Member Author

rowanc1 commented Apr 10, 2018

Thanks for the code snippets!

I think this works because they are both linear problems and you don't have to account for the fields in your Jvec calls.

https://github.com/simpeg/simpeg/blob/master/SimPEG/PF/Gravity.py#L124

So although it is probably passing the fields object around, it is never used - and I am not sure which one it would be (mag or grav problem).

@thast
Copy link

thast commented Apr 10, 2018

Thanks for pointing this out @rowanc1 ! True I have not try joint inversion for nonlinear problem yet. I will keep you updated once I've tried it.

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

No branches or pull requests

3 participants