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

createworld 3D model layering #679

Open
kangbow opened this issue Mar 20, 2024 · 4 comments
Open

createworld 3D model layering #679

kangbow opened this issue Mar 20, 2024 · 4 comments
Assignees

Comments

@kangbow
Copy link

kangbow commented Mar 20, 2024

Problem description

How to divide the 3D model formed in createworld into three layers according to depth, mark them, and fix the resistivity according to the marks in the setRegulation below for inversion

Your environment

Please provide the output of print(pygimli.Report()) here. If that does not
work, please give provide some additional information on your:

            OS : Windows
        CPU(s) : 16
       Machine : AMD64
  Architecture : 64bit
   Environment : Python

Python 3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:29:04) [MSC
v.1929 64 bit (AMD64)]

       pygimli : 1.4.6
        pgcore : 1.4.0
         numpy : 1.26.4
    matplotlib : 3.7.2
         scipy : 1.11.2
        tetgen : 0.6.4
       pyvista : 0.43.2

Steps to reproduce

Tell us how to reproduce this issue. Ideally, you could paste the code that produces the error:

from pygimli.physics import ert
import pygimli as pg
import numpy as np
import matplotlib.pyplot as plt
import pygimli.meshtools as mt
cube_region_1=mt.createWorld(start=[-10, -10,-40], end=[140, 10,0],worldMarker=True,marker=1)
cube_region_2=mt.createCube(size=[128, 0.4, 40], pos=[128/2, 0, -40/2],marker=2)
start_model=cube_region_1+cube_region_2
pg.show(start_model,alpha=0.3,markers=True)
filename = "cp32.shm"
shm = pg.DataContainerERT(filename)
data=ert.load(filename)
data['k']=ert.geometricFactors(data)
data['rhoa']=data['k']*data['u']/data['i']*1000
data.remove(data['rhoa']<0)
data['err'] = ert.estimateError(data,relativeError=0.02)
for s in shm.sensors():
    start_model.createNode(s)
for s in shm.sensorPositions():
    start_model.createNode(s - [0,0,1e-2/2])
inversion_mesh= mt.createMesh(start_model,quality=1.4)
mgr=ert.ERTManager()
mgr.setData(data)
mgr.setMesh(inversion_mesh)
mgr.inv.setRegularization(1, background=True)
mgr.inv.setRegularization(1,fix=200)
mgr.inv.setRegularization(2,startModel=1e4,limits=[100,1e4+20])
mgr.invert(lam=10,zWeight=0.1,verbose=True)
mgr.saveResult()
mgr.showMisfit()

Expected behavior

divide the 3D model formed in createworld into three layers according to depth, mark them, and fix the resistivity according to the marks in the setRegulation below for inversion

Actual behavior

Tell us what happens instead and/or provide the output of your script.

If possible, please add one or more labels to your issue, e.g. if you expect that your issue is rather a question than a problem with the code, please add the label "question".

@halbmy
Copy link
Contributor

halbmy commented Mar 20, 2024

So far, the code looks good but you did neither tell us what's going wrong (under Actual behaviour) nor attach the data file to run the code.

@kangbow
Copy link
Author

kangbow commented Mar 20, 2024

There is no problem with the code, I want to layer it according to depth and set markers based on this world model. In the following code, different values are set according to the tags, and I cannot write such code. I would like to ask for your advice

mgr.inv.setRegularization(1, background=True)
mgr.inv.setRegularization(1,fix=200)

到目前为止,代码看起来不错,但您既没有告诉我们出了什么问题(在_“实际行为_”下),也没有附加数据文件来运行代码。

@halbmy
Copy link
Contributor

halbmy commented Mar 20, 2024

You just need the second line. The fix argument implies background. It is a background region that is just not prolongated, but filled with a constant value.

@halbmy halbmy self-assigned this Mar 20, 2024
@halbmy
Copy link
Contributor

halbmy commented Mar 20, 2024

However, I still don't get the actual problem. Can you please describe what's going wrong?

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

2 participants