Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_ReflectParticleData.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: Reflect particle data about patch face.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pPatch Pointer to patch
31 ! pPlag Pointer to particle data
32 ! ifl Local face index
33 ! iPcl Particle index
34 ! xLocOld x-component of old particle location
35 ! yLocOld y-component of old particle location
36 ! zLocOld z-component of old particle location
37 ! xLoc x-component of particle location
38 ! yLoc y-component of particle location
39 ! zLoc z-component of particle location
40 ! xTraj x-component of particle trajectory
41 ! yTraj y-component of particle trajectory
42 ! zTraj z-component of particle trajectory
43 !
44 ! Output:
45 ! xLocOld x-component of reflected old particle location
46 ! yLocOld y-component of reflected old particle location
47 ! zLocOld z-component of reflected old particle location
48 ! xLoc x-component of reflected particle location
49 ! yLoc y-component of reflected particle location
50 ! zLoc z-component of reflected particle location
51 ! xTraj x-component of reflected particle trajectory
52 ! yTraj y-component of reflected particle trajectory
53 ! zTraj z-component of reflected particle trajectory
54 !
55 ! Notes:
56 ! 1. Reflect particle data about centroid of face instead of about point of
57 ! intersection of particle path and plane defined by face. This is ok
58 ! because vector between centroid and intersection lies in plane defined
59 ! by face.
60 !
61 ! ******************************************************************************
62 !
63 ! $Id: PLAG_ReflectParticleData.F90,v 1.8 2008/12/06 08:44:36 mtcampbe Exp $
64 !
65 ! Copyright: (c) 2004 by the University of Illinois
66 !
67 ! ******************************************************************************
68 
69 SUBROUTINE plag_reflectparticledata(pPatch,pPlag,ifl,iPcl,xLocOld,yLocOld, &
70  zlocold,xloc,yloc,zloc,xtraj,ytraj,ztraj)
71 
72  USE moddatatypes
73  USE modparameters
74  USE moderror
75  USE modglobal, ONLY: t_global
76  USE modbndpatch, ONLY: t_patch
77  USE modpartlag, ONLY: t_plag
78  USE modmpi
79 
81 
82  USE modinterfaces, ONLY: reflectposition, &
84 
85  IMPLICIT NONE
86 
87 ! ******************************************************************************
88 ! Declarations
89 ! ******************************************************************************
90 
91 ! ==============================================================================
92 ! Arguments
93 ! ==============================================================================
94 
95  INTEGER, INTENT(IN) :: ifl,ipcl
96  REAL(RFREAL), INTENT(INOUT) :: xloc,xlocold,yloc,ylocold,zloc,zlocold
97  REAL(RFREAL), INTENT(INOUT), OPTIONAL :: xtraj,ytraj,ztraj
98  TYPE(t_patch), POINTER :: ppatch
99  TYPE(t_plag), POINTER :: pplag
100 
101 ! ==============================================================================
102 ! Locals
103 ! ==============================================================================
104 
105  CHARACTER(CHRLEN) :: rcsidentstring
106  REAL(RFREAL) :: nx,ny,nz,xc,xmom,xrhssum,yc,ymom,yrhssum,zc,zmom,zrhssum
107 
108 ! ******************************************************************************
109 ! Start
110 ! ******************************************************************************
111 
112  rcsidentstring = '$RCSfile: PLAG_ReflectParticleData.F90,v $ $Revision: 1.8 $'
113 
114 ! ******************************************************************************
115 ! Reflect particle data
116 ! ******************************************************************************
117 
118 ! ==============================================================================
119 ! Get face normal and centroid
120 ! ==============================================================================
121 
122  nx = ppatch%fn(xcoord,ifl)
123  ny = ppatch%fn(ycoord,ifl)
124  nz = ppatch%fn(zcoord,ifl)
125 
126  xc = ppatch%fc(xcoord,ifl)
127  yc = ppatch%fc(ycoord,ifl)
128  zc = ppatch%fc(zcoord,ifl)
129 
130 ! ==============================================================================
131 ! Reflect old position, new position, and trajectory
132 ! ==============================================================================
133 
134  CALL reflectposition(nx,ny,nz,xc,yc,zc,xlocold,ylocold,zlocold)
135  CALL reflectposition(nx,ny,nz,xc,yc,zc,xloc,yloc,zloc)
136 
137  IF ( (present(xtraj) .EQV. .true.) .AND. &
138  (present(ytraj) .EQV. .true.) .AND. &
139  (present(ztraj) .EQV. .true.) ) THEN
140  CALL reflectvector(nx,ny,nz,xtraj,ytraj,ztraj)
141  END IF ! PRESENT
142 
143 ! ==============================================================================
144 ! Reflect particle momentum (and any other data)
145 ! ==============================================================================
146 
147  xmom = pplag%cv(cv_plag_xmom,ipcl)
148  ymom = pplag%cv(cv_plag_ymom,ipcl)
149  zmom = pplag%cv(cv_plag_zmom,ipcl)
150 
151  CALL reflectvector(nx,ny,nz,xmom,ymom,zmom)
152 
153  pplag%cv(cv_plag_xmom,ipcl) = xmom
154  pplag%cv(cv_plag_ymom,ipcl) = ymom
155  pplag%cv(cv_plag_zmom,ipcl) = zmom
156 
157  xmom = pplag%cvOld(cv_plag_xmom,ipcl)
158  ymom = pplag%cvOld(cv_plag_ymom,ipcl)
159  zmom = pplag%cvOld(cv_plag_zmom,ipcl)
160 
161  CALL reflectvector(nx,ny,nz,xmom,ymom,zmom)
162 
163  pplag%cvOld(cv_plag_xmom,ipcl) = xmom
164  pplag%cvOld(cv_plag_ymom,ipcl) = ymom
165  pplag%cvOld(cv_plag_zmom,ipcl) = zmom
166 
167 ! ==============================================================================
168 ! Reflect particle rhsSum, needed for RK4 and RK3
169 ! ==============================================================================
170 
171  xrhssum = pplag%rhsSum(cv_plag_xmom,ipcl)
172  yrhssum = pplag%rhsSum(cv_plag_ymom,ipcl)
173  zrhssum = pplag%rhsSum(cv_plag_zmom,ipcl)
174 
175  CALL reflectvector(nx,ny,nz,xrhssum,yrhssum,zrhssum)
176 
177  pplag%rhsSum(cv_plag_xmom,ipcl) = xrhssum
178  pplag%rhsSum(cv_plag_ymom,ipcl) = yrhssum
179  pplag%rhsSum(cv_plag_zmom,ipcl) = zrhssum
180 
181  xrhssum = pplag%rhsSum(cv_plag_xpos,ipcl)
182  yrhssum = pplag%rhsSum(cv_plag_ypos,ipcl)
183  zrhssum = pplag%rhsSum(cv_plag_zpos,ipcl)
184 
185  CALL reflectvector(nx,ny,nz,xrhssum,yrhssum,zrhssum)
186 
187  pplag%rhsSum(cv_plag_xpos,ipcl) = xrhssum
188  pplag%rhsSum(cv_plag_ypos,ipcl) = yrhssum
189  pplag%rhsSum(cv_plag_zpos,ipcl) = zrhssum
190 
191 ! ******************************************************************************
192 ! End
193 ! ******************************************************************************
194 
195 END SUBROUTINE plag_reflectparticledata
196 
197 ! ******************************************************************************
198 !
199 ! RCS Revision history:
200 !
201 ! $Log: PLAG_ReflectParticleData.F90,v $
202 ! Revision 1.8 2008/12/06 08:44:36 mtcampbe
203 ! Updated license.
204 !
205 ! Revision 1.7 2008/11/19 22:17:48 mtcampbe
206 ! Added Illinois Open Source License/Copyright
207 !
208 ! Revision 1.6 2006/04/07 15:19:24 haselbac
209 ! Removed tabs
210 !
211 ! Revision 1.5 2005/01/01 21:34:29 haselbac
212 ! Made traj arguments optional
213 !
214 ! Revision 1.4 2004/11/30 23:34:10 fnajjar
215 ! Included further description in comment for reflection of rhsSum
216 !
217 ! Revision 1.3 2004/06/17 14:32:16 fnajjar
218 ! Applied reflectivity to rhsSum vectors of positions and momenta
219 !
220 ! Revision 1.2 2004/05/05 21:01:22 fnajjar
221 ! Bug fixes: Reflect position properly and reflect old momentum
222 !
223 ! Revision 1.1 2004/04/08 01:32:13 haselbac
224 ! Initial revision
225 !
226 ! ******************************************************************************
227 
228 
229 
230 
231 
232 
subroutine plag_reflectparticledata(pPatch, pPlag, ifl, iPcl, xLocOld, yLocOld, zLocOld, xLoc, yLoc, zLoc, xTraj, yTraj, zTraj)
subroutine reflectvector(nx, ny, nz, xComp, yComp, zComp)
subroutine reflectposition(nx, ny, nz, xc, yc, zc, xComp, yComp, zComp)