Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_CalcDrag.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: compute interaction source for drag forces on Lagrangian particles.
26 !
27 ! Description: none.
28 !
29 ! Input: region = current region.
30 !
31 ! Output: region%levels(iLev)%plag%inrtSources
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: INRT_CalcDrag.F90,v 1.5 2008/12/06 08:44:31 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2003 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE inrt_calcdrag( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
48  USE modpartlag, ONLY : t_plag
49  USE moderror
50  USE modparameters
52 
53 #ifdef PLAG
55 #endif
56  IMPLICIT NONE
57 
58 ! ... parameters
59  TYPE(t_region), INTENT(INOUT), TARGET :: region
60 
61 ! ... loop variables
62  INTEGER :: ipcls
63 
64 ! ... local variables
65  CHARACTER(CHRLEN) :: rcsidentstring
66 
67  INTEGER :: dragmodel, icont, ncont, npcls
68 #ifdef RFLO
69  INTEGER :: ilev
70 #endif
71  INTEGER, POINTER, DIMENSION(:) :: pcvplagmass
72 
73  REAL(RFREAL) :: diaml, massl, mixtvolr, pi, psil, &
74  relvelmagl, reyl, taulr
75  REAL(RFREAL), DIMENSION(3) :: relvel, accell
76  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv, pdv, ptv
77 
78  TYPE(t_plag) , POINTER :: pplag
79  TYPE(t_global), POINTER :: global
80 
81 !******************************************************************************
82 
83  rcsidentstring = '$RCSfile: INRT_CalcDrag.F90,v $ $Revision: 1.5 $'
84 
85  global => region%global
86 
87  CALL registerfunction( global,'INRT_CalcDrag',&
88  'INRT_CalcDrag.F90' )
89 
90 #ifdef PLAG
91 ! begin -----------------------------------------------------------------------
92 
93 ! Check if there are any particles
94 
95  npcls = 0
96 
97 #ifdef RFLO
98  ilev = region%currLevel
99  IF (global%plagUsed) npcls = region%levels(ilev)%plag%nPcls
100 #endif
101 #ifdef RFLU
102  IF (global%plagUsed) npcls = region%plag%nPcls
103 #endif
104 
105  IF (npcls < 1) go to 999
106 
107 ! Get dimensions --------------------------------------------------------------
108 
109  pi = global%pi
110 
111  ncont = region%plagInput%nCont
112  dragmodel = region%inrtInput%inrts(inrt_type_drag)%switches( &
113  inrt_swi_drag_model)
114 
115 ! Set pointers ----------------------------------------------------------------
116 
117 #ifdef RFLO
118  pplag => region%levels(ilev)%plag
119 #endif
120 #ifdef RFLU
121  pplag => region%plag
122 #endif
123 
124  pcv => pplag%cv
125  pdv => pplag%dv
126  ptv => pplag%tv
127 
128  pcvplagmass => pplag%cvPlagMass
129 
130 ! Loop over all the particles -------------------------------------------------
131 
132  DO ipcls = 1,npcls
133 
134  diaml = pdv(dv_plag_diam,ipcls)
135 
136  massl = sum( pcv(pcvplagmass(:),ipcls) )
137 
138  taulr = 3.0_rfreal*pi*ptv(tv_plag_muelmixt,ipcls)* &
139  diaml/massl
140 
141  relvel(1) = pdv(dv_plag_uvelmixt,ipcls)-pdv(dv_plag_uvel,ipcls)
142  relvel(2) = pdv(dv_plag_vvelmixt,ipcls)-pdv(dv_plag_vvel,ipcls)
143  relvel(3) = pdv(dv_plag_wvelmixt,ipcls)-pdv(dv_plag_wvel,ipcls)
144 
145  SELECT CASE (dragmodel)
146 
147  CASE (inrt_drag_model_stokes)
148 
149  psil = 1.0_rfreal
150 
151  CASE (inrt_drag_model_sn)
152 
153  relvelmagl = sqrt( relvel(1)*relvel(1)+ &
154  relvel(2)*relvel(2)+ &
155  relvel(3)*relvel(3) )
156 
157  reyl = diaml * relvelmagl * pdv(dv_plag_densmixt,ipcls) / &
158  ptv(tv_plag_muelmixt,ipcls)
159 
160  psil = 1.0_rfreal + 0.15_rfreal* (reyl**0.687_rfreal)
161 
162  CASE (inrt_drag_model_smrfld)
163 
164  relvelmagl = sqrt( relvel(1)*relvel(1)+ &
165  relvel(2)*relvel(2)+ &
166  relvel(3)*relvel(3) )
167 
168  reyl = diaml * relvelmagl * pdv(dv_plag_densmixt,ipcls) / &
169  ptv(tv_plag_muelmixt,ipcls)
170 
171  psil = 112.0_rfreal/24.0_rfreal *reyl**(+0.02_rfreal)
172 
173  CASE default
174  CALL errorstop( global,err_reached_default,__line__ )
175 
176  END SELECT ! dragModel
177 
178  accell(1) = psil*relvel(1)*taulr
179  accell(2) = psil*relvel(2)*taulr
180  accell(3) = psil*relvel(3)*taulr
181 
182 ! - fill the effect of the particles (L) on the gas (G).
183 ! - the source terms will be added to the particle Rhs.
184 
185  pplag%inrtSources(inrt_drag_l_xmom_g,ipcls) = -massl*accell(1)
186  pplag%inrtSources(inrt_drag_l_ymom_g,ipcls) = -massl*accell(2)
187  pplag%inrtSources(inrt_drag_l_zmom_g,ipcls) = -massl*accell(3)
188 
189  END DO ! iPcls
190 
191 ! finalize --------------------------------------------------------------------
192 
193 999 CONTINUE
194 #endif
195  CALL deregisterfunction( global )
196 
197 END SUBROUTINE inrt_calcdrag
198 
199 !******************************************************************************
200 !
201 ! RCS Revision history:
202 !
203 ! $Log: INRT_CalcDrag.F90,v $
204 ! Revision 1.5 2008/12/06 08:44:31 mtcampbe
205 ! Updated license.
206 !
207 ! Revision 1.4 2008/11/19 22:17:44 mtcampbe
208 ! Added Illinois Open Source License/Copyright
209 !
210 ! Revision 1.3 2007/03/08 14:59:36 fnajjar
211 ! Fixed bug in Sommerfeld drag law for psiL
212 !
213 ! Revision 1.2 2007/03/07 22:16:47 fnajjar
214 ! Added Sommerfeld drag law
215 !
216 ! Revision 1.1 2004/12/01 21:56:14 fnajjar
217 ! Initial revision after changing case
218 !
219 ! Revision 1.6 2004/03/05 22:09:03 jferry
220 ! created global variables for peul, plag, and inrt use
221 !
222 ! Revision 1.5 2004/01/31 03:59:22 haselbac
223 ! Initial integration for Rocflu and Rocpart
224 !
225 ! Revision 1.4 2003/04/03 21:10:17 jferry
226 ! implemented additional safety checks for rocinteract
227 !
228 ! Revision 1.3 2003/04/02 22:32:03 jferry
229 ! codified Activeness and Permission structures for rocinteract
230 !
231 ! Revision 1.2 2003/03/11 16:09:39 jferry
232 ! Added comments
233 !
234 ! Revision 1.1 2003/03/04 22:12:35 jferry
235 ! Initial import of Rocinteract
236 !
237 !******************************************************************************
238 
239 
240 
241 
242 
243 
244 
Tfloat sum() const
Return the sum of all the pixel values in an image.
Definition: CImg.h:13022
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
static const double pi
Definition: smooth_medial.C:43
subroutine inrt_calcdrag(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469