|
1 | 1 | module coupling_mod |
2 | 2 |
|
3 | 3 | use proj_lc_mod, only : proj_lc_t |
4 | | - use interp_mod, only : Interp_horizontal_nearest, Interp_horizontal_bilinear, HINTERP_NEAREST, HINTERP_BILINEAR |
| 4 | + use interp_mod, only : Interp_horizontal_nearest, Interp_horizontal_bilinear, HINTERP_NEAREST, HINTERP_BILINEAR, Interp_profile |
5 | 5 | use stderrout_mod, only : Stop_simulation |
6 | 6 |
|
7 | | - |
8 | 7 | implicit none |
9 | 8 |
|
10 | 9 | private |
11 | 10 |
|
12 | | - public :: Interp_horizontal |
| 11 | + public :: Interp_horizontal, Calc_fire_wind |
13 | 12 |
|
14 | 13 | contains |
15 | 14 |
|
@@ -62,4 +61,58 @@ subroutine Interp_horizontal (data_in, proj_data_in, ims, ime, jms, jme, ifms, i |
62 | 61 |
|
63 | 62 | end subroutine Interp_horizontal |
64 | 63 |
|
| 64 | + subroutine Calc_fire_wind (u3d, v3d, z_at_w, z0, iims, iime, jims, jime, kims, kime, fire_lsm_zcoupling, & |
| 65 | + fire_lsm_zcoupling_ref, fire_wind_height, ioms, iome, joms, jome, iops, iope, jops, jope, & |
| 66 | + u_out, v_out, cap_winds) |
| 67 | + |
| 68 | + implicit none |
| 69 | + |
| 70 | + integer, intent (in) :: iims, iime, jims, jime, kims, kime, ioms, iome, joms, jome, iops, iope, jops, jope |
| 71 | + real, intent (in) :: fire_wind_height, fire_lsm_zcoupling_ref |
| 72 | + logical, intent (in) :: fire_lsm_zcoupling |
| 73 | + real, dimension(iims:iime, jims:jime, kims:kime), intent (in) :: u3d, v3d, z_at_w |
| 74 | + real, dimension(iims:iime, jims:jime), intent (in) :: z0 |
| 75 | + real, dimension(ioms:iome, joms:joms), intent (out) :: u_out, v_out |
| 76 | + logical, intent (in), optional :: cap_winds |
| 77 | + |
| 78 | + real :: wspd |
| 79 | + integer :: i, j |
| 80 | + logical :: cap_winds_flag |
| 81 | + |
| 82 | + |
| 83 | +! print *, 'shape u3d = ', shape (u3d) |
| 84 | +! print *, 'shape v3d = ', shape (v3d) |
| 85 | +! print *, 'shape z_at_w = ', shape (z_at_w) |
| 86 | +! print *, 'shape u_out = ', shape (u_out) |
| 87 | +! print *, 'shape v_out = ', shape (v_out) |
| 88 | +! print *, 'shape z0 = ', shape (z0) |
| 89 | + |
| 90 | + if (present (cap_winds)) then |
| 91 | + cap_winds_flag = cap_winds |
| 92 | + else |
| 93 | + cap_winds_flag = .false. |
| 94 | + end if |
| 95 | + |
| 96 | + do j = jops, jope |
| 97 | + do i = iops, iope |
| 98 | + call Interp_profile (fire_lsm_zcoupling, fire_lsm_zcoupling_ref, fire_wind_height, kims, kime, & |
| 99 | + u3d(i, j, :), v3d(i, j, :), z_at_w(i, j, :), z0(i, j), u_out(i, j), v_out(i, j)) |
| 100 | + end do |
| 101 | + end do |
| 102 | + |
| 103 | + ! To avoid arithmatic error |
| 104 | + if (cap_winds_flag) then |
| 105 | + do j = jops, jope |
| 106 | + do i = iops, iope |
| 107 | + wspd = sqrt (u_out(i, j) ** 2 + v_out(i, j) ** 2) |
| 108 | + if (wspd < 0.001) then |
| 109 | + u_out(i, j) = sign (0.001, u_out(i, j)) |
| 110 | + v_out(i, j) = sign (0.001, v_out(i, j)) |
| 111 | + end if |
| 112 | + end do |
| 113 | + end do |
| 114 | + end if |
| 115 | + |
| 116 | + end subroutine Calc_fire_wind |
| 117 | + |
65 | 118 | end module coupling_mod |
0 commit comments