From 8ee2f8a887170cb8244377b51eb1baee8e4cc2e5 Mon Sep 17 00:00:00 2001 From: BenjaminRodenberg Date: Thu, 7 Jan 2021 19:28:49 +0100 Subject: [PATCH] Fix ill-posed problem by providing additional data. --- HT/partitioned-heat/fenics-fenics/heat.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HT/partitioned-heat/fenics-fenics/heat.py b/HT/partitioned-heat/fenics-fenics/heat.py index 8a0a4757d..e528dd9d9 100644 --- a/HT/partitioned-heat/fenics-fenics/heat.py +++ b/HT/partitioned-heat/fenics-fenics/heat.py @@ -29,7 +29,7 @@ File, solve, lhs, rhs, grad, inner, dot, dx, ds, interpolate, VectorFunctionSpace, MeshFunction, MPI from fenicsprecice import Adapter from errorcomputation import compute_errors -from my_enums import ProblemType, Subcycling +from my_enums import ProblemType, Subcycling, DomainPart import argparse import numpy as np from problem_setup import get_geometry, get_problem_setup @@ -211,6 +211,10 @@ def determine_gradient(V_g, u, flux): precice.store_checkpoint(u_n, t, n) read_data = precice.read_data() + if problem is ProblemType.DIRICHLET and (domain_part is DomainPart.CIRCULAR or domain_part is DomainPart.RECTANGLE): + # We have to data for an arbitrary point that is not on the circle, to obtain exact solution. + # See https://github.com/precice/fenics-adapter/issues/113 for details. + read_data[(0, 0)] = u_D(0, 0) # Update the coupling expression with the new read data precice.update_coupling_expression(coupling_expression, read_data)