gimu 0.4.0__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ """ handle GMF's boundary condition
2
+
3
+
4
+
5
+ """
6
+
7
+ def cell2block(geo, cell):
8
+ """ returns mulgrid block name (str) of a cell id (int) """
9
+ return geo.block_name_list[geo.num_atmosphere_blocks:][cell]
10
+
11
+ def update_waiwera_model_heat_bc(geo, wjson, bcjson):
12
+ """ bcjson is loaded from the GMF modifier _boundary_conditions.json
13
+ """
14
+ # heat component
15
+ if wjson['eos']['name'] == 'wae':
16
+ heat_components = [3, 'energy']
17
+ else:
18
+ raise NotImplementedError(f"(gimu) EOS {wjson['eos']['name']} not implemented")
19
+
20
+
21
+ if 'Heat' not in bcjson:
22
+ return
23
+ heat_bc = bcjson['Heat']
24
+ default_flux = float(heat_bc['Default']['Heat_Flux'])
25
+ count = 0
26
+ for src in wjson['source']:
27
+ if 'component' in src:
28
+ if src['component'] in heat_components:
29
+ block_name = cell2block(geo, src['cell'])
30
+ column_name = geo.column_name(block_name)
31
+ area = geo.column[column_name].area
32
+ flux = default_flux
33
+ for zone_name, zone in heat_bc.get('Zones', {}).items():
34
+ if column_name in zone['Columns']:
35
+ flux = float(zone['Heat_Flux'])
36
+ break
37
+ src['rate'] = area * flux
38
+ count += 1
39
+ # print(f"Updated {src['name']} heatflow")
40
+ print(f"(gimu) Updated heatflow in {count} sources")
41
+
42
+
43
+ def update_aut2_model_heat_bc(geo, dat, bcjson):
44
+ if 'Heat' not in bcjson:
45
+ return
46
+ heat_bc = bcjson['Heat']
47
+ default_flux = float(heat_bc['Default']['Heat_Flux'])
48
+ count = 0
49
+ for gen in dat.generatorlist:
50
+ if gen.type == 'HEAT':
51
+ block_name = gen.block
52
+ column_name = geo.column_name(block_name)
53
+ area = geo.column[column_name].area
54
+ flux = default_flux
55
+ for zone_name, zone in heat_bc.get('Zones', {}).items():
56
+ if column_name in zone['Columns']:
57
+ flux = float(zone['Heat_Flux'])
58
+ break
59
+ gen.gx = area * flux
60
+ count += 1
61
+ # print(f"Updated {gen.name} heatflow")
62
+ print(f"(gimu) Updated heatflow in {count} generators")
63
+
64
+
gimu/gmf/modifier.py CHANGED
@@ -85,17 +85,28 @@ def compute_rocktypes(rocktype_json, warn=True):
85
85
  float(rt['modifier']['k2'][0]),
86
86
  float(rt['modifier']['k3'][0]),
87
87
  ]
88
- # update permeability in place
89
- if rt['base'][0] in rocktype_json:
88
+ c_modifier = 1.0
89
+ if 'conductivity' in rt['modifier']:
90
+ c_modifier = float(rt['modifier']['conductivity'][0])
91
+ # update values in place
92
+ base_name = rt['base'][0]
93
+ if base_name in rocktype_json:
90
94
  rt['permeability'] = [k * m for k, m in zip(
91
- rocktype_json[rt['base'][0]]['permeability'], k_modifier)]
92
- rt['porosity'][0] = rocktype_json[rt['base'][0]]['porosity'][0] * rt['modifier']['porosity'][0]
95
+ rocktype_json[base_name]['permeability'], k_modifier)]
96
+ rt['porosity'][0] = rocktype_json[base_name]['porosity'][0] * rt['modifier']['porosity'][0]
97
+ if 'conductivity' in rocktype_json[base_name]:
98
+ # print(f"Rocktype {rt_name} use conductivity from base rocktype {base_name}")
99
+ rt['conductivity'] = [rocktype_json[base_name]['conductivity'][0] * c_modifier]
100
+ else:
101
+ if 'conductivity' in rt:
102
+ print(f"(gimu) Rocktype {rt_name} remove conductivity because no conductivity in base rocktype {base_name}")
103
+ del rt['conductivity']
93
104
  else:
94
- msg = f"Base rocktype {rt['base'][0]} not found for rocktype {rt_name}"
105
+ msg = f"Base rocktype {base_name} not found for rocktype {rt_name}"
95
106
  if warn:
96
107
  raise Exception(msg)
97
108
  else:
98
- print("Warning: " + msg)
109
+ print("(gimu) Warning: " + msg)
99
110
  rt['error'] = msg
100
111
 
101
112
 
@@ -105,13 +116,16 @@ def update_waiwera_model_rocktypes(wjson, rtjson, skip_missing=True):
105
116
  for rt in wjson['rock']['types']:
106
117
  if rt['name'] not in rtjson:
107
118
  if skip_missing:
108
- print(f"Rocktype {rt['name']} not found in _rocktypes.json... skipped")
119
+ print(f"(gimu) Rocktype {rt['name']} not found in _rocktypes.json... skipped")
109
120
  continue
110
121
  else:
111
- raise Exception(f"Rocktype {rt['name']} not found in _rocktypes.json")
122
+ raise Exception(f"(gimu) Rocktype {rt['name']} not found in _rocktypes.json")
112
123
  modifier = rtjson[rt['name']]
113
124
  rt['permeability'] = modifier['permeability']
114
125
  rt['porosity'] = modifier['porosity'][0]
126
+ if 'conductivity' in modifier:
127
+ rt['wet_conductivity'] = modifier['conductivity'][0]
128
+ rt['dry_conductivity'] = modifier['conductivity'][0]
115
129
 
116
130
  def update_aut2_model_rocktypes(dat, rtjson, skip_missing=True):
117
131
  """ rtjson is loaded from the GMF modifier _rocktypes.json
@@ -119,11 +133,13 @@ def update_aut2_model_rocktypes(dat, rtjson, skip_missing=True):
119
133
  for rt in dat.grid.rocktypelist:
120
134
  if rt.name not in rtjson:
121
135
  if skip_missing:
122
- print(f"Rocktype {rt.name} not found in _rocktypes.json... skipped")
136
+ print(f"(gimu) Rocktype {rt.name} not found in _rocktypes.json... skipped")
123
137
  continue
124
138
  else:
125
- raise Exception(f"Rocktype {rt.name} not found in _rocktypes.json")
139
+ raise Exception(f"(gimu) Rocktype {rt.name} not found in _rocktypes.json")
126
140
  modifier = rtjson[rt.name]
127
141
  rt.permeability = modifier['permeability']
128
142
  rt.porosity = modifier['porosity'][0]
143
+ if 'conductivity' in modifier:
144
+ rt.conductivity = modifier['conductivity'][0]
129
145
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gimu
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: A toolkit and python library for modelling at Geothermal Institute, University of Auckland.
5
5
  Project-URL: Documentation, https://github.com/cyeh015/gimu/blob/main/README.md
6
6
  Project-URL: Issues, https://github.com/cyeh015/gimu/issues
@@ -8,10 +8,11 @@ gimu/t2listingh5.py,sha256=sepCah3lV6etWr-aJ_Tc9d3Rubio7DitEn0SQP2oJ2E,16628
8
8
  gimu/waiwera_copy.py,sha256=G84UQWbVq--cfkETCs_jpcquTL-x5SftAFNNNs3GfJs,1286
9
9
  gimu/waiwera_listing.py,sha256=c7moQY8DQEH_MqLUuhrinnkEHnDMKWx4srChffXoK6I,27787
10
10
  gimu/gmf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ gimu/gmf/boundary_conditions.py,sha256=lknJrVwOuT_fl5nhD9hVQeNzWj6tkQcVp9gkDVFLLKU,2205
11
12
  gimu/gmf/data.py,sha256=KoPfSMVzon17ZFZRIUOOQwluv7FMzDQTYzq46xoJGpI,3583
12
- gimu/gmf/modifier.py,sha256=WkZ0Bu36jGUglnCKNPsGwsZBBsadOpibH4NWsyAlmTQ,4766
13
- gimu-0.4.0.dist-info/METADATA,sha256=ilC3EsUPzHnf_7l-dYSGBJeicLAXh4-46HV8QRZcQm0,2320
14
- gimu-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
- gimu-0.4.0.dist-info/entry_points.txt,sha256=FbtLXv_XXn6Wh2DXRsqJpTp85lxEvJiE36TTUTa0e1o,129
16
- gimu-0.4.0.dist-info/licenses/LICENSE.txt,sha256=E2nlaUhQtke9PAEhVEbZfNCPa-qJYGSeuR6Q3f6XgOM,1121
17
- gimu-0.4.0.dist-info/RECORD,,
13
+ gimu/gmf/modifier.py,sha256=6RZe-kN4vz8gBYXzeDQQOreesb9NRt87N6Roi71jUXY,5758
14
+ gimu-0.6.0.dist-info/METADATA,sha256=o_GrlBFVZsMcygu3rkVRC_UqoDDW0_g9WzC90ml8Wkk,2320
15
+ gimu-0.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
+ gimu-0.6.0.dist-info/entry_points.txt,sha256=FbtLXv_XXn6Wh2DXRsqJpTp85lxEvJiE36TTUTa0e1o,129
17
+ gimu-0.6.0.dist-info/licenses/LICENSE.txt,sha256=E2nlaUhQtke9PAEhVEbZfNCPa-qJYGSeuR6Q3f6XgOM,1121
18
+ gimu-0.6.0.dist-info/RECORD,,
File without changes