コード例 #1
0
ファイル: rivermodule.py プロジェクト: mcflugen/avulsion-bmi
    def advance_in_time(self):
        """ Update avulsion model one time step. """

        ### future work: SLRR can be a vector to change rates ###

        # determine if there is an avulsion & find new path if so
        ### need to change this to look for shoreline after coupling ###
        ### (instead of looking for sea level)
        (self._riv_i, self._riv_j), self._avulsion_type, self._loc = avulse.find_avulsion(
             self._riv_i, self._riv_j, self._n,
             self._super_ratio, self._SL, self._ch_depth,
             self._short_path, self._splay_type, self._splay_dep, dx=self._dx,
             dy=self._dy)

        if self._saveavulsions & self._avulsion_type > 0:
            new_info = (self._avulsion_type, self._time / _SECONDS_PER_YEAR, self._loc)
            self._avulsion_info = np.vstack([self._avulsion_info, new_info])

        #assert(self._riv_i[-1] != 0)

        # save timestep and avulsion location if there was one
        #if len(loc) != 0:
        #    self._avulsions = self._avulsions + [(self._time/_SECONDS_PER_DAY),
        #                loc[-1], avulsion_type, length_old,
        #                length_new_sum, self._SL)]
        
        # raise first two rows by inlet rise rate (subsidence)
        self._n[:2, :] += self._IRR

        # change elevations according to sea level rise (SLRR)
        ### needs to be changed to subtracting elevation once coupled ###
        SLR.elev_change(self._SL, self._n, self._riv_i,
                        self._riv_j, self._ch_depth)

        # smooth river course elevations using linear diffusion equation
        diffuse.smooth_rc(self._dx, self._dy, self._nu, self._dt,
                          self._riv_i, self._riv_j, self._n)

        # Floodplain sedimentation
        FP.dep_blanket(self._SL, self._blanket_rate, self._n,
                       self._riv_i, self._riv_j, self._ch_depth)

        # Wetland sedimentation
        ### no wetlands in first version of coupling to CEM ###
        FP.wetlands(self._SL, self._WL_Z, self._WL_dist * self._dy,
                    self._n, self._riv_i, self._riv_j, self._x, self._y)

        # calculate sediment flux
        self._sed_flux = flux.calc_qs(self._nu, self._riv_i,
                                      self._riv_j, self._n,
                                      self._dx, self._dy, self._dt)

        self._profile = self._n[self._riv_i, self._riv_j]

        # Update sea level
        self._SL += self._SLRR
        self._time += self._dt
コード例 #2
0
    def advance_in_time(self):
        """ Update avulsion model one time step. """
        # if (self._time / _SECONDS_PER_YEAR) > 2000:
        #     self._SLRR = 0.01 / _SECONDS_PER_YEAR * self._dt

        self._riv_i, self._riv_j, self._course_update = steep_desc.update_course(
            self._n, self._riv_i, self._riv_j, self._ch_depth, self._slope,
            sea_level=self._SL, dx=self._dx, dy=self._dy)

        self._n = avulsion_utils.fix_elevations(self._n, self._riv_i, self._riv_j,
            self._ch_depth, self._SL, self._slope, self._dx, self._max_rand, self._SLRR)

        """ Save every time the course changes? """
        if self._saveupdates and self._course_update > 0:
            with open('output_data/river_info.out','a') as file:
                file.write("%.5f %i \n" % ((self._time / _SECONDS_PER_YEAR),
                    self._course_update))

        """ determine if there is an avulsion & find new path if so """
        (self._riv_i, self._riv_j), self._avulsion_type, self._loc, self._avulse_length, \
         self._path_diff, self._splay_deposit = avulse.find_avulsion(self._riv_i,
            self._riv_j, self._n, self._super_ratio, self._SL, self._ch_depth,
            self._short_path, self._splay_type, self._slope,
            self._splay_deposit, self._nu, self._dt, dx=self._dx, dy=self._dy)

        """ Save avulsion record. """
        if self._saveavulsions and self._avulsion_type > 0:
            with open('output_data/river_info.out','a') as file:
                file.write("%.5f %i %i %.5f %.5f\n" % ((self._time / _SECONDS_PER_YEAR),
                    self._avulsion_type, self._loc, self._avulse_length, self._path_diff))

        """ Save crevasse splay deposits. """        
        if self._saveavulsions and (self._splay_deposit.sum() > 0):
            np.savetxt('output_data/splay_deposit.out', self._splay_deposit, '%.8f')

        # need to fill old river channels if coupled to CEM
        if (self._avulsion_type == 1) or (self._avulsion_type == 2):
            self._n = avulsion_utils.fix_elevations(self._n, self._riv_i, self._riv_j,
                self._ch_depth, self._SL, self._slope, self._dx, self._max_rand, self._SLRR)

        #assert(self._riv_i[-1] != 0)

        """ change elevations according to sea level rise (SLRR)
        (if not coupled -- this occurs in coupling script otherwise) """
        # SLR.elev_change(self._SL, self._n, self._riv_i,
        #                 self._riv_j, self._ch_depth, self._SLRR)

        """ smooth river course elevations using linear diffusion equation """
        self._dn_rc = diffuse.smooth_rc(self._dx, self._dy, self._nu, self._dt, self._ch_depth,
                          self._riv_i, self._riv_j, self._n, self._SL, self._slope)

        """ Floodplain sedimentation (use one or the other) """
        #-------------------------------------------------------
        ### Deposit blanket across entire subaerial domain: ###
        # FP.dep_blanket(self._SL, self._blanket_rate, self._n,
        #                self._riv_i, self._riv_j, self._ch_depth)

        ### Deposit fines adjacent to river channel: ###
        FP.dep_fines(self._n, self._riv_i, self._riv_j, self._dn_rc, self._frac_fines,
                     self._SL)
        #-------------------------------------------------------

        """ Wetland sedimentation """
        ### no wetlands in first version of coupling to CEM ###
        # FP.wetlands(self._SL, self._WL_Z, self._WL_dist * self._dy,
        #             self._n, self._riv_i, self._riv_j, self._x, self._y)

        """ Subsidence """
        subside.linear_subsidence(self._n, self._riv_i, self._riv_j, self._ch_depth,
                                  self._SubRate, self._SubStart, self._SL)

        """ calculate sediment flux at the river mouth """
        self._sed_flux = flux.calc_qs(self._nu, self._riv_i, self._riv_j,
                                      self._n, self._SL, self._ch_depth,
                                      self._dx, self._dy, self._dt, self._slope)

        self._profile = self._n[self._riv_i, self._riv_j]

        # Update time
        self._time += self._dt
        # update sea level
        self._SL += self._SLRR
コード例 #3
0
# begin time loop and main program
for k in range(kmax):

    # determine sea level (or subsidence)
    SL = SL + [k * SLRR]
    current_SL = SL[-1]

#    # raise river inlet row by inlet rise rate (subsidence)
#    for j in range(jmax):
#        n[0][j] = n0 + (IRR)

    # determine if there is an avulsion & find new path if so
    riv_x, riv_y, loc, SEL, SER, n, dn_fp, avulsion_type, length_new_sum, \
        length_old = avulse.find_avulsion(dx, dy, imax, jmax, riv_x, riv_y,
                        n, super_ratio, current_SL, ch_depth, short_path,
                        dn_fp, splay_type, splay_dep)

    # save timestep and avulsion location if there was one
    if len(loc) != 0:
        avulsions = avulsions + [(k*dt/86400, loc[-1], avulsion_type, 
                                    length_old, length_new_sum, current_SL)]
    
    # raise first two rows by inlet rise rate (subsidence)
    n[0][:] = n[0][:] + (IRR)
    n[1][:] = n[1][:] + (IRR)

    # change elevations according to sea level rise (SLRR)
    n, rc_flag = SLR.elev_change(imax, jmax, current_SL, n, riv_x, riv_y,
                                 ch_depth, dx, dy)