source: palm/trunk/SOURCE/timestep.f90 @ 1320

Last change on this file since 1320 was 1320, checked in by raasch, 10 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

  • Property svn:keywords set to Id
File size: 21.1 KB
Line 
1 SUBROUTINE timestep
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22! ONLY-attribute added to USE-statements,
23! kind-parameters added to all INTEGER and REAL declaration statements,
24! kinds are defined in new module kinds,
25! old module precision_kind is removed,
26! revision history before 2012 removed,
27! comment fields (!:) to be used for variable explanations added to
28! all variable declaration statements
29!
30! Former revisions:
31! -----------------
32! $Id: timestep.f90 1320 2014-03-20 08:40:49Z raasch $
33!
34! 1257 2013-11-08 15:18:40Z raasch
35! openacc porting
36! bugfix for calculation of advective timestep in case of vertically stretched
37! grids
38!
39! 1092 2013-02-02 11:24:22Z raasch
40! unused variables removed
41!
42! 1053 2012-11-13 17:11:03Z hoffmann
43! timestep is reduced in two-moment cloud scheme according to the maximum
44! terminal velocity of rain drops
45!
46! 1036 2012-10-22 13:43:42Z raasch
47! code put under GPL (PALM 3.9)
48!
49! 1001 2012-09-13 14:08:46Z raasch
50! all actions concerning leapfrog scheme removed
51!
52! 978 2012-08-09 08:28:32Z fricke
53! restriction of the outflow damping layer in the diffusion criterion removed
54!
55! 866 2012-03-28 06:44:41Z raasch
56! bugfix for timestep calculation in case of Galilei transformation,
57! special treatment in case of mirror velocity boundary condition removed
58!
59! Revision 1.1  1997/08/11 06:26:19  raasch
60! Initial revision
61!
62!
63! Description:
64! ------------
65! Compute the time step under consideration of the FCL and diffusion criterion.
66!------------------------------------------------------------------------------!
67
68    USE arrays_3d,                                                             &
69        ONLY:  cdc, dzu, dzw, kh, km, lad_u, lad_v, lad_w, u, v, w
70
71    USE cloud_parameters,                                                      &
72        ONLY:  dt_precipitation
73
74    USE control_parameters,                                                    &
75        ONLY:  cfl_factor, coupling_mode, dt_3d, dt_fixed, dt_max,             &
76               galilei_transformation, old_dt, plant_canopy, message_string,   &
77               stop_dt, terminate_coupled, terminate_coupled_remote,           &
78               timestep_reason, u_gtrans, use_ug_for_galilei_tr, v_gtrans
79
80    USE cpulog,                                                                &
81        ONLY:  cpu_log, log_point
82
83    USE grid_variables,                                                        &
84        ONLY:  dx, dx2, dy, dy2
85
86    USE indices,                                                               &
87        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
88
89    USE interfaces
90
91    USE kinds
92
93    USE pegrid
94
95    USE statistics,                                                            &
96        ONLY:  flow_statistics_called, hom, u_max, u_max_ijk, v_max, v_max_ijk,&
97               w_max, w_max_ijk
98
99    IMPLICIT NONE
100
101    INTEGER(iwp) ::  i !:
102    INTEGER(iwp) ::  j !:
103    INTEGER(iwp) ::  k !:
104
105    REAL(wp) ::  div               !:
106    REAL(wp) ::  dt_diff           !:
107    REAL(wp) ::  dt_diff_l         !:
108    REAL(wp) ::  dt_plant_canopy   !:
109    REAL(wp) ::  dt_plant_canopy_l !:
110    REAL(wp) ::  dt_plant_canopy_u !:
111    REAL(wp) ::  dt_plant_canopy_v !:
112    REAL(wp) ::  dt_plant_canopy_w !:
113    REAL(wp) ::  dt_u              !:
114    REAL(wp) ::  dt_u_l            !:
115    REAL(wp) ::  dt_v              !:
116    REAL(wp) ::  dt_v_l            !:
117    REAL(wp) ::  dt_w              !:
118    REAL(wp) ::  dt_w_l            !:
119    REAL(wp) ::  u_gtrans_l        !:
120    REAL(wp) ::  u_max_l           !:
121    REAL(wp) ::  u_min_l           !:
122    REAL(wp) ::  value             !:
123    REAL(wp) ::  v_gtrans_l        !:
124    REAL(wp) ::  v_max_l           !:
125    REAL(wp) ::  v_min_l           !:
126    REAL(wp) ::  w_max_l           !:
127    REAL(wp) ::  w_min_l           !:
128 
129    REAL(wp), DIMENSION(2)         ::  uv_gtrans   !:
130    REAL(wp), DIMENSION(2)         ::  uv_gtrans_l !:
131    REAL(wp), DIMENSION(3)         ::  reduce      !:
132    REAL(wp), DIMENSION(3)         ::  reduce_l    !:
133    REAL(wp), DIMENSION(nzb+1:nzt) ::  dxyz2_min   !: 
134
135
136
137    CALL cpu_log( log_point(12), 'calculate_timestep', 'start' )
138
139!
140!-- In case of Galilei-transform not using the geostrophic wind as translation
141!-- velocity, compute the volume-averaged horizontal velocity components, which
142!-- will then be subtracted from the horizontal wind for the time step and
143!-- horizontal advection routines.
144    IF ( galilei_transformation  .AND. .NOT.  use_ug_for_galilei_tr )  THEN
145       IF ( flow_statistics_called )  THEN
146!
147!--       Horizontal averages already existent, just need to average them
148!--       vertically.
149          u_gtrans = 0.0
150          v_gtrans = 0.0
151          DO  k = nzb+1, nzt
152             u_gtrans = u_gtrans + hom(k,1,1,0)
153             v_gtrans = v_gtrans + hom(k,1,2,0)
154          ENDDO
155          u_gtrans = u_gtrans / REAL( nzt - nzb )
156          v_gtrans = v_gtrans / REAL( nzt - nzb )
157       ELSE
158!
159!--       Averaging over the entire model domain.
160          u_gtrans_l = 0.0
161          v_gtrans_l = 0.0
162          !$acc parallel present( u, v )
163          DO  i = nxl, nxr
164             DO  j = nys, nyn
165                DO  k = nzb+1, nzt
166                   u_gtrans_l = u_gtrans_l + u(k,j,i)
167                   v_gtrans_l = v_gtrans_l + v(k,j,i)
168                ENDDO
169             ENDDO
170          ENDDO
171          !$acc end parallel
172          uv_gtrans_l(1) = u_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb) )
173          uv_gtrans_l(2) = v_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb) )
174#if defined( __parallel )
175          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
176          CALL MPI_ALLREDUCE( uv_gtrans_l, uv_gtrans, 2, MPI_REAL, MPI_SUM, &
177                              comm2d, ierr )
178          u_gtrans = uv_gtrans(1) / REAL( numprocs )
179          v_gtrans = uv_gtrans(2) / REAL( numprocs )
180#else
181          u_gtrans = uv_gtrans_l(1)
182          v_gtrans = uv_gtrans_l(2)
183#endif
184       ENDIF
185    ENDIF
186
187!
188!-- Determine the maxima of the velocity components, including their
189!-- grid index positions.
190#if defined( __openacc )
191    IF ( dt_fixed )  THEN  ! otherwise do it further below for better cache usage
192       u_max_l = -999999.9
193       u_min_l =  999999.9
194       v_max_l = -999999.9
195       v_min_l =  999999.9
196       w_max_l = -999999.9
197       w_min_l =  999999.9
198       !$acc parallel present( u, v, w )
199       DO  i = nxl, nxr
200          DO  j = nys, nyn
201             DO  k = nzb+1, nzt
202                u_max_l = MAX( u_max_l, u(k,j,i) )
203                u_min_l = MIN( u_min_l, u(k,j,i) )
204                v_max_l = MAX( v_max_l, v(k,j,i) )
205                v_min_l = MIN( v_min_l, v(k,j,i) )
206                w_max_l = MAX( w_max_l, w(k,j,i) )
207                w_min_l = MIN( w_min_l, w(k,j,i) )
208             ENDDO
209          ENDDO
210       ENDDO
211       !$acc end parallel
212#if defined( __parallel )
213       reduce_l(1) = u_max_l
214       reduce_l(2) = v_max_l
215       reduce_l(3) = w_max_l
216       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
217       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )
218       u_max = reduce(1)
219       v_max = reduce(2)
220       w_max = reduce(3)
221       reduce_l(1) = u_min_l
222       reduce_l(2) = v_min_l
223       reduce_l(3) = w_min_l
224       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
225       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
226       IF ( ABS( reduce(1) ) > u_max )  u_max = reduce(1)
227       IF ( ABS( reduce(2) ) > v_max )  v_max = reduce(2)
228       IF ( ABS( reduce(3) ) > w_max )  w_max = reduce(3)
229#else
230       IF ( ABS( u_min_l ) > u_max_l )  THEN
231          u_max = u_min_l
232       ELSE
233          u_max = u_max_l
234       ENDIF
235       IF ( ABS( v_min_l ) > v_max_l )  THEN
236          v_max = v_min_l
237       ELSE
238          v_max = v_max_l
239       ENDIF
240       IF ( ABS( w_min_l ) > w_max_l )  THEN
241          w_max = w_min_l
242       ELSE
243          w_max = w_max_l
244       ENDIF
245#endif
246    ENDIF
247#else
248    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0_wp, &
249                         u_max, u_max_ijk )
250    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'abs', 0.0_wp, &
251                         v_max, v_max_ijk )
252    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0_wp, &
253                         w_max, w_max_ijk )
254#endif
255
256    IF ( .NOT. dt_fixed )  THEN
257#if defined( __openacc )
258!
259!--    Variable time step:
260!--    Calculate the maximum time step according to the CFL-criterion,
261!--    individually for each velocity component
262       dt_u_l  =  999999.9
263       dt_v_l  =  999999.9
264       dt_w_l  =  999999.9
265       u_max_l = -999999.9
266       u_min_l =  999999.9
267       v_max_l = -999999.9
268       v_min_l =  999999.9
269       w_max_l = -999999.9
270       w_min_l =  999999.9
271       !$acc parallel loop collapse(3) present( u, v, w )
272       DO  i = nxl, nxr
273          DO  j = nys, nyn
274             DO  k = nzb+1, nzt
275                dt_u_l  = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10 ) ) )
276                dt_v_l  = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10 ) ) )
277                dt_w_l  = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10 ) ) )
278                u_max_l = MAX( u_max_l, u(k,j,i) )
279                u_min_l = MIN( u_min_l, u(k,j,i) )
280                v_max_l = MAX( v_max_l, v(k,j,i) )
281                v_min_l = MIN( v_min_l, v(k,j,i) )
282                w_max_l = MAX( w_max_l, w(k,j,i) )
283                w_min_l = MIN( w_min_l, w(k,j,i) )
284             ENDDO
285          ENDDO
286       ENDDO
287       !$acc end parallel
288
289#if defined( __parallel )
290       reduce_l(1) = dt_u_l
291       reduce_l(2) = dt_v_l
292       reduce_l(3) = dt_w_l
293       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
294       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
295       dt_u = reduce(1)
296       dt_v = reduce(2)
297       dt_w = reduce(3)
298
299       reduce_l(1) = u_max_l
300       reduce_l(2) = v_max_l
301       reduce_l(3) = w_max_l
302       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
303       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )
304       u_max = reduce(1)
305       v_max = reduce(2)
306       w_max = reduce(3)
307       reduce_l(1) = u_min_l
308       reduce_l(2) = v_min_l
309       reduce_l(3) = w_min_l
310       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
311       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
312       IF ( ABS( reduce(1) ) > u_max )  u_max = reduce(1)
313       IF ( ABS( reduce(2) ) > v_max )  v_max = reduce(2)
314       IF ( ABS( reduce(3) ) > w_max )  w_max = reduce(3)
315#else
316       dt_u = dt_u_l
317       dt_v = dt_v_l
318       dt_w = dt_w_l
319
320       IF ( ABS( u_min_l ) > u_max_l )  THEN
321          u_max = u_min_l
322       ELSE
323          u_max = u_max_l
324       ENDIF
325       IF ( ABS( v_min_l ) > v_max_l )  THEN
326          v_max = v_min_l
327       ELSE
328          v_max = v_max_l
329       ENDIF
330       IF ( ABS( w_min_l ) > w_max_l )  THEN
331          w_max = w_min_l
332       ELSE
333          w_max = w_max_l
334       ENDIF
335#endif
336
337#else
338!
339!--    Variable time step:
340!--    Calculate the maximum time step according to the CFL-criterion,
341!--    individually for each velocity component
342       dt_u_l = 999999.9
343       dt_v_l = 999999.9
344       dt_w_l = 999999.9
345       DO  i = nxl, nxr
346          DO  j = nys, nyn
347             DO  k = nzb+1, nzt
348                dt_u_l = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10 ) ) )
349                dt_v_l = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10 ) ) )
350                dt_w_l = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10 ) ) )
351             ENDDO
352          ENDDO
353       ENDDO
354
355#if defined( __parallel )
356       reduce_l(1) = dt_u_l
357       reduce_l(2) = dt_v_l
358       reduce_l(3) = dt_w_l
359       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
360       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
361       dt_u = reduce(1)
362       dt_v = reduce(2)
363       dt_w = reduce(3)
364#else
365       dt_u = dt_u_l
366       dt_v = dt_v_l
367       dt_w = dt_w_l
368#endif
369
370#endif
371
372!
373!--    Compute time step according to the diffusion criterion.
374!--    First calculate minimum grid spacing which only depends on index k
375!--    Note: also at k=nzb+1 a full grid length is being assumed, although
376!--          in the Prandtl-layer friction term only dz/2 is used.
377!--          Experience from the old model seems to justify this.
378       dt_diff_l = 999999.0
379
380       DO  k = nzb+1, nzt
381           dxyz2_min(k) = MIN( dx2, dy2, dzw(k)*dzw(k) ) * 0.125
382       ENDDO
383
384!$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l)
385!$OMP DO
386       !$acc parallel loop collapse(3) present( kh, km )
387       DO  i = nxl, nxr
388          DO  j = nys, nyn
389             DO  k = nzb+1, nzt
390                dt_diff_l = MIN( dt_diff_l, dxyz2_min(k) / &
391                                       ( MAX( kh(k,j,i), km(k,j,i) ) + 1E-20 ) )
392             ENDDO
393          ENDDO
394       ENDDO
395       !$acc end parallel
396!$OMP END PARALLEL
397#if defined( __parallel )
398       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
399       CALL MPI_ALLREDUCE( dt_diff_l, dt_diff, 1, MPI_REAL, MPI_MIN, comm2d, &
400                           ierr )
401#else
402       dt_diff = dt_diff_l
403#endif
404
405!
406!--    Additional timestep criterion with plant canopies:
407!--    it is not allowed to extract more than the available momentum
408       IF ( plant_canopy ) THEN
409
410          dt_plant_canopy_l = 0.0
411          DO  i = nxl, nxr
412             DO  j = nys, nyn
413                DO k = nzb+1, nzt
414                   dt_plant_canopy_u = cdc(k,j,i) * lad_u(k,j,i) *  &
415                                       SQRT(     u(k,j,i)**2     +  &
416                                             ( ( v(k,j,i-1)      +  &
417                                                 v(k,j,i)        +  &
418                                                 v(k,j+1,i)      +  &
419                                                 v(k,j+1,i-1) )     &
420                                               / 4.0 )**2        +  &
421                                             ( ( w(k-1,j,i-1)    +  &
422                                                 w(k-1,j,i)      +  &
423                                                 w(k,j,i-1)      +  &
424                                                 w(k,j,i) )         &
425                                                 / 4.0 )**2 ) 
426                   IF ( dt_plant_canopy_u > dt_plant_canopy_l ) THEN
427                      dt_plant_canopy_l = dt_plant_canopy_u 
428                   ENDIF
429                   dt_plant_canopy_v = cdc(k,j,i) * lad_v(k,j,i) *  &
430                                       SQRT( ( ( u(k,j-1,i)      +  &
431                                                 u(k,j-1,i+1)    +  &
432                                                 u(k,j,i)        +  &
433                                                 u(k,j,i+1) )       &
434                                               / 4.0 )**2        +  &
435                                                 v(k,j,i)**2     +  &
436                                             ( ( w(k-1,j-1,i)    +  &
437                                                 w(k-1,j,i)      +  &
438                                                 w(k,j-1,i)      +  &
439                                                 w(k,j,i) )         &
440                                                 / 4.0 )**2 ) 
441                   IF ( dt_plant_canopy_v > dt_plant_canopy_l ) THEN
442                      dt_plant_canopy_l = dt_plant_canopy_v
443                   ENDIF                   
444                   dt_plant_canopy_w = cdc(k,j,i) * lad_w(k,j,i) *  &
445                                       SQRT( ( ( u(k,j,i)        +  &
446                                                 u(k,j,i+1)      +  &
447                                                 u(k+1,j,i)      +  &
448                                                 u(k+1,j,i+1) )     &
449                                               / 4.0 )**2        +  &
450                                             ( ( v(k,j,i)        +  &
451                                                 v(k,j+1,i)      +  &
452                                                 v(k+1,j,i)      +  &
453                                                 v(k+1,j+1,i) )     &
454                                               / 4.0 )**2        +  &
455                                                 w(k,j,i)**2 )     
456                   IF ( dt_plant_canopy_w > dt_plant_canopy_l ) THEN
457                      dt_plant_canopy_l = dt_plant_canopy_w
458                   ENDIF
459                ENDDO
460             ENDDO
461          ENDDO 
462
463          IF ( dt_plant_canopy_l > 0.0 ) THEN
464!
465!--          Invert dt_plant_canopy_l and apply a security timestep factor 0.1
466             dt_plant_canopy_l = 0.1 / dt_plant_canopy_l
467          ELSE
468!
469!--          In case of inhomogeneous plant canopy, some processors may have no
470!--          canopy at all. Then use dt_max as dummy instead.
471             dt_plant_canopy_l = dt_max
472          ENDIF
473
474!
475!--       Determine the global minumum
476#if defined( __parallel )
477          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
478          CALL MPI_ALLREDUCE( dt_plant_canopy_l, dt_plant_canopy, 1, MPI_REAL, &
479                              MPI_MIN, comm2d, ierr )
480#else
481          dt_plant_canopy = dt_plant_canopy_l
482#endif
483
484       ELSE
485!
486!--       Use dt_diff as dummy value to avoid extra IF branches further below
487          dt_plant_canopy = dt_diff
488
489       ENDIF
490
491!
492!--    The time step is the minimum of the 3-4 components and the diffusion time
493!--    step minus a reduction (cfl_factor) to be on the safe side.
494!--    The time step must not exceed the maximum allowed value.
495       dt_3d = cfl_factor * MIN( dt_diff, dt_plant_canopy, dt_u, dt_v, dt_w,   &
496                                 dt_precipitation )
497       dt_3d = MIN( dt_3d, dt_max )
498
499!
500!--    Remember the restricting time step criterion for later output.
501       IF ( MIN( dt_u, dt_v, dt_w ) < MIN( dt_diff, dt_plant_canopy ) )  THEN
502          timestep_reason = 'A'
503       ELSEIF ( dt_plant_canopy < dt_diff )  THEN
504          timestep_reason = 'C'
505       ELSE
506          timestep_reason = 'D'
507       ENDIF
508
509!
510!--    Set flag if the time step becomes too small.
511       IF ( dt_3d < ( 0.00001 * dt_max ) )  THEN
512          stop_dt = .TRUE.
513
514          WRITE( message_string, * ) 'Time step has reached minimum limit.',  &
515               '&dt              = ', dt_3d, ' s  Simulation is terminated.', &
516               '&old_dt          = ', old_dt, ' s',                           &
517               '&dt_u            = ', dt_u, ' s',                             &
518               '&dt_v            = ', dt_v, ' s',                             &
519               '&dt_w            = ', dt_w, ' s',                             &
520               '&dt_diff         = ', dt_diff, ' s',                          &
521               '&dt_plant_canopy = ', dt_plant_canopy, ' s',                  &
522               '&u_max           = ', u_max, ' m/s   k=', u_max_ijk(1),       &
523               '  j=', u_max_ijk(2), '  i=', u_max_ijk(3),                    &
524               '&v_max           = ', v_max, ' m/s   k=', v_max_ijk(1),       &
525               '  j=', v_max_ijk(2), '  i=', v_max_ijk(3),                    &
526               '&w_max           = ', w_max, ' m/s   k=', w_max_ijk(1),       &
527               '  j=', w_max_ijk(2), '  i=', w_max_ijk(3)
528          CALL message( 'timestep', 'PA0312', 0, 1, 0, 6, 0 )
529!
530!--       In case of coupled runs inform the remote model of the termination
531!--       and its reason, provided the remote model has not already been
532!--       informed of another termination reason (terminate_coupled > 0) before.
533#if defined( __parallel )
534          IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0 )  THEN
535             terminate_coupled = 2
536             IF ( myid == 0 ) THEN
537                CALL MPI_SENDRECV( &
538                     terminate_coupled,        1, MPI_INTEGER, target_id,  0, &
539                     terminate_coupled_remote, 1, MPI_INTEGER, target_id,  0, &
540                     comm_inter, status, ierr )
541             ENDIF
542             CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr)
543          ENDIF
544#endif
545       ENDIF
546
547!
548!--    Ensure a smooth value (two significant digits) of the timestep.
549       div = 1000.0
550       DO  WHILE ( dt_3d < div )
551          div = div / 10.0
552       ENDDO
553       dt_3d = NINT( dt_3d * 100.0 / div ) * div / 100.0
554
555!
556!--    Adjust the time step
557       old_dt = dt_3d
558
559    ENDIF
560
561    CALL cpu_log( log_point(12), 'calculate_timestep', 'stop' )
562
563 END SUBROUTINE timestep
Note: See TracBrowser for help on using the repository browser.