Boundary integrals in tutorial 2.5: Mixed formulation for second order equations


I am trying to go through the NGSolve example 2.5 on the mixed formulation for the diffusion equation. The primal problem has the integral on the Neumann boundary defined as:
g*vp * ds.

Where is “ds” active? Is “ds” automatically defined on the complement of the essential boundary? For the primal problem the essential boundary is set by the flag: dirichlet=“bottom”. So would “ds” be active on the
“right|top|left” boundaries?

Similarly for the mixed formulation, the condition u=u_D is to be applied on the bottom edge, but this is done as part of the variational form. The equivalent NGSolve implementation is given in the example as:
For the mixed formulation, the Dirichlet boundary on the H(div) space is given as: dirichlet=“right|top|left”. So is “ds” automatically defined on the complement of this, which is the bottom edge?

Thank you,

I think the ds operator loops over all boudnary edges for the bilinear form. But since you have a finite element space that is Dirichlet on bottom boundary, the test function on boundary edges is always zero. There will be no difference between ds and ds(“top|left|right”) for the primal problem.
Similar thing happens to the Mixed form.
If instead of Dirichlet on bottom boundary, you have Robin BC, then, you really need to do ds(“top|left|right”) and ds(“bottom”) separately.

Hi Guosheng,

Thanks for clarifying how the ds operator is implemented in NGSolve and also for your note on Robin BCs.

Thank you,