Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_FinishSD.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: Finish computation of substantial derivative.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! region Data of current region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. On entry: region%mixt%sd Residual from convective terms only
36 ! region%mixt%rhs Residual from all terms
37 ! 2. On exit: region%mixt%sd D{u,v,w}/Dt
38 ! 3. Current implementation assumes grid is not moving
39 !
40 ! ******************************************************************************
41 !
42 ! $Id: RFLU_FinishSD.F90,v 1.4 2008/12/06 08:44:12 mtcampbe Exp $
43 !
44 ! Copyright: (c) 2004-2005 by the University of Illinois
45 !
46 ! ******************************************************************************
47 
48 SUBROUTINE rflu_finishsd(region)
49 
50  USE moddatatypes
51  USE moderror
52  USE modparameters
53  USE moddatastruct, ONLY: t_region
54  USE modglobal, ONLY: t_global
55 
56 ! TEMPORARY
57 ! USE RFLU_ModTime, ONLY: RFLU_GetTimeRK
58 ! END TEMPORARY
59 
60  IMPLICIT NONE
61 
62 ! ******************************************************************************
63 ! Definitions and declarations
64 ! ******************************************************************************
65 
66 ! ==============================================================================
67 ! Arguments
68 ! ==============================================================================
69 
70  TYPE(t_region) :: region
71 
72 ! ==============================================================================
73 ! Locals
74 ! ==============================================================================
75 
76  INTEGER :: arraylimlow,arraylimupp,icg
77  REAL(RFREAL) :: term
78  REAL(RFREAL), DIMENSION(:), POINTER :: vol
79  REAL(RFREAL), DIMENSION(:,:), POINTER :: sd,rhs,cv,tv
80  TYPE(t_global), POINTER :: global
81 
82 ! TEMPORARY
83 ! REAL(RFREAL) :: term2,term3,DuDt,DuDt2,DuDt3,xr,xl,dx
84 ! END TEMPORARY
85 
86 ! ******************************************************************************
87 ! Start
88 ! ******************************************************************************
89 
90  global => region%global
91 
92  CALL registerfunction(global,'RFLU_FinishSD',&
93  'RFLU_FinishSD.F90')
94 
95 ! ******************************************************************************
96 ! Checks: Defensive coding, should never occur
97 ! ******************************************************************************
98 
99  IF ( region%mixtInput%moveGrid .EQV. .true. ) THEN
100  CALL errorstop( global,err_unknown_option,__line__, &
101  'Equilibrium Eulerian method not yet implemented with moving grid')
102  END IF ! region%mixtInput%moveGrid
103 
104  IF ( region%mixtInput%indSd /= 1 ) THEN
105  CALL errorstop(global,err_illegal_value,__line__)
106  END IF ! region%mixtInput%indSd
107 
108 ! ******************************************************************************
109 ! Set up pointers and compute array bounds
110 ! ******************************************************************************
111 
112  vol => region%grid%vol
113 
114  sd => region%mixt%sd
115  rhs => region%mixt%rhs
116  cv => region%mixt%cv
117  tv => region%mixt%tv
118 
119 ! ******************************************************************************
120 ! Compute DuDt
121 ! ******************************************************************************
122 
123 ! DEBUG
124 ! dx = 2.0_RFREAL/(region%grid%nCells/9.0_RFREAL)
125 ! WRITE(*,*) 'RFLU_FinishSD:',dx
126 ! END DEBUG
127 
128  DO icg = 1,region%grid%nCellsTot
129  term = 1.0_rfreal/(cv(cv_mixt_dens,icg)*vol(icg))
130 
131  sd(sd_xmom,icg) = term*(sd(sd_xmom,icg) - rhs(cv_mixt_xmom,icg))
132  sd(sd_ymom,icg) = term*(sd(sd_ymom,icg) - rhs(cv_mixt_ymom,icg))
133  sd(sd_zmom,icg) = term*(sd(sd_zmom,icg) - rhs(cv_mixt_zmom,icg))
134 
135 ! TEMPORARY - Comparison with shock tube Sod 1 at 1ms
136 ! term = region%grid%cofg(XCOORD,icg)/1.0E-3_RFREAL
137 !
138 ! IF ( (ABS(region%grid%cofg(YCOORD,icg)) < 0.017_RFREAL) .AND. &
139 ! (ABS(region%grid%cofg(ZCOORD,icg)) < 0.017_RFREAL) ) THEN
140 ! IF ( region%grid%cofg(XCOORD,icg) > -0.374165735491392_RFREAL .AND. &
141 ! region%grid%cofg(XCOORD,icg) < -2.222221147508515E-002 ) THEN
142 ! term2 = -5.0_RFREAL/6.0_RFREAL*term/1.0E-3_RFREAL
143 ! term3 = 25.0_RFREAL/36.0_RFREAL*(374.166_RFREAL+term)/1.0E-3_RFREAL
144 !
145 ! xl = region%grid%cofg(XCOORD,icg)-0.5_RFREAL*dx
146 ! xr = region%grid%cofg(XCOORD,icg)+0.5_RFREAL*dx
147 ! DuDt = ((311.805_RFREAL-xr/6.0E-3_RFREAL)**7-(311.805_RFREAL-xl/6.0E-3_RFREAL)**7)/ &
148 ! ((311.805_RFREAL-xr/6.0E-3_RFREAL)**6-(311.805_RFREAL-xl/6.0E-3_RFREAL)**6)/(1.4_RFREAL*1.0E-3_RFREAL)
149 ! DuDt2 = 5.0_RFREAL/6.0_RFREAL*(311.805_RFREAL-region%grid%cofg(XCOORD,icg)/(6.0_RFREAL*1.0E-3_RFREAL))/1.0E-3_RFREAL
150 ! DuDt3 = 5.0_RFREAL/(6.0_RFREAL*dx)*((xr/1.0E-3_RFREAL*(311.805-xr/(12.0_RFREAL*1.0E-3_RFREAL))) &
151 ! - (xl/1.0E-3_RFREAL*(311.805-xl/(12.0_RFREAL*1.0E-3_RFREAL))))
152 ! ELSE
153 ! term2 = 0.0_RFREAL
154 ! term3 = 0.0_RFREAL
155 ! DuDt = 0.0_RFREAL
156 ! DuDt2 = 0.0_RFREAL
157 ! DuDt3 = 0.0_RFREAL
158 ! END IF
159 !
160 ! WRITE(11,'(7(1X,E23.16))') region%grid%cofg(XCOORD,icg), &
161 ! sd(SD_XMOM,icg), &
162 ! term2+term3, &
163 ! DuDt,DuDt2,DuDt3, &
164 ! region%mixt%cv(CV_MIXT_XMOM,icg)/region%mixt%cv(CV_MIXT_DENS,icg)
165 ! END IF
166 ! END TEMPORARY
167  END DO ! icg
168 
169 ! ******************************************************************************
170 ! End
171 ! ******************************************************************************
172 
173  CALL deregisterfunction(global)
174 
175 END SUBROUTINE rflu_finishsd
176 
177 ! ******************************************************************************
178 !
179 ! RCS Revision history:
180 !
181 ! $Log: RFLU_FinishSD.F90,v $
182 ! Revision 1.4 2008/12/06 08:44:12 mtcampbe
183 ! Updated license.
184 !
185 ! Revision 1.3 2008/11/19 22:17:25 mtcampbe
186 ! Added Illinois Open Source License/Copyright
187 !
188 ! Revision 1.2 2005/03/31 16:49:32 haselbac
189 ! Improved computation of sd
190 !
191 ! Revision 1.1 2004/07/30 22:47:35 jferry
192 ! Implemented Equilibrium Eulerian method for Rocflu
193 !
194 ! ******************************************************************************
195 
196 
197 
198 
199 
200 
201 
NT rhs
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflu_finishsd(region)