| 1 | module config_ocean_skin_m |
|---|
| 2 | |
|---|
| 3 | implicit none |
|---|
| 4 | |
|---|
| 5 | logical, protected:: jcool ! cool skin calculation |
|---|
| 6 | logical, protected:: jwarm ! warm layer calculation |
|---|
| 7 | logical, protected:: rain_effect |
|---|
| 8 | |
|---|
| 9 | real, protected:: depth_1 = 20. |
|---|
| 10 | ! Depth at which the temperature and salinity are input. Could be |
|---|
| 11 | ! the depth of a sensor, or the depth at the middle of the first |
|---|
| 12 | ! layer of an ocean model (half the depth of the first layer). In |
|---|
| 13 | ! m. Setting depth_1 to any value >= depth (named constant defined |
|---|
| 14 | ! in module `near_Surface_m`) has the same effect as setting depth_1 |
|---|
| 15 | ! to depth. |
|---|
| 16 | |
|---|
| 17 | !$omp threadprivate(jcool, jwarm, rain_effect, depth_1) |
|---|
| 18 | |
|---|
| 19 | #ifdef IN_LMDZ |
|---|
| 20 | integer, protected:: activate_ocean_skin = 0 |
|---|
| 21 | ! Allowed values: 0 do not activate; 1 activate without retroaction |
|---|
| 22 | ! on LMDZ; 2 activate with retroaction on LMDZ |
|---|
| 23 | |
|---|
| 24 | !$omp threadprivate(activate_ocean_skin) |
|---|
| 25 | #endif |
|---|
| 26 | |
|---|
| 27 | contains |
|---|
| 28 | |
|---|
| 29 | subroutine config_ocean_skin |
|---|
| 30 | |
|---|
| 31 | #ifdef IN_LMDZ |
|---|
| 32 | use ioipsl_getin_p_mod, only: getin_p |
|---|
| 33 | use assert_m, only: assert |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | integer:: flag_ocean_skin = 3 |
|---|
| 37 | !$omp threadprivate(flag_ocean_skin) |
|---|
| 38 | |
|---|
| 39 | namelist /config_ocean_skin_nml/ flag_ocean_skin, depth_1 |
|---|
| 40 | |
|---|
| 41 | !----------------------------------------------------------------------- |
|---|
| 42 | |
|---|
| 43 | #ifdef IN_LMDZ |
|---|
| 44 | call getin_p("activate_ocean_skin", activate_ocean_skin) |
|---|
| 45 | call assert(activate_ocean_skin >= 0 .and. activate_ocean_skin <= 2, & |
|---|
| 46 | "config_ocean_skin bad value of activate_ocean_skin") |
|---|
| 47 | if (activate_ocean_skin >= 1) then |
|---|
| 48 | call getin_p("flag_ocean_skin", flag_ocean_skin) |
|---|
| 49 | call getin_p("depth_1", depth_1) |
|---|
| 50 | end if |
|---|
| 51 | #else |
|---|
| 52 | write(unit = *, nml = config_ocean_skin_nml) |
|---|
| 53 | print *, "Enter namelist config_ocean_skin_nml." |
|---|
| 54 | read(unit = *, nml = config_ocean_skin_nml) |
|---|
| 55 | write(unit = *, nml = config_ocean_skin_nml) |
|---|
| 56 | #endif |
|---|
| 57 | |
|---|
| 58 | select case (flag_ocean_skin) |
|---|
| 59 | case (0) |
|---|
| 60 | jwarm = .false. |
|---|
| 61 | jcool = .false. |
|---|
| 62 | rain_effect = .false. |
|---|
| 63 | case (1) |
|---|
| 64 | jwarm = .false. |
|---|
| 65 | jcool = .true. |
|---|
| 66 | rain_effect = .false. |
|---|
| 67 | case (2) |
|---|
| 68 | jwarm = .true. |
|---|
| 69 | jcool = .true. |
|---|
| 70 | rain_effect = .false. |
|---|
| 71 | case (3) |
|---|
| 72 | jwarm = .true. |
|---|
| 73 | jcool = .true. |
|---|
| 74 | rain_effect = .true. |
|---|
| 75 | case default |
|---|
| 76 | print *, "config_ocean_skin: bad value for flag_ocean_skin." |
|---|
| 77 | stop 1 |
|---|
| 78 | end select |
|---|
| 79 | |
|---|
| 80 | end subroutine config_ocean_skin |
|---|
| 81 | |
|---|
| 82 | end module config_ocean_skin_m |
|---|