How to compute the error over a subdomain ?
Hello Wen Jing,
have a Look at the tutorial on subdomains you see that bilinear forms use the definedon
to determine which domain to act on If you look at the docstring of the Integrate function
help(Integrate)
you will see that is also has an optional Flag ‘definedon’ which you can use just as as in a BilinearForm to integrate over a subdomain.
Best wishes
Henry
Thanks for your reply. I tried “ erru3 = sqrt( Integrate(errDD,mesh,order = 2*order, definedon=[2]) )” , but it doesn’t seem to be able to use it that way.
TypeError: Integrate(): incompatible function arguments. The following argument types are supported:
definedon
expects a ngsolve.Region object (as stated in the docstring) so you need to give is something like mesh.Materials(“region_name”)
Thanks for your help!
Best regards,
Wen jing
We can compute the error of the subregion, so can we graph the solution on the subregion? If yes, could you give me a general idea? Looking for your reply, thanks!
Best regards,
Wen Jing
Assume that the domain split into two subregions 1 and 2. The exact solution on each region is u1 and u2, respectively. You can draw the exact solution on the domain by using the characteristic functions. For examples,
[code]
Draw exact solution
char_1 = GridFunction(L2(mesh,order=0))
char_1.Set(CoefficientFunction([1,0]))
char_2 = GridFunction(L2(mesh,order=0))
char_2.Set(CoefficientFunction([0,1]))
u = char_1u1+char_2u2
Draw(u, mesh, “uexact”)[/code]
Thank you for your constant reply! However, if the variable is only defined on one of the regions, can we draw?
Dear dong
I’ve seen you ask some questions about Stokes - Darcy’s code, I think you must be very good at dealing with interface problems. I have recently written IPDG for primal form of Stokes- Darcy and HDG for mixed form of Stokes- Darcy according to the ideas I have learned,but I have encountered difficulties. Have you ever written a complete program like this? What kind of difficulties have you encountered? Looking forward to your reply. Thanks!
Best regards,
JIng