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

The cellMarkers is different before and after the inversion process AND inversion mesh setting #717

Closed
p56075607 opened this issue May 14, 2024 · 2 comments
Assignees
Labels

Comments

@p56075607
Copy link

Problem description

I found that the original input inversion mesh cellMarkers is different from the mgr.paraDomain.
And can we set the inversion mesh to inversionDomain, while the forward task mesh is grid?

Your environment


Date: Tue May 14 15:41:44 2024 Taipei Standard Time

            OS : Windows
        CPU(s) : 32
       Machine : AMD64
  Architecture : 64bit
           RAM : 50.0 GiB
   Environment : Jupyter

Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC
v.1937 64 bit (AMD64)]

       pygimli : 1.5.0
        pgcore : 1.5.0
         numpy : 1.26.4
    matplotlib : 3.8.4
         scipy : 1.13.0
       IPython : 8.22.2
       pyvista : 0.43.5

Steps to reproduce

# %%
import numpy as np
import pygimli as pg
from pygimli.physics import ert  # the module
import pygimli.meshtools as mt
from os.path import join

data = ert.load('data.ohm')

left = min(pg.x(data))
right = max(pg.x(data))
depth = 18.5
yDevide = 1.0 - np.logspace(np.log10(1.0), np.log10(depth+1),50 )
xDevide = np.linspace(start=left, stop=right, num=200)
inversionDomain = pg.createGrid(x=xDevide,
                                y=yDevide[::-1],
                                marker=2
                                )
pg.show(inversionDomain, markers=True)
print(inversionDomain.cellMarkers())

grid = pg.meshtools.appendTriangleBoundary(inversionDomain,xbound=1000,ybound=1000,quality=33, marker=1)
pg.show(grid, markers=True)

# %%
# Creat the ERT Manager
mgr = ert.ERTManager(data)
model = mgr.invert(data,mesh=grid,lam=100,verbose=True)

print(mgr.paraDomain.cellMarkers())

Expected behavior

Does the mesh cellMarkers should be the same before and after the inversion process?

Actual behavior

print(inversionDomain.cellMarkers())

9751 [2,...,2]

print(mgr.paraDomain.cellMarkers())

9751 [0,...,9750]

By the way, can I set the inversion mesh to inversionDomain, while the forward task mesh is grid?
Because when I use the code I attach above, the forward mesh is very fine and take lots of time to calculate.
data.zip

@halbmy halbmy self-assigned this May 15, 2024
@halbmy
Copy link
Contributor

halbmy commented May 15, 2024

You are right: internally, the cell markers (that define the inversion regions) are renumbered in the inversion process according to the inversion settings:

  • background (or fixed) regions are removed from the inversion mesh
  • cells in single regions obtain the same marker so that the model vector value is mapped to the entire region
  • other cells are numbered in ascending order according to the region numbers
    This is needed to display the inversion result properly. We should clarify this, maybe best in the region tutorial
    https://www.pygimli.org/_tutorials_auto/3_inversion/plot_8-regionWise.html

Up to now, we only set one mesh, and its region markers define the behaviour. The inversion mesh is a submesh of this and the forward mesh is a (p or h) refined version of it. This is also the case for you.

One could, however, override the inversion mesh, but a connection to the forward mesh (on which forward response and Jacobian are computed) will be needed, e.g. by interpolation.

@halbmy
Copy link
Contributor

halbmy commented May 26, 2024

As there was no answer, I consider this question answered and close the issue.

@halbmy halbmy closed this as completed May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants