Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
14.09.2015, 17:22 GMT-4
For best accuracy, we recommend adding a domain to your geometry to coincide with the region over which you want to integrate.
If it is not possible to add such a region and high accuracy is not crucial, integrate over a larger domain while using a boolean expression in your integrand.
Jeff
For best accuracy, we recommend adding a domain to your geometry to coincide with the region over which you want to integrate.
If it is not possible to add such a region and high accuracy is not crucial, integrate over a larger domain while using a boolean expression in your integrand.
Jeff
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
15.09.2015, 10:41 GMT-4
Is it possible to add a domain after the calculation has completed? This integration wasn't originally planned for, and I would like to avoid having to rerun my models if that's possible.
I'll also have to look into how to add a boolean to the integrand. That's new territory for me.
Thanks,
Paul
Is it possible to add a domain after the calculation has completed? This integration wasn't originally planned for, and I would like to avoid having to rerun my models if that's possible.
I'll also have to look into how to add a boolean to the integrand. That's new territory for me.
Thanks,
Paul
Henrik Sönnerlind
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
15.09.2015, 11:28 GMT-4
Hi,
Say that you want to integrate u^2 but not over the whole domain. You only want the integration where X>17 and Y<4711. Then you can integrate the expression
(X>17)*(Y<4711)*u^2
The logical expressions evaluate to either 1 or 0.
Regards,
Henrik
Hi,
Say that you want to integrate u^2 but not over the whole domain. You only want the integration where X>17 and Y17)*(Y
Edgar J. Kaiser
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
15.09.2015, 11:32 GMT-4
Hi Jeff, Henrik,
in which way is using the boolean expression in the integrand affecting precision?
Cheers
Edgar
--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Jeff, Henrik,
in which way is using the boolean expression in the integrand affecting precision?
Cheers
Edgar
--
Edgar J. Kaiser
emPhys Physical Technology
http://www.emphys.com
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
15.09.2015, 11:39 GMT-4
Henrik,
That makes that nice and simple! Thank you.
Paul
Henrik,
That makes that nice and simple! Thank you.
Paul
Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
15.09.2015, 20:51 GMT-4
Hello Edgar,
When carrying out numerical integration by Gaussian quadrature, if you use the boolean expression approach instead of the separate domain approach you're putting yourself at the mercy of elements that sit on both sides of the boolean condition: how many of their quadrature points are on each side and what their weights are is rather unpredictable.
Example: Set up a Laplace equation model on the canonical square [0,1]x[0,1], so that the solution is u=1. Mesh it with a single rectangular element. COMSOL captures the trivial solution perfectly, of course. But compute the integral of u over [0,.6]x[0,1] using the boolean approach and you'll get ~.722 because of where the Gauss points are and of their weights. ( As a side note, if you reduce the quadrature order from the default 4 to 3, you'll get .5 because then half the Gauss points and half the weights sit on each side of the x=.6 line).
On the other hand, if you split the domain into two at x=.6, you'll get the correct solution: .6.
Jeff
Hello Edgar,
When carrying out numerical integration by Gaussian quadrature, if you use the boolean expression approach instead of the separate domain approach you're putting yourself at the mercy of elements that sit on both sides of the boolean condition: how many of their quadrature points are on each side and what their weights are is rather unpredictable.
Example: Set up a Laplace equation model on the canonical square [0,1]x[0,1], so that the solution is u=1. Mesh it with a single rectangular element. COMSOL captures the trivial solution perfectly, of course. But compute the integral of u over [0,.6]x[0,1] using the boolean approach and you'll get ~.722 because of where the Gauss points are and of their weights. ( As a side note, if you reduce the quadrature order from the default 4 to 3, you'll get .5 because then half the Gauss points and half the weights sit on each side of the x=.6 line).
On the other hand, if you split the domain into two at x=.6, you'll get the correct solution: .6.
Jeff
Edgar J. Kaiser
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
16.09.2015, 08:17 GMT-4
Hi Jeff,
thanks for the explanation. So, small domains with few inner and relatively many edge (at the boolean edge) elements are more susceptible to this kind of numerical error.
Cheers
Edgar
--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Jeff,
thanks for the explanation. So, small domains with few inner and relatively many edge (at the boolean edge) elements are more susceptible to this kind of numerical error.
Cheers
Edgar
--
Edgar J. Kaiser
emPhys Physical Technology
http://www.emphys.com