acroucher / PyTOUGH

A Python library for automating TOUGH2 simulations of subsurface fluid and heat flow
GNU Lesser General Public License v3.0
96 stars 36 forks source link

[rectgeo] AttributeError: 'NoneType' object has no attribute 'name' #40

Closed dandikcic closed 1 year ago

dandikcic commented 2 years ago

I have a single atmosphere block (ATM 0 dfalt1.0000e+25 ) [Type 0] Geometry file naming convention is 3 characters for column followed by 2 digits for layer [Type0] When I use the rectgeo method I'm having following error:

image Here is the piece of my script: from t2data import * dat = t2data('Cefined06_5.dat') geo =dat.grid.rectgeo(convention=0,atmos_type=0) geo.write('Gcryk.dat')

What is the issue here, could you help me ?

acroucher commented 2 years ago

Are you able to email me your original data file (Cefined06_5.dat)?

I just ran a small test here with the same naming convention and atmosphere type, which worked ok:

from t2data import *

geo = mulgrid().rectangular([100]*5, [120]*4, [10]*10, convention = 0, atmos_type = 0)
dat = t2data()
dat.grid = t2grid().fromgeo(geo)

geo2, blkmap = dat.grid.rectgeo(convention = 0, atmos_type = 0)
dandikcic commented 2 years ago

Thank you for the reply, here is the data file.

I just ran the same test, it worked. Strangely, Cefined06_05.dat crashed.

On Mon, 22 Aug 2022 at 23:16, Adrian Croucher @.***> wrote:

Are you able to email me your original data file (Cefined06_5.dat)?

I just ran a small test here with the same naming convention and atmosphere type, which worked ok:

from t2data import geo = mulgrid().rectangular([100]5, [120]4, [10]10, convention = 0, atmos_type = 0)dat = t2data()dat.grid = t2grid().fromgeo(geo) geo2, blkmap = dat.grid.rectgeo(convention = 0, atmos_type = 0)

— Reply to this email directly, view it on GitHub https://github.com/acroucher/PyTOUGH/issues/40#issuecomment-1223308248, or unsubscribe https://github.com/notifications/unsubscribe-auth/APBHKJ56IINWIKSVCDDPEUDV2QC5DANCNFSM57I3SYLQ . You are receiving this because you authored the thread.Message ID: @.***>

acroucher commented 2 years ago

If you sent an attachment, I'm not sure what happened to it - not sure if you can even do that on a Github comment. Maybe email directly to me at the address here.

acroucher commented 2 years ago

Thanks, I think I see what the problem is. The atmosphere block in your data file has volume 1e25 m3. The rectgeo() method has a parameter atmos_volume which is the "block volume below which blocks are considered part of the geometrical grid", and it defaults to 1e25 m3.

In your case, since you have not specified atmos_volume, this parameter is equal to the atmosphere block volume, not less than it, so it does not identify the atmosphere block. If you pass a smaller value e.g. atmos_volume=1e24 into rectgeo() then it works.

dandikcic commented 2 years ago

In fact, I was also suspecting a bug in atmosphere block (volume, connections). Before opening a new issue, I changed rectgeoparameters and tried to run the script.

Sorry for the lack of information, I should have been more specific. Below you can see my different attempts:

Were you able to run rectgeo after changing the parameters? If yes, it looks like something wrong with my conda package.

acroucher commented 2 years ago

Yes, rectgeo() ran fine for me if I passed in the parameter atmos_volume=1e24.

Are you running the latest version of PyTOUGH (1.5.6)? There was a small change in how the atmos_volume parameter works in rectgeo() in version 1.5.5, if you are running an older version it might behave differently.

dandikcic commented 2 years ago

I was using 1.5.4 before I started new project. Recently updated PyTOUGH 1.5.6 via anaconda3, looks like there is some sort of environment problem. Pip uninstall was not able to remove PyTOUGH libraries and I deleted manually. I will look into my anaconda3\Lib\site-packages as there is no problem with the rectgeo() method.

Thank you for your time.