1 |
jmc |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/flt/flt_main.F,v 1.1 2001/09/13 17:43:55 adcroft Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
jmc |
1.2 |
#include "FLT_OPTIONS.h" |
5 |
adcroft |
1.1 |
|
6 |
|
|
c ================================================================== |
7 |
|
|
c |
8 |
|
|
c Float Package for the MIT Model |
9 |
|
|
c |
10 |
|
|
c Main Routines: |
11 |
|
|
c |
12 |
|
|
c o flt_main - Integrates the floats forward and stores |
13 |
jmc |
1.2 |
c positions and vertical profiles at specific |
14 |
adcroft |
1.1 |
c time intervals. |
15 |
|
|
c o flt_init - Initialise the floats |
16 |
jmc |
1.2 |
c o flt_restart - Writes restart data to file. |
17 |
adcroft |
1.1 |
c |
18 |
|
|
c Second Level Subroutines: |
19 |
|
|
c |
20 |
|
|
c o flt_runga2 - Second order Runga-Kutta inetgration (default) |
21 |
|
|
c o flt_exchg - Does a new distribution of floats over tiles |
22 |
|
|
c after every integration step. |
23 |
|
|
c o flt_up - moves float to the surface (if flag is set) |
24 |
|
|
c and stores profiles to file |
25 |
|
|
c o flt_down - moves float to its target depth (if flag is set) |
26 |
|
|
c o flt_traj - stores positions and data to file |
27 |
|
|
c o flt_bilinear - contains blinear interpolation scheme |
28 |
|
|
c o flt_functions - contains some functions |
29 |
|
|
c o flt_mdsreadvector - modified mdsreadvector to read files |
30 |
|
|
c |
31 |
|
|
c ToDo: |
32 |
jmc |
1.2 |
c |
33 |
|
|
c o avoid exchanges when arrays empty |
34 |
adcroft |
1.1 |
c o 3D advection of floats |
35 |
jmc |
1.2 |
c |
36 |
adcroft |
1.1 |
c ================================================================== |
37 |
|
|
c |
38 |
|
|
c Documentation: |
39 |
|
|
c |
40 |
|
|
c To be made.... |
41 |
|
|
c |
42 |
|
|
c |
43 |
|
|
c started: Arne Biastoch abiastoch@ucsd.edu 10-Jan-2000 |
44 |
jmc |
1.2 |
c (adopted from version written by Detlef Stammer |
45 |
adcroft |
1.1 |
c for the old model code) |
46 |
|
|
c |
47 |
|
|
c changed: Arne Biastoch abiastoch@ucsd.edu 21-JUN-2001 |
48 |
|
|
c |
49 |
|
|
c ================================================================== |
50 |
|
|
|
51 |
|
|
|
52 |
jmc |
1.2 |
SUBROUTINE FLT_MAIN ( |
53 |
|
|
I myIter, |
54 |
|
|
I myTime, |
55 |
adcroft |
1.1 |
I myThid |
56 |
|
|
& ) |
57 |
|
|
|
58 |
jmc |
1.2 |
C ================================================================== |
59 |
|
|
C SUBROUTINE FLT_MAIN |
60 |
|
|
C ================================================================== |
61 |
|
|
C |
62 |
|
|
C o This routine steps floats forward in time and samples the model |
63 |
|
|
C state at float position every flt_int_traj time steps. |
64 |
|
|
C Also moves the float up and down and samples vertical profiles. |
65 |
|
|
C |
66 |
|
|
C o Uses 2nd or fourth order runga-kutta |
67 |
|
|
C o Spatial interpolation is bilinear close to boundaries and otherwise |
68 |
|
|
C a polynomial interpolation. |
69 |
|
|
C o Particles are kept in grid space (with position of dp taken as |
70 |
|
|
C x(south), y(east) grid cell point) |
71 |
|
|
C o Calls profile every flt_int_prof time steps; in that event the |
72 |
|
|
C profile over the whole water column is written to file and the |
73 |
|
|
C float might be moved upwards to the surface (depending on its |
74 |
|
|
C configuration). |
75 |
|
|
Cc |
76 |
|
|
C ================================================================== |
77 |
|
|
C SUBROUTINE FLT_MAIN |
78 |
|
|
C ================================================================== |
79 |
adcroft |
1.1 |
|
80 |
|
|
#include "EEPARAMS.h" |
81 |
|
|
#include "SIZE.h" |
82 |
|
|
#include "FLT.h" |
83 |
|
|
|
84 |
jmc |
1.2 |
C == routine arguments == |
85 |
adcroft |
1.1 |
|
86 |
jmc |
1.2 |
C mythid - thread number for this instance of the routine. |
87 |
adcroft |
1.1 |
|
88 |
jmc |
1.2 |
INTEGER myIter, myThid |
89 |
|
|
_RL myTime |
90 |
adcroft |
1.1 |
|
91 |
jmc |
1.2 |
C integration of the float trajectories |
92 |
|
|
|
93 |
|
|
c write(0,*) ' bf call flt_runga2', myIter |
94 |
adcroft |
1.1 |
CALL TIMER_START('FLOATS RUNGA2 [FLT LOOP]',myThid) |
95 |
jmc |
1.2 |
call flt_runga2( myIter, myTime, myThid ) |
96 |
adcroft |
1.1 |
CALL TIMER_STOP ('FLOATS RUNGA2 [FLT LOOP]',myThid) |
97 |
jmc |
1.2 |
c write(0,*) ' af call flt_runga2', myIter |
98 |
|
|
|
99 |
|
|
C check if exchanges between tiles are necessary |
100 |
adcroft |
1.1 |
|
101 |
|
|
if (Nx .ne. sNx .or. Ny .ne. sNy) then |
102 |
|
|
CALL TIMER_START('FLOATS EXCHG [FLT LOOP]',myThid) |
103 |
jmc |
1.2 |
call flt_exchg( myIter, myTime, myThid ) |
104 |
adcroft |
1.1 |
CALL TIMER_STOP ('FLOATS EXCHG [FLT LOOP]',myThid) |
105 |
|
|
endif |
106 |
|
|
|
107 |
jmc |
1.2 |
C store profiles every flt_int_prof time steps: |
108 |
|
|
C and move floats up and down |
109 |
adcroft |
1.1 |
|
110 |
jmc |
1.2 |
if (mod(myTime,flt_int_prof).eq.0.) then |
111 |
adcroft |
1.1 |
CALL TIMER_START('FLOATS UP [FLT LOOP]',myThid) |
112 |
jmc |
1.2 |
call flt_up( myIter, myTime, myThid ) |
113 |
adcroft |
1.1 |
CALL TIMER_STOP ('FLOATS UP [FLT LOOP]',myThid) |
114 |
|
|
endif |
115 |
|
|
|
116 |
jmc |
1.2 |
c write(0,*) ' bf call flt_down', myIter |
117 |
adcroft |
1.1 |
CALL TIMER_START('FLOATS DOWN [FLT LOOP]',myThid) |
118 |
jmc |
1.2 |
call flt_down( myIter, myTime, myThid ) |
119 |
adcroft |
1.1 |
CALL TIMER_STOP ('FLOATS DOWN [FLT LOOP]',myThid) |
120 |
jmc |
1.2 |
c write(0,*) ' af call flt_down', myIter |
121 |
|
|
|
122 |
|
|
C store particles every flt_int_traj timesteps: |
123 |
adcroft |
1.1 |
|
124 |
jmc |
1.2 |
if (mod(myTime,flt_int_traj).eq.0.) then |
125 |
|
|
c write(0,*) ' bf call flt_traj', myIter |
126 |
adcroft |
1.1 |
CALL TIMER_START('FLOATS TRAJ [FLT LOOP]',myThid) |
127 |
jmc |
1.2 |
call flt_traj( myIter, myTime, myThid ) |
128 |
adcroft |
1.1 |
CALL TIMER_STOP ('FLOATS TRAJ [FLT LOOP]',myThid) |
129 |
jmc |
1.2 |
c write(0,*) ' af call flt_traj', myIter |
130 |
adcroft |
1.1 |
endif |
131 |
|
|
|
132 |
jmc |
1.2 |
RETURN |
133 |
|
|
END |