-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello Vassilios,
Is there a way to use the global Cactus reduction functions on fractions of the entire grid?
I am interested in summing grid scalars (say rho) in spherical shells in the grid. Is there a way to perform the "sum" reduction on those shells specified by a global radius variable? Or do I need to write my own MPI function that sums the contributions from all processors that have grid point that fall within the shell I am interested in?
There is no such facility build into Cactus unfortunately. The easiest way to achieve a reduction using only points satisfying some criterion (having coordinates inside the shells in your case) is to set up a helper grid function which is set to:
/ rho : if condition is true helper = { \ 0 : otherwise
For multiple shells you will have to set up multiple helper grid functions (or re-use the same one several times). One way of doing this is:
schedule.ccl: STORAGE: helper[1] schedule setup_integrand in CCTK_ANALYSIS { OPTIONS: global loop-local LANG: C } "compute 'helper' grid function for integrand" schedule integrate in CCTK_ANALYSIS AFTER setup_integrand { OPTIONS: global LANG: C } "reduce 'helper' grid function on all processes"
You can have a look at the thorn ADMMass (in AEIThorns) and its ADMMass_Volume routines to see how this is done in practise.
Doing the reduction by hand can be tricky since you will have to properly handle mesh refinement boundaries. Roughly speaking you have to multiply your integrand by the CarpetReduce::weight grid function and only include the non-ghost zones points (ie start cctk_nghostzones points from the edge of each component). Outer boundaries require special treatment (detectable via cctk_bbox) and you have to include all points there. I am right now not sure how symmetry boundaries need to be handled (ie whether for vertex centering weight is set to 1/2 already or of you'll have to query the symmetry thorn whether an outer boundary is a symmetry boundary).
Yours, Roland
- -- My email is as private as my paper mail. I therefore support encrypting and signing email messages. Get my PGP key from http://keys.gnupg.net.