0
$\begingroup$

I have a time-dependent two dimensional pde that I am solving by FEM. I have been successful solving it with forward Euler. Now, I am trying to solve with higher order methods such as RK4. It is fairly straight forward but the hard part is implementing the Dirichlet boundary condition. For example, with forward Euler $A \frac{dx}{dt}=b$ then with forward Euler $A \frac{x_{t+1}-x_t}{\Delta t } = b $. Thus, $A x_{t+1} = A x_t +\Delta t b$ which then the Dirichlet boundary condition can be implemented. But I am not sure how this works with RK4.

Could anyone give me an explanation how this is done or recommend me a good reading for this?

$\endgroup$
0
$\begingroup$

You might already have the answer but let me comment nevertheless. You can use the same approach as when deriving a formula for non-homogeneous Dirichlet boundary conditions. Let me give you an example.

Consider the heat equation $$ u_t=\Delta u. $$ Let $\phi_i,~i\in\{1,\cdots,N\}$ be your basis. Discretizing the weak formulation gives $$ M \dot{x} + A x = 0, $$ where $M_{ij} = (\phi_i,\phi_j)$, $A_{ij}=(\nabla \phi_i, \nabla \phi_j)$ and $x \in \mathbb{R}^N$ is the vector of unknown degrees-of-freedom. Next split your DOF vector in such a way that the DOF's corresponding to the Dirichlet boundary come last, i.e. $$ x=\begin{bmatrix} x_I \\ x_B \end{bmatrix}, $$ where $x_I$ consists of the interior (or free) DOFs and $x_B$ consists of the boundary DOFs (for which you should know the value already). This kind of splitting induces a similar splitting for the discrete weak formulation: $$ \begin{bmatrix} M_{II} & M_{IB} \\ M_{BI} & M_{BB} \end{bmatrix} \begin{bmatrix} \dot{x_I} \\ \dot{x_B} \end{bmatrix}+\begin{bmatrix} A_{II} & A_{IB} \\ A_{BI} & A_{BB} \end{bmatrix} \begin{bmatrix} x_I \\ x_B \end{bmatrix} = 0. $$ The first set of equations reads now $$ M_{II} \dot{x_I} + A_{II} x_I = -A_{IB} x_B - M_{IB} \dot{x_B}, $$ which you can solve for $x_I$ using any difference method. Note that the right hand side consists only of terms that you know a priori. The second term on the right hand side might be zero if your Dirichlet boundary condition does not depend on time.

$\endgroup$
  • $\begingroup$ Hi there. Thank you very much for this. Is there any good reference for this kind of method by any chance? $\endgroup$ – p.c Nov 5 '16 at 5:59
  • $\begingroup$ I am not aware of any references. I learned this from my MSc thesis instructor, say, three years ago. $\endgroup$ – knl Nov 5 '16 at 8:08
  • $\begingroup$ Doesn't this rely on few assumptions such as $M_{II}$ is invertible? Also assumption that $M_{BB}$ is invertible would be needed to make sure that we can get an expression for $\dot{x}_{B}$ from the second set of equations. Am I looking at this correctly because as far as I can see even though $M$ is invertible it could be usually the case that $M_{II}$ and $M_{BB}$ are non-invertible? This is the case at the moment with the toy problem I am playing around with. $\endgroup$ – p.c Nov 6 '16 at 4:01
  • $\begingroup$ My intuition is that $M_{II}$ should always be invertible. I also think that you don't need the second (set of) equation(s) since you should know $\dot{x}_B$ a priori from the boundary condition. $\endgroup$ – knl Nov 6 '16 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.