Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RkUpdatePointScalar.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: Updates particle velocity with classical 4-stage Runge-Kutta method.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! region Region data
31 ! iStage Runge-Kutta stage
32 ! ivBeg Beginning index for variable update
33 ! ivEnd Ending index for variable update
34 ! var Conserved variables
35 ! varOld Old conserved variables
36 ! rhs Residual
37 ! rhsSum Residual sum
38 !
39 !
40 ! Output:
41 ! var Variables
42 ! rhsSum Residual sum
43 !
44 ! Notes: None.
45 !
46 !******************************************************************************
47 !
48 ! $Id: RkUpdatePointScalar.F90,v 1.3 2008/12/06 08:44:10 mtcampbe Exp $
49 !
50 ! Copyright: (c) 2005 by the University of Illinois
51 !
52 !******************************************************************************
53 
54 SUBROUTINE rkupdatepointscalar(region,iStage,ivBeg,ivEnd,var,varOld,rhs,rhsSum)
55 
56  USE moddatatypes
57  USE moddatastruct, ONLY: t_region
58  USE modglobal, ONLY: t_global
59  USE moderror
60  USE modparameters
61 
62  IMPLICIT NONE
63 
64 ! *****************************************************************************
65 ! Definitions and declarations
66 ! *****************************************************************************
67 
68 ! =============================================================================
69 ! Arguments
70 ! =============================================================================
71 
72  TYPE(t_region) :: region
73  INTEGER, INTENT(IN) :: istage,ivbeg,ivend
74  REAL(RFREAL), DIMENSION(:), POINTER :: var,varold,rhs,rhssum
75 
76 ! =============================================================================
77 ! Locals
78 ! =============================================================================
79 
80  CHARACTER(CHRLEN) :: rcsidentstring
81  INTEGER :: iv
82  REAL(RFREAL) :: fac
83  REAL(RFREAL) :: ark(5),grk(5)
84  TYPE(t_global), POINTER :: global
85 
86 ! *****************************************************************************
87 ! Start
88 ! *****************************************************************************
89 
90  rcsidentstring = '$RCSfile: RkUpdatePointScalar.F90,v $ $Revision: 1.3 $'
91 
92  global => region%global
93 
94  CALL registerfunction(global,'RkUpdatePointScalar',&
95  'RkUpdatePointScalar.F90')
96 
97 ! *****************************************************************************
98 ! Set pointers and variables
99 ! *****************************************************************************
100 
101  ark(:) = region%mixtInput%ark(:)
102  grk(:) = region%mixtInput%grk(:)
103 
104 ! *****************************************************************************
105 ! Update
106 ! *****************************************************************************
107 
108  fac = ark(istage)*global%dtMin
109 
110  SELECT CASE ( global%rkScheme )
111  CASE ( rk_scheme_4_classical )
112  IF ( istage == 1 ) THEN
113  DO iv = ivbeg,ivend
114  var(iv) = varold(iv) + fac*rhs(iv)
115  rhssum(iv) = rhs(iv)
116  END DO ! iv
117  ELSE IF ( istage == global%nrkSteps ) THEN
118  DO iv = ivbeg,ivend
119  var(iv) = varold(iv) + fac*(rhs(iv) + rhssum(iv))
120  END DO ! iv
121  ELSE
122  DO iv = ivbeg,ivend
123  var(iv) = varold(iv) + fac*rhs(iv)
124  rhssum(iv) = rhssum(iv) + grk(istage)*rhs(iv)
125  END DO ! iv
126  END IF ! iStage
127  CASE ( rk_scheme_3_wray )
128  IF ( istage == 1 ) THEN
129  DO iv = ivbeg,ivend
130  var(iv) = varold(iv) + fac*rhs(iv)
131  rhssum(iv) = rhs(iv)
132  END DO ! iv
133  ELSE IF ( istage == 2 ) THEN
134  DO iv = ivbeg,ivend
135  var(iv) = varold(iv) + fac*(rhs(iv) - grk(istage)*rhssum(iv))
136  rhssum(iv) = rhs(iv)
137  END DO ! iv
138  ELSE
139  DO iv = ivbeg,ivend
140  var(iv) = varold(iv) + fac*(rhs(iv) - grk(istage)*rhssum(iv))
141  END DO ! iv
142  END IF ! iStage
143  CASE default
144  CALL errorstop(global,err_reached_default,__line__)
145  END SELECT ! global%rkScheme
146 
147 ! *****************************************************************************
148 ! End
149 ! *****************************************************************************
150 
151  CALL deregisterfunction(global)
152 
153 END SUBROUTINE rkupdatepointscalar
154 
155 ! ******************************************************************************
156 !
157 ! RCS Revision history:
158 !
159 ! $Log: RkUpdatePointScalar.F90,v $
160 ! Revision 1.3 2008/12/06 08:44:10 mtcampbe
161 ! Updated license.
162 !
163 ! Revision 1.2 2008/11/19 22:17:23 mtcampbe
164 ! Added Illinois Open Source License/Copyright
165 !
166 ! Revision 1.1 2006/08/19 15:37:27 mparmar
167 ! Initial revision
168 !
169 ! ******************************************************************************
170 
171 
172 
173 
174 
175 
176 
NT rhs
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rkupdatepointscalar(region, iStage, ivBeg, ivEnd, var, varOld, rhs, rhsSum)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469