In TRACMASS, there are four available options of terminating or "killing" trajectories. Here we will briefly present how to set them up. In general, trajectory killing is handled by the file kill_zones.F90, but in most cases, no modifications need to be made there. The only exception is when exitType=4, in which case the user needs to write FORTRAN code in kill_zones.F90 that will terminate trajectories in some locations. The file itself is located in the project's folder, which you can read more about here.

Various exit types (exitType)

exitType=1: BOX

This trajectory killer is the simplest to implement, as it requires only the coordinates of the box that would represent the kill zone.

Here is an example showing how to set up kill zones with exitType=1, which is a regular box. Similarly as with tracer setup, a maximum of 10 kill zone boxes can be set with this option. Here, we have set up two boxes: the first acting as a line and the second as a rectangular box. The first box has the dimensions from 200th to 300th index in the west-east direction and is set to 150th index in the north-south direction. Looking from a bird's-eye view, that would be a horizontal line across the grid. The second kill zone box is truly a box with a size from 50th to 250th index in the west-east direction and from 350th to 450th index in the north-south direction. Once the boundary is crossed, the trajectory is terminated, regardless of the direction of crossing.

 INIT_KILLZONES
     ! Maximum time for which trajectories will run
     timax = 75000 ! time limit for traj [days]

     ! Set up an exitType as a box of kill zones
     exitType = 1
     
     !       1st box   2nd box
     ! west indices of killzones
     ienw =  200,      50  
     ! east indices of killzones
     iene =  300,      250	    
     ! south indices of killzones
     jens =  150,      350
     ! north indices of killzones
     jenn =  150,      450
/
Note:
The kill zone box is implemented in all model levels; it is not possible to specify at which heights the termination should occur.

exitType=2: TRACER VALUE

This exit type terminates trajectories once a maximum or minimum tracer value is reached along the trajectory. In this example, we will implement two tracers — temperature and salinity — that will be used to terminate the trajectories. First, it is necessary to enable tracers. Otherwise, when running TRACMASS, an error will appear (e.g., *'Fortran runtime error: Index '1' of dimension 1 of array 'tracervalue' above upper bound of 0'*) indicating that no tracers are available for TRACMASS. Thus, the tracers need to be set up as usual. Some values, such as the tracervarname, might be different for your specific case.

Next, the kill zones need to be set up. Here, we enable both temperature and salinity tracer values for trajectory termination. In this case, we set up the system so that the temperature tracer value does not exceed 25 degrees; this is done by setting the variable maxormin=1. To set up a minimum value threshold for tracers, maxormin must be set to -1. This is shown with salinity, which has been set to have a minimum value of 35 PSU. If any trajectory reaches a value lower than 35 PSU, it will be terminated.

&INIT_TRACERS
     l_tracers = .TRUE.

     ! Tracer name (description)
     tracername =   'To',         'S',
     ! Tracer unit (description)
     tracerunit =   'degC',       'PSU',

     ! Name of the variable in the netcdf (if it's read)
     tracervarname ='votemper',   'vosaline',

     ! Action (read or compute)
     traceraction = 'read',       'read',

     ! Minimum and maximum value of the binning
     tracermin =    -3,           32,
     tracermax =    33,           38,

     ! Dimension of the tracer
     tracerdimension = 3D,        3D,
/
&INIT_KILLZONES
     timax = 75000 ! time limit for traj [days]

     exitType = 2

     ! Choose which tracers will beused for kill zones, here we have
     !              temperature   salinity
     tracerchoice = 1,            2
     tracere      = 25,           35
     maxormin     =  1,           -1
     
/
Note:
Tracers must be enabled and provided for the model! Otherwise, it won't work!

exitType=3: BOX & TRACER VALUE

In this case, a kill zone is defined by both a geographic location and the tracer values. For this, the namelist code presented in the other two sections needs to be used. It is essentially the same, but with the possibility to have more constraining and precise kill zone definitions.

exitType=4: HARD CODED

This section is still in development.

Maximum trajectory runtime

It is also possible to set a maximum runtime for trajectories in the namelist using timax. This sets the maximum trajectory runtime in days. It will terminate the simulation itself once all trajectories have been terminated. The simulation will be terminated, even if more trajectories are scheduled to be added in future timesteps.

Warning:
If the simulation runs out of active trajectories, the simulation will terminate, even if more trajectories are scheduled to be added in future timesteps!