Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScaleRotateVector.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: Scale and rotate vector.
26 !
27 ! Description: None.
28 !
29 ! Input: vect = vector to scale and rotate.
30 !
31 ! Output: vect = scaled and rotated.
32 !
33 ! Notes: None.
34 !
35 !******************************************************************************
36 !
37 ! $Id: ScaleRotateVector.F90,v 1.3 2008/12/06 08:44:10 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE scalerotatevector( global,vect )
44 
45  USE moddatatypes
46  USE modglobal, ONLY : t_global
47  USE moderror
48  USE modparameters
49 
50  IMPLICIT NONE
51 
52 ! ... parameters
53  REAL(RFREAL), POINTER :: vect(:,:)
54 
55  TYPE(t_global), POINTER :: global
56 
57 ! ... local variables
58  CHARACTER(CHRLEN) :: rcsidentstring
59 
60  INTEGER :: ic, ncomp
61 
62  REAL(RFREAL) :: anglex, angley, anglez, cx, cy, cz, sx, sy, sz, x, y, z
63 
64 !******************************************************************************
65 
66  rcsidentstring = '$RCSfile: ScaleRotateVector.F90,v $ $Revision: 1.3 $'
67 
68  IF ( global%verbLevel > verbose_none ) THEN
69  WRITE(stdout,'(A,1X,A)') solver_name,'Scaling and rotating vector...'
70  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'X-scale:',global%scaleX
71  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'Y-scale:',global%scaleY
72  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'Z-scale:',global%scaleZ
73  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'X-angle:',global%angleX
74  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'Y-angle:',global%angleY
75  WRITE(stdout,'(A,3X,A,1X,E15.6)') solver_name,'Z-angle:',global%angleZ
76  END IF ! global%verbLevel
77 
78  ncomp = SIZE(vect,dim=2)
79 
80 ! scale vector
81 
82  DO ic = 1,ncomp
83  vect(1,ic) = global%scaleX*vect(1,ic)
84  vect(2,ic) = global%scaleY*vect(2,ic)
85  vect(3,ic) = global%scaleZ*vect(3,ic)
86  END DO ! ic
87 
88 ! rotate vector
89 
90  anglex = global%angleX*global%rad
91  angley = global%angleY*global%rad
92  anglez = global%angleZ*global%rad
93 
94  cx = cos(anglex)
95  sx = sin(anglex)
96  cy = cos(angley)
97  sy = sin(angley)
98  cz = cos(anglez)
99  sz = sin(anglez)
100 
101  DO ic = 1,ncomp
102  x = vect(1,ic)
103  y = vect(2,ic)
104  z = vect(3,ic)
105 
106  vect(1,ic) = cy*cz*x - (sx*sy*cz + cx*sz)*y - (cx*sy*cz - sx*sz)*z
107  vect(2,ic) = cy*sz*x - (sx*sy*sz - cx*cz)*y - (cx*sy*sz + sx*cz)*z
108  vect(3,ic) = sy*x + ( sx*cy)*y + ( cx*cy)*z
109  END DO ! ic
110 
111  IF ( global%verbLevel > verbose_none ) THEN
112  WRITE(stdout,'(A,1X,A)') solver_name,'Scaling and rotating vector done.'
113  END IF ! global%verbLevel
114 
115 END SUBROUTINE scalerotatevector
116 
117 !******************************************************************************
118 !
119 ! RCS Revision history:
120 !
121 ! $Log: ScaleRotateVector.F90,v $
122 ! Revision 1.3 2008/12/06 08:44:10 mtcampbe
123 ! Updated license.
124 !
125 ! Revision 1.2 2008/11/19 22:17:23 mtcampbe
126 ! Added Illinois Open Source License/Copyright
127 !
128 ! Revision 1.1 2004/12/01 16:51:21 haselbac
129 ! Initial revision after changing case
130 !
131 ! Revision 1.5 2004/01/29 22:52:48 haselbac
132 ! Clean up
133 !
134 ! Revision 1.4 2003/02/01 00:28:20 haselbac
135 ! Some clean up, added diagnostic output
136 !
137 ! Revision 1.3 2002/09/05 17:40:20 jblazek
138 ! Variable global moved into regions().
139 !
140 ! Revision 1.2 2002/07/16 21:34:37 jblazek
141 ! Prefixed screen output with SOLVER_NAME.
142 !
143 ! Revision 1.1 2002/05/07 18:51:27 haselbac
144 ! Initial revision
145 !
146 !******************************************************************************
147 
148 
149 
150 
151 
152 
void int int REAL REAL * y
Definition: read.cpp:74
**********************************************************************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 scalerotatevector(global, vect)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
NT & sin
void int int REAL * x
Definition: read.cpp:74
NT & cos