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