From 03825552c4db145413c697868d3cc80a4886264a Mon Sep 17 00:00:00 2001 From: BenjaminRueth Date: Tue, 11 Aug 2020 09:47:46 +0200 Subject: [PATCH 1/2] Update case according to https://github.com/precice/fenics-adapter/pull/81 --- HT/partitioned-heat/fenics-fenics/heat.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/HT/partitioned-heat/fenics-fenics/heat.py b/HT/partitioned-heat/fenics-fenics/heat.py index 002eb5ce0..b4d777093 100644 --- a/HT/partitioned-heat/fenics-fenics/heat.py +++ b/HT/partitioned-heat/fenics-fenics/heat.py @@ -124,17 +124,13 @@ def determine_gradient(V_g, u, flux): # Initialize the adapter according to the specific participant if problem is ProblemType.DIRICHLET: precice = Adapter(adapter_config_filename="precice-adapter-config-D.json") - precice_dt = precice.initialize(coupling_boundary, mesh, V) - initial_data = precice.initialize_data(f_N_function) + precice_dt = precice.initialize(coupling_boundary, mesh, V, write_function=f_N_function) elif problem is ProblemType.NEUMANN: precice = Adapter(adapter_config_filename="precice-adapter-config-N.json") - precice_dt = precice.initialize(coupling_boundary, mesh, V_g) - initial_data = precice.initialize_data(u_D_function) + precice_dt = precice.initialize(coupling_boundary, mesh, V_g, write_function=u_D_function) boundary_marker = False -coupling_expression = precice.create_coupling_expression(initial_data) - dt = Constant(0) dt.assign(np.min([fenics_dt, precice_dt])) @@ -148,6 +144,7 @@ def determine_gradient(V_g, u, flux): bcs = [DirichletBC(V, u_D, remaining_boundary)] # Set boundary conditions at coupling interface once wrt to the coupling expression +coupling_expression = precice.create_coupling_expression() if problem is ProblemType.DIRICHLET: # modify Dirichlet boundary condition on coupling interface bcs.append(DirichletBC(V, coupling_expression, coupling_boundary)) From c764405e3b671a1e37fb1910a21fa5e49b01b1ec Mon Sep 17 00:00:00 2001 From: BenjaminRueth Date: Tue, 11 Aug 2020 10:43:04 +0200 Subject: [PATCH 2/2] Update get_point_sources --- FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/cyl-flap.py | 6 ++---- FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/cyl-flap.py b/FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/cyl-flap.py index 18c79649c..13d4d86ae 100644 --- a/FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/cyl-flap.py +++ b/FSI/cylinderFlap/OpenFOAM-FEniCS/Solid/cyl-flap.py @@ -88,7 +88,7 @@ def remaining_boundary(x, on_boundary): force_boundary = AutoSubDomain(remaining_boundary) # Initialize the coupling interface -precice_dt = precice.initialize(coupling_boundary, mesh, V, dim) +precice_dt = precice.initialize(coupling_boundary, mesh, V, dim, fixed_boundary=clamped_boundary_domain) fenics_dt = precice_dt # if fenics_dt == precice_dt, no subcycling is applied # fenics_dt = 0.02 # if fenics_dt < precice_dt, subcycling is applied @@ -171,8 +171,6 @@ def avg(x_old, x_new, alpha): res = m(avg(a_n, a_np1, alpha_m), v) + k(avg(u_n, du, alpha_f), v) -Forces_x, Forces_y = precice.create_point_sources(clamped_boundary_domain) - a_form = lhs(res) L_form = rhs(res) @@ -201,7 +199,7 @@ def avg(x_old, x_new, alpha): read_data = precice.read_data() # Update the point sources on the coupling boundary with the new read data - Forces_x, Forces_y = precice.update_point_sources(read_data) + Forces_x, Forces_y = precice.get_point_sources(read_data) A, b = assemble_system(a_form, L_form, bc) diff --git a/FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py b/FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py index 4d544f71f..91851f9aa 100644 --- a/FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py +++ b/FSI/flap_perp/OpenFOAM-FEniCS/Solid/perp-flap.py @@ -72,7 +72,7 @@ def neumann_boundary(x, on_boundary): force_boundary = AutoSubDomain(neumann_boundary) # Initialize the coupling interface -precice_dt = precice.initialize(coupling_boundary, mesh, V, dim) +precice_dt = precice.initialize(coupling_boundary, mesh, V, dim, fixed_boundary=clamped_boundary_domain) fenics_dt = precice_dt # if fenics_dt == precice_dt, no subcycling is applied # fenics_dt = 0.02 # if fenics_dt < precice_dt, subcycling is applied @@ -165,8 +165,6 @@ def avg(x_old, x_new, alpha): res = m(avg(a_n, a_np1, alpha_m), v) + k(avg(u_n, du, alpha_f), v) -Forces_x, Forces_y = precice.create_point_sources(clamped_boundary_domain) - a_form = lhs(res) L_form = rhs(res) @@ -194,7 +192,7 @@ def avg(x_old, x_new, alpha): read_data = precice.read_data() # Update the point sources on the coupling boundary with the new read data - Forces_x, Forces_y = precice.update_point_sources(read_data) + Forces_x, Forces_y = precice.get_point_sources(read_data) A, b = assemble_system(a_form, L_form, bc)