Skip to content
Snippets Groups Projects
Commit 0e44a5a4 authored by Florian Zill's avatar Florian Zill
Browse files

[studies] use plot_diff in convergence study

parent c313cea5
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ for sim_result, dt in zip(sim_results, time_step_sizes): ...@@ -91,7 +91,7 @@ for sim_result, dt in zip(sim_results, time_step_sizes):
for ts in mesh_series.timesteps: for ts in mesh_series.timesteps:
mesh = mesh_series.read(ts) mesh = mesh_series.read(ts)
results["temperature"] += [np.max(mesh.point_data["temperature"])] results["temperature"] += [np.max(mesh.point_data["temperature"])]
max_T = propertylib.presets.temperature(results["temperature"]).magnitude max_T = propertylib.presets.temperature(results["temperature"])
# times 2 due to symmetry, area of repo, to kW # times 2 due to symmetry, area of repo, to kW
results["heat_flux"] += [np.max(mesh.point_data["heat_flux"][:, 0])] results["heat_flux"] += [np.max(mesh.point_data["heat_flux"][:, 0])]
tv = np.asarray(mesh_series.timevalues) / sec_per_yr tv = np.asarray(mesh_series.timevalues) / sec_per_yr
......
...@@ -57,7 +57,7 @@ def grid_convergence( ...@@ -57,7 +57,7 @@ def grid_convergence(
returns: Grid convergence field of the given property. returns: Grid convergence field of the given property.
""" """
assert len(meshes) >= 3 assert len(meshes) >= 3
cast = property.magnitude.strip_units cast = property.magnitude
result = deepcopy(topology) result = deepcopy(topology)
result.clear_point_data() result.clear_point_data()
result.clear_cell_data() result.clear_cell_data()
......
...@@ -81,21 +81,14 @@ fig = meshplotlib.plot(richardson, mesh_property) ...@@ -81,21 +81,14 @@ fig = meshplotlib.plot(richardson, mesh_property)
data_key = mesh_property.data_name data_key = mesh_property.data_name
if reference_solution_path is None: if reference_solution_path is None:
diff = richardson[data_key] - topology.sample(meshes[-1])[data_key] fig = meshplotlib.plot_diff(
richardson, topology.sample(meshes[-1]), mesh_property
)
else: else:
reference_solution = topology.sample( reference_solution = topology.sample(
meshlib.MeshSeries(reference_solution_path).read_closest(timevalue) meshlib.MeshSeries(reference_solution_path).read_closest(timevalue)
) )
diff = reference_solution[data_key] - richardson[data_key] fig = meshplotlib.plot_diff(reference_solution, richardson, mesh_property)
richardson["difference"] = diff
diff_unit = (mesh_property(1) - mesh_property(1)).units
diff_property = type(mesh_property)(
data_name="difference",
data_unit=diff_unit,
output_unit=diff_unit,
output_name=mesh_property.output_name + " difference",
)
fig = meshplotlib.plot(richardson, diff_property)
# %% [markdown] # %% [markdown]
# ## Convergence metrics # ## Convergence metrics
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment