Skip to content

Boundary conditions and heat equation #933

Answered by kinnala
SebfraOslo asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is not how you set inhomogeneous boundary condition in a time-dependent problem.

I modified the evolution loop as follows in ex19.py:

    while np.linalg.norm(u, np.inf) > 2**-3:
        t = t + dt
        u[basis.get_dofs(lambda x: np.isclose(x[1], 3.0))] = 1
        u = solve(*penalize(A.T, B @ u, x=u, D=basis.get_dofs()))
        yield t, u

In other words, you need to enforce the boundary condition at every step over and over again.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SebfraOslo
Comment options

Answer selected by SebfraOslo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #932 on October 11, 2022 09:38.