Writing the residual in the file to save.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | RESNORM_FILE_UNIT | Resnorm file handler unit |
||
type(controltype), | intent(in) | :: | control | Control parameters |
||
type(schemetype), | intent(in) | :: | scheme | turbulenca and transition schemes |
subroutine write_resnorm(RESNORM_FILE_UNIT, control, scheme)
!< Writing the residual in the file to save.
implicit none
integer, intent(in) :: RESNORM_FILE_UNIT
!<Resnorm file handler unit
type(controltype), intent(in) :: control
!< Control parameters
type(schemetype) , intent(in) :: scheme
!< turbulenca and transition schemes
integer :: i
integer :: n=6
character(len=20) :: frm
n=control%write_percision
write(frm, '(A,I0,A,I0,A)') "(e",n+8,".",n,"E2, 4x)"
write(RESNORM_FILE_UNIT, '(I0,4x)', advance='no') control%current_iter+control%last_iter
do i=1,control%Res_count
select case(trim(control%Res_list(i)))
!include "resnorm_write_cases.inc"
case('Mass_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(0)
case('Resnorm_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_abs(1:)**2))
case('Viscous_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_abs(1:5)**2))
case('Turbulent_abs')
if(trim(scheme%turbulence)/='none')then
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_abs(6:)**2))
end if
case('Continuity_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(1)
case('X_mom_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(2)
case('Y_mom_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(3)
case('Z_mom_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(4)
case('Energy_abs')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(5)
case('Mass_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(0)
case('Resnorm_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_rel(1:)**2))
case('Viscous_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_rel(1:5)**2))
case('Turbulent_rel')
if(trim(scheme%turbulence)/='none')then
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_rel(6:)**2))
end if
case('Continuity_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(1)
case('X-mom_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(2)
case('Y-mom_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(3)
case('Z-mom_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(4)
case('Energy_rel')
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(5)
case('TKE_abs')
if(trim(scheme%turbulence)=='sst' .or. trim(scheme%turbulence)=='kkl'.or. trim(scheme%turbulence)=='sst2003' )then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(6)
end if
case('Tv_abs')
if(trim(scheme%turbulence)=='sa' .or. trim(scheme%turbulence)=='saBC')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(6)
end if
case('Dissipation_abs')
if(trim(scheme%turbulence)=='ke')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(7)
end if
case('Omega_abs')
if(trim(scheme%turbulence)=='sst'.or. trim(scheme%turbulence)=='sst2003')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(7)
end if
case('Kl_abs')
if(trim(scheme%turbulence)=='kkl')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_abs(7)
end if
case('TKE_rel')
if(trim(scheme%turbulence)=='sst' .or. trim(scheme%turbulence)=='kkl'.or. trim(scheme%turbulence)=='sst2003')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(6)
end if
case('Tv_rel')
if(trim(scheme%turbulence)=='sa' .or. trim(scheme%turbulence)=='saBC')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(6)
end if
case('Dissipation_rel')
if(trim(scheme%turbulence)=='ke')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(7)
end if
case('Omega_rel')
if(trim(scheme%turbulence)=='sst'.or. trim(scheme%turbulence)=='sst2003')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(7)
end if
case('Kl_rel')
if(trim(scheme%turbulence)=='kkl')then
write(RESNORM_FILE_UNIT, frm, advance='no') Res_rel(7)
end if
case DEFAULT
! making absolute resnorm default
write(RESNORM_FILE_UNIT, frm, advance='no') sqrt(sum(Res_abs(1:)**2))
Issue_warning
end select
end do
write(RESNORM_FILE_UNIT, *)
end subroutine write_resnorm