[HDG method] Error illegal dnumsin Assemble BilinearForm 'biform_from_py'

More
4 years 6 months ago - 4 years 6 months ago #2698 by dong
I'm trying to implement a HDG method for the Stokes problem.
[tex]a_h(u_h, v_h) + b_h(v_h, p_h)-b_h(u_h, q_h)+ c_h(p_h, q_h)=\int_\Omega f\cdot v_hdx[/tex]

where
[tex]b_h(v,q) = -\int_\Omega q\nabla\cdot v dx + \sum\limits_{K\in \mathcal{T}}\int_{\partial K}(v-\bar{v})\cdot n\bar{q}ds,[/tex]
[tex]c_h(q, r):=\sum\limits_{K\in \mathcal{T}}\int_{\partial K}h_K(q-\bar{q})(r-\bar{r})ds.[/tex]
Please see the attached ipynb files for more details.
The error is
parseMatrixTM::AddElementMatrix: illegal dnumsin Assemble BilinearForm 'biform_from_py'

when I used
Code:
a += ch*dx(skeleton=True) # interface a += ch*ds(skeleton=True) # boundary
When I changed the code to
Code:
a += ch*dx(element_boundary=True)
,
then the error is UmfpackInverse: Numeric factorization failed.

Could you please tell me why this is and how to fixed it?
Thank you so much.
Last edit: 4 years 6 months ago by dong.
More
4 years 6 months ago - 4 years 6 months ago #2699 by lkogler
1) You want to use "element_boundary" here. "skeleton" does not give you what you want.
"skeleton" terms are integrals over facets, but there are multiple volume elements attached to a facet.
The term
Code:
a += h*(p-pbar)*(q-qbar)*dx(skeleton=True)
is not well defined. Which of the volume elements attached to a facet should provide "p" and "q"?
With "element_boundary", it is well defined. Every facet is integrated over twice - once as part of the boundary of each volume element.
"skeleton" is usually used when you have jumps between volume elements, something like
Code:
a += h*(p-p.Other())*(q-q.Other())*dx(skeleton=True)
Here, it does not matter which of the volume elements of a facet provides "p" and which one "p.Other()".
To make this clear, your term, using "skeleton", would be something like this:
Code:
a += h * ( (p-pbar)*(q-qbar) + (p.Other()-pbar)*(q.Other()-qbar) ) * dx(skeleton=True)
For "skeleton" to work, though, you have to set "dgjumps=True" in the FESpace:
Code:
X = FESpace([V, Vbar, Vbar, Q, Qbar], dgjumps=True)
Forgetting this, and using "skeleton" integrals leads to the illegal dnums error you encountered.

2) See the replies to this post from last week as for why your problem is not well posed if we use Dirichlet conditions everywhere and how to fix this issue.

3) There is a typo:
Code:
(u, ubar1, ubar2, p, pbar) = X.TrialFunction() (v, vbar1, vbar2, q, qbar) = X.TrialFunction()
should be
Code:
(u, ubar1, ubar2, p, pbar) = X.TrialFunction() (v, vbar1, vbar2, q, qbar) = X.TestFunction()
You can do
Code:
a.Assemble() print(a.mat)
and look at the matrix entries as a first sanity check. In this case, ALL entries are 0, which leads us to suspect something is off with trial/test functions.

4) Your formulation is wrong
Code:
bh_dx = - p*div(v) + q*div(u) bh_ds = (v-vbar)*n*pbar - (u-ubar)*n*qbar,
should, I think, be
Code:
bh_dx = -p*div(v) - q*div(u) bh_ds = v*n*pbar + u*n*qbar
You should multiply the divergence criterium by -1, or define p as -p such that you get a symmetric matrix. This is not strictly speaking necessary, but good practice.
The term (v-vbar)*n*pbar is, I believe, wrong. I think it should be a b*n*pbar

Best,
Lukas
Attachments:
Last edit: 4 years 6 months ago by lkogler.
The following user(s) said Thank You: dong
More
4 years 6 months ago #2702 by dong
Thank you very much for the detailed explanation. This helps me a lot.

Best wishes,
Dong
Time to create page: 0.120 seconds