Commit 1d70d286 authored by Feliks Kuba Kiszkurno's avatar Feliks Kuba Kiszkurno
Browse files

Move get_analytical_model out of ogs_compare

parent 99377e40
from AHM.models import heatsource
import numpy as np
# TODO: This should be removed and AHM package should be called directly
def get_analytica_model(parameter_name, x, y, z, t, ogs_model=None):
model = heatsource.ANASOL()
if ogs_model == None:
model.E = 8e9
model.nu = 0.35
model.aprime = 1.5e-5
model.a_s = 1.5e-5
model.a_w = 4.0e-4
model.Q = 152
model.n = 0.18
model.rho_w = 999.1
model.rho_s = 2689.65517241379
model.K_w = 0.6
model.K_s = 2.4
model.vis = 1.0e-3
model.c_w = 4181.3
model.c_s = 995
model.T0 = 288.15
model.k = 5e-20
model.reInit()
else:
model.E = float(
ogs_model.tree.find("./parameters/parameter[name='YoungsModuliClay']/values").text.split(" ")[0])
model.nu = float(
ogs_model.tree.find("./parameters/parameter[name='PoissonsRatiosClay']/values").text.split(" ")[0])
model.a_s = 3 * float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='thermal_expansivity']/value").text)
model.aprime = model.a_s
model.a_w = -float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='density']/independent_variable/slope").text)
model.n = float(ogs_model.tree.find("./media/medium/properties/property[name='porosity']/value").text)
model.rho_w = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='density']/reference_value").text)
model.rho_s = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='density']/value").text)
model.c_w = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='specific_heat_capacity']/value").text)
model.c_s = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='specific_heat_capacity']/value").text)
# ana_model.K_w = float(ogs_model.tree.find(
# "./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='thermal_conductivity']/value").text)
model.K_w = 0.6
model.K_s = float(ogs_model.tree.find(
"./parameters/parameter[name='ThermalConductivityClay']/values").text.split(" ")[0])
# ana_model.vis = float(ogs_model.tree.find(
# "./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='viscosity']/value").text)
model.vis = 0.001137740703477269
model.k = float(
ogs_model.tree.find("./parameters/parameter[name='IntrinsicPermClay']/values").text.split(" ")[0])
model.Q = 2 * float(
ogs_model.tree.find("./parameters/parameter[name='heater']/values").text)
model.T0 = float(ogs_model.tree.find("./parameters/parameter[name='temperature_ic']/values").text)
model.reInit()
# t[0] = 0.01
R = np.sqrt(x ** 2 + y ** 2 + z ** 2)
if parameter_name == 'temperature' or parameter_name == 'temperature_interpolated':
output = model.temperature(R, t)
elif parameter_name == 'pressure' or parameter_name == 'pressure_interpolated':
output = model.porepressure(R, t)
else:
print('Unrecognized parameter name! Skipping analytical model...')
return output
......@@ -13,78 +13,6 @@ from ogs_compare.Tools.detect_experiments import detect_experiments, getfilesbye
from ogs_compare.Tools.legend_without_duplicate_labels import legend_without_duplicate_labels
from ogs_compare.Tools.match_time_step import match_time_step
from AHM.models import heatsource
# TODO: This should be removed and AHM package should be called directly
def get_analytica_model(parameter_name, x, y, z, t, ogs_model=None):
model = heatsource.ANASOL()
if ogs_model == None:
model.E = 8e9
model.nu = 0.35
model.aprime = 1.5e-5
model.a_s = 1.5e-5
model.a_w = 4.0e-4
model.Q = 152
model.n = 0.18
model.rho_w = 999.1
model.rho_s = 2689.65517241379
model.K_w = 0.6
model.K_s = 2.4
model.vis = 1.0e-3
model.c_w = 4181.3
model.c_s = 995
model.T0 = 288.15
model.k = 5e-20
model.reInit()
else:
model.E = float(
ogs_model.tree.find("./parameters/parameter[name='YoungsModuliClay']/values").text.split(" ")[0])
model.nu = float(
ogs_model.tree.find("./parameters/parameter[name='PoissonsRatiosClay']/values").text.split(" ")[0])
model.a_s = 3 * float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='thermal_expansivity']/value").text)
model.aprime = model.a_s
model.a_w = -float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='density']/independent_variable/slope").text)
model.n = float(ogs_model.tree.find("./media/medium/properties/property[name='porosity']/value").text)
model.rho_w = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='density']/reference_value").text)
model.rho_s = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='density']/value").text)
model.c_w = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='specific_heat_capacity']/value").text)
model.c_s = float(ogs_model.tree.find(
"./media/medium/phases/phase[type='Solid']/properties/property[name='specific_heat_capacity']/value").text)
# ana_model.K_w = float(ogs_model.tree.find(
# "./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='thermal_conductivity']/value").text)
model.K_w = 0.6
model.K_s = float(ogs_model.tree.find(
"./parameters/parameter[name='ThermalConductivityClay']/values").text.split(" ")[0])
# ana_model.vis = float(ogs_model.tree.find(
# "./media/medium/phases/phase[type='AqueousLiquid']/properties/property[name='viscosity']/value").text)
model.vis = 0.001137740703477269
model.k = float(
ogs_model.tree.find("./parameters/parameter[name='IntrinsicPermClay']/values").text.split(" ")[0])
model.Q = 2 * float(
ogs_model.tree.find("./parameters/parameter[name='heater']/values").text)
model.T0 = float(ogs_model.tree.find("./parameters/parameter[name='temperature_ic']/values").text)
model.reInit()
# t[0] = 0.01
R = np.sqrt(x ** 2 + y ** 2 + z ** 2)
if parameter_name == 'temperature' or parameter_name == 'temperature_interpolated':
output = model.temperature(R, t)
elif parameter_name == 'pressure' or parameter_name == 'pressure_interpolated':
output = model.porepressure(R, t)
else:
print('Unrecognized parameter name! Skipping analytical model...')
return output
def read_data(experiments_to_include, field_to_read, points, results_folder):
SEC2A = 1 / (356 * 24 * 60 * 60) # time in seconds to time in years
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment