Beispiel #1
0
    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
        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)

    # smooth river course elevations using linear diffusion equation
    n, dn_rc = diffuse.smooth_rc(dx, dy, nu, dt, riv_x, riv_y, n, nslope)

    # Floodplain sedimentation
    n, dn_fp = FP.dep_blanket(dy, dx, imax, jmax, current_SL, blanket_rate,
                              n, riv_x, riv_y, ch_depth)
    
    # Wetland sedimentation
    n, dn_fp = FP.wetlands(dx, dy, imax, jmax, current_SL, WL_Z, WL_dist, n,
                           riv_x, riv_y, x, y, dn_fp)

    # here we will calculate flux (?)

    # create a river profile array
    profile = prof.make_profile(dx, dy, n, riv_x, riv_y, profile)

    # save files
    if savefiles == 1:
        if k >= save_after:
            if k % savespacing == 0:
                np.savetxt('elev_grid/elev_' + str(k*dt/86400 - (save_after)) +