Changeset 4143 for LMDZ6/trunk/libf/dyn3d_common
- Timestamp:
- May 9, 2022, 12:35:40 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
r4130 r4143 28 28 PUBLIC :: isoName, isoZone, isoPhas !--- Isotopes and tagging zones names, phases 29 29 PUBLIC :: niso, nzone, nphas, ntiso !--- " " numbers + isotopes & tagging tracers number 30 PUBLIC :: itZonIso , index_trac!--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx)31 PUBLIC :: iq TraPha, iqiso!--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases30 PUBLIC :: itZonIso !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx) 31 PUBLIC :: iqIsoPha !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases 32 32 PUBLIC :: isoCheck !--- Run isotopes checking routines 33 33 !=== FOR BOTH TRACERS AND ISOTOPES 34 34 PUBLIC :: getKey !--- Get a key from "tracers" or "isotope" 35 36 !=== OLD QUANTITIES OR ALIASES FOR OLDER NAMES (TO BE REMOVED SOON)37 PUBLIC :: ntraciso, ntraceurs_zone38 PUBLIC :: ok_iso_verif, use_iso39 PUBLIC :: iso_num, iso_indnum, indnum_fn_num, niso_possibles40 PUBLIC :: qperemin, masseqmin, ratiomin41 35 42 36 INTERFACE isoSelect; MODULE PROCEDURE isoSelectByIndex, isoSelectByName; END INTERFACE isoSelect … … 101 95 ! | zone | nzone | Geographic tagging zones list + number | / | ntraceurs_zone | | 102 96 ! | phase | nphas | Phases list + number | | [g][l][s], 1:3 | 103 ! | iq TraPha | Index in "qx" = f(name(1:ntiso)),phas) | iqiso | 1:nqtot |97 ! | iqIsoPha | Index in "qx" = f(name(1:ntiso)),phas) | iqiso | 1:nqtot | 104 98 ! | itZonIso | Index in "trac(1:ntiso)"= f(zone, name(1:niso)) | index_trac | 1:ntiso | 105 99 ! +-----------------+--------------------------------------------------+--------------------+-----------------+ … … 131 125 nphas, ntiso, & !--- NUMBER OF PHASES AND ISOTOPES + ISOTOPIC TAGGING TRACERS 132 126 itZonIso(:,:), & !--- INDEX IN "isoTrac" AS f(tagging zone idx, isotope idx) 133 iqTraPha(:,:) !--- INDEX IN "qx" AS f(isotopic tracer idx, phase idx) 134 135 !--- Aliases for older names + quantities to be removed soon 136 INTEGER, SAVE, POINTER :: index_trac(:,:) ! numero ixt en fn izone, indnum entre 1 et niso 137 INTEGER, SAVE, POINTER :: iqiso(:,:) ! donne indice iq en fn de (ixt,phase) 138 INTEGER, SAVE, POINTER :: ntraciso, ntraceurs_zone 139 REAL, SAVE :: qperemin, masseqmin, ratiomin 140 INTEGER, SAVE :: niso_possibles 141 LOGICAL, SAVE :: ok_iso_verif 142 LOGICAL, SAVE, ALLOCATABLE :: use_iso(:) 143 INTEGER, SAVE, ALLOCATABLE :: iso_num(:) !--- idx in [1,niso_possibles] = f(1<=iq <=nqtot) 144 INTEGER, SAVE, ALLOCATABLE :: iso_indnum(:) !--- idx in [1,niso] = f(1<=iq <=nqtot) 145 INTEGER, SAVE, ALLOCATABLE :: indnum_fn_num(:) !--- idx in [1,niso] = f(1<=idx<=niso_possibles) 127 iqIsoPha(:,:) !--- INDEX IN "qx" AS f(isotopic tracer idx, phase idx) 146 128 147 129 !=== VARIABLES FOR ISOTOPES INITIALIZATION AND FOR INCA … … 359 341 DEALLOCATE(tnom_0, tnom_transp) 360 342 #ifdef INCA 361 DEALLOCATE(hadv_inca, vadv_inca, solsym_inca)343 DEALLOCATE(hadv_inca, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca) 362 344 #endif 363 345 … … 377 359 nqtrue = nbtr + nqo !--- Total number of "true" tracers 378 360 IF(ALL([2,3] /= nqo)) CALL abort_gcm(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1) 379 ALLOCATE(hadv(nqtrue), conv_flg(nbtr),hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA))380 ALLOCATE(vadv(nqtrue), pbl_flg(nbtr),vadv_inca(nqINCA), pbl_flg_inca(nqINCA))361 ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA)) 362 ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA), pbl_flg_inca(nqINCA)) 381 363 CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca) 382 !--- Passive CO2 tracer is at position 1 because: H2O has been removed ; nqCO2/=0 in "inco" case only383 conv_flg(1:nbtr) = [(1, k=1, nqCO2), conv_flg_inca]384 pbl_flg(1:nbtr) = [(1, k=1, nqCO2), pbl_flg_inca]385 364 ALLOCATE(ttr(nqtrue)) 386 365 ttr(1:nqo+nqCO2) = tracers … … 407 386 lerr = getKey('hadv', hadv, ky=tracers(:)%keys) 408 387 lerr = getKey('vadv', vadv, ky=tracers(:)%keys) 409 ALLOCATE(conv_flg(nbtr), pbl_flg(nbtr))410 conv_flg(1:nbtr) = [(1, it=1, nbtr)] !--- Convection activated for all tracers411 pbl_flg(1:nbtr) = [(1, it=1, nbtr)] !--- Boundary layer activated for all tracers412 388 !--------------------------------------------------------------------------------------------------------------------------- 413 389 END IF … … 531 507 nbtr = nbtr -nqo* ntiso !--- ISOTOPIC TAGGING TRACERS ARE NOT PASSED TO THE PHYSICS 532 508 nqtottr = nqtot-nqo*(1+ntiso) !--- NO H2O-FAMILY TRACER IS PASSED TO THE PHYSICS 533 534 ALLOCATE(conv_flg(nbtr), pbl_flg(nbtr))535 #ifndef INCA536 conv_flg(1:nbtr) = 1 !--- Convection activated for all tracers537 pbl_flg(1:nbtr) = 1 !--- Boundary layer activated for all tracers538 #else539 !--- Passive CO2 tracer is at position 1 because: H2O has been removed ; nqCO2/=0 in "inco" case only540 conv_flg(1:nbtr) = [(1, ic=1, nqCO2),conv_flg_inca]541 pbl_flg(1:nbtr) = [(1, ic=1, nqCO2), pbl_flg_inca]542 #endif543 509 544 510 ELSE … … 578 544 END IF 579 545 546 !--- Convection / boundary layer activation for all tracers 547 ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1 548 ALLOCATE( pbl_flg(nbtr)); pbl_flg(1:nbtr) = 1 549 580 550 !--- Note: nqtottr can differ from nbtr when nmom/=0 581 551 ! IF(COUNT(tracers%iso_iName == 0) - COUNT(delPhase(tracers%name) == 'H2O' .AND. tracers%component == 'lmdz') /= nqtottr) & 582 552 ! CALL abort_gcm('infotrac_init', 'pb dans le calcul de nqtottr', 1) 583 584 !--- Some aliases to be removed later585 ntraciso => ntiso586 ntraceurs_zone => nzone587 qperemin = min_qParent588 masseqmin = min_qMass589 ratiomin = min_ratio590 iqiso => iqTraPha591 index_trac => itZonIso592 553 593 554 !=== DISPLAY THE RESULTS … … 704 665 USE readTracFiles_mod, ONLY: tnom_iso => newH2OIso 705 666 IMPLICIT NONE 706 INTEGER, ALLOCATABLE :: nb_iso(:), nb_tiso(:), nb_zone(:), ix(:) 667 INTEGER, ALLOCATABLE :: nb_iso(:), nb_tiso(:), nb_zone(:), ix(:), iy(:) 707 668 INTEGER :: ii, ip, iq, it, iz, ixt 708 669 TYPE(isot_type), POINTER :: i … … 765 726 END DO 766 727 767 niso_possibles = SIZE(tnom_iso) 768 ! ix = strIdx(tnom_iso, i%trac) 769 ! tnat = tnat0 (PACK(ix, MASK=ix/=0)) 770 ! alpha_ideal = alpha_ideal0(PACK(ix, MASK=ix/=0)) 771 tnat = tnat0 772 alpha_ideal = alpha_ideal0 728 !--- Get vectors, one value each "isotope%trac" element (and in the same order) 729 ix = strIdx(tnom_iso, i%trac) 730 iy = PACK(ix, MASK = ix/=0) 731 tnat = tnat0 (iy) 732 alpha_ideal = alpha_ideal0(iy) 773 733 774 734 !--- Tests … … 786 746 787 747 !--- Table: index in "qx(:)" of an isotope, knowing its indices "it","ip" in "isotope%iName,%iPhase" 788 i%iq TraPha = RESHAPE([((strIdx(t%name, TRIM(addPhase(i%trac(it),ip,i%phase))),it=1,i%ntiso),ip=1,i%nphas)],[i%ntiso,i%nphas])748 i%iqIsoPha = RESHAPE([((strIdx(t%name, TRIM(addPhase(i%trac(it),ip,i%phase))),it=1,i%ntiso),ip=1,i%nphas)],[i%ntiso,i%nphas]) 789 749 790 750 !--- Table: index in "isotope%tracs(:)%name" of an isotopic tagging tracer, knowing its indices "iz","ip" in "isotope%iZone,%iName" 791 751 i%itZonIso = RESHAPE([((strIdx(i%trac,TRIM(i%trac(it))//'_'//TRIM(i%zone(iz))),iz=1,i%nzone),it=1,i%niso )],[i%nzone,i%niso]) 792 752 793 DO it=1,i%ntiso; CALL msg('iq TraPha('//TRIM(int2str(it))//',:) = '//strStack(int2str(i%iqTraPha(it,:))), modname); END DO753 DO it=1,i%ntiso; CALL msg('iqIsoPha('//TRIM(int2str(it))//',:) = '//strStack(int2str(i%iqIsoPha(it,:))), modname); END DO 794 754 DO iz=1,i%nzone; CALL msg('itZonIso('//TRIM(int2str(iz))//',:) = '//strStack(int2str(i%itZonIso(iz,:))), modname); END DO 795 796 !--- Isotopic quantities (to be removed soon)797 ok_iso_verif = i%check798 niso_possibles = SIZE(tnom_iso)799 iso_num = [(strIdx(tnom_iso(:), strHead(delPhase(tracers(iq)%name), '_')), iq=1, nqtot)]800 iso_indnum = [(strIdx(i%keys(:)%name, strHead(delPhase(tracers(iq)%name), '_')), iq=1, nqtot)]801 indnum_fn_num = [(strIdx(i%keys(:)%name, tnom_iso(ixt)), ixt=1, niso_possibles)]802 use_iso = indnum_fn_num /= 0 !--- .TRUE. for the effectively used isotopes of the possible isotopes list803 755 804 756 !--- Finalize : … … 845 797 isoPhas => isotope%phase; nphas => isotope%nphas 846 798 itZonIso => isotope%itZonIso; isoCheck => isotope%check 847 iq TraPha => isotope%iqTraPha799 iqIsoPha => isotope%iqIsoPha 848 800 END FUNCTION isoSelectByIndex 849 801 !==============================================================================================================================
Note: See TracChangeset
for help on using the changeset viewer.