Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

local integration for error estimator

More
4 years 3 months ago - 4 years 3 months ago #2276 by PKonig
Hello,

I am trying to implement an error estimator for Maxwell's equation. For this I followed tutorial 1.6 which wasn't a problem in the first place.
Code:
h = specialcf.mesh_size n = specialcf.normal(mesh.dim) err1 = Integrate ( h * Norm( (curl(A)-(curl(A).Other()) ) - (n*(curl(A)-(curl(A).Other()))*n) )**2*dx(element_boundary=True), mesh, element_wise=True) ...

Now I tried to apply this error estimator to a problem which contains a PML which doesn't seem to work, as it becomes an integration over a complex domain. Therefore, I would like to localize these integrals to ignore the PML, yet still run over the boundary of each element. I tried the "definedon" flag, but it always returned some error.
Could someone tell me the correct way to achieve this?

Greetings,
Philipp
Last edit: 4 years 3 months ago by PKonig.
More
4 years 3 months ago #2279 by joachim
Hi Philipp,

(n*(curl(A)-(curl(A).Other()))*n) )**2

gives you a complex-valued function, use Norm( n*(curl(A)-(curl(A).Other()))*n) )**2
instead.

Joachim
More
4 years 3 months ago - 4 years 3 months ago #2282 by PKonig
Hello Joachim,

thanks for your reply. Even though my code is a bit messy, there is already a "Norm( ... )" contained in it. From my understanding the problem arises with the PML, as this area becomes a complex domain (therefore i want to exclude it from the computation).
Please correct me if I am mistaken.

Greetings,
Philipp

Edit: I tried integrating over the "inner" (not "pml") area via
Code:
eberr2 = Integrate ( h * Norm( ... )**2*dx(element_boundary=True, definedon= mesh.Materials("inner")), mesh, element_wise=True)

but still get the error

"NgException: ComputeNormalsAndMeasure not available for complex IR".

Edit2: I found a workaround by unsetting the PML during each error estimation and reapplying it to the refined mesh, but this seems quite a bruteforce method.
Last edit: 4 years 3 months ago by PKonig.
More
4 years 3 months ago #2284 by joachim
HI Philipp,

the complex stretching for boundary integrals is not implemented (we did not need it so far), thus the exception.

Unsetting the PML computes something, but (I guess) the jump terms will not be consistent, and thus overestimate the error at the interface to the PML region. You can filter out these edges by multiplying with a GridFunction in FacetFESpace set to 0 or 1, depending on which faces you want to include. Anyway you miss some terms ...


My favourite, practical estimators for Maxwell equations are ZZ-type estimators, where we average the H-field into an H(curl) space, and the total current density into an H(div) space. Very similar to the tutorial.
Should work fine also together with PML.

Joachim
Time to create page: 0.172 seconds