[2720] | 1 | module generic_tracer_index_mod |
---|
| 2 | |
---|
| 3 | !======================================================================C |
---|
| 4 | ! |
---|
[2722] | 5 | ! This module is to get back the index of a generic condensable tracer |
---|
| 6 | ! for both the vap & ice parts of the tracer |
---|
[2720] | 7 | ! |
---|
[2722] | 8 | ! call_ice_vap_generic is a boolean which tells if the tracer is condensable |
---|
| 9 | ! and allows, if it is condensable, to call the vap/ice pair |
---|
[2720] | 10 | ! |
---|
[2722] | 11 | ! Noé Clément & Lucas Teinturier (2022) |
---|
| 12 | ! |
---|
[2720] | 13 | !======================================================================C |
---|
| 14 | |
---|
| 15 | implicit none |
---|
| 16 | |
---|
| 17 | contains |
---|
| 18 | |
---|
[2722] | 19 | subroutine generic_tracer_index(nq,iq,igcm_generic_vap,igcm_generic_ice,call_ice_vap_generic) |
---|
[2720] | 20 | |
---|
| 21 | USE tracer_h, only: noms, is_condensable |
---|
| 22 | integer nq,iq, igcm_generic_vap, igcm_generic_ice |
---|
[2722] | 23 | logical call_ice_vap_generic |
---|
[2720] | 24 | |
---|
| 25 | if((is_condensable(iq)==1) .and. (index(noms(iq),"vap") .ne. 0) & |
---|
| 26 | .and. (index(noms(iq),"h2o") .eq. 0) .and. (index(noms(iq),"co2") .eq. 0)) then |
---|
| 27 | ! Let's get the index of our tracers (we look for igcm _generic_vap and igcm_generic_ice) |
---|
| 28 | |
---|
| 29 | igcm_generic_vap = iq |
---|
| 30 | igcm_generic_ice = -1 |
---|
| 31 | |
---|
| 32 | ! We look for the corresponding ice traceur (before or after in the list of traceurs, maybe could be generalised to the whole list) |
---|
| 33 | if (iq .ne. nq) then |
---|
| 34 | if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq+1)(1:len(trim(noms(iq+1)))-4)) .and. (index(noms(iq+1),"ice") .ne. 0)) then |
---|
| 35 | igcm_generic_ice = iq+1 |
---|
| 36 | end if |
---|
| 37 | end if |
---|
| 38 | if ((iq .gt. 1)) then |
---|
| 39 | if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq-1)(1:len(trim(noms(iq-1)))-4)) .and. (index(noms(iq-1),"ice") .ne. 0)) then |
---|
| 40 | igcm_generic_ice = iq-1 |
---|
| 41 | end if |
---|
| 42 | end if |
---|
| 43 | if (igcm_generic_ice .eq. -1) then |
---|
| 44 | write(*,*) "ERROR : You set a vap traceur but you forgot to set the corresponding ice traceur, & |
---|
| 45 | or the pair vap/ice is not written one after another in traceur.def" |
---|
| 46 | endif |
---|
| 47 | |
---|
[2722] | 48 | call_ice_vap_generic = .true. |
---|
| 49 | |
---|
| 50 | else |
---|
[2720] | 51 | |
---|
[2722] | 52 | call_ice_vap_generic = .false. |
---|
| 53 | |
---|
[2720] | 54 | end if ! if((is_condensable(iq)==1) .and. (index(noms(iq),"vap") .ne. 0)) |
---|
| 55 | |
---|
| 56 | end subroutine generic_tracer_index |
---|
| 57 | |
---|
| 58 | end module generic_tracer_index_mod |
---|