Hi,
I ran into this problem while using OGS-Tools dev version of gen_bhe_mesh():
It created a nice mesh but without soil_temperature as vector-property. So I got this error:
The PropertyVector 'temperature_soil' is not available in the mesh.
This is my code:
tmp_dir = Path(mkdtemp())
for length in bhe_lengths:
print(f"start mesh {datetime.datetime.now()}")
vtu_file = tmp_dir / f"bhe_mesh_len_{length}.vtu"
bhe_meshes = gen_bhe_mesh(
length=150,
width=150,
layer=[20, 50, 50],
groundwater=(-10, 1, "+x"),
BHE_Array=[
(44, 44, -1, -100, 0.076),
(44, 50, -1, -100, 0.076),
(44, 56, -1, -100, 0.076),
(50, 44, -1, -100, 0.076),
(50, 50, -1, -100, 0.076),
(50, 56, -1, -100, 0.076),
(56, 44, -1, -100, 0.076),
(56, 50, -1, -100, 0.076),
(56, 56, -1, -100, 0.076),
],
meshing_type="prism",
out_name=vtu_file,
)
print(f"finish mesh {datetime.datetime.now()}")
#============ Define the .prj-File with ogs6py=====================================================================================
model = OGS(PROJECT_FILE="HeatTransportBHE_ogs6py_len_" + str(length) +".prj", MKL=False)
for mesh in bhe_meshes:
print(mesh)
model.mesh.add_mesh(filename=tmp_dir / mesh)
model.processes.set_process(
name="HeatTransportBHE",
type="HEAT_TRANSPORT_BHE",
integration_order="2")
model.processes.add_process_variable(process_variable="process_variable",
process_variable_name="temperature_soil")
model.processes.add_process_variable(process_variable="process_variable",
process_variable_name="temperature_BHE1")
model.processes.add_bhe_type(process_tree = model.processes.tree, bhe_type = "2U")
model.processes.add_bhe_component(comp_type = "borehole",
length = repr(length),
diameter = "0.152")
model.processes.add_bhe_component(comp_type = "pipes",
inlet_diameter = "0.0262",
inlet_wall_thickness = "0.0029",
inlet_wall_thermal_conductivity = "0.4",
outlet_diameter = "0.0262",
outlet_wall_thickness = "0.0029",
outlet_wall_thermal_conductivity = "0.4",
distance_between_pipes = "0.06",
longitudinal_dispersion_length = "0.001")
model.processes.add_bhe_component(comp_type = "flow_and_temperature_control",
type = "FixedPowerConstantFlow",
power = "-1000",
flow_rate = "0.00037")
model.processes.add_bhe_component(comp_type = "grout",
density = "1",
porosity = "0",
specific_heat_capacity = "1910000",
thermal_conductivity = "0.6")
model.processes.add_bhe_component(comp_type = "refrigerant",
density = "1052",
viscosity = "0.0052",
specific_heat_capacity = "3795",
thermal_conductivity = "0.48",
reference_temperature = "20")
model.processvars.set_ic(process_variable_name="temperature_soil",
components="1",
order="1",
initial_condition="T0")
model.processvars.add_bc(process_variable_name="temperature_soil",
mesh= "bhe_mesh_len_" + str(length) + "_physical_group_Top_Surface",
type="Dirichlet",
parameter="T_Surface")
model.processvars.add_bc(process_variable_name="temperature_soil",
mesh="bhe_mesh_len_" + str(length) + "_physical_group_Bottom_Surface",
type="Neumann",
parameter="dT_Groundsource")
model.processvars.add_bc(process_variable_name="temperature_soil",
mesh="bhe_mesh_len_" + str(length) + "_physical_group_Groundwater_Inflow_0",
type="Dirichlet",
parameter="T_Inflow")
model.processvars.set_ic(process_variable_name="temperature_BHE1",
components="8",
order="1",
initial_condition="T0_BHE1")
model.media.add_property(medium_id="0",
phase_type="Solid",
name="specific_heat_capacity",
type="Constant",
value="2150000")
model.media.add_property(medium_id="0",
phase_type="Solid",
name="density",
type="Constant",
value="1")
model.media.add_property(medium_id="0",
phase_type="AqueousLiquid",
name="phase_velocity",
type="Constant",
value="0 0 0")
model.media.add_property(medium_id="0",
phase_type="AqueousLiquid",
name="specific_heat_capacity",
type="Constant",
value="4000")
model.media.add_property(medium_id="0",
phase_type="AqueousLiquid",
name="density",
type="Constant",
value="1000")
model.media.add_property(medium_id="0",
name="porosity",
type="Constant",
value="0.1")
model.media.add_property(medium_id="0",
name="thermal_conductivity",
type="Constant",
value="2.5")
model.media.add_property(medium_id="0",
name="thermal_longitudinal_dispersivity",
type="Constant",
value="0")
model.media.add_property(medium_id="0",
name="thermal_transversal_dispersivity",
type="Constant",
value="0")
model.media.add_property(medium_id="1",
phase_type="Solid",
name="specific_heat_capacity",
type="Constant",
value="1800000")
model.media.add_property(medium_id="1",
phase_type="Solid",
name="density",
type="Constant",
value="1")
model.media.add_property(medium_id="1",
phase_type="AqueousLiquid",
name="phase_velocity",
type="Constant",
value="0 2e-7 0")
model.media.add_property(medium_id="1",
phase_type="AqueousLiquid",
name="specific_heat_capacity",
type="Constant",
value="4000")
model.media.add_property(medium_id="1",
phase_type="AqueousLiquid",
name="density",
type="Constant",
value="1000")
model.media.add_property(medium_id="1",
name="porosity",
type="Constant",
value="0.1")
model.media.add_property(medium_id="1",
name="thermal_conductivity",
type="Constant",
value="2")
model.media.add_property(medium_id="1",
name="thermal_longitudinal_dispersivity",
type="Constant",
value="0")
model.media.add_property(medium_id="1",
name="thermal_transversal_dispersivity",
type="Constant",
value="0")
model.timeloop.add_process(process="HeatTransportBHE",
nonlinear_solver_name="basic_picard",
convergence_type="DeltaX",
norm_type="NORM2",
reltol="1e-3",
time_discretization="BackwardEuler")
model.timeloop.set_stepping(process="HeatTransportBHE",
type="FixedTimeStepping",
t_initial="0",
t_end="31104000",
repeat="30",
delta_t="1036800")
model.timeloop.add_output(
type="VTK",
prefix="HeatTransportBHE_ogs6py_len_" + str(length),
repeat="1",
each_steps="1",
variables=["temperature_soil", "temperature_BHE1"])
model.parameters.add_parameter(name="T0",
type="MeshNode",
mesh="bhe_mesh_len_" + str(length)+"_domain",
field_name="temperature_soil")
model.parameters.add_parameter(name="T0_BHE1",
type="Constant",
values="11 11 11 11 11 11 11 11")
model.parameters.add_parameter(name="T_Surface",
type="CurveScaled",
curve="surface_temperature",
parameter="T_CurveScaled")
model.parameters.add_parameter(name="T_CurveScaled",
type="Constant",
value="1")
model.parameters.add_parameter(name="T_Inflow",
type="MeshNode",
mesh="bhe_mesh_len_" + str(length) + "_physical_group_Groundwater_Inflow_0",
field_name="temperature_soil")
model.parameters.add_parameter(name="dT_Groundsource",
type="Constant",
value="0.06")
model.curves.add_curve(name="surface_temperature",
coords=["0 3600"],
values=["10 12"])
model.nonlinsolvers.add_non_lin_solver(name="basic_picard",
type="Picard",
max_iter="500",
linear_solver="general_linear_solver")
model.linsolvers.add_lin_solver(name="general_linear_solver",
kind="lis",
solver_type="cg",
precon_type="jacobi",
max_iteration_step="100",
error_tolerance="1e-8")
model.linsolvers.add_lin_solver(name="general_linear_solver",
kind="eigen",
solver_type="BiCGSTAB",
precon_type="ILUT",
max_iteration_step="100",
error_tolerance="1e-8")
model.linsolvers.add_lin_solver(name="general_linear_solver",
kind="petsc",
prefix="gw",
solver_type="cg",
precon_type="bjacobi",
max_iteration_step="100",
error_tolerance="1e-8")
model.write_input()
print("project file saved")
print(datetime.datetime.now())
#================== Run ogs with ogs6py ============================================================================================
# To run the simulation in ogs, please use the commented out code in the next line and add ogs.exe to the directory of this example file
model.run_model(logfile="HeatTransportBHE_ogs6py_len_" + str(length) + ".log")
print(datetime.datetime.now())