[Users] problem in analysis thorn

Fabrizio di giovanni Fabrizio2.Giovanni at uv.es
Fri Oct 4 10:37:31 CDT 2019


Hi all.

I'm having a problem, probably in the scheduling, but I'm not able to
understand why this is happening. I attached two files .txt where I report
the schedule.ccl file of my thorn and the grid parameters in my parfile.
What happen is the following; I have these variables defined in the
interface.ccl like this:

CCTK_REAL masscenter_point type = GF Timelevels = 3
tags='Prolongation="none" tensortypealias="Scalar" '
{

  masscenterX_point
  masscenterY_point

}"mass center to be used in the global reductions"


CCTK_REAL global_masscenter type = SCALAR
{

 masscenterX
 masscenterY

}"mass center coordinates"


What I want to do is evaluate in every grid point the values for
masscenterX_point and masscenterY_point (I do this in the function
my_analysis_point_calc) and then integrate them (using CCTK_Reduce) over
the entire domain and save the result in the scalar variables masscenterX
and masscenterY (and I do it in the function my_analysis_reduce). So far
everything seems to work well, if I plot the masscenter it has reasonable
values. The problem happens when, in the same thorn, I want to use the
values of masscenterX and masscenterY in another function (
my_analysis_modes_point_calc) to evaluate some other variable (let's call
it mode_m1) point by point and then integrate it (in
my_analysis_modes_reduce).


At the initial time I get a reasonable value for mode_m1, but the second
time I print it ( after 12 timesteps) I get nan, the third time I print it
(after 24 timesteps) I get a reasonable value and after that it seems to be
fine for the rest of the simulation. When I print masscenterX and
masscenterY they have reasonable values at every iteration.  This is the
output:
"

#1:iteration 2:time 3:data
#data columns: 3:masscenterX 4:masscenterY
0 0 2.04233950307922e-07 1.43009709532618e-07
12 0.6 1.64952865679123e-07 1.15302233769628e-07
24 1.2 2.59441645250822e-08 1.8122269479532e-08

#1:iteration 2:time 3:data
#data columns: 3:mode_m1
0 0 5.09771568069084e-09
12 0.6 -nan
24 1.2 5.98971400034287e-10

"

I thought that the problematic line in my code could be this one:

            phi = atan((yy-*masscenterY)/(xx-*masscenterX));

            if(((xx-*masscenterX)<0.0)){
                phi = atan((yy-*masscenterY)/(xx-*masscenterX)) +
3.14159265358979323846;
            }

where I try to use the values of masscenterX and masscenterY inside the
function "my_analysis_modes_point_calc". If I change that part not using
masscenterX and masscenterY I don't get nans anymore in mode_m1.

After doing different tests, I actually found out that if I try to plot
scalar output every 4 iterations I get also NaN in masscenter at time 0.2;
this is the output in this case:
"
#1:iteration 2:time 3:data
#data columns: 3:masscenterX 4:masscenterY

0 0 2.04233950307922e-07 1.43009709532618e-07
4 0.2 -nan -nan
8 0.4 1.76472702563281e-07 1.23428120452789e-07
12 0.6 1.64952865679123e-07 1.15302233769628e-07
16 0.8 1.05057935424561e-07 7.33797284607643e-08
20 1 5.6677119219615e-08 3.93971526043537e-08
24 1.2 2.59441645250822e-08 1.8122269479532e-08
28 1.4 5.57004919317397e-08 3.90090013497981e-08
32 1.6 1.2454179781868e-08 8.57409404496548e-09
36 1.8 7.81397952778142e-08 5.4397631432516e-08

#1:iteration 2:time 3:data
#data columns: 3:mode_m1

0 0 5.09771568069084e-09
4 0.2 -nan
8 0.4 -nan
12 0.6 -nan
16 0.8 2.49105795013804e-09
20 1 -nan
24 1.2 5.98971400034287e-10
28 1.4 3.14686031011036e-10
32 1.6 2.57981958462494e-10
36 1.8 6.79137649228778e-10

"

I'm not really sure what is going on here, so I hope somebody can explain
me where is the mistake. Thank you.

Best,
Fabrizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20191004/ca626e5a/attachment.html 
-------------- next part --------------
CoordBase::xmin                      = -512.00
CoordBase::ymin                      = -512.00
CoordBase::zmin                      =    0.00
CoordBase::xmax                      = +512.00
CoordBase::ymax                      = +512.00
CoordBase::zmax                      = +512.00
CoordBase::dx                        =    6.40
CoordBase::dy                        =    6.40
CoordBase::dz                        =    6.40

driver::ghost_size                   = 3

CoordBase::boundary_size_x_lower     = 3
CoordBase::boundary_size_y_lower     = 3
CoordBase::boundary_size_z_lower     = 3
CoordBase::boundary_size_x_upper     = 3
CoordBase::boundary_size_y_upper     = 3
CoordBase::boundary_size_z_upper     = 3

CoordBase::boundary_shiftout_x_lower = 1
CoordBase::boundary_shiftout_y_lower = 1
CoordBase::boundary_shiftout_z_lower = 1

CarpetRegrid2::symmetry_rotating180  = no

ReflectionSymmetry::reflection_x     = no
ReflectionSymmetry::reflection_y     = no
ReflectionSymmetry::reflection_z     = yes
ReflectionSymmetry::avoid_origin_x   = no
ReflectionSymmetry::avoid_origin_y   = no
ReflectionSymmetry::avoid_origin_z   = no

# Mesh refinement
#------------------------------------------------------------------------------

Carpet::max_refinement_levels           = 5

CarpetRegrid2::num_centres              = 1

CarpetRegrid2::num_levels_1             = 3
CarpetRegrid2::radius_1[1]              = 256.0
CarpetRegrid2::radius_1[2]              = 128.0

Carpet::use_buffer_zones                = yes
Carpet::prolongation_order_space        = 5
Carpet::prolongation_order_time         = 2

CarpetRegrid2::freeze_unaligned_levels  = yes
CarpetRegrid2::regrid_every             = 0

CarpetRegrid2::verbose                  = yes

Carpet::grid_structure_filename         = "carpet-grid-structure"
Carpet::grid_coordinates_filename       = "carpet-grid-coordinates"

Time::dtfac                             = 0.125
-------------- next part --------------
# Schedule definitions for thorn NS_analysis

#request storage for all your thorn variables
STORAGE:masscenter_point[3]
STORAGE:modes_point[3]
STORAGE:global_quantities
STORAGE:global_masscenter
STORAGE:global_quantities_modes


#=============================================================================
## Set symmetries for NPScalars grid functions
##=============================================================================
schedule analysis_symmetries AT BASEGRID
{
  LANG: Fortran
    OPTIONS: Meta
    } "Set symmetries for grid functions"

schedule my_analysis_point_calc in MoL_PostStep #after my_AddToTmunu 
        {
                LANG: C
                OPTIONS: global loop-local
                TRIGGERS: global_quantities, global_masscenter

       } "Calculate the global quantities at each grid point: global loop-local routine"

## Call symmetry boundary conditions
schedule myAnalysis_Boundaries in AddToTmunu after my_analysis_point_calc  #at ANALYSIS after my_analysis_point_calc
{
  LANG:    Fortran
      OPTIONS: global
            SYNC:   masscenter_point
                                } "Symmetry boundary conditions"

 schedule GROUP ApplyBCs AS ApplyBCs_myAnalysis in AddToTmunu AFTER myAnalysis_Boundaries
{
                                                                                           } "Apply boundary conditions"

schedule my_analysis_reduce in MoL_PostStep after myAnalysis_Boundaries before my_analysis_modes_point_calc
        {
                LANG: C
                OPTIONS: global
                TRIGGERS: global_quantities, global_masscenter

        }"Reduce the NS rest and gravitational mass"

## MODES PART

schedule my_analysis_modes_point_calc in MoL_PostStep after my_analysis_reduce 
        {
                LANG: C
                OPTIONS: global loop-local
                TRIGGERS: global_quantities_modes, global_masscenter

       } "Calculate the global quantities at each grid point: global loop-local routine"

## Call symmetry boundary conditions
schedule myAnalysis_modes_Boundaries in AddToTmunu after my_analysis_modes_point_calc  #at ANALYSIS after my_analysis_point_calc
{
  LANG:    Fortran
      OPTIONS: global
            SYNC:   modes_point
                                } "Symmetry boundary conditions"

 schedule GROUP ApplyBCs AS ApplyBCs_myAnalysis_modes in AddToTmunu AFTER myAnalysis_modes_Boundaries
{
                                                                                           } "Apply boundary conditions"

schedule my_analysis_modes_reduce in MoL_PostStep after myAnalysis_modes_Boundaries
        {
                LANG: C
                OPTIONS: global
                TRIGGERS: global_quantities_modes

        }"Reduce the modes quantities"


More information about the Users mailing list