/[MITgcm]/MITgcm/eesupp/src/different_multiple.F
ViewVC logotype

Annotation of /MITgcm/eesupp/src/different_multiple.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (hide annotations) (download)
Tue Sep 27 18:38:28 2005 UTC (18 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint58b_post, checkpoint57y_post, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint59, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint62s, checkpoint58a_post, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint57z_post, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint58t_post, checkpoint58m_post, checkpoint57t_post, checkpoint63g, checkpoint57v_post, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint58w_post, checkpoint57y_pre, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58e_post, mitgcm_mapl_00, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint58r_post, checkpoint58n_post, checkpoint65o, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpint57u_post, checkpoint58k_post, checkpoint62b, checkpoint58v_post, checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint61f, checkpoint58g_post, checkpoint58x_post, checkpoint61n, checkpoint59j, checkpoint58h_post, checkpoint58j_post, checkpoint61q, checkpoint57w_post, checkpoint61e, checkpoint58i_post, checkpoint57x_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.8: +2 -2 lines
avoid 2 consecutive time-steps to be T (if freq is just half a multiple of dT)

1 jmc 1.9 C $Header: /u/gcmpack/MITgcm/eesupp/src/different_multiple.F,v 1.8 2005/05/15 02:58:40 jmc Exp $
2 cnh 1.5 C $Name: $
3 jmc 1.8
4 cnh 1.1 #include "CPP_EEOPTIONS.h"
5    
6 cnh 1.5 CBOP
7     C !ROUTINE: DIFFERENT_MULTIPLE
8    
9     C !INTERFACE:
10 jmc 1.8 LOGICAL FUNCTION DIFFERENT_MULTIPLE( freq, val1, step )
11 cnh 1.1 IMPLICIT NONE
12 cnh 1.5
13     C !DESCRIPTION:
14     C *==========================================================*
15 edhill 1.6 C | LOGICAL FUNCTION DIFFERENT\_MULTIPLE
16 jmc 1.8 C | o Checks if a multiple of freq exist
17     C | around val1 +/- step/2
18 cnh 1.5 C *==========================================================*
19     C | This routine is used for diagnostic and other periodic
20     C | operations. It is very sensitive to arithmetic precision.
21     C | For IEEE conforming arithmetic it works well but for
22     C | cases where short cut arithmetic is used it may not work
23     C | as expected. To overcome this issue compile this routine
24     C | separately with no optimisation.
25     C *==========================================================*
26    
27     C !INPUT PARAMETERS:
28     C == Routine arguments ==
29 jmc 1.8 C freq :: Frequency by which time is divided.
30     C val1 :: time that is checked
31     C step :: length of time interval (around val1) that is checked
32     _RL freq, val1, step
33    
34     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
35 cnh 1.5
36     C !LOCAL VARIABLES:
37     C == Local variables ==
38     C v1, v2, v3, v4 :: Temp. for holding time
39     C d1, d2, d3 :: Temp. for hold difference
40 jmc 1.8 _RL v1, v2, v3, v4, d1, d2, d3
41 cnh 1.5 CEOP
42 cnh 1.2
43     C o Do easy cases first.
44 cnh 1.1 DIFFERENT_MULTIPLE = .FALSE.
45 adcroft 1.3
46     IF ( freq .NE. 0. ) THEN
47 jmc 1.8 IF ( ABS(step) .GT. freq ) THEN
48 adcroft 1.3 DIFFERENT_MULTIPLE = .TRUE.
49     ELSE
50    
51     C o This case is more complex because of round-off error
52     v1 = val1
53 jmc 1.8 v2 = val1 - step
54     v3 = val1 + step
55 adcroft 1.3
56     C Test v1 to see if its a "closest multiple"
57 jmc 1.8 v4 = NINT(v1/freq)*freq
58 adcroft 1.3 d1 = v1-v4
59     d2 = v2-v4
60     d3 = v3-v4
61 jmc 1.9 IF ( ABS(d1) .LT. ABS(d2) .AND. ABS(d1) .LE. ABS(d3) )
62 adcroft 1.3 & DIFFERENT_MULTIPLE = .TRUE.
63    
64 jmc 1.8 ENDIF
65     ENDIF
66 cnh 1.1
67 jmc 1.8 RETURN
68 cnh 1.2 END

  ViewVC Help
Powered by ViewVC 1.1.22