Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SourceTerms.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: Add source terms to the residual.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! region data of current region.
31 !
32 ! Output: None.
33 !
34 ! Notes: none.
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: SourceTerms.F90,v 1.6 2008/12/06 08:44:10 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002-2005 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE sourceterms(region)
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY: t_region
48  USE modglobal, ONLY: t_global
49  USE moderror
50  USE modparameters
51 
52  IMPLICIT NONE
53 
54 #ifdef RFLO
55 #include "Indexing.h"
56 #endif
57 
58 ! ******************************************************************************
59 ! Declarations and definitions
60 ! ******************************************************************************
61 
62 ! ==============================================================================
63 ! Arguments
64 ! ==============================================================================
65 
66  TYPE(t_region) :: region
67 
68 ! ==============================================================================
69 ! Locals
70 ! ==============================================================================
71 
72  INTEGER :: ibc,iec,ic
73 #ifdef RFLO
74  INTEGER :: idcbeg,idcend,jdcbeg,jdcend,kdcbeg,kdcend
75  INTEGER :: ilev,icoff,ijcoff
76 #endif
77  REAL(RFREAL) :: fac,fvol,rhovol
78  REAL(RFREAL), POINTER :: cv(:,:),cvold(:,:),sdual(:,:),rhs(:,:),vol(:)
79  TYPE(t_global), POINTER :: global
80 
81 ! ******************************************************************************
82 ! Start
83 ! ******************************************************************************
84 
85  global => region%global
86 
87  CALL registerfunction( global,'SourceTerms',&
88  'SourceTerms.F90' )
89 
90 ! ******************************************************************************
91 ! Get dimensions and pointers
92 ! ******************************************************************************
93 
94 #ifdef RFLO
95  ilev = region%currLevel
96 
97  CALL rflo_getdimensdummy( region,ilev,idcbeg,idcend, &
98  jdcbeg,jdcend,kdcbeg,kdcend )
99  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
100  ibc = indijk(idcbeg,jdcbeg,kdcbeg,icoff,ijcoff)
101  iec = indijk(idcend,jdcend,kdcend,icoff,ijcoff)
102 
103  cv => region%levels(ilev)%mixt%cv
104  cvold => region%levels(ilev)%mixt%cvOld
105  sdual => region%levels(ilev)%mixt%sDual
106  rhs => region%levels(ilev)%mixt%rhs
107  vol => region%levels(ilev)%grid%vol
108 #endif
109 
110 #ifdef RFLU
111  ibc = 1
112  iec = region%grid%nCells
113 
114  cv => region%mixt%cv
115  rhs => region%mixt%rhs
116  vol => region%grid%vol
117 #endif
118 
119 #ifdef RFLO
120 ! ******************************************************************************
121 ! Source term due to dual time-stepping
122 ! ******************************************************************************
123 
124  IF (global%solverType==solv_implicit .AND. global%dualTstSource) THEN
125  fac = 1.5_rfreal/global%dtMin
126  DO ic=ibc,iec
127  fvol = fac*vol(ic)
128  rhs(cv_mixt_dens,ic) = rhs(cv_mixt_dens,ic) - sdual(cv_mixt_dens,ic) + &
129  fvol*cv(cv_mixt_dens,ic)
130  rhs(cv_mixt_xmom,ic) = rhs(cv_mixt_xmom,ic) - sdual(cv_mixt_xmom,ic) + &
131  fvol*cv(cv_mixt_xmom,ic)
132  rhs(cv_mixt_ymom,ic) = rhs(cv_mixt_ymom,ic) - sdual(cv_mixt_ymom,ic) + &
133  fvol*cv(cv_mixt_ymom,ic)
134  rhs(cv_mixt_zmom,ic) = rhs(cv_mixt_zmom,ic) - sdual(cv_mixt_zmom,ic) + &
135  fvol*cv(cv_mixt_zmom,ic)
136  rhs(cv_mixt_ener,ic) = rhs(cv_mixt_ener,ic) - sdual(cv_mixt_ener,ic) + &
137  fvol*cv(cv_mixt_ener,ic)
138  ENDDO
139  ENDIF
140 #endif
141 
142 ! ******************************************************************************
143 ! Source term due to acceleration
144 ! ******************************************************************************
145 
146  IF ( global%accelOn .EQV. .true. ) THEN
147  DO ic = ibc,iec
148  rhovol = vol(ic)*cv(cv_mixt_dens,ic)
149  rhs(cv_mixt_xmom,ic) = rhs(cv_mixt_xmom,ic) - global%accelX*rhovol
150  rhs(cv_mixt_ymom,ic) = rhs(cv_mixt_ymom,ic) - global%accelY*rhovol
151  rhs(cv_mixt_zmom,ic) = rhs(cv_mixt_zmom,ic) - global%accelZ*rhovol
152  rhs(cv_mixt_ener,ic) = rhs(cv_mixt_ener,ic) - &
153  vol(ic)*(global%accelX*cv(cv_mixt_xmom,ic)+ &
154  global%accelY*cv(cv_mixt_ymom,ic)+ &
155  global%accelZ*cv(cv_mixt_zmom,ic))
156  END DO ! ic
157  END IF ! global%accelOn
158 
159 ! ******************************************************************************
160 ! End
161 ! ******************************************************************************
162 
163  CALL deregisterfunction(global)
164 
165 END SUBROUTINE sourceterms
166 
167 ! ******************************************************************************
168 !
169 ! RCS Revision history:
170 !
171 ! $Log: SourceTerms.F90,v $
172 ! Revision 1.6 2008/12/06 08:44:10 mtcampbe
173 ! Updated license.
174 !
175 ! Revision 1.5 2008/11/19 22:17:23 mtcampbe
176 ! Added Illinois Open Source License/Copyright
177 !
178 ! Revision 1.4 2006/04/07 15:19:15 haselbac
179 ! Removed tabs
180 !
181 ! Revision 1.3 2005/11/10 01:58:37 haselbac
182 ! Added Rocflu support for accel terms, clean-up
183 !
184 ! Revision 1.2 2004/12/04 06:13:31 wasistho
185 ! cvOld to cv in updating rhs by DualTST source terms
186 !
187 ! Revision 1.1 2004/12/01 16:51:24 haselbac
188 ! Initial revision after changing case
189 !
190 ! Revision 1.9 2003/11/20 16:40:35 mdbrandy
191 ! Backing out RocfluidMP changes from 11-17-03
192 !
193 ! Revision 1.6 2003/08/28 20:05:38 jblazek
194 ! Added acceleration terms.
195 !
196 ! Revision 1.5 2003/07/03 21:48:44 jblazek
197 ! Implemented dual-time stepping.
198 !
199 ! Revision 1.4 2003/05/15 02:57:02 jblazek
200 ! Inlined index function.
201 !
202 ! Revision 1.3 2002/09/05 17:40:20 jblazek
203 ! Variable global moved into regions().
204 !
205 ! Revision 1.2 2002/02/21 23:25:05 jblazek
206 ! Blocks renamed as regions.
207 !
208 ! Revision 1.1 2002/01/23 03:51:24 jblazek
209 ! Added low-level time-stepping routines.
210 !
211 ! *****************************************************************************
212 
213 
214 
215 
216 
217 
218 
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcend
NT rhs
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ic
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kdcbeg
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcbeg
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcend
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine sourceterms(region)
Definition: SourceTerms.F90:44