Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
comp_row_K.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 
54 
55 !!****
56 !!
57 !! NAME
58 !! comp_row_K
59 !!
60 !! FUNCTION
61 !! This subroutine takes the K matrix and puts it
62 !! into compressed row storage. It will always
63 !! assure that the matrix is symmetric. The resulting
64 !! arrays are assigned to the global variables
65 !! located in comp_row_global.
66 !!
67 !! INPUTS
68 !! ndim -- Dimension of one size of the square stiffness matrix
69 !! A -- The part of the stiffness matrix assigned to this processor
70 !! nstart -- The first row of the stiffness matrix assigned to this processor
71 !! nrows -- The number of rows of the stiffness matrix assigned to this processor
72 !!
73 !! OUTPUTS
74 !! none
75 !!
76 !! USES
77 !! none
78 !!
79 !!****
80 
81 SUBROUTINE comp_row_k(ndim,A,nstart,nrows)
82 
83  USE comp_row_global
84  USE implicit_global
85  USE precision
86 
87  ! Input variables
88  INTEGER :: ndim, nstart, nrows
89  REAL(kind=wp), DIMENSION(1:ndim,1:ndim) :: a
90 
91  ! Internal variables
92  INTEGER :: i, j, inode, jnode, idof, jdof
93  INTEGER :: avali
94  INTEGER :: counter
95 
96  ! Count the nonzeros in the matrix
97  nnz_temp = 0
98  DO i = nstart, nstart+nrows-1
99  DO j = 1, 3*gnumnp
100  inode = int((i-0.5)/3.0)+1
101  jnode = int((j-0.5)/3.0)+1
102  idof = i - 3*inode + 3
103  jdof = j - 3*jnode + 3
104 
105  IF ((global2local(inode) /= -1))THEN
106  IF ((global2local(jnode) /= -1))THEN
107  !print*,3*Global2Local(inode)+idof-3,3*Global2Local(jnode)+jdof-3
108  IF ( 3*global2local(inode)+idof-3 > 3*global2local(jnode)+jdof-3 ) THEN ! something in lower triangle
109  !print*,A(3*Global2Local(jnode)+jdof-3,3*Global2Local(inode)+idof-3)
110  IF ( abs(a(3*global2local(jnode)+jdof-3,3*global2local(inode)+idof-3)) /= 0.0 ) THEN
111  nnz_temp = nnz_temp + 1
112  ENDIF
113  ELSE ! something on diagonal or upper triangle
114  IF ( abs(a(3*global2local(inode)+idof-3,3*global2local(jnode)+jdof-3)) /= 0.0 ) THEN
115  nnz_temp = nnz_temp + 1
116  ENDIF
117  ENDIF
118  ENDIF
119  ENDIF
120  ENDDO
121  ENDDO
122  ALLOCATE(rp_temp(1:nrows+1))
123  ALLOCATE(cval_temp(1:nnz_temp))
124  ALLOCATE(aval_temp(1:nnz_temp))
125 
126  !print*,myid,' nnz = ',nnz_temp
127 
128  ! Construct the matrix in compressed row format
129  avali = 1
130  rp_temp(1) = 0
131  DO i = nstart, nstart+nrows-1
132  DO j = 1, 3*gnumnp
133  inode = int((i-0.5)/3.0)+1
134  jnode = int((j-0.5)/3.0)+1
135  idof = i - 3*inode + 3
136  jdof = j - 3*jnode + 3
137  IF ((global2local(inode) /= -1))THEN
138  IF ((global2local(jnode) /= -1))THEN
139  !print*,3*Global2Local(inode)+idof-3,3*Global2Local(jnode)+jdof-3
140  IF ( 3*global2local(inode)+idof-3 > 3*global2local(jnode)+jdof-3 ) THEN ! something in lower triangle
141  !print*,A(3*Global2Local(jnode)+jdof-3,3*Global2Local(inode)+idof-3)
142  IF ( abs(a(3*global2local(jnode)+jdof-3,3*global2local(inode)+idof-3)) /= 0.0 ) THEN
143  aval_temp(avali) = a(3*global2local(jnode)+jdof-3,3*global2local(inode)+idof-3)
144  cval_temp(avali) = j-1
145  avali = avali + 1
146  ENDIF
147  ELSE ! something on diagonal or upper triangle
148  IF ( abs(a(3*global2local(inode)+idof-3,3*global2local(jnode)+jdof-3)) /= 0.0 ) THEN
149  aval_temp(avali) = a(3*global2local(inode)+idof-3,3*global2local(jnode)+jdof-3)
150  cval_temp(avali) = j-1
151  avali = avali + 1
152  ENDIF
153  ENDIF
154  ENDIF
155  ENDIF
156  ENDDO
157  rp_temp(i-nstart+2) = avali-1
158  ENDDO
159 
160 END SUBROUTINE comp_row_k
161 
**********************************************************************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 inode
subroutine comp_row_k(ndim, A, nstart, nrows)
Definition: comp_row_K.f90:81
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
**********************************************************************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 jnode
RT a() const
Definition: Line_2.h:140