Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_MinimumTimeStep.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: calculate the minimum time step for all regions on all processors,
26 ! compare it to the imposed time step and store the minimum of both.
27 !
28 ! Description: none.
29 !
30 ! Input: regions = data of all grid regions
31 ! global%dtImposed = user prescribed time step.
32 !
33 ! Output: global%dtMin = minimum time step.
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RFLO_MinimumTimeStep.F90,v 1.3 2008/12/06 08:44:27 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE rflo_minimumtimestep( regions )
46 
47  USE moddatatypes
48  USE moddatastruct, ONLY : t_region
49  USE modglobal, ONLY : t_global
50  USE moderror
51  USE modmpi
52  USE modparameters
53  IMPLICIT NONE
54 
55 ! ... parameters
56  TYPE(t_region), POINTER :: regions(:)
57 
58 ! ... loop variables
59  INTEGER :: ireg
60 
61 ! ... local variables
62  REAL(RFREAL) :: cfl, dtmin, dtmintot
63 
64  TYPE(t_global), POINTER :: global
65 
66 !******************************************************************************
67 
68  global => regions(1)%global
69 
70  CALL registerfunction( global,'RFLO_MinimumTimeStep',&
71  'RFLO_MinimumTimeStep.F90' )
72 
73 ! compare imposed and max. stable time step
74 
75  dtmin = global%dtImposed
76 
77  DO ireg=1,global%nRegions
78  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
79  regions(ireg)%active==active) THEN ! on my processor
80  cfl = regions(ireg)%mixtInput%cfl
81  dtmin = min(dtmin,global%dtMin*cfl)
82  ENDIF ! active
83  ENDDO ! iReg
84 
85  global%dtMin = dtmin
86 
87 ! exhange time step between processors
88 
89 #ifdef MPI
90  CALL mpi_allreduce( global%dtMin,dtmintot,1,mpi_rfreal,mpi_min, &
91  global%mpiComm,global%mpierr )
92  IF (global%mpierr /=0 ) CALL errorstop( global,err_mpi_trouble,__line__ )
93 
94  global%dtMin = dtmintot
95 #endif
96 
97 ! finalize
98 
99  CALL deregisterfunction( global )
100 
101 END SUBROUTINE rflo_minimumtimestep
102 
103 !******************************************************************************
104 !
105 ! RCS Revision history:
106 !
107 ! $Log: RFLO_MinimumTimeStep.F90,v $
108 ! Revision 1.3 2008/12/06 08:44:27 mtcampbe
109 ! Updated license.
110 !
111 ! Revision 1.2 2008/11/19 22:17:38 mtcampbe
112 ! Added Illinois Open Source License/Copyright
113 !
114 ! Revision 1.1 2004/11/29 20:51:39 wasistho
115 ! lower to upper case
116 !
117 ! Revision 1.7 2003/05/15 02:57:04 jblazek
118 ! Inlined index function.
119 !
120 ! Revision 1.6 2002/09/20 22:22:36 jblazek
121 ! Finalized integration into GenX.
122 !
123 ! Revision 1.5 2002/09/05 17:40:21 jblazek
124 ! Variable global moved into regions().
125 !
126 ! Revision 1.4 2002/03/18 23:11:33 jblazek
127 ! Finished multiblock and MPI.
128 !
129 ! Revision 1.3 2002/02/21 23:25:06 jblazek
130 ! Blocks renamed as regions.
131 !
132 ! Revision 1.2 2002/02/09 01:47:01 jblazek
133 ! Added multi-probe option, residual smoothing, physical time step.
134 !
135 ! Revision 1.1 2002/01/16 22:03:35 jblazek
136 ! Added time-stepping routines.
137 !
138 !******************************************************************************
139 
140 
141 
142 
143 
144 
145 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_minimumtimestep(regions)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469