Changeset 4067 for LMDZ6/trunk/libf/dyn3d_common
- Timestamp:
- Jan 27, 2022, 8:47:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
r4064 r4067 3 3 MODULE infotrac 4 4 5 USE strings_mod, ONLY: msg, find, strIdx, strFind, strParse, dispTable, int2str, reduceExpr,&6 cat, fmsg, test, strTail, strHead, strStack, strReduce , bool2str, maxlen, testFile5 USE strings_mod, ONLY: msg, find, strIdx, strFind, strParse, dispTable, int2str, reduceExpr, & 6 cat, fmsg, test, strTail, strHead, strStack, strReducef, bool2str, maxlen, testFile 7 7 USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, addPhase, phases_sep, nphases, ancestor, & 8 8 isot_type, readIsotopesFile, delPhase, old_phases, getKey_init, tran0, & 9 keys_type, initIsotopes, indexUpdate, known_phases, getKey, setGeneration 9 keys_type, initIsotopes, indexUpdate, known_phases, getKey, setGeneration, & 10 new2oldPhase 10 11 11 12 IMPLICIT NONE … … 225 226 descrq(30) = 'PRA' 226 227 227 CALL msg('type_trac ='//TRIM(type_trac), modname)228 CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname) 228 229 IF(lOldCode) THEN 229 230 str = [type_trac]; nt = 1 … … 377 378 tracers(:)%phase = 'g' 378 379 tracers(:)%component = type_trac 379 DO ip = 1, nphases 380 p = old_phases(ip:ip) 381 iq = strIdx(tracers(:)%name, 'H2O'//p) 382 IF(iq /= 0) CYCLE 383 tracers(iq)%phase = p 380 DO iq = 1, nqtrue 384 381 IF(lINCA) tracers(iq)%component = 'lmdz' 382 ip = strIdx([('H2O'//old_phases(ix:ix), ix=1, nphases)], strHead(tracers(iq)%name,'_')) 383 IF(ip == 0) CYCLE 384 tracers(iq)%phase = known_phases(ip:ip) 385 385 END DO 386 386 IF(lINCA) tracers(1+nqo:nqCO2+nqo)%component = 'co2i' 387 387 CALL setGeneration(tracers) !--- SET FIELDS %iGeneration, %gen0Name 388 389 388 ! manque "type" 390 389 … … 709 708 IMPLICIT NONE 710 709 CHARACTER(LEN=3) :: tnom_iso(niso_possibles) 711 INTEGER, ALLOCATABLE :: nb_iso(:,:), nb_traciso(:,:) 712 INTEGER :: ii, ip, iq, it, iz, ixt, n b_isoind, nzone_prec710 INTEGER, ALLOCATABLE :: nb_iso(:,:), nb_traciso(:,:), nb_isoind(:) 711 INTEGER :: ii, ip, iq, it, iz, ixt, nzone_prec 713 712 TYPE(isot_type), POINTER :: i 714 713 TYPE(trac_type), POINTER :: t(:) 715 714 CHARACTER(LEN=maxlen) :: tnom_trac 716 715 CHARACTER(LEN=maxlen), ALLOCATABLE :: str(:) 716 LOGICAL, DIMENSION(:), ALLOCATABLE :: mask 717 717 INCLUDE "iniprint.h" 718 718 … … 723 723 ALLOCATE(indnum_fn_num(niso_possibles)) 724 724 ALLOCATE(iso_indnum(nqtot)) 725 ALLOCATE(nb_isoind(nqo)) 725 726 726 727 iso_indnum (:) = 0 … … 729 730 nb_iso (:,:) = 0 730 731 nb_traciso (:,:) = 0 732 nb_isoind (:) = 0 731 733 732 734 DO iq=1, nqtot 733 735 IF(delPhase(tracers(iq)%name) == 'H2O' .OR. .NOT.tracers(iq)%isAdvected) CYCLE 734 736 outer:DO ip = 1, nqo 735 nb_isoind = 0736 737 DO ixt= 1,niso_possibles 737 738 tnom_trac = 'H2O'//old_phases(ip:ip)//'_'//TRIM(tnom_iso(ixt)) 738 739 IF (tracers(iq)%name == tnom_trac) THEN 739 740 nb_iso(ixt,ip) = nb_iso(ixt,ip)+1 740 nb_isoind = nb_isoind+1741 nb_isoind (ip) = nb_isoind (ip)+1 741 742 tracers(iq)%type = 'tracer' 742 743 tracers(iq)%iso_iGroup = 1 743 744 tracers(iq)%iso_iName = ixt 744 iso_indnum(iq) = nb_isoind 745 iso_indnum(iq) = nb_isoind(ip) 745 746 indnum_fn_num(ixt) = iso_indnum(iq) 746 747 tracers(iq)%iso_iPhase = ip … … 748 749 ELSE IF(tracers(iq)%iqParent> 0) THEN 749 750 IF(tracers(tracers(iq)%iqParent)%name == tnom_trac) THEN 750 nb_traciso(ixt,ip) = nb_traciso(ixt,ip)+1751 nb_traciso(ixt,ip) = nb_traciso(ixt,ip)+1 751 752 iso_indnum(iq) = indnum_fn_num(ixt) 752 tracers(iq)%type = 'tag'753 tracers(iq)%type = 'tag' 753 754 tracers(iq)%iso_iGroup = 1 754 755 tracers(iq)%iso_iName = ixt … … 814 815 ALLOCATE(isotopes(1)) !--- Only water 815 816 nbIso = 1 817 t => tracers 816 818 i => isotopes(1) 817 t => tracers818 str = PACK(delPhase(t%name), MASK = t%type=='tracer' .AND. delPhase(t%parent) == 'H2O' .AND. t%phase == 'g')819 819 i%parent = 'H2O' 820 i%niso = SIZE(str) 820 821 !--- Isotopes names list (embedded in the "keys" field) 822 i%niso = niso 823 ALLOCATE(i%keys(i%niso)) 824 mask = t%type=='tracer' .AND. delPhase(t%gen0Name)=='H2O' .AND. t%phase == 'g' .AND. t%iGeneration==1 825 i%keys(:)%name = strReducef(strTail(PACK(delPhase(t%name), MASK = mask), '_')) 826 827 !--- Full isotopes list, with isotopes tagging tracers (if any) following the previous list 828 i%ntiso = ntiso; ALLOCATE(i%trac(i%ntiso)) 829 mask = t%type=='tag' .AND. delPhase(t%gen0Name)=='H2O' .AND. t%phase == 'g' .AND. t%iGeneration==2 830 i%trac(:) = [i%keys(:)%name, strReducef(PACK(delPhase(t%name), MASK = mask))] 831 832 !--- Tagging zones names list 821 833 i%nzone = nzone 834 i%zone = strTail(str, '_', .TRUE.) 835 836 !--- Effective phases list 822 837 i%nphas = nqo 823 FORALL(it = 1:i%niso) i%keys(it)%name = str(it) 824 i%zone = PACK(strTail(t%name,'_',.TRUE.), MASK = t%type=='tag' .AND. delPhase(t%gen0Name)=='H2O' .AND. t%iGeneration==3) 825 CALL strReduce(i%zone) 826 i%phase = strStack([(known_phases(ip:ip), ip=1, nphases)], MASK=[(strIdx(t%name,addPhase('H2O',known_phases(ip:ip)))/=0)]) 827 i%iTraPha = RESHAPE([((strIdx(t(:)%name,addPhase(i%trac(it),i%phase(ip:ip))) ,it=1,i%ntiso),ip=1,i%nphas)],[i%ntiso,i%nphas]) 838 i%phase = '' 839 DO ip=1,nphases; IF(strIdx(t%name, addPhase('H2O',old_phases(ip:ip),''))/=0) i%phase=TRIM(i%phase)//known_phases(ip:ip); END DO 840 841 !--- Table: index in "qx" of an isotope, knowing its indices "it","ip" in "isotope%iName,%iPhase" 842 i%iTraPha = RESHAPE([((strIdx(t%name, TRIM(addPhase('H2O', new2oldPhase(i%phase(ip:ip)), ''))//'_'//TRIM(i%trac(it))), & 843 it=1,i%ntiso), ip=1,i%nphas)], [i%ntiso,i%nphas]) 844 845 !--- Table: index in "isotope%tracs(:)%name" of an isotopic tagging tracer, knowing its indices "iz","ip" in "isotope%iZone,%iName" 828 846 i%iZonIso = RESHAPE([((strIdx(i%trac,TRIM(i%trac(it))//'_'//TRIM(i%zone(iz))),iz=1,i%nzone),it=1,i%niso )],[i%nzone,i%niso ]) 829 847 DO it=1,ntiso
Note: See TracChangeset
for help on using the changeset viewer.