Discontinuity at interface

Hi everyone

I would like to be able to model a thermal contact resistance in FEniCS if possible

see Thermal contact conductance - Wikipedia

I’m quite new to FEniCS and not entirely sure what I doing, is it possible to alter this script attached to model a discontinuity caused by resistance at an interface in CG elements, or must it be done with DG? If so how would one define the variational formulation for this example with the heat equation? I have seen examples imposing a jump at an interface, could this be a solution?

Thank you!

from fenics import *

nx = ny = 30
mesh = RectangleMesh(Point(-2, -2), Point(2, 2), nx, ny)

V = FunctionSpace(mesh, FiniteElement("CG", mesh.ufl_cell(), 1))

tol = 1e-14

class Boundary(SubDomain):
    def inside(mesh, x, on_boundary):
        return on_boundary and near(x[0], 0, tol)


class Omega_0(SubDomain):
    def inside(mesh, x, on_boundary):
        return x[0] <= 0 - tol


class Omega_1(SubDomain):
    def inside(mesh, x, on_boundary):
        return x[0] >= 0 + tol

T_1, T_0 = 1, 0

bcs = [
    DirichletBC(V, T_1, "on_boundary && x[0] == 2"),
    DirichletBC(V, T_0, "on_boundary && x[0] == -2")
]   

u = Function(V)
v = TestFunction(V)

F = (
    dot(grad(u), grad(v))*dx
    )

solve(F == 0, u, bcs=bcs)

XDMFFile('out.xdmf').write(u)
1 Like

Do I understand you right that you want to have a discontinuity in your thermal resistance of your model. If yes, then i can refer you to Subdomains and boundary conditions
This should be applicable for your example.
Note that the c+±Code at the bottom is not quite up to date; you have to add some header files and stuff below the code to make it work (see Pass Function to C++ expression - #8 by Emanuel_Gebauer) :slight_smile:

I think @James_Dark is more interested in a discontinuity in the temperature field at the interface, not a discontinuity in the thermal conductivity.

This is not quite physically possible or is it? At least not if the diffusion coefficent D_T\neq0, or am I wrong?
The temperature has to be contiuous, heat flow can be discontiuous when introducing different temperature resistances as mentioned above with subdomains.

Edit: If youre looking for initial values then these can also be set via subdomains, but as soon as diffusion starts there should not be a discontiuity in temperature anymore

As shown in the wikipedia link, a thermal contact resistance can induce a temperature jump at the interface (see image below)

The heat flow, on the other hand has to be continuous. I think the subject here is just “how to introduce a jump at an interface between two subdomains”.

ok I was wrong, sorry.
The only solution I can currently think of would involve a mixed function space with two temperature variables, one for Body A and one for Body B. With proper Neuman boundaries one could possibly solve this system. But this might not be the most elegant solution.

@dokken I think we talked about discontinuities at some point didn’t we? Any idea?

I would suggest using DG, imposing continuity in the interior of each of the domains, and the jump condition on the internal interface between the bodies. As heat equations are Poisson type equations when discretized in time, it should be a fairly standard DG/Nitsche scheme.

Another option:
You could probably use @cdaversin’s Mixed FEM to couple to CG solutions at the internal boundary.