MFIX  2016-1
write_ab_m_var.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
2 ! C
3 ! Module name: Write_Ab_m_var(A_m, b_m, var, IER) C
4 ! Purpose: Write the sparse matrix coefficients and the C
5 ! source vector. C
6 ! C
7 ! C
8 ! Literature/Document References: C
9 ! C
10 ! Variables referenced: C
11 ! Variables modified: C
12 ! C
13 ! Local variables: C
14 ! C
15 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
16 !
17  SUBROUTINE write_ab_m_var(A_M, B_M, VAR)
18 !...Translated by Pacific-Sierra Research VAST-90 2.06G5 12:17:31 12/09/98
19 !...Switches: -xf
20 !
21 ! Include param.inc file to specify parameter values
22 !
23 !-----------------------------------------------
24 ! M o d u l e s
25 !-----------------------------------------------
26  USE param
27  USE param1
28 
29  USE geometry
30  USE compar
31  USE mpi_utility
32  USE indices
33  USE functions
34 
35  use machine
36 
37  IMPLICIT NONE
38 !-----------------------------------------------
39 ! G l o b a l P a r a m e t e r s
40 !-----------------------------------------------
41 !-----------------------------------------------
42 ! D u m m y A r g u m e n t s
43 !-----------------------------------------------
44 !
45 ! Local index
46  INTEGER L
47 !
48 ! cell index
49  INTEGER IJK
50 !
51 ! Septadiagonal matrix A_m
52  DOUBLE PRECISION A_m(dimension_3, -3:3)
53 !
54 ! Source vector
55  DOUBLE PRECISION b_m(dimension_3)
56 
57 ! Source vector
58  DOUBLE PRECISION var(dimension_3)
59 
60  double precision, allocatable :: array1(:) , array2(:) !//
61  double precision, allocatable :: am(:,:) !//
62 !
63 !-----------------------------------------------
64 !
65  integer i, j, k
66 
67  if (mype == pe_io) then
68  allocate (array1(ijkmax3))
69  allocate (array2(ijkmax3))
70  allocate (am(ijkmax3,-3:3))
71  else
72  allocate (array1(1))
73  allocate (array2(1))
74  allocate (am(1,-3:3))
75  end if
76 
77  if (mype == pe_io) then
78  CALL start_log
79  IF(dmp_log)WRITE (unit_log,*) ' Note : write_am_m is VERY inefficient '
80  WRITE (*,*) ' Note : write_am_m is VERY inefficient '
81  IF(dmp_log)WRITE (unit_log,*) ' '
82  IF(dmp_log)WRITE (unit_log,*) ' A_m and B_m arrays below are in the '
83  IF(dmp_log)WRITE (unit_log,*) ' mfix INTERNAL order'
84  IF(dmp_log)WRITE (unit_log,*) ' '
85  IF(dmp_log)WRITE (unit_log, '(A,A)') &
86  ' IJK I J K b s w p e ', &
87  ' n t Source Variable'
88  end if
89 
90 
91  do l = -3,3
92 
93  call gather(a_m(:,l),array1,root)
94 
95  DO k = kmin2, kmax2
96  DO i = imin2, imax2
97  DO j = jmin2, jmax2
98 
99  IF (dead_cell_at(i,j,k)) cycle ! skip dead cells
100 
101  ijk = funijk_gl(imap_c(i),jmap_c(j),kmap_c(k))
102 ! IJK = FUNIJK_GL(I,J,K)
103 
104  if (mype == pe_io) am(ijk,l) = array1(ijk)
105 
106 
107  END DO
108  END DO
109  END DO
110 
111  end do
112 
113  call gather(var(:),array1,root)
114  call gather(b_m(:),array2,root)
115 
116  DO k = kmin2, kmax2
117  DO i = imin2, imax2
118  DO j = jmin2, jmax2
119 
120  IF (dead_cell_at(i,j,k)) cycle ! skip dead cells
121 
122 ! IJK = FUNIJK_GL(I,J,K)
123  ijk = funijk_gl(imap_c(i),jmap_c(j),kmap_c(k))
124 
125  if (mype == pe_io .AND. dmp_log)WRITE (unit_log, '(I5, 3(I3), 9(1X,G9.2))') funijk_io(i,j,k), i, j, k,&
126  (am(ijk,l),l=-3,3), array2(ijk), array1(ijk)
127 
128  END DO
129  END DO
130  END DO
131 
132  if (mype == pe_io) CALL end_log
133 
134 
135  deallocate (array1) !//
136  deallocate (array2) !//
137 
138  RETURN
139  END SUBROUTINE write_ab_m_var
140 
141 !// Comments on the modifications for DMP version implementation
142 !// 001 Include header file and common declarations for parallelization
143 !// 020 New local variables for parallelization: array1,array2,i,j,k
144 !// 400 Added mpi_utility module and other global reduction (gather) calls
integer, dimension(:), allocatable jmap_c
Definition: compar_mod.f:78
integer imax2
Definition: geometry_mod.f:61
integer, dimension(:), allocatable kmap_c
Definition: compar_mod.f:78
integer dimension_3
Definition: param_mod.f:11
integer jmin2
Definition: geometry_mod.f:89
integer ijkmax3
Definition: geometry_mod.f:82
integer pe_io
Definition: compar_mod.f:30
logical, dimension(:,:,:), allocatable dead_cell_at
Definition: compar_mod.f:127
integer jmax2
Definition: geometry_mod.f:63
integer root
Definition: compar_mod.f:41
integer kmax2
Definition: geometry_mod.f:65
subroutine write_ab_m_var(A_M, B_M, VAR)
integer, dimension(:), allocatable imap_c
Definition: compar_mod.f:78
Definition: param_mod.f:2
integer mype
Definition: compar_mod.f:24
subroutine start_log
Definition: machine_mod.f:182
integer imin2
Definition: geometry_mod.f:89
subroutine end_log
Definition: machine_mod.f:208
integer kmin2
Definition: geometry_mod.f:89