Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!! build matrix a !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nlayer | |||
real(kind=r64), | intent(out), | dimension(4*nlayer, 4*nlayer) | :: | a | ||
real(kind=r64), | intent(out), | dimension(4*nlayer) | :: | b | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | scon | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | thick | ||
real(kind=r64), | intent(in), | dimension(maxlay1) | :: | hcgas | ||
real(kind=r64), | intent(in) | :: | hcout | |||
real(kind=r64), | intent(in) | :: | hcin | |||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | asol | ||
real(kind=r64), | intent(in), | dimension(maxlay1) | :: | qv | ||
real(kind=r64), | intent(in) | :: | Tin | |||
real(kind=r64), | intent(in) | :: | Tout | |||
real(kind=r64), | intent(in) | :: | Gin | |||
real(kind=r64), | intent(in) | :: | Gout | |||
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | theta | ||
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | tir | ||
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | rir | ||
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | emis |
subroutine matrixQBalance(nlayer, a, b, scon, thick, hcgas, hcout, hcin, asol, qv, &
Tin, Tout, Gin, Gout, theta, tir, rir, emis)
use DataGlobals, only: StefanBoltzmann
use TARCOGParams
integer, intent(in) :: nlayer
real(r64), dimension(maxlay), intent(in) :: scon, thick
real(r64), dimension(maxlay1), intent(in) :: hcgas
real(r64), intent(in) :: hcout, hcin, Gin, Gout
real(r64), dimension(maxlay2), intent(in) :: tir, rir, emis, theta
real(r64), dimension(maxlay), intent(in) :: asol
real(r64), dimension(maxlay1), intent(in) :: qv
real(r64), intent(in) :: Tin, Tout
real(r64), dimension(4*nlayer, 4*nlayer), intent(out) :: a
real(r64), dimension(4*nlayer), intent(out) :: b
! local variables
integer :: i, j, k, front, back
do i=1, 4*nlayer
b(i) = 0.0d0
do j = 1, 4*nlayer
a(i,j) = 0.0d0
end do
end do
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!! build matrix a !!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Because of build matrix optimization all environmental heat transfer
! coefficients were stored in hgas array. This means that hgas(1) is actually
! hout, while hgas(nlayer+1) is actually hin. Same is valid for hcgas and
! hrgas arrays
do i = 1, nlayer
k = 4*i - 3
front = 2*i - 1
back = 2*i
if (nlayer.ne.1) then
if (i.ne.1) then
a(k, k-3) = -hcgas(i)
a(k, k-1) = -1.0d0
a(k+1, k-3) = -hcgas(i)
a(k+1, k-1) = -1.0d0
a(k+2, k-1) = rir(front)
a(k+3, k-1) = tir(front)
end if
if (i.ne.nlayer) then
a(k, k+4) = -hcgas(i+1)
a(k, k+6) = -1.0d0
a(k+2, k+6) = tir(back)
a(k+3, k+6) = rir(back)
end if
end if
a(k, k) = hcgas(i)
a(k, k+1) = hcgas(i+1)
a(k, k+2) = 1.0d0
a(k, k+3) = 1.0d0
a(k+1, k) = scon(i)/thick(i) + hcgas(i)
a(k+1, k+1) = -scon(i)/thick(i)
a(k+1, k+2) = 1.0d0
a(k+2, k) = emis(front) * StefanBoltzmann * theta(front)**3.0d0
a(k+2, k+2) = -1.0d0
a(k+3, k+1) = emis(back) * StefanBoltzmann * theta(back)**3.0d0
a(k+3, k+3) = -1.0d0
end do
!build matrix b
do i = 1, nlayer
k = 4*i - 3
front = 2*i - 1
back = 2*i
b(k) = asol(i) + 0.5d0 * qv(i) + 0.5d0 * qv(i+1)
b(k+1) = 0.5d0 * asol(i) + 0.5d0 * qv(i)
if (i.eq.1) then
b(k) = b(k) + hcout*Tout + Gout
b(k+1) = b(k+1) + hcout*Tout + Gout
b(k+2) = b(k+2) - rir(front)*Gout
b(k+3) = b(k+3) - tir(front)*Gout
end if
if (i.eq.(nlayer)) then
b(k) = b(k) + hcin*Tin + Gin
b(k+2) = b(k+2) - tir(back)*Gin
b(k+3) = b(k+3) - rir(back)*Gin
end if
end do
end subroutine matrixQBalance