Changeset 2357 in lmdz_wrf


Ignore:
Timestamp:
Feb 20, 2019, 4:24:32 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `from_coordlist_2DRKmatrix': Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of coordinates to find i,j grid-point coordinates by minimum distance
  • `from_ptlist_2DRKNmatrix': Subroutine to construct N 2D RK matrix from a list of values accompaigned by a list of grid-point coordinates
  • compilation of `module_ForGen.so' for 'llamp'
Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/Makefile.llamp

    r2244 r2357  
    5454intsrcs = $(srcs) module_ForInterpolate.f90
    5555scisrcs = $(srcs)
     56gensrcs = module_definitions.f90 module_basic.f90 module_generic.f90
    5657defsrcs = module_definitions.f90
    5758
     
    6263        module_basic.o \
    6364        module_generic.o \
     65        module_NCgeneric.o \
    6466        module_scientific.o \
    6567        module_ForInterpolate.o \
     
    9193        pyintmods.o \
    9294        pyscimods.o \
     95        pygenmods.o \
    9396        pydefmods.o \
    9497        trajectories_overlap.o
     
    100103        pyintmods.o \
    101104        pyscimods.o \
     105        pygenmods.o \
    102106        pydefmods.o
    103107
     
    115119
    116120clean :
    117         $(RM) *.mod *.o interpolate module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForDef.so
     121        $(RM) *.mod *.o interpolate module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForGen.so module_ForDef.so
    118122
    119123########    #######
     
    169173        $(F2PY) -c $(F2PYF) -I$(NCINCFOLD) -m module_ForSci $(scisrcs) -L$(NCLIBFOLD)
    170174
     175pygenmods.o:
     176        $(F2PY) -c $(F2PYF) -I$(NCINCFOLD) -m module_ForGen $(gensrcs) -L$(NCLIBFOLD)
     177
    171178pydefmods.o:
    172179        $(F2PY) -c $(F2PYF) -I$(NCINCFOLD) -m module_ForDef $(defsrcs) -L$(NCLIBFOLD)
  • trunk/tools/module_generic.f90

    r2356 r2357  
    55! continguos_homogene_zones: Subroutine to look for contiguous zones by looking by continuous grid points
    66! freeunit: provides the number of a free unit in which open a file
     7! from_coordlist_2DRKmatrix: Subroutine to construct a 2D RK matrix from a list of values accompaigned
     8!   by a list of coordinates to find i,j grid-point coordinates by minimum distance
    79! from_ptlist_2DRKmatrix: Subroutine to construct a 2D RK matrix from a list of values accompaigned
    8 !   by a list of coordinates
     10!   by a list of grid-point coordinates
     11! from_ptlist_2DRKNmatrix: Subroutine to construct N 2D RK matrix from a list of values accompaigned
     12!   by a list of grid-point coordinates
    913! GetInNamelist: Subroutine to get a paramter from a namelistfile
    1014! get_xyconlimits: Subroutine for getting the limits of contiguous values from a given point in a 2D matrix
     
    988992
    989993  SUBROUTINE from_ptlist_2DRKmatrix(Npts, pts, vals, dx, dy, NOval, matrix)
    990   ! Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of coordinates
     994  ! Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of grid-point
     995  !   coordinates
    991996
    992997    IMPLICIT NONE
     
    10231028  END SUBROUTINE from_ptlist_2DRKmatrix
    10241029
     1030  SUBROUTINE from_ptlist_2DRKNmatrix(Npts, pts, Nvals, vals, dx, dy, NOval, Nmatrix)
     1031  ! Subroutine to construct N 2D RK matrix from a list of values accompaigned by a list of grid-point
     1032  !   coordinates
     1033
     1034    IMPLICIT NONE
     1035
     1036    INTEGER, INTENT(in)                                  :: Npts, dx, dy, Nvals
     1037    REAL(r_k), INTENT(in)                                :: NOval
     1038    INTEGER, DIMENSION(Npts,2), INTENT(in)               :: pts
     1039    REAL(r_k), DIMENSION(Npts,Nvals), INTENT(in)         :: vals
     1040    REAL(r_k), DIMENSION(dx,dy,Nvals), INTENT(out)       :: Nmatrix
     1041
     1042! Local
     1043    INTEGER                                              :: iv, i, j, ic
     1044
     1045!!!!!!! Variables
     1046! Npts: Number of values of the list
     1047! pts: 2D matrix coordinates of the values
     1048! Nvals: number of different values
     1049! vals: list of N-values correspondant to the coordinates
     1050! dx, dy: shape of the 2D matrix
     1051! NOval: Value to assign when there is no coordinate
     1052! Nmatrix: resultant N-matrix
     1053
     1054    fname = 'from_ptlist_2DRKNmatrix'
     1055
     1056    Nmatrix = NOval
     1057
     1058    DO iv=1, Npts
     1059      i = pts(iv,1)
     1060      j = pts(iv,2)
     1061      Nmatrix(i,j,:) = vals(iv,:)
     1062    END DO
     1063
     1064    RETURN
     1065
     1066  END SUBROUTINE from_ptlist_2DRKNmatrix
     1067
     1068  SUBROUTINE from_coordlist_2DRKmatrix(Npts, coords, xcoord, ycoord, vals, dx, dy, NOval, matrix)
     1069  ! Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of coordinates
     1070  !   to find i,j grid-point coordinates by minimum distance
     1071
     1072    IMPLICIT NONE
     1073
     1074    INTEGER, INTENT(in)                                  :: Npts, dx, dy
     1075    REAL(r_k), INTENT(in)                                :: NOval
     1076    REAL(r_k), DIMENSION(Npts,2), INTENT(in)             :: coords
     1077    REAL(r_k), DIMENSION(Npts), INTENT(in)               :: vals
     1078    REAL(r_k), DIMENSION(dx,dy), INTENT(in)              :: xcoord, ycoord
     1079    REAL(r_k), DIMENSION(dx,dy), INTENT(out)             :: matrix
     1080
     1081! Local
     1082    INTEGER                                              :: iv, i, j
     1083    REAL(r_k)                                            :: xi, yi
     1084    REAL(r_k), DIMENSION(dx,dy)                          :: diff
     1085    INTEGER, DIMENSION(2)                                :: minpt
     1086
     1087!!!!!!! Variables
     1088! Npts: Number of values of the list
     1089! coords: 2D coordinates of the values
     1090! vals: list of values correspondant to the coordinates
     1091! xcoord, ycoord: matrix of values correspondant to the each coordinate
     1092! dx, dy: shape of the 2D matrix
     1093! NOval: Value to assign when there is no coordinate
     1094! matrix: resultant matrix
     1095
     1096    fname = 'from_coordlist_2DRKmatrix'
     1097
     1098    matrix = NOval
     1099
     1100    DO iv=1, Npts
     1101      xi = coords(iv,1)
     1102      yi = coords(iv,2)
     1103      diff = SQRT((xcoord-xi)**2+(ycoord-yi)**2)
     1104      minpt = MINLOC(diff)
     1105      matrix(minpt(1),minpt(2)) = vals(iv)
     1106    END DO
     1107
     1108    RETURN
     1109
     1110  END SUBROUTINE from_coordlist_2DRKmatrix
     1111
    10251112END MODULE module_generic
Note: See TracChangeset for help on using the changeset viewer.