source: LMDZ5/branches/Cold_pool_death/libf/phylmd/Cold_pool_death/derivs_m.F90 @ 3899

Last change on this file since 3899 was 3899, checked in by lguez, 3 years ago

Old work on cold pool death.

File size: 1.6 KB
Line 
1module derivs_m
2
3  implicit none
4
5contains
6
7  function derivs(t, y)
8
9    use derivs_param, only: eps_cp_m, beta_m, av_thvu_constant_m, k_star_m, &
10         theta_v_uns_m, theta_vs_m, rate_uns_m, av_rho_m, c_dw_m
11    use nrtype, only: pi
12
13    REAL, INTENT(IN):: t ! time, in s
14    REAL, INTENT(IN):: y(:) ! (5) (/theta_v_cp, z_cp, r, av_thvu, h/)
15
16    REAL derivs(size(y)) ! time derivative of y
17
18    ! Local:
19
20    real, parameter:: g = 9.81 ! acceleration of gravity, in m s-2
21
22    real, parameter:: C_dx = 0.01
23    ! drag coefficient outside cold pools, in m s-1
24
25    real, parameter:: delta_theta = 2.
26    ! jump at the top of the mixed layer, in K
27
28    real surf_buoy_env ! surface buoyancy flux in the environment, in m s-1 K
29    ! \overline{w' \theta'_{v, \mathrm{env}}}(0)
30
31    real theta_v_cp, z_cp, r, av_thvu, h, v
32    real c_star ! spreading velocity, in m s-1
33
34    !----------------------------------------------------
35
36    theta_v_cp = y(1)
37    z_cp = y(2)
38    r = y(3)
39    av_thvu = y(4)
40
41    v = rate_uns_m / (pi * r**2 * av_rho_m)
42    c_star = k_star_m * sqrt(max(2. * g * (av_thvu - theta_v_cp) &
43         / av_thvu * z_cp, 0.))
44
45    derivs(1) = (v * (theta_v_uns_m - theta_v_cp) + c_dw_m * (theta_vs_m &
46         - theta_v_cp)) / z_cp + eps_cp_m * c_star / r * (av_thvu - theta_v_cp)
47    derivs(2) = v + (eps_cp_m - 2.) * z_cp / r * c_star
48    derivs(3) = c_star
49
50    if (av_thvu_constant_m) then
51       derivs(4:5) = 0.
52    else
53       surf_buoy_env = c_dx * (theta_vs_m - av_thvu)
54       h = y(5)
55       derivs(4) = (1. + beta_m) / h * surf_buoy_env
56       derivs(5) = beta_m / delta_theta * surf_buoy_env
57    end if
58
59  END function derivs
60
61end module derivs_m
Note: See TracBrowser for help on using the repository browser.