gimu 0.5.0__tar.gz → 0.6.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gimu
3
- Version: 0.5.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
@@ -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
+
@@ -99,14 +99,14 @@ def compute_rocktypes(rocktype_json, warn=True):
99
99
  rt['conductivity'] = [rocktype_json[base_name]['conductivity'][0] * c_modifier]
100
100
  else:
101
101
  if 'conductivity' in rt:
102
- print(f"Rocktype {rt_name} remove conductivity because no conductivity in base rocktype {base_name}")
102
+ print(f"(gimu) Rocktype {rt_name} remove conductivity because no conductivity in base rocktype {base_name}")
103
103
  del rt['conductivity']
104
104
  else:
105
105
  msg = f"Base rocktype {base_name} not found for rocktype {rt_name}"
106
106
  if warn:
107
107
  raise Exception(msg)
108
108
  else:
109
- print("Warning: " + msg)
109
+ print("(gimu) Warning: " + msg)
110
110
  rt['error'] = msg
111
111
 
112
112
 
@@ -116,10 +116,10 @@ def update_waiwera_model_rocktypes(wjson, rtjson, skip_missing=True):
116
116
  for rt in wjson['rock']['types']:
117
117
  if rt['name'] not in rtjson:
118
118
  if skip_missing:
119
- print(f"Rocktype {rt['name']} not found in _rocktypes.json... skipped")
119
+ print(f"(gimu) Rocktype {rt['name']} not found in _rocktypes.json... skipped")
120
120
  continue
121
121
  else:
122
- raise Exception(f"Rocktype {rt['name']} not found in _rocktypes.json")
122
+ raise Exception(f"(gimu) Rocktype {rt['name']} not found in _rocktypes.json")
123
123
  modifier = rtjson[rt['name']]
124
124
  rt['permeability'] = modifier['permeability']
125
125
  rt['porosity'] = modifier['porosity'][0]
@@ -133,10 +133,10 @@ def update_aut2_model_rocktypes(dat, rtjson, skip_missing=True):
133
133
  for rt in dat.grid.rocktypelist:
134
134
  if rt.name not in rtjson:
135
135
  if skip_missing:
136
- print(f"Rocktype {rt.name} not found in _rocktypes.json... skipped")
136
+ print(f"(gimu) Rocktype {rt.name} not found in _rocktypes.json... skipped")
137
137
  continue
138
138
  else:
139
- raise Exception(f"Rocktype {rt.name} not found in _rocktypes.json")
139
+ raise Exception(f"(gimu) Rocktype {rt.name} not found in _rocktypes.json")
140
140
  modifier = rtjson[rt.name]
141
141
  rt.permeability = modifier['permeability']
142
142
  rt.porosity = modifier['porosity'][0]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes