Skip to content
Snippets Groups Projects
Commit 14d66e9f authored by Sven Marcus's avatar Sven Marcus
Browse files

Improve Poiseuille Test Case

parent b7debd04
No related branches found
No related tags found
1 merge request!48Adds a convergence analysis test case that runs on Phoenix
...@@ -30,14 +30,9 @@ class TestPoiseuilleFlow(unittest.TestCase): ...@@ -30,14 +30,9 @@ class TestPoiseuilleFlow(unittest.TestCase):
self.viscosities) self.viscosities)
def test_poiseuille_flow(self): def test_poiseuille_flow(self):
self.skipTest("This test is not implemented correctly yet")
plt.ion() plt.ion()
channel_height = 10
number_of_nodes = [16, 32, 64]
number_of_timesteps = [40_000, 80_000, 160_000]
viscosities = [5e-3, 1e-2, 2e-2]
l2_norm_results = []
physical_params = PhysicalParameters() physical_params = PhysicalParameters()
runtime_params = RuntimeParameters() runtime_params = RuntimeParameters()
...@@ -53,8 +48,9 @@ class TestPoiseuilleFlow(unittest.TestCase): ...@@ -53,8 +48,9 @@ class TestPoiseuilleFlow(unittest.TestCase):
runtime_params.number_of_timesteps = timesteps runtime_params.number_of_timesteps = timesteps
kernel.forcing_in_x1 = forcing kernel.forcing_in_x1 = forcing
self.assertLessEqual(l2_norm_results[1], l2_norm_results[0] / 2) grid_params = create_grid_params_with_nodes_in_column(nodes, delta_x)
self.assertLessEqual(l2_norm_results[2], l2_norm_results[1] / 2) l2_error = get_l2_error_for_simulation(grid_params, physical_params, runtime_params, kernel)
normalized_l2_errors.append(l2_error)
nodes_as_log = [np.log10(node) for node in self.number_of_nodes] nodes_as_log = [np.log10(node) for node in self.number_of_nodes]
l2_norms_as_log = [np.log10(l2) for l2 in normalized_l2_errors] l2_norms_as_log = [np.log10(l2) for l2 in normalized_l2_errors]
...@@ -76,7 +72,7 @@ def get_l2_error_for_simulation(grid_params, physical_params, runtime_params, ke ...@@ -76,7 +72,7 @@ def get_l2_error_for_simulation(grid_params, physical_params, runtime_params, ke
heights = get_heights(output_folder, runtime_params) heights = get_heights(output_folder, runtime_params)
numerical_results = get_numerical_results(runtime_params, output_folder) numerical_results = get_numerical_results(runtime_params, output_folder)
analytical_results = get_analytical_results(physical_params, heights, grid_params.number_of_nodes_per_direction[2]) analytical_results = get_analytical_results(grid_params, physical_params, kernel, heights)
plt.plot(heights, numerical_results) plt.plot(heights, numerical_results)
plt.plot(heights, analytical_results) plt.plot(heights, analytical_results)
......
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