source: LMDZ6/trunk/libf/phylmd/ecrad/utilities/print_matrix.F90 @ 5423

Last change on this file since 5423 was 4773, checked in by idelkadi, 13 months ago
  • Update of Ecrad in LMDZ The same organization of the Ecrad offline version is retained in order to facilitate the updating of Ecrad in LMDZ and the comparison between online and offline results. version 1.6.1 of Ecrad (https://github.com/lguez/ecrad.git)
  • Implementation of the double call of Ecrad in LMDZ


File size: 1.9 KB
Line 
1module print_matrix_mod
2contains
3  subroutine print_vector(vec, name, unit)
4    use parkind1, only : jprb
5    real(jprb),   intent(in) :: vec(:)
6    character(*), intent(in), optional :: name
7    integer,      intent(in), optional :: unit
8    integer    :: i
9    integer    :: unit_local
10    if (present(unit)) then
11      unit_local = unit
12    else
13      unit_local = 6
14    end if
15    if (present(name)) then
16      write(unit_local,'(a,a,$)') name, '=['
17    end if
18    do i = 1,size(vec,1)
19       write(unit_local,'(f16.8,$)') vec(i)
20    end do
21    if (present(name)) then
22      write(unit_local,'(a)') ']'
23    else
24      write(unit_local,'(x)')
25    end if
26
27  end subroutine print_vector
28
29  subroutine print_matrix(mat, name, unit)
30    use parkind1, only : jprb
31    real(jprb),   intent(in) :: mat(:,:)
32    character(*), intent(in), optional :: name
33    integer,      intent(in), optional :: unit
34    integer    :: i, j
35    integer    :: unit_local
36    if (present(unit)) then
37      unit_local = unit
38    else
39      unit_local = 6
40    end if
41
42    if (present(name)) then
43      write(unit_local,'(a,a,$)') name, '=['
44    end if
45    do i = 1,size(mat,1)
46       do j = 1,size(mat,2)
47          write(unit_local,'(f16.8,$)') mat(i,j)
48       end do
49       if (present(name) .and. i == size(mat,1)) then
50         write(unit_local,'(a)') ']'
51       else
52         write(unit_local,'(x)')
53       end if
54    end do
55  end subroutine print_matrix
56 
57  subroutine print_array3(name, mat)
58    use parkind1, only : jprb
59    character(*), intent(in) :: name
60    real(jprb),   intent(in) :: mat(:,:,:)
61    integer    :: i, j, k
62    write(6,'(a,a)') name, '='
63    do k = 1,size(mat,3)
64      do i = 1,size(mat,1)
65        do j = 1,size(mat,2)
66             write(6,'(f16.8,$)') mat(i,j,k)
67          end do
68          write(6,'(x)')
69       end do
70       write(6,'(x)')
71    end do
72  end subroutine print_array3
73 
74
75end module print_matrix_mod
Note: See TracBrowser for help on using the repository browser.