30 votes
Accepted

What is the general idea of Nitsche's method in numerical analysis?

Nitsche's method is related to discontinuous Galerkin methods (indeed, as Wolfgang points out, it is a precursor to these methods), and can be derived in a similar fashion. Let's consider the simplest ...
12 votes
Accepted

How to efficiently implement Dirichlet boundary conditions in global sparse finite element stiffnes matrices

In deal.II (http://www.dealii.org -- disclaimer: I'm one of the principal authors of that library), we do eliminate whole rows and columns, and it is not too expensive overall. The trick is to use the ...
11 votes

Periodic boundary condition for the heat equation in ]0,1[

The best way to do this is (as you said) to just use the definition of periodic boundary conditions and set up your equations correctly from the start using the fact that $u(0)=u(1)$. In fact, even ...
10 votes
Accepted

How do I simulate an open end?

The problem you describe, how to prescribe non-reflecting or absorbing boundary conditions when solving partial differential equations (PDE) has been extensively studied. For complex (e.g. nonlinear) ...
  • 5,794
10 votes

How to solve a second order differential equation (diffusion) with boundary conditions using Python

I have found that I must keep the value of dt near dx or the results become unstable This behavior you have noticed is known as the Courant–Friedrichs–Lewy (CFL) condition. Indeed, there are ...
9 votes
Accepted

FEM: Possible to have boundary conditions "inside" the domain?

The solution of the equation you are looking for is in the space $H^1$ of functions that have one weak derivative, but in 2d and 3d, this does not imply that the solution is in fact continuous. As a ...
8 votes
Accepted

Transparent boundary conditions for finite element simulation of TDSE

Kirill's answer is a good method but it is hampered that the fact that you need to tune it to a specific range in energy, so it is not appropriate if you have a broad-band wavepacket you need to ...
8 votes
Accepted

Symmetric boundary condition

For the sake of simplicity let me slightly change your notation. Let $u, v, w$ be the components in the $x, y, z$ directions of a true (polar) vector, and $y=0$ the symmetry plane. For a true vector, ...
  • 3,809
8 votes
Accepted

Solving Poisson equation with current BC using FEM

It is standard procedure for general case like that. You can enforce condition for electrode by Lagrange multipliers, $$ L(u,\lambda) = \int_\Omega \sigma u_{,i} u_{,i} \, \textrm{d}V - \int_{\...
  • 906
7 votes

Solving a linear equation system with pure Neumann condition

Pure Neumann problem is unique up to a constant. My two favourite solution strategies: Modifying the equation $-\Delta u = f$ to $-\Delta u + \varepsilon u = f$ for some small $\varepsilon>0$. If ...
  • 1,936
7 votes
Accepted

Do the class of PDEs that lack initial conditions have a name?

Such problems (sometimes called lateral Cauchy problems) are in general not well-posed (meaning they either lack a solution, or there are infinitely many of them, or the solution is unstable under ...
7 votes

How can an engineering student become a computational scinece expert in a short time

There is no shortcut. Just like there is no shortcut to becoming an "engineering expert in a short time". The thing is that to be an expert in civil engineering, you need to understand load analysis, ...
6 votes

Role of boundary conditions (e.g. periodic) in Poisson equation

I know its been 2 years.. but here is an example from physics to hammer it home. Consider you are solving the Poisson equation: $$\nabla^2\phi =f$$for electrostatic potentials(ϕ) with the right hand ...
6 votes
Accepted

How to impose an integral conservation in solving ODEs boundary value problems (BVP)?

You could augment your system of ODEs to include one more equation. If you let \begin{align} I(x) = \int_{a}^{x}(A(s) + B(s) + C(s))\,\mathrm{d}s, \end{align} then $I(a) = 0$, $I(b) = N$, $\dot{I}(x)...
6 votes

Do I need to impose boundary conditions in the Jacobian matrix?

There are multiple ways of implementing Dirichlet boundary conditions when using the finite element method. For each unknown $i$ of the system belonging to the Dirichlet boundary, you can zero out ...
6 votes
Accepted

Is "tangent stiffness matrix" the same as "stiffness matrix"?

$K u$ equals the internal forces only in the linear case. The tangent stiffness matrix, $K$, in a nonlinear problem is normally used in a Newton-Raphson algorithm to calculate updates to the ...
  • 5,794
6 votes

Scipy OdeInt solver with Neumann boundary conditions

From Ablowitz and Zeppetella we know that the analytical solution reads: \begin{equation} u(x,t)=\frac{1}{1+e^{{(-\frac{5}{6} t+ \frac{\sqrt{6}x}{6}})^2}} \end{equation} Usually, analytical ...
6 votes

Absorbing boundary conditions for acoustics in Discontinuous Galerkin

The problem with ABC in the form of derivative operators at the boundary is that the exact ABCs are non-local in space and often in time, which makes them hard to use in numerical simulations. You can ...
  • 1,228
6 votes

How do I program periodic boundary conditions?

Typically, you would add "guard cells", that is (for u) u(-1) and u(n+1) with your notation. Before each integration step: u(n+1) = u(0) u(-1) = u(n) and ...
6 votes

Computing accurate fluxes with FEM

If $\nabla u$ is of more interest than $u$ itself, it is reasonable to set $\mathbb v := -\sigma \, \nabla u$ and convert your Poisson problem $$ -\nabla \cdot (\sigma \, \nabla u) = f \quad \text{in }...
  • 871
6 votes
Accepted

How to apply non zero Dirichlet boundary condition in finite elements?

Consider the fact that your linear system can be broken up into two parts: the equations that correspond to the known Dirichlet dofs, and the equations that correspond to the unknown dofs. For the ...
  • 1,522
6 votes
Accepted

FEM current toy problem

The formulation of this problem is tricky. Here is what you have in your original post: Find $h \in L^2(\partial D)$ such that for any $w \in H^{\frac 1 2}(\partial D)$, $$ \int_{\partial D} hw \,...
6 votes
Accepted

Traction -> stress; stress->displacement gradient

In short, no. Neumann boundary conditions should be specified in terms of traction. This is clear when you move from a strong-form statement of the boundary value problem to a weak-form. Strong form: ...
  • 1,522
6 votes

Modelling question: example of a physical phenomenon with this jump condition at an interface?

$\vec\Phi = K_i \nabla u_i$ is the flux across the interface. For example, if $u$ is the thermal energy density and $K$ the thermal conductivity, then $\vec\Phi$ is the thermal energy flux. Energy ...
5 votes

Transparent boundary conditions for finite element simulation of TDSE

In the literature these boundary conditions go by the name of absorbing boundary conditions (or nonreflecting, open, radiation, invisible, far-field), and this is a well-known topic. One clear ...
  • 11.4k
5 votes
Accepted

What are acceptable boundary conditions for porous media flow?

The velocity $\mathbf u$ is in $H^1$, so imposing all or some components of the velocity as boundary conditions is allowed. This includes no-slip or tangential flow boundary conditions. However, from ...
5 votes

Poisson equation finite-difference with pure Neumann boundary conditions

I know this question is old but I found an error that I wanted to clear up in @DrHansGruber 's answer. It took me a few hours to spot the issue and I wanted to post the solution to save anyone else ...
  • 101
5 votes
Accepted

Boundary condition for Pressure in Navier-Stokes equation

When we say that the pressure is only defined "up to a constant", what we mean is this: If $u,p$ is a solution to the Navier-Stokes equations, then $u,p+c$ for any constant $c$ is also a solution. In ...
5 votes
Accepted

Is the diffusion equation with Neumann and Dirichlet BCs well-posed?

Yes, the problem with mixed boundary conditions is well posed. What's not clear to me is this: Why do you approximate the derivative via the two-sides approximation? Shouldn't it be enough to just ...
5 votes
Accepted

Imposing no flux boundary conditions on variants of the Cahn-Hilliard equation using Finite Differences in Python

The short answer is that you need $$\phi_{-1} = \phi_0$$ $$\phi_N = \phi_{N-1}$$ to impose $\nabla\phi=0$. A quick check by making the following change ...

Only top scored, non community-wiki answers of a minimum length are eligible