underworld2 icon indicating copy to clipboard operation
underworld2 copied to clipboard

'surface' integration

Open tiannh7 opened this issue 2 years ago • 2 comments

Hi,

I'm trying to perform surface integration on a non-boundary "sub-surface" in a parallel environment using Underworld2. Specifically, I want to integrate over any arbitrary row in a Mesh[yRes+1, xRes+1], similar to pressure calibration. However, I encountered the following error:

underworld version: 2.14.0b
python version    : 3.11.3
tempAve = uw.utils.Integral(temperatureField, mesh, integrationType='surface', surfaceIndexSet=rowIndexSet)
ValueError: Your surfaceIndexSet appears to contain node(s) which do not belong to the mesh boundary. Surface integration across internal nodes is not currently supported.

One workaround I can think of is to evaluate on this horizontal line and then use scipy for integration. But in a parallel environment, would I need to consolidate resources so that I can operate on each row of the original data? Also, would the precision of this approach be comparable to the results obtained from utils.Integral?

Any guidance would be greatly appreciated. Thanks!

N.

tiannh7 avatar Jan 16 '24 09:01 tiannh7

Hi @NTIaN7 , Sorry for the late response. The utils.Integral() doesn't handle internal surface indices. Your idea for scipy could work, you can consolidate the resultant per proc integral together with something like mpi4py's allreduce(), an example is https://github.com/underworldcode/underworld2/blob/e62b5de9a5ba673b6df23c94f4f6f34e34a301d7/underworld/utils/_utils.py#L645

What is the integral you're trying to evaluate? Just temperature over the surface?

Another idea that comes to mind is to distribute a swarm of particles over the 'internal" surface you'd like to integrate on.

julesghub avatar Feb 09 '24 06:02 julesghub

Thank you for your reply @julesghub,

I want to evaluate the pressure, temperature, and physical strength of a specific interface. For example, obtaining the average (integral to area ratio) temperature and pressure on a horizontal grid line.

Particle swarm is a great way, but do I not need to set the adject attribute on it so as not to change its position?

N.

tiannh7 avatar Feb 20 '24 01:02 tiannh7

Closing due to inactivity. @tiannh7 feel free to reopen if this is still unresolved.

julesghub avatar Apr 07 '25 00:04 julesghub