Export integrand to Tecplot file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrand_ladvection), | intent(in) | :: | self | Advection field. |
||
character(len=*), | intent(in), | optional | :: | file_name | File name. |
|
real(kind=R_P), | intent(in), | optional | :: | t | Time. |
|
character(len=*), | intent(in), | optional | :: | scheme | Scheme used to integrate integrand. |
|
logical, | intent(in), | optional | :: | close_file | Flag for closing file. |
|
logical, | intent(in), | optional | :: | with_exact_solution | Flag for export also exact solution. |
|
class(integrand_object), | intent(in), | optional | :: | U0 | Initial conditions. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine export_tecplot(self, file_name, t, scheme, close_file, with_exact_solution, U0)
!< Export integrand to Tecplot file.
class(integrand_ladvection), intent(in) :: self !< Advection field.
character(*), intent(in), optional :: file_name !< File name.
real(R_P), intent(in), optional :: t !< Time.
character(*), intent(in), optional :: scheme !< Scheme used to integrate integrand.
logical, intent(in), optional :: close_file !< Flag for closing file.
logical, intent(in), optional :: with_exact_solution !< Flag for export also exact solution.
class(integrand_object), intent(in), optional :: U0 !< Initial conditions.
logical :: with_exact_solution_ !< Flag for export also exact solution, local variable.
logical, save :: is_open=.false. !< Flag for checking if file is open.
integer(I_P), save :: file_unit !< File unit.
real(R_P), allocatable :: exact_solution(:) !< Exact solution.
integer(I_P) :: i !< Counter.
if (present(close_file)) then
if (close_file .and. is_open) then
close(unit=file_unit)
is_open = .false.
endif
else
with_exact_solution_ = .false. ; if (present(with_exact_solution)) with_exact_solution_ = with_exact_solution
if (present(file_name)) then
if (is_open) close(unit=file_unit)
open(newunit=file_unit, file=trim(adjustl(file_name)))
is_open = .true.
write(unit=file_unit, fmt='(A)') 'VARIABLES="x" "u"'
endif
if (present(t) .and. present(scheme) .and. is_open) then
write(unit=file_unit, fmt='(A)') 'ZONE T="'//str(t)//' '//trim(adjustl(scheme))//'"'
do i=1, self%Ni
write(unit=file_unit, fmt='(2('//FR_P//',1X))') self%Dx * i - 0.5_R_P * self%Dx, self%u(i)
enddo
if (with_exact_solution_) then
exact_solution = self%exact_solution(t=t, U0=U0)
write(unit=file_unit, fmt='(A)') 'ZONE T="'//str(t)//' exact solution"'
do i=1, self%Ni
write(unit=file_unit, fmt='(2('//FR_P//',1X))') self%Dx * i - 0.5_R_P * self%Dx, exact_solution(i)
enddo
endif
endif
endif
endsubroutine export_tecplot