1 subroutine bc3Res ( iBC, BC, res, iper, ilwork) 2c 3c---------------------------------------------------------------------- 4c 5c This routine satisfies the BC of the residual vector for 3D elements. 6c 7c input: 8c iBC (nshg) : Boundary Condition Code 9c BC (nshg,ndofBC) : the boundary condition constraint parameters 10c res (nshg,nflow) : residual before BC is applied 11c 12c output: 13c res (nshg,nflow) : residual after satisfaction of BC 14c 15c 16c Thuc Bui, Winter 1989. 17c Zdenek Johan, Winter 1991. (Fortran 90) 18c---------------------------------------------------------------------- 19c 20 include "common.h" 21c 22 dimension iBC(nshg), 23 & BC(nshg,ndofBC), 24 & res(nshg,nflow), ilwork(nlwork), 25 & iper(nshg) 26c 27c.... local periodic boundary conditions (no communications) 28c 29 call bc3per(iBC, res, iper, ilwork, nflow) 30c 31c.... pressure 32c 33 where (btest(iBC,2)) 34 res(:,4) = zero 35 endwhere 36c 37c.... velocities 38c 39c ibits(n1,n2,n3) extracts bits n2+1 through n2+n3 (extending to the left 40c as is traditional in binary) of the integer n1 41c and returns the base 10 integer. In examples below x y z a b can 42c be 1 or zero without any effect. 43c 44c.... x1-velocity 45c 46c if iBC=4 bits of ibc =00000100 => ibits(4,3,3)=0 47c if iBC=40 bits of ibc =00101000 => ibits(40,3,3)=5 48c if iBC=40 bits of ibc =00101000 => ibits(40,3,2)=1 49c 50 where (ibits(iBC,3,3) .eq. 1) ! bits of iBC= xy001zab 51c 52c notice that the extracted 3 bits form the number 1. below 53c you will see the combinations which make up 2-7, all of the 54c possible velocity combinations 55c 56 res(:,2) = res(:,2) - BC(:,4) * res(:,1) 57 res(:,3) = res(:,3) - BC(:,5) * res(:,1) 58 res(:,1) = zero 59 endwhere 60c 61c.... x2-velocity 62c 63 where (ibits(iBC,3,3) .eq. 2) ! bits of iBC= xy010zab 64 res(:,1) = res(:,1) - BC(:,4) * res(:,2) 65 res(:,3) = res(:,3) - BC(:,5) * res(:,2) 66 res(:,2) = zero 67 endwhere 68c 69c.... x1-velocity and x2-velocity 70c 71 where (ibits(iBC,3,3) .eq. 3) ! bits of iBC= xy011zab 72 res(:,3) = res(:,3) - BC(:,4) * res(:,1) - BC(:,6) * res(:,2) 73 res(:,1) = zero 74 res(:,2) = zero 75 endwhere 76c 77c.... x3-velocity 78c 79 where (ibits(iBC,3,3) .eq. 4) ! bits of iBC= xy100zab 80 res(:,1) = res(:,1) - BC(:,4) * res(:,3) 81 res(:,2) = res(:,2) - BC(:,5) * res(:,3) 82 res(:,3) = zero 83 endwhere 84c 85c.... x1-velocity and x3-velocity 86c 87 where (ibits(iBC,3,3) .eq. 5) ! bits of iBC= xy101zab 88 res(:,2) = res(:,2) - BC(:,4) * res(:,1) - BC(:,6) * res(:,3) 89 res(:,1) = zero 90 res(:,3) = zero 91 endwhere 92c 93c.... x2-velocity and x3-velocity 94c 95 where (ibits(iBC,3,3) .eq. 6) ! bits of iBC= xy110zab 96 res(:,1) = res(:,1) - BC(:,4) * res(:,2) - BC(:,6) * res(:,3) 97 res(:,2) = zero 98 res(:,3) = zero 99 endwhere 100c 101c.... x1-velocity, x2-velocity and x3-velocity 102c 103 where (ibits(iBC,3,3) .eq. 7) ! bits of iBC= xy111zab 104 res(:,1) = zero 105 res(:,2) = zero 106 res(:,3) = zero 107 endwhere 108c 109c.... scaled plane extraction boundary condition 110c 111 if(intpres.eq.1) then ! interpolating pressure so zero continuity res 112 where (btest(iBC,11)) 113 res(:,1) = zero 114 res(:,2) = zero 115 res(:,3) = zero 116 res(:,4) = zero 117 endwhere 118 else ! leave residual in continuity equation 119 where (btest(iBC,11)) 120 res(:,1) = zero 121 res(:,2) = zero 122 res(:,3) = zero 123 endwhere 124 endif 125c 126c.... return 127c 128 return 129 end 130 131 132c--------------------------------------------------------------------- 133c 134c boundary conditions on scalar residual 135c 136c--------------------------------------------------------------------- 137 subroutine bc3ResSclr (iBC, res, iper, ilwork) 138 139 include "common.h" 140c 141 dimension iBC(nshg), 142 & res(nshg), ilwork(nlwork), 143 & iper(nshg) 144 145 146 if(isclr.eq.0) then 147c 148c.... temperature 149c 150 where (btest(iBC,1)) res(:) = zero 151 else 152c 153c.... turbulence or scalar 154c 155 is=isclr+5 156 where (btest(iBC,is)) res(:) = zero 157 endif 158c 159c.... local periodic boundary conditions (no communications) 160c 161 call bc3per(iBC, res, iper, ilwork, 1) 162c 163c.... return 164c 165 return 166 end 167 168