-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfluxViscous.f90
169 lines (134 loc) · 4.99 KB
/
fluxViscous.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
!> @file fluxViscous.f90
!!
!! Computation of the viscous fluxes.
!
! *****************************************************************************
!
! (c) J. Blazek, CFD Consulting & Analysis, www.cfd-ca.de
! Created February 25, 2014
! Last modification: July 18, 2014
!
! *****************************************************************************
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License
! as published by the Free Software Foundation; either version 2
! of the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
!
! *****************************************************************************
!> Computes viscous fluxes for the Navier-Stokes equations and adds
!! them to the dissipation variable (diss). Gradients at the faces
!! of the control volumes are obtained by a modified averaging of
!! node-based gradients (see Section 5.4.2).
!!
!! @param beta coefficient for mixing new and old dissipation values
!!
subroutine FluxViscous( beta )
use ModDataTypes
use ModGeometry
use ModNumerics
use ModPhysics
implicit none
! parameters
real(rtype), intent(in) :: beta
! local variables
integer :: i, j, ie
real(rtype) :: two3, ui, uj, vi, vj, uav, vav, mav, kav
real(rtype) :: txn, tyn, ds2, rds, duxa, duya, dvxa, dvya, dtxa, dtya
real(rtype) :: duds, dvds, dtds, dudt, dvdt, dtdt
real(rtype) :: duxf, duyf, dvxf, dvyf, dtxf, dtyf
real(rtype) :: tauxx, tauxy, tauyy, phix, phiy
real(rtype) :: fv(3)
! *****************************************************************************
two3 = 2.D0/3.D0
! interior edges --------------------------------------------------------------
do ie=1,nedint
i = edge(1,ie)
j = edge(2,ie)
! - average of flow variables
ui = cv(2,i)/cv(1,i)
uj = cv(2,j)/cv(1,j)
vi = cv(3,i)/cv(1,i)
vj = cv(3,j)/cv(1,j)
uav = 0.5D0*(ui+uj)
vav = 0.5D0*(vi+vj)
mav = 0.5D0*(dv(6,i)+dv(6,j))
kav = 0.5D0*(dv(7,i)+dv(7,j))
! - tangential vector (normalized)
txn = x(j) - x(i)
tyn = y(j) - y(i)
ds2 = txn*txn + tyn*tyn
rds = 1.D0/Sqrt(ds2)
txn = txn*rds
tyn = tyn*rds
! - average of gradients
duxa = 0.5D0*(gradx(2,i)+gradx(2,j))
duya = 0.5D0*(grady(2,i)+grady(2,j))
dvxa = 0.5D0*(gradx(3,i)+gradx(3,j))
dvya = 0.5D0*(grady(3,i)+grady(3,j))
dtxa = 0.5D0*(gradx(5,i)+gradx(5,j))
dtya = 0.5D0*(grady(5,i)+grady(5,j))
! - divided difference
duds = rds*(uj-ui)
dvds = rds*(vj-vi)
dtds = rds*(dv(2,j)-dv(2,i))
! - tangential component - divided difference
dudt = duxa*txn + duya*tyn - duds
dvdt = dvxa*txn + dvya*tyn - dvds
dtdt = dtxa*txn + dtya*tyn - dtds
! - face gradients (Eq. (5.73))
duxf = duxa - dudt*txn
duyf = duya - dudt*tyn
dvxf = dvxa - dvdt*txn
dvyf = dvya - dvdt*tyn
dtxf = dtxa - dtdt*txn
dtyf = dtya - dtdt*tyn
! - viscous fluxes
tauxx = two3*mav*(2.D0*duxf-dvyf)
tauyy = two3*mav*(2.D0*dvyf-duxf)
tauxy = mav*( duyf+dvxf)
phix = uav*tauxx + vav*tauxy + kav*dtxf
phiy = uav*tauxy + vav*tauyy + kav*dtyf
fv(1) = sij(1,ie)*tauxx + sij(2,ie)*tauxy
fv(2) = sij(1,ie)*tauxy + sij(2,ie)*tauyy
fv(3) = sij(1,ie)*phix + sij(2,ie)*phiy
! - edge contributions to dissipation
diss(2,i) = diss(2,i) + fv(1)*beta
diss(3,i) = diss(3,i) + fv(2)*beta
diss(4,i) = diss(4,i) + fv(3)*beta
diss(2,j) = diss(2,j) - fv(1)*beta
diss(3,j) = diss(3,j) - fv(2)*beta
diss(4,j) = diss(4,j) - fv(3)*beta
enddo
! edges to dummy nodes --------------------------------------------------------
do ie=nedint+1,nedges
i = edge(1,ie)
j = edge(2,ie)
! - average of variables
uav = 0.5D0*(cv(2,i)/cv(1,i)+cv(2,j)/cv(1,j))
vav = 0.5D0*(cv(3,i)/cv(1,i)+cv(3,j)/cv(1,j))
mav = 0.5D0*(dv(6,i)+dv(6,j))
kav = 0.5D0*(dv(7,i)+dv(7,j))
! - viscous fluxes
tauxx = two3*mav*(2.D0*gradx(2,i)-grady(3,i))
tauyy = two3*mav*(2.D0*grady(3,i)-gradx(2,i))
tauxy = mav*( grady(2,i)+gradx(3,i))
phix = uav*tauxx + vav*tauxy + kav*gradx(5,i)
phiy = uav*tauxy + vav*tauyy + kav*grady(5,i)
fv(1) = sij(1,ie)*tauxx + sij(2,ie)*tauxy
fv(2) = sij(1,ie)*tauxy + sij(2,ie)*tauyy
fv(3) = sij(1,ie)*phix + sij(2,ie)*phiy
diss(2,i) = diss(2,i) + fv(1)*beta
diss(3,i) = diss(3,i) + fv(2)*beta
diss(4,i) = diss(4,i) + fv(3)*beta
enddo
end subroutine FluxViscous