- Thank you received: 0
local integration for error estimator
4 years 10 months ago - 4 years 10 months ago #2276
by PKonig
local integration for error estimator was created 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.
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
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 10 months ago by PKonig.
4 years 10 months ago #2279
by joachim
Replied by joachim on topic local integration for error estimator
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
(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
4 years 10 months ago - 4 years 10 months ago #2282
by PKonig
Replied by PKonig on topic local integration for error estimator
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
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.
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 10 months ago by PKonig.
4 years 10 months ago #2284
by joachim
Replied by joachim on topic local integration for error estimator
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
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.105 seconds