Changeset 4050 for LMDZ6/trunk/libf/dyn3d_common
- Timestamp:
- Dec 23, 2021, 6:54:17 PM (3 years ago)
- Location:
- LMDZ6/trunk/libf/dyn3d_common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
r4046 r4050 32 32 TYPE(isot_type), TARGET, SAVE, ALLOCATABLE :: isotopes(:) !=== ISOTOPES PARAMETERS VECTOR 33 33 34 ! iadv : index of trasport schema for each tracer35 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: iadv36 37 34 ! niadv : vector keeping the coorspondance between all tracers(nqtot) treated in the 38 35 ! dynamic part of the code and the tracers (nbtr+2) used in the physics part of the code. 39 36 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: niadv ! equivalent dyn / physique 40 37 41 ! CRisi: tableaux de fils42 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: nqfils43 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: nqdesc ! nombres de fils + nombre de tous les petits fils sur toutes les generations44 INTEGER, SAVE :: nqdesc_tot45 INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE :: iqfils46 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: iqpere47 38 REAL :: qperemin,masseqmin,ratiomin ! MVals et CRisi 48 39 PARAMETER (qperemin=1e-30,masseqmin=1e-18,ratiomin=1e-16) ! MVals … … 63 54 LOGICAL, DIMENSION(niso_possibles),SAVE :: use_iso 64 55 INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE :: iqiso ! donne indice iq en fn de (ixt,phase) 65 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: iso_num ! donne numero iso entre 1 et niso_possibles en fn de nqtot66 56 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: iso_indnum ! donne numero iso entre 1 et niso effectif en fn de nqtot 67 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: zone_num ! donne numero de la zone de tracage en fn de nqtot68 INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: phase_num ! donne numero de la zone de tracage en fn de nqtot69 57 INTEGER, DIMENSION(niso_possibles), SAVE :: indnum_fn_num ! donne indice entre entre 1 et niso en fonction du numero d isotope entre 1 et niso_possibles 70 58 INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE :: index_trac ! numero ixt en fn izone, indnum entre 1 et niso … … 128 116 129 117 INTEGER :: nqtrue ! number of tracers read from tracer.def, without higer order of moment 130 INTEGER :: iq, new_iq, iiq, jq, ierr,itr 131 INTEGER :: ifils,ipere ,generation! CRisi118 INTEGER :: iq, new_iq, iiq, jq, ierr,itr, iadv 119 INTEGER :: ifils,ipere ! CRisi 132 120 LOGICAL :: continu,nouveau_traceurdef 133 121 INTEGER :: IOstatus ! gestion de la retrocompatibilite de traceur.def 134 122 CHARACTER(len=maxlen) :: tchaine 123 INTEGER, ALLOCATABLE :: iqfils(:,:) 135 124 136 125 character(len=*),parameter :: modname="infotrac_init" … … 565 554 ! 566 555 ALLOCATE(tracers(nqtot)) 567 ALLOCATE( iadv(nqtot),niadv(nqtot))556 ALLOCATE(niadv(nqtot)) 568 557 569 558 !----------------------------------------------------------------------- … … 578 567 ! Verify choice of advection schema 579 568 IF (hadv(iq)==vadv(iq)) THEN 580 iadv(new_iq)=hadv(iq)569 tracers(new_iq)%iadv=hadv(iq) 581 570 ELSE IF (hadv(iq)==10 .AND. vadv(iq)==16) THEN 582 iadv(new_iq)=11571 tracers(new_iq)%iadv=11 583 572 ELSE 584 573 WRITE(lunout,*)trim(modname),': This choice of advection schema is not available',iq,hadv(iq),vadv(iq) … … 588 577 589 578 str1=tnom_0(iq) 590 tracers(new_iq)%name=TRIM(tnom_0(iq)) 591 IF (iadv(new_iq)==0) THEN 579 tracers(new_iq)%name = TRIM(tnom_0(iq)) 580 tracers(new_iq)%parent = TRIM(tnom_transp(iq)) 581 IF (tracers(new_iq)%iadv==0) THEN 592 582 tracers(new_iq)%longName=trim(str1) 593 583 ELSE 594 tracers(new_iq)%longName=trim(tnom_0(iq))//descrq( iadv(new_iq))584 tracers(new_iq)%longName=trim(tnom_0(iq))//descrq(tracers(new_iq)%iadv) 595 585 ENDIF 596 586 597 587 ! schemas tenant compte des moments d'ordre superieur 598 588 str2=TRIM(tracers(new_iq)%longName) 599 IF ( iadv(new_iq)==20) THEN589 IF (tracers(new_iq)%iadv==20) THEN 600 590 DO jq=1,3 601 591 new_iq=new_iq+1 602 iadv(new_iq)=-20592 tracers(new_iq)%iadv=-20 603 593 tracers(new_iq)%longName=trim(str2)//txts(jq) 604 594 tracers(new_iq)%name=trim(str1)//txts(jq) 605 595 END DO 606 ELSE IF ( iadv(new_iq)==30) THEN596 ELSE IF (tracers(new_iq)%iadv==30) THEN 607 597 DO jq=1,9 608 598 new_iq=new_iq+1 609 iadv(new_iq)=-30599 tracers(new_iq)%iadv=-30 610 600 tracers(new_iq)%longName=trim(str2)//txtp(jq) 611 601 tracers(new_iq)%name=trim(str1)//txtp(jq) … … 620 610 iiq=0 621 611 DO iq=1,nqtot 622 IF( iadv(iq).GE.0) THEN612 IF(tracers(iq)%iadv.GE.0) THEN 623 613 ! True tracer 624 614 iiq=iiq+1 … … 632 622 633 623 DO iq=1,nqtot 634 WRITE(lunout,*) iadv(iq),niadv(iq), ' ',trim(tracers(iq)%name),' ',trim(tracers(iq)%longName)624 WRITE(lunout,*) tracers(iq)%iadv,niadv(iq), ' ',trim(tracers(iq)%name),' ',trim(tracers(iq)%longName) 635 625 END DO 636 626 … … 640 630 ! 641 631 DO iq=1,nqtot 642 IF (iadv(iq)/=10 .AND. iadv(iq)/=14 .AND. iadv(iq)/=0) THEN 643 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv(iq),' is not tested in this version of LMDZ' 632 iadv=tracers(iq)%iadv 633 IF (ALL([10, 14, 0]/=iadv)) THEN 634 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv,' is not tested in this version of LMDZ' 644 635 CALL abort_gcm('infotrac_init','In this version only iadv=10 and iadv=14 is tested!',1) 645 ELSE IF (iadv (iq)==14 .AND. iq/=1) THEN646 WRITE(lunout,*)trim(modname),'STOP : The option iadv=',iadv (iq),' is not tested in this version of LMDZ'636 ELSE IF (iadv==14 .AND. iq/=1) THEN 637 WRITE(lunout,*)trim(modname),'STOP : The option iadv=',iadv,' is not tested in this version of LMDZ' 647 638 CALL abort_gcm('infotrac_init','In this version iadv=14 is only permitted for water vapour!',1) 648 639 ENDIF … … 653 644 ! initialiser tous les tableaux d'indices lies aux traceurs familiaux 654 645 ! + verifier que tous les peres sont ecrits en premieres positions 655 ALLOCATE(nqfils(nqtot),nqdesc(nqtot))656 646 ALLOCATE(iqfils(nqtot,nqtot)) 657 ALLOCATE(iqpere(nqtot))658 647 nqperes=0 659 nqfils(:)=0660 nqdesc(:)=0661 648 iqfils(:,:)=0 662 iqpere(:)=0 663 nqdesc_tot=0 649 tracers(:)%iqParent=0 664 650 DO iq=1,nqtot 665 651 if (tnom_transp(iq) == 'air') then … … 667 653 WRITE(lunout,*) 'Le traceur',iq,', appele ',trim(tnom_0(iq)),', est un pere' 668 654 nqperes=nqperes+1 669 iqpere(iq)=0655 tracers(iq)%iqParent=0 670 656 else !if (tnom_transp(iq) == 'air') then 671 657 ! ceci est un fils. Qui est son pere? … … 681 667 CALL abort_gcm('infotrac_init','Un fils est son propre pere',1) 682 668 endif 683 nqfils(ipere)=nqfils(ipere)+1684 iqfils( nqfils(ipere),ipere)=iq685 iqpere(iq)=ipere669 tracers(ipere)%nqChilds = tracers(ipere)%nqChilds+1 670 iqfils(tracers(ipere)%nqChilds,ipere)=iq 671 tracers(iq)%iqParent=ipere 686 672 continu=.false. 687 673 else !if (tnom_transp(iq) == tnom_0(ipere)) then … … 697 683 enddo !DO iq=1,nqtot 698 684 WRITE(lunout,*) 'infotrac: nqperes=',nqperes 699 WRITE(lunout,*) 'nq fils=',nqfils700 WRITE(lunout,*) 'iq pere=',iqpere685 WRITE(lunout,*) 'nqChilds=',tracers(:)%nqChilds 686 WRITE(lunout,*) 'iqParent=',tracers(:)%iqParent 701 687 WRITE(lunout,*) 'iqfils=',iqfils 702 688 703 689 ! Calculer le nombre de descendants a partir de iqfils et de nbfils 704 690 DO iq=1,nqtot 705 generation=0691 tracers(iq)%iGeneration=0 706 692 continu=.true. 707 693 ifils=iq 708 694 do while (continu) 709 ipere= iqpere(ifils)695 ipere=tracers(ifils)%iqParent 710 696 if (ipere.gt.0) then 711 nqdesc(ipere)=nqdesc(ipere)+1 712 nqdesc_tot=nqdesc_tot+1 713 iqfils(nqdesc(ipere),ipere)=iq 697 tracers(ipere)%nqDescen = tracers(ipere)%nqDescen+1 698 iqfils(tracers(ipere)%nqDescen,ipere)=iq 714 699 ifils=ipere 715 generation=generation+1700 tracers(iq)%iGeneration=tracers(iq)%iGeneration+1 716 701 else !if (ipere.gt.0) then 717 702 continu=.false. 718 703 endif !if (ipere.gt.0) then 719 704 enddo !do while (continu) 720 WRITE(lunout,*) 'Le traceur ',iq,', appele ',trim(tnom_0(iq)),' est un traceur de generation: ',generation 705 WRITE(lunout,*) 'Le traceur ',iq,', appele ',trim(tnom_0(iq)), & 706 ' est un traceur de generation: ',tracers(iq)%iGeneration 721 707 enddo !DO iq=1,nqtot 722 WRITE(lunout,*) 'infotrac: nqdesc=',nqdesc 708 DO iq=1,nqtot 709 ALLOCATE(tracers(iq)%iqDescen(tracers(iq)%nqDescen)) 710 tracers(iq)%iqDescen(:) = iqfils(1:tracers(iq)%nqDescen,iq) 711 END DO 712 713 WRITE(lunout,*) 'infotrac: nqDescen=',tracers(iq)%nqDescen 723 714 WRITE(lunout,*) 'iqfils=',iqfils 724 WRITE(lunout,*) 'nq desc_tot=',nqdesc_tot715 WRITE(lunout,*) 'nqDescen_tot=',SUM(tracers(:)%nqDescen) 725 716 726 717 ! Interdire autres schemas que 10 pour les traceurs fils, et autres schemas 727 718 ! que 10 et 14 si des peres ont des fils 728 719 do iq=1,nqtot 729 if ( iqpere(iq).gt.0) then720 if (tracers(iq)%iqParent > 0) then 730 721 ! ce traceur a un pere qui n'est pas l'air 731 722 ! Seul le schema 10 est autorise 732 if (iadv(iq)/=10) then 733 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv(iq),' is not implemented for sons' 723 iadv=tracers(iq)%iadv 724 if (iadv/=10) then 725 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv,' is not implemented for sons' 734 726 CALL abort_gcm('infotrac_init','Sons should be advected by scheme 10',1) 735 727 endif 736 728 ! Le traceur pere ne peut etre advecte que par schema 10 ou 14: 737 IF ( iadv(iqpere(iq))/=10 .AND. iadv(iqpere(iq))/=14) THEN738 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv (iq),' is not implemented for fathers'729 IF (ALL([10,14]/=tracers(tracers(iq)%iqParent)%iadv)) THEN 730 WRITE(lunout,*)trim(modname),' STOP : The option iadv=',iadv,' is not implemented for fathers' 739 731 CALL abort_gcm('infotrac_init','Fathers should be advected by scheme 10 ou 14',1) 740 endif !IF (iadv(iqpere(iq))/=10 .AND. iadv(iqpere(iq))/=14) THEN741 endif !if (iqpere(iq).gt.0) the732 endif 733 endif 742 734 enddo !do iq=1,nqtot 743 735 tracers(:)%gen0Name = ancestor(tracers) !--- Name of the first generation ancestor 744 736 745 737 … … 763 755 itr=0 764 756 do iq=nqo+1, nqtot 765 if ( iso_num(iq).eq.0) then757 if (tracers(iq)%iso_iName.eq.0) then 766 758 itr=itr+1 767 759 write(*,*) 'itr=',itr 768 760 itr_indice(itr)=iq 769 endif !if ( iso_num(iq).eq.0) then761 endif !if (tracers(iq)%iso_iName.eq.0) then 770 762 enddo 771 763 if (itr.ne.nqtottr) then … … 811 803 ALLOCATE(nb_isoind(nqo)) 812 804 ALLOCATE(nb_traciso(niso_possibles,nqo)) 813 ALLOCATE(iso_num(nqtot))814 805 ALLOCATE(iso_indnum(nqtot)) 815 ALLOCATE(zone_num(nqtot))816 ALLOCATE(phase_num(nqtot))817 806 818 iso_num(:)=0819 807 iso_indnum(:)=0 820 zone_num(:)=0821 phase_num(:)=0822 808 indnum_fn_num(:)=0 823 809 use_iso(:)=.false. … … 841 827 nb_iso(ixt,phase)=nb_iso(ixt,phase)+1 842 828 nb_isoind(phase)=nb_isoind(phase)+1 843 iso_num(iq)=ixt829 tracers(iq)%iso_iName=ixt 844 830 iso_indnum(iq)=nb_isoind(phase) 845 831 indnum_fn_num(ixt)=iso_indnum(iq) 846 phase_num(iq)=phase 847 ! write(lunout,*) 'iso_num(iq)=',iso_num(iq) 848 ! write(lunout,*) 'iso_indnum(iq)=',iso_indnum(iq) 849 ! write(lunout,*) 'indnum_fn_num(ixt)=',indnum_fn_num(ixt) 850 ! write(lunout,*) 'phase_num(iq)=',phase_num(iq) 832 tracers(iq)%iso_iPhase=phase 851 833 goto 20 852 else if ( iqpere(iq).gt.0) then853 if (tnom_0( iqpere(iq)) == tnom_trac) then834 else if ( tracers(iq)%iqParent> 0) then 835 if (tnom_0(tracers(iq)%iqParent) == tnom_trac) then 854 836 ! write(lunout,*) 'Ce traceur est le fils d''un isotope' 855 837 ! c'est un traceur d'isotope 856 838 nb_traciso(ixt,phase)=nb_traciso(ixt,phase)+1 857 iso_num(iq)=ixt839 tracers(iq)%iso_iName=ixt 858 840 iso_indnum(iq)=indnum_fn_num(ixt) 859 zone_num(iq)=nb_traciso(ixt,phase) 860 phase_num(iq)=phase 861 ! write(lunout,*) 'iso_num(iq)=',iso_num(iq) 862 ! write(lunout,*) 'phase_num(iq)=',phase_num(iq) 863 ! write(lunout,*) 'zone_num(iq)=',zone_num(iq) 841 tracers(iq)%iso_iZone=nb_traciso(ixt,phase) 842 tracers(iq)%iso_iPhase=phase 864 843 goto 20 865 endif !if (tnom_0( iqpere(iq)) == trim(tnom_0(phase))//trim(tnom_iso(ixt))) then844 endif !if (tnom_0(tracers(iq)%iqParent) == trim(tnom_0(phase))//trim(tnom_iso(ixt))) then 866 845 endif !IF (tnom_0(iq) == trim(tnom_0(phase))//trim(tnom_iso(ixt))) then 867 846 enddo !do ixt= niso_possibles … … 869 848 20 continue 870 849 enddo !do iq=1,nqtot 871 872 ! write(lunout,*) 'iso_num=',iso_num873 ! write(lunout,*) 'iso_indnum=',iso_indnum874 ! write(lunout,*) 'zone_num=',zone_num875 ! write(lunout,*) 'phase_num=',phase_num876 ! write(lunout,*) 'indnum_fn_num=',indnum_fn_num877 850 878 851 do ixt= 1,niso_possibles … … 926 899 927 900 ! flags isotopiques: 928 if (niso.gt.0) then 929 ok_isotopes=.true. 930 else 931 ok_isotopes=.false. 932 endif 901 ok_isotopes = niso > 0 933 902 ! WRITE(lunout,*) 'ok_isotopes=',ok_isotopes 934 903 … … 955 924 iqiso(:,:)=0 956 925 do iq=1,nqtot 957 if ( iso_num(iq).gt.0) then958 ixt=iso_indnum(iq)+ zone_num(iq)*niso959 iqiso(ixt, phase_num(iq))=iq926 if (tracers(iq)%iso_iName > 0) then 927 ixt=iso_indnum(iq)+tracers(iq)%iso_iZone*niso 928 iqiso(ixt,tracers(iq)%iso_iPhase)=iq 960 929 endif 961 930 enddo -
LMDZ6/trunk/libf/dyn3d_common/iso_verif_dyn.F
r2270 r4050 64 64 function iso_verif_aberrant_nostop 65 65 : (x,iso,q,err_msg) 66 USE infotrac 66 USE infotrac, ONLY: tnat 67 67 implicit none 68 68
Note: See TracChangeset
for help on using the changeset viewer.