Ejemplo n.º 1
0
   def copyCommonData(self):

      SLFn = SELAFIN('')
      #   Meta data
      SLFn.TITLE = self.slf.TITLE
      SLFn.file = self.slf.file
      SLFn.IPARAM = self.slf.IPARAM
      #   Time
      SLFn.DATETIME = self.slf.DATETIME
      SLFn.tags = self.slf.tags
      #   Variables
      SLFn.NBV1 = self.slf.NBV1
      SLFn.VARNAMES = self.slf.VARNAMES
      SLFn.VARUNITS = self.slf.VARUNITS
      SLFn.NBV2 = self.slf.NBV2
      SLFn.CLDNAMES = self.slf.CLDNAMES
      SLFn.CLDUNITS = self.slf.CLDUNITS
      SLFn.NVAR = self.slf.NVAR
      SLFn.VARINDEX = range(self.slf.NVAR)
      #   Unchanged numbers
      SLFn.NPLAN = self.slf.NPLAN
      SLFn.NDP2 = self.slf.NDP2
      SLFn.NDP3 = self.slf.NDP3

      return SLFn
Ejemplo n.º 2
0
    def copyCommonData(self):

        SLFn = SELAFIN("")
        #   Meta data
        SLFn.TITLE = self.slf.TITLE
        SLFn.file = self.slf.file
        SLFn.IPARAM = self.slf.IPARAM
        #   Time
        SLFn.DATETIME = self.slf.DATETIME
        SLFn.tags = self.slf.tags
        #   Variables
        SLFn.NBV1 = self.slf.NBV1
        SLFn.VARNAMES = self.slf.VARNAMES
        SLFn.VARUNITS = self.slf.VARUNITS
        SLFn.NBV2 = self.slf.NBV2
        SLFn.CLDNAMES = self.slf.CLDNAMES
        SLFn.CLDUNITS = self.slf.CLDUNITS
        SLFn.NVAR = self.slf.NVAR
        SLFn.VARINDEX = range(self.slf.NVAR)
        #   Unchanged numbers
        SLFn.NPLAN = self.slf.NPLAN
        SLFn.NDP2 = self.slf.NDP2
        SLFn.NDP3 = self.slf.NDP3

        return SLFn
Ejemplo n.º 3
0
    bnd.NBV1 = 5
    # /!\ ELEVATION has to be the first variable
    # (for possible vertical re-interpolation within TELEMAC)
    bnd.VARNAMES = ['ELEVATION Z     ', \
                    'VELOCITY U      ','VELOCITY V      ', \
                    'SALINITY        ','TEMPERATURE     ' ]
    bnd.VARUNITS = ['M               ', \
                    'M/S             ','M/S             ', \
                    '                ','                ' ]
    bnd.NVAR = bnd.NBV1
    bnd.VARINDEX = range(bnd.NVAR)

    # Sizes and mesh connectivity
    bnd.NPLAN = slf.NPLAN
    bnd.NDP2 = 2
    bnd.NDP3 = 4
    bnd.NPOIN2 = len(BOR)
    bnd.NPOIN3 = bnd.NPOIN2 * slf.NPLAN
    bnd.IPARAM = [0, 0, 0, 0, 0, 0, bnd.NPLAN, 0, 0, 0]
    bnd.IPOB2 = BOR  # /!\ Note that IPOBO keeps the original numbering
    print '   +> masking and setting connectivity'
    # Set the array that only includes elements of geo.IKLE2 with at least two nodes in BOR
    MASK = geo.IKLE2[np.where(
        np.sum(np.in1d(geo.IKLE2, np.sort(BOR -
                                          1)).reshape(geo.NELEM2, geo.NDP2),
               axis=1) == 2)]
    IKLE2 = np.ravel(MASK)[np.in1d(MASK, np.sort(BOR - 1))].reshape(
        len(MASK), 2)  # this IKLE2 keeps the original numbering
    # ~~> re-numbering IKLE2 as a local connectivity matrix
    KNOLG, indices = np.unique(np.ravel(IKLE2), return_index=True)
    KNOGL = dict(zip(KNOLG, range(len(KNOLG))))
Ejemplo n.º 4
0
    bnd.NBV1 = 5
    # /!\ ELEVATION has to be the first variable
    # (for possible vertical re-interpolation within TELEMAC)
    bnd.VARNAMES = ['ELEVATION Z     ', \
                    'VELOCITY U      ','VELOCITY V      ', \
                    'SALINITY        ','TEMPERATURE     ' ]
    bnd.VARUNITS = ['M               ', \
                    'M/S             ','M/S             ', \
                    '                ','                ' ]
    bnd.NVAR = bnd.NBV1
    bnd.VARINDEX = range(bnd.NVAR)

    # Sizes and mesh connectivity
    bnd.NPLAN = slf.NPLAN
    bnd.NDP2 = 3
    bnd.NDP3 = 6
    bnd.NPOIN2 = len(BOR)
    bnd.NPOIN3 = bnd.NPOIN2 * slf.NPLAN
    bnd.IPARAM = [0, 0, 0, 0, 0, 0, bnd.NPLAN, 0, 0, 0]
    bnd.IPOB2 = BOR  # /!\ Note that IPOBO keeps the original numbering
    print '   +> masking and setting connectivity'
    # Set the array that only includes elements of geo.IKLE2 with at least two nodes in BOR
    IKLE2 = MASK
    # ~~> re-numbering IKLE2 as a local connectivity matrix
    KNOLG, indices = np.unique(np.ravel(IKLE2), return_index=True)
    KNOGL = dict(zip(KNOLG, range(len(KNOLG))))
    bnd.IKLE2 = -np.ones_like(IKLE2, dtype=np.int)
    for k in range(len(IKLE2)):
        bnd.IKLE2[k] = [
            KNOGL[IKLE2[k][0]], KNOGL[IKLE2[k][1]], KNOGL[IKLE2[k][2]]
        ]  # /!\ bnd.IKLE2 has a local numbering, fit to the boundary elements
Ejemplo n.º 5
0
   ini.NBV1 = 5
   # /!\ ELEVATION has to be the first variable
   # (for possible vertical re-interpolation within TELEMAC)
   ini.VARNAMES = ['ELEVATION Z     ', \
                   'VELOCITY U      ','VELOCITY V      ', \
                   'SALINITY        ','TEMPERATURE     ' ]
   ini.VARUNITS = ['M               ', \
                   'M/S             ','M/S             ', \
                   '                ','                ' ]
   ini.NVAR = ini.NBV1
   ini.VARINDEX = range(ini.NVAR)

   # Sizes and mesh connectivity
   ini.NPLAN = slf.NPLAN
   ini.NDP2 = 3
   ini.NDP3 = 6
   ini.NPOIN2 = geo.NPOIN2
   ini.NPOIN3 = geo.NPOIN2*ini.NPLAN
   ini.NELEM2 = geo.NELEM2
   ini.NELEM3 = ini.NELEM2*(ini.NPLAN-1)

   print '   +> setting connectivity'
   ini.IKLE3 = \
      np.repeat(geo.NPOIN2*np.arange(ini.NPLAN-1),geo.NELEM2*ini.NDP3).reshape((geo.NELEM2*(ini.NPLAN-1),ini.NDP3)) + \
      np.tile(np.add(np.tile(geo.IKLE2,2),np.repeat(geo.NPOIN2*np.arange(2),geo.NDP2)),(ini.NPLAN-1,1))
   ini.IPOB3 = np.ravel(np.add(np.repeat(geo.IPOB2,ini.NPLAN).reshape((geo.NPOIN2,ini.NPLAN)),geo.NPOIN2*np.arange(ini.NPLAN)).T)
   ini.IPARAM = [0,0,0,0,0,0,ini.NPLAN,0,0,0]

   # Mesh coordinates
   ini.MESHX = geo.MESHX
   ini.MESHY = geo.MESHY
Ejemplo n.º 6
0
    # Meta data and variable names
    atm.TITLE = ''
    atm.NBV1 = 4
    atm.VARNAMES = ['SURFACE PRESSURE', \
       'WIND VELOCITY U ','WIND VELOCITY V ', \
       'AIR TEMPERATURE ']
    atm.VARUNITS = ['UI              ', \
       'M/S             ','M/S             ', \
       'DEGREES         ']
    atm.NVAR = atm.NBV1
    atm.VARINDEX = range(atm.NVAR)

    # Sizes and mesh connectivity
    atm.NPLAN = slf.NPLAN  # it should be 2D but why the heack not ...
    atm.NDP2 = slf.NDP2
    atm.NDP3 = slf.NDP3
    atm.NPOIN2 = geo.NPOIN2
    atm.NPOIN3 = geo.NPOIN2 * atm.NPLAN
    atm.NELEM2 = geo.NELEM2

    print '   +> setting connectivity'
    if atm.NPLAN > 1:
        atm.NELEM3 = geo.NELEM2 * (atm.NPLAN - 1)
        atm.IKLE2 = geo.IKLE2
        atm.IKLE3 = \
           np.repeat(geo.NPOIN2*np.arange(atm.NPLAN-1),geo.NELEM2*atm.NDP3).reshape((geo.NELEM2*(atm.NPLAN-1),atm.NDP3)) + \
           np.tile(np.add(np.tile(geo.IKLE2,2),np.repeat(geo.NPOIN2*np.arange(2),geo.NDP2)),(atm.NPLAN-1,1))
        atm.IPOB2 = geo.IPOB2
        atm.IPOB3 = np.ravel(
            np.add(
                np.repeat(geo.IPOB2,
Ejemplo n.º 7
0
# now to write the SELAFIN mesh file
slf2d = SELAFIN('')

#print '     +> Set SELAFIN variables'
slf2d.TITLE = 'Converted from gmsh'
slf2d.NBV1 = 1
slf2d.NVAR = 1
slf2d.VARINDEX = range(slf2d.NVAR)
slf2d.VARNAMES.append('BOTTOM          ')
slf2d.VARUNITS.append('M               ')

#print '     +> Set SELAFIN sizes'
slf2d.NPLAN = 1
slf2d.NDP2 = 3
slf2d.NDP3 = 3
slf2d.NPOIN2 = n
slf2d.NPOIN3 = n
slf2d.NELEM2 = e
slf2d.NELEM3 = e
slf2d.IPARAM = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

#print '     +> Set SELAFIN mesh'
slf2d.MESHX = x
slf2d.MESHY = y

#print '     +> Set SELAFIN IPOBO'
junkIPOB = np.zeros(n - len(b))
junkIPOB = junkIPOB.astype(np.int16)
slf2d.IPOB2 = np.hstack((b, junkIPOB))
slf2d.IPOB3 = slf2d.IPOB2
Ejemplo n.º 8
0
# now to write the SELAFIN mesh file
slf2d = SELAFIN('')

#print '     +> Set SELAFIN variables'
slf2d.TITLE = 'Converted from gmsh'
slf2d.NBV1 = 1 
slf2d.NVAR = 1
slf2d.VARINDEX = range(slf2d.NVAR)
slf2d.VARNAMES.append('BOTTOM          ')
slf2d.VARUNITS.append('M               ')

#print '     +> Set SELAFIN sizes'
slf2d.NPLAN = 1
slf2d.NDP2 = 3
slf2d.NDP3 = 3
slf2d.NPOIN2 = n
slf2d.NPOIN3 = n
slf2d.NELEM2 = e
slf2d.NELEM3 = e
slf2d.IPARAM = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

#print '     +> Set SELAFIN mesh'
slf2d.MESHX = x
slf2d.MESHY = y

#print '     +> Set SELAFIN IPOBO'
junkIPOB = np.zeros(n-len(b))
junkIPOB = junkIPOB.astype(np.int16)
slf2d.IPOB2 = np.hstack((b,junkIPOB))
slf2d.IPOB3 = slf2d.IPOB2