Qualitative experiments: Backward integration from a previous qualitative experiment
Hello and welcome to this video.
Here, we will set up a qualitative experiment
in which the initial positions of the particles
will come from a previous qualitative experiment,
and where the particle trajectories
will be calculated backward in time.
I want to separate these two ideas:
'backward' does not necessarily mean
that the initial positions of the particles used
are from a previous experiment.
We can do a backward experiment
starting from an 'initial_positions.txt' file,
as seen in experiment 1.
Another important thing to remember:
in forward mode we answer the question
'Where do the particles go?'
In backward mode we answer the question
'Where do the particles come from?'
So, I open a terminal and go back to the directory,
which you should already have on your computer:
'Qual', in which we find
our previous experiments 'Exp0' and 'Exp1'.
We will create a new experiment,
which we will call 'Exp2'.
So, we go into this directory.
To conduct a qualitative experiment
we need several files.
The first important file is the Ariane executable,
here in red on the slide.
As in experiment 1, we will
create a symbolic link to the Ariane executable
that we have already compiled and installed
in the directory noted here on the screen.
Then, we also need a Namelist file,
to tell Ariane which experiment we want to do.
We will copy the Namelist file
from 'Exp1' to the directory of 'Exp2'.
We will now see how to modify the Namelist file
to achieve the objectives mentioned at the start of this module.
In contrast to experiment 1,
we will not create an 'initial_positions' file
in which we enter the initial positions of our particles 'by hand'.
We will instead create a file
that will be a symbolic link: 'ariane_initial.nc'
pointing to the result
of experiment 1: 'ariane_trajectories_qualitative.nc'.
Now let's create this symbolic link in the terminal.
First, let's create a symbolic link
to the Ariane executable.
In my case it is in this directory.
Now we have a link
that points to the Ariane executable that we installed and compiled.
Now we will copy the Namelist file
from experiment 1 to the 'Exp2' directory.
We now have two files in our directory.
We'll see later how to modify Namelist.
Then, we will create a symbolic link ('ln -s')
to the results of experiment 1
'../Exp1/ariane_trajectories_qualitative.nc'
and we will call it 'ariane_initial.nc'.
We now have three files in our directory.
The big difference from experiment 1
is that instead of having an 'initial_positions' file
in which we had put our particles 'by hand',
we have a NetCDF file that points to
the results of a previous qualitative experiment.
We will now modify the Namelist file so as to
integrate the particle trajectories in 'backward' mode.
We use the 'forback' parameter,
which we will change to 'backward'.
We will not tell the program to read an 'initial_positions' file,
as in experiment 1,
but to read the content of 'ariane_initial.nc',
which points to the results of a previous experiment.
To do this, we will modify the 'bin' parameter
so as to change from 'nobin' (Exp1) to 'bin'.
We write this information here.
Then, we have another parameter to integrate:
the 'init_final' parameter.
We'll tell the program to point
to the final positions of 'Exp1'.
In the results file from experiment 1,
there are several variables
that give the initial positions of the particles:
init_x', 'init_y', 'init_z' and 'init_t'
and their final positions:
'final_x', 'final_y', 'final_z' and 'final_t'.
In our 'backward' experiment,
we will start from the final positions of our experiment 1.
This is why 'init_final' = 'final'.
If we had put 'init', we would have started
from the initial positions of experiment 1.
Let's implement what we just said.
We'll modify the Namelist file.
For the 'forback' parameter, we will
put 'backward' instead of 'forward'.
For the 'bin' parameter, we will
put 'bin' (Exp2) instead of 'nobin' (Exp1).
For the 'init_final' parameter,
we will start from the final positions ('final').
We have made all the changes
necessary to run our experiment.
How will the experiment go?
Let's go back to experiment 1
as shown on my slide.
The red crosses represent
the final 't' (time) positions
of our experiment 1, which was in 'forward' mode.
We had two recordings (records 1 & 2)
and four particles: 'p1', 'p2', 'p3', 'p4'.
These were integrated for 6 * 30 days, so 180 days,
provided that they do not leave the time domain
or geographic domain, as we saw in an earlier video.
Particle 1 was integrated and its final position
was recorded at 1.5.
Particle 2 was integrated and its final position
was recorded at 2.0.
Particle 3 was recorded at 2.5.
Particle 4, which went outside of the domain,
has a value that is a bit different, approx. 1.55.
Now, what will happen in experiment 2?
As we point to the final positions
of particles 1, 2 and 3,
the initial positions of our particles, 'init_t', will be:
for particle 1: 1.5,
for particle 2: 2.0,
for particle 3: 2.5,
and for particle 4: 1.55.
We will integrate 'backward'.
So the integration is done backwards.
We keep the same information
for the sampling rate of the trajectories.
So, every 30 days we will record
the position of our particles and we'll do this six times.
So, for 180 days we will record
the integration of our particles,
which corresponds to the size of one recording.
We will run our experiment.
There are several ways to do this,
but it is better to record
what will appear on the screen in a file.
There, the experience went well
and now I have 3 new files in my directory:
– what appeared on the screen,
which I have already mentioned in a previous video;
– the result of our qualitative 'backward' experiment;
– and a log file with some information about the memory.
What happened in this experiment?
We will check the contents of the results.
So, in 'ariane_trajectories_qualitative.nc'
we will see the initial positions of our particles,
so that's init_x', 'init_y', 'init_z' and 'init_t'
for this file.
So we will display them.
We will compare them with the final positions of 'Exp1'.
Indeed, the initial positions of 'Exp2' correspond to the final positions of 'Exp1'.
I'll open a second terminal
and I'll go into
experiment 2.
We will do the same thing again: 'ncdump -v'.
We'll look at the positions 'final x', 'final y', 'final z' and 'final t'
of the previous experiment: 'Exp1'.
We have the same file name.
We see that the final positions of experiment 1
must correspond to the initial positions of experiment 2.
This is the case, which is good.
Next, we will examine experiment 2 for
the final positions of our particles.
We replace 'init' with 'final' for all four parameters.
We add an option to have less significant digits
to make it easier to read on the screen.
This is an 'ncdump' option.
Here are the final positions of the particles in experiment 2.
We will compare them directly
with the initial positions of the particles in experiment 1,
which we'll find in the file 'initial_positions.txt'.
So... 'Exp1'... 'initial_positions.txt'...
And we see that happily, the positions...
Here we have the information about the first particle,
which corresponds to the first line of 'initial_positions.txt'.
We have 18.5, 24.5, 1.5 and 0.5.
So particle 1 has returned
exactly to its initial position, in 'backward' mode.
For particle 2, I select...
For particle 2 we have 18.5, 15.5, 1.5 and 1.0.
So the particle has returned to its original position.
For particles 3 and 4, on the other hand, which you'll remember
either went outside the time domain (particle 3)
or outside the geographic domain (particle 4),
we'll see that their integration goes back further than their initial positions.
So we won't have the same results
as in the file 'initial_positions.txt'.
Here, I wanted to show in this slide…
We are in experiment 2.
Particle 1 has been integrated 180 days backwards.
It has returned to its initial position in experiment 1.
It's the same for particle 2, which has returned to its initial position.
Particles 3 and 4, on the other hand,
although they were also integrated over 180 days,
remain in the geographic and time domains.
This contrasts with experiment 1
in which particle 3, which started here,
highlighted in green,
was integrated in 'forward' mode and left the domain.
Here, it was again integrated over 180 days,
but came a lot further back
than in experiment 1.
It's the same for particle 4, which started
from this position (shown in green) in experiment 1,
and was integrated but went outside of the geographic domain.
Here, we took its final position and reintegrated it for 180 days.
The particle went much further back than its position in experiment 1.
A remark about particles 3 and 4.
For particle 3, we finished on
a time corresponding to a multiple
of its position relative to the initial position.
Thus, when integrated backwards,
the recordings will contain
the exact value of its initial position,
which is the fourth recording here.
On the other hand, for particle 4,
which had gone outside the geographic domain and which had a time
that was not a multiple of 30 days,
we start from a position of 1.55
so it's completely out of sync with the earlier position.
When you reintegrate it backwards,
it can be seen that none of the positions correspond to its initial position.
Another remark about this slide:
because the particles are multiples of the recording frequency
and are positioned at these multiples,
the positions of particles 1, 2 and 3 are aligned.
The position of p2 relative to p3, and of p1 relative to p2 etc.
Particle 4, however, is shifted
and its positions are not aligned with the other particles.
This is important if you want to do statistics
on the positions of the particles, for example.
Over time, the particles will not be recorded at the same points.
This is a small comment.
Let's go back over what we have seen in this video.
First, it is possible to restart a qualitative experiment
from another qualitative experiment
using the file 'ariane_initial.nc'
which points to the results of a previous qualitative experiment.
We have also seen that we can integrate
our experiment 'backward' qualitatively,
in contrast to the 'forward' direction of experiment 1.
This 'backward' property is related to the fact that
that the Ariane program is not integrated into
the ocean circulation model.
Our ocean circulation model runs,
records its current fields u, v and w,
and then we run Ariane.
Since Ariane is 'offline', we have the possibility
to run Ariane in 'forward' or 'backward' mode.
If we had a Lagrangian particle trajectory model
integrated into the ocean circulation model
then we could use
this Lagrangian integration model
in 'forward' mode only.
In this case it would be an 'online' application.
Thank you for watching this video and see you soon!