diff --git a/src/erosion.jl b/src/erosion.jl index 58e432a21..d41a12920 100644 --- a/src/erosion.jl +++ b/src/erosion.jl @@ -63,17 +63,16 @@ function update!(model::SoilLoss, dt) overland_flow_erosion, soil_erosion, ) = model - # Convert dt to integer - ts = tosecond(dt) + #TODO add interception/canopygapfraction calculation here for eurosem #need SBM refactor # Rainfall erosion update_boundary_conditions!(rainfall_erosion, atmospheric_forcing, hydrological_forcing) - update!(rainfall_erosion, geometry, ts) + update!(rainfall_erosion, geometry, dt) # Overland flow erosion update_boundary_conditions!(overland_flow_erosion, hydrological_forcing) - update!(overland_flow_erosion, geometry, ts) + update!(overland_flow_erosion, geometry, dt) # Total soil erosion and particle differentiation update_boundary_conditions!(soil_erosion, rainfall_erosion, overland_flow_erosion) update!(soil_erosion) diff --git a/src/sediment/erosion/erosion_process.jl b/src/sediment/erosion/erosion_process.jl index eaf9d184c..b50f55b25 100644 --- a/src/sediment/erosion/erosion_process.jl +++ b/src/sediment/erosion/erosion_process.jl @@ -9,7 +9,7 @@ canopygapfraction, soilcover_fraction, area, - ts, + dt, ) Rainfall erosion model based on EUROSEM. @@ -24,7 +24,7 @@ Rainfall erosion model based on EUROSEM. - `canopygapfraction` (canopy gap fraction [-]) - `soilcover_fraction` (soil cover fraction [-]) - `area` (area [m2]) -- `ts` (timestep [seconds]) +- `dt` (timestep [seconds]) # Output - `rainfall_erosion` (soil loss [t Δt⁻¹]) @@ -39,10 +39,10 @@ function rainfall_erosion_eurosem( canopygapfraction, soilcover_fraction, area, - ts, + dt, ) # calculate rainfall intensity [mm/h] - rintnsty = precip / (ts / 3600) + rintnsty = precip / (dt / 3600) # Kinetic energy of direct throughfall [J/m2/mm] # kedir = max(11.87 + 8.73 * log10(max(0.0001, rintnsty)),0.0) #basis used in USLE kedir = max(8.95 + 8.44 * log10(max(0.0001, rintnsty)), 0.0) #variant used in most distributed mdoels @@ -72,7 +72,7 @@ end usle_k, usle_c, area, - ts, + dt, ) Rainfall erosion model based on ANSWERS. @@ -83,18 +83,18 @@ Rainfall erosion model based on ANSWERS. - `usle_c` (USLE cover and management factor [-]) - `soilcover_fraction` (soil cover fraction [-]) - `area` (area [m2]) -- `ts` (timestep [seconds]) +- `dt` (timestep [seconds]) # Output - `rainfall_erosion` (soil loss [t Δt⁻¹]) """ -function rainfall_erosion_answers(precip, usle_k, usle_c, area, ts) +function rainfall_erosion_answers(precip, usle_k, usle_c, area, dt) # calculate rainfall intensity [mm/min] - rintnsty = precip / (ts / 60) + rintnsty = precip / (dt / 60) # splash erosion [kg/min] rainfall_erosion = 0.108 * usle_c * usle_k * area * rintnsty^2 # [ton/timestep] - rainfall_erosion = rainfall_erosion * (ts / 60) * 1e-3 + rainfall_erosion = rainfall_erosion * (dt / 60) * 1e-3 return rainfall_erosion end @@ -108,7 +108,7 @@ end slope, soilcover_fraction, area, - ts, + dt, ) Overland flow erosion model based on ANSWERS. @@ -121,7 +121,7 @@ Overland flow erosion model based on ANSWERS. - `answers_k` (ANSWERS overland flow factor [-]) - `slope` (slope [-]) - `area` (area [m2]) -- `ts` (timestep [seconds]) +- `dt` (timestep [seconds]) # Output - `overland_flow_erosion` (soil loss [t Δt⁻¹]) @@ -133,7 +133,7 @@ function overland_flow_erosion_answers( answers_k, slope, area, - ts, + dt, ) # Overland flow rate [m2/min] qr_land = overland_flow * 60 / (area .^ 0.5) @@ -144,7 +144,7 @@ function overland_flow_erosion_answers( # For a wide range of slope, it is better to use the sine of slope rather than tangeant erosion = answers_k * usle_c * usle_k * area * sinslope * qr_land # [ton/timestep] - erosion = erosion * (ts / 60) * 1e-3 + erosion = erosion * (dt / 60) * 1e-3 return erosion end @@ -210,7 +210,7 @@ end width, length, slope, - ts, + dt, ) River erosion model based on Julian Torres. @@ -222,13 +222,13 @@ Repartition of the effective shear stress between the bank and the bed from Knig - `width` (width [m]) - `length` (length [m]) - `slope` (slope [-]) -- `ts` (timestep [seconds]) +- `dt` (timestep [seconds]) # Output - `bed` (potential river erosion [t Δt⁻¹]) - `bank` (potential bank erosion [t Δt⁻¹]) """ -function river_erosion_julian_torres(waterlevel, d50, width, length, slope, ts) +function river_erosion_julian_torres(waterlevel, d50, width, length, slope, dt) if waterlevel > 0.0 # Bed and Bank from Shields diagram, Da Silva & Yalin (2017) E_ = (2.65 - 1) * 9.81 @@ -257,9 +257,9 @@ function river_erosion_julian_torres(waterlevel, d50, width, length, slope, ts) #(assuming only one bank is eroding) Tex = max(TEffbank - TCrbank, 0.0) # 1.4 is bank default bulk density - ERbank = kdbank * Tex * length * waterlevel * 1.4 * ts + ERbank = kdbank * Tex * length * waterlevel * 1.4 * dt # 1.5 is bed default bulk density - ERbed = kdbed * (TEffbed - TCrbed) * length * width * 1.5 * ts + ERbed = kdbed * (TEffbed - TCrbed) * length * width * 1.5 * dt # Potential maximum bed/bank erosion bed = max(ERbed, 0.0) diff --git a/src/sediment/erosion/overland_flow_erosion.jl b/src/sediment/erosion/overland_flow_erosion.jl index 6883b6569..7fcfd22cc 100644 --- a/src/sediment/erosion/overland_flow_erosion.jl +++ b/src/sediment/erosion/overland_flow_erosion.jl @@ -90,7 +90,7 @@ function update_boundary_conditions!( @. q = q_land end -function update!(model::OverlandFlowErosionAnswersModel, geometry::LandParameters, ts) +function update!(model::OverlandFlowErosionAnswersModel, geometry::LandParameters, dt) (; q) = model.boundary_conditions (; usle_k, usle_c, answers_k) = model.parameters (; amount) = model.variables @@ -104,7 +104,7 @@ function update!(model::OverlandFlowErosionAnswersModel, geometry::LandParameter answers_k[i], geometry.slope[i], geometry.area[i], - ts, + dt, ) end end \ No newline at end of file diff --git a/src/sediment/erosion/rainfall_erosion.jl b/src/sediment/erosion/rainfall_erosion.jl index b87261792..3257d4e65 100644 --- a/src/sediment/erosion/rainfall_erosion.jl +++ b/src/sediment/erosion/rainfall_erosion.jl @@ -136,7 +136,7 @@ function update_boundary_conditions!( end "Update EUROSEM rainfall erosion model for a single timestep" -function update!(model::RainfallErosionEurosemModel, geometry::LandParameters, ts) +function update!(model::RainfallErosionEurosemModel, geometry::LandParameters, dt) (; precipitation, interception, waterlevel) = model.boundary_conditions (; soil_detachability, @@ -159,7 +159,7 @@ function update!(model::RainfallErosionEurosemModel, geometry::LandParameters, t canopygapfraction[i], soilcover_fraction[i], geometry.area[i], - ts, + dt, ) end end @@ -239,7 +239,7 @@ function update_boundary_conditions!( end "Update ANSWERS rainfall erosion model for a single timestep" -function update!(model::RainfallErosionAnswersModel, geometry::LandParameters, ts) +function update!(model::RainfallErosionAnswersModel, geometry::LandParameters, dt) (; precipitation) = model.boundary_conditions (; usle_k, usle_c) = model.parameters (; amount) = model.variables @@ -251,7 +251,7 @@ function update!(model::RainfallErosionAnswersModel, geometry::LandParameters, t usle_k[i], usle_c[i], geometry.area[i], - ts, + dt, ) end end \ No newline at end of file diff --git a/src/sediment/erosion/river_erosion.jl b/src/sediment/erosion/river_erosion.jl index 37d2c97ef..56c102378 100644 --- a/src/sediment/erosion/river_erosion.jl +++ b/src/sediment/erosion/river_erosion.jl @@ -73,7 +73,7 @@ function update_boundary_conditions!( @. waterlevel = waterlevel_river end -function update!(model::RiverErosionJulianTorresModel, geometry::RiverParameters, ts) +function update!(model::RiverErosionJulianTorresModel, geometry::RiverParameters, dt) (; waterlevel) = model.boundary_conditions (; d50) = model.parameters (; bed, bank) = model.variables @@ -86,7 +86,7 @@ function update!(model::RiverErosionJulianTorresModel, geometry::RiverParameters geometry.width[i], geometry.length[i], geometry.slope[i], - ts, + dt, ) end end \ No newline at end of file diff --git a/src/sediment/sediment_transport/deposition.jl b/src/sediment/sediment_transport/deposition.jl index 720c6685f..a533fd357 100644 --- a/src/sediment/sediment_transport/deposition.jl +++ b/src/sediment/sediment_transport/deposition.jl @@ -38,7 +38,7 @@ function reservoir_deposition_camp( # Natural deposition deposition = input * min(1.0, (DCres * (dm / 1000)^2)) - # Check if the particles was travelling in suspension or bed load using Rouse number + # Check if particles are travelling in suspension or bed load using Rouse number dsuspf = 1e3 * (1.2 * 3600 * 0.41 / 411 * (9.81 * waterlevel * slope)^0.5)^0.5 # If bed load, we have extra deposition depending on the reservoir type if dm > dsuspf diff --git a/src/sediment/sediment_transport/river_transport.jl b/src/sediment/sediment_transport/river_transport.jl index 43ed2dd0f..9c87e9ee3 100644 --- a/src/sediment/sediment_transport/river_transport.jl +++ b/src/sediment/sediment_transport/river_transport.jl @@ -387,7 +387,7 @@ function update!( network, geometry::RiverParameters, waterbodies, - ts, + dt, ) (; waterlevel, @@ -744,7 +744,7 @@ function update!( # Reduce the fraction so that there is still some sediment staying in the river cell if waterlevel[v] > 0.0 fwaterout = min( - q[v] * ts / (waterlevel[v] * geometry.width[v] * geometry.length[v]), + q[v] * dt / (waterlevel[v] * geometry.width[v] * geometry.length[v]), 1.0, ) else @@ -952,14 +952,14 @@ function update_boundary_conditions!( @. gravel = sediment_flux_model.variables.gravel end -function update!(model::SedimentConcentrationsRiverModel, geometry::RiverParameters, ts) +function update!(model::SedimentConcentrationsRiverModel, geometry::RiverParameters, dt) (; q, waterlevel, clay, silt, sand, sagg, lagg, gravel) = model.boundary_conditions (; dm_clay, dm_silt, dm_sand, dm_sagg, dm_lagg, dm_gravel) = model.parameters (; total, suspended, bed) = model.variables zeros = fill(0.0, length(q)) # Conversion from load [ton] to concentration for rivers [mg/L] - toconc = ifelse.(q .> 0.0, 1e6 ./ (q .* ts), zeros) + toconc = ifelse.(q .> 0.0, 1e6 ./ (q .* dt), zeros) # Differentiation of bed and suspended load using Rouse number for suspension # threshold diameter between bed load and mixed load using Rouse number diff --git a/src/sediment/sediment_transport/transport_capacity.jl b/src/sediment/sediment_transport/transport_capacity.jl index eeda04164..dbad7cf91 100644 --- a/src/sediment/sediment_transport/transport_capacity.jl +++ b/src/sediment/sediment_transport/transport_capacity.jl @@ -56,12 +56,12 @@ end n_govers::Vector{T} | "-" end -function TransportCapacityGoversParameters(dataset, config, inds) +function TransportCapacityGoversParameters(dataset, config, indices) slope = ncread( dataset, config, "lateral.land.transport_capacity.parameters.slope"; - sel = inds, + sel = indices, defaults = 0.01, type = Float, ) @@ -69,7 +69,7 @@ function TransportCapacityGoversParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.density"; - sel = inds, + sel = indices, defaults = 2650.0, type = Float, ) @@ -77,7 +77,7 @@ function TransportCapacityGoversParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.c_govers"; - sel = inds, + sel = indices, defaults = 0.000505, type = Float, ) @@ -85,7 +85,7 @@ function TransportCapacityGoversParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.n_govers"; - sel = inds, + sel = indices, defaults = 4.27, type = Float, ) @@ -105,10 +105,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityGoversModel(dataset, config, inds) - n = length(inds) +function TransportCapacityGoversModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityGoversParameters(dataset, config, inds) + params = TransportCapacityGoversParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityGoversModel(; boundary_conditions = bc, @@ -118,7 +118,7 @@ function TransportCapacityGoversModel(dataset, config, inds) return model end -function update!(model::TransportCapacityGoversModel, width, waterbodies, rivers, ts) +function update!(model::TransportCapacityGoversModel, width, waterbodies, rivers, dt) (; q, waterlevel) = model.boundary_conditions (; slope, density, c_govers, n_govers) = model.parameters (; amount) = model.variables @@ -135,7 +135,7 @@ function update!(model::TransportCapacityGoversModel, width, waterbodies, rivers width[i], waterbodies[i], rivers[i], - ts, + dt, ) end end @@ -150,12 +150,12 @@ end d50::Vector{T} | "mm" end -function TransportCapacityYalinParameters(dataset, config, inds) +function TransportCapacityYalinParameters(dataset, config, indices) slope = ncread( dataset, config, "lateral.land.transport_capacity.parameters.slope"; - sel = inds, + sel = indices, defaults = 0.01, type = Float, ) @@ -163,7 +163,7 @@ function TransportCapacityYalinParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.density"; - sel = inds, + sel = indices, defaults = 2650.0, type = Float, ) @@ -171,7 +171,7 @@ function TransportCapacityYalinParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.d50"; - sel = inds, + sel = indices, defaults = 0.1, type = Float, ) @@ -187,10 +187,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityYalinModel(dataset, config, inds) - n = length(inds) +function TransportCapacityYalinModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityYalinParameters(dataset, config, inds) + params = TransportCapacityYalinParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityYalinModel(; boundary_conditions = bc, @@ -200,7 +200,7 @@ function TransportCapacityYalinModel(dataset, config, inds) return model end -function update!(model::TransportCapacityYalinModel, width, waterbodies, rivers, ts) +function update!(model::TransportCapacityYalinModel, width, waterbodies, rivers, dt) (; q, waterlevel) = model.boundary_conditions (; slope, density, d50) = model.parameters (; amount) = model.variables @@ -216,7 +216,7 @@ function update!(model::TransportCapacityYalinModel, width, waterbodies, rivers, width[i], waterbodies[i], rivers[i], - ts, + dt, ) end end @@ -272,12 +272,12 @@ end dm_lagg::Vector{T} | "µm" end -function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) +function TransportCapacityYalinDifferentiationParameters(dataset, config, indices) density = ncread( dataset, config, "lateral.land.transport_capacity.parameters.density"; - sel = inds, + sel = indices, defaults = 2650.0, type = Float, ) @@ -285,7 +285,7 @@ function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.dm_clay"; - sel = inds, + sel = indices, defaults = 2.0, type = Float, ) @@ -293,7 +293,7 @@ function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.dm_silt"; - sel = inds, + sel = indices, defaults = 10.0, type = Float, ) @@ -301,7 +301,7 @@ function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.dm_sand"; - sel = inds, + sel = indices, defaults = 200.0, type = Float, ) @@ -309,7 +309,7 @@ function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.dm_sagg"; - sel = inds, + sel = indices, defaults = 30.0, type = Float, ) @@ -317,7 +317,7 @@ function TransportCapacityYalinDifferentiationParameters(dataset, config, inds) dataset, config, "lateral.land.transport_capacity.parameters.dm_lagg"; - sel = inds, + sel = indices, defaults = 500.0, type = Float, ) @@ -340,10 +340,10 @@ end variables::TransportCapacityYalinDifferentiationModelVariables{T} end -function TransportCapacityYalinDifferentiationModel(dataset, config, inds) - n = length(inds) +function TransportCapacityYalinDifferentiationModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityYalinDifferentiationModelVariables(n) - params = TransportCapacityYalinDifferentiationParameters(dataset, config, inds) + params = TransportCapacityYalinDifferentiationParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityYalinDifferentiationModel(; boundary_conditions = bc, @@ -358,7 +358,7 @@ function update!( geometry::LandParameters, waterbodies, rivers, - ts, + dt, ) (; q, waterlevel) = model.boundary_conditions (; density, dm_clay, dm_silt, dm_sand, dm_sagg, dm_lagg) = model.parameters @@ -386,7 +386,7 @@ function update!( waterbodies[i], rivers[i], dtot, - ts, + dt, ) silt[i] = transport_capacity_yalin_differentiation( q[i], @@ -398,7 +398,7 @@ function update!( waterbodies[i], rivers[i], dtot, - ts, + dt, ) sand[i] = transport_capacity_yalin_differentiation( q[i], @@ -410,7 +410,7 @@ function update!( waterbodies[i], rivers[i], dtot, - ts, + dt, ) sagg[i] = transport_capacity_yalin_differentiation( q[i], @@ -422,7 +422,7 @@ function update!( waterbodies[i], rivers[i], dtot, - ts, + dt, ) lagg[i] = transport_capacity_yalin_differentiation( q[i], @@ -434,7 +434,7 @@ function update!( waterbodies[i], rivers[i], dtot, - ts, + dt, ) amount[i] = clay[i] + silt[i] + sand[i] + sagg[i] + lagg[i] end @@ -448,12 +448,12 @@ end d50::Vector{T} | "mm" end -function TransportCapacityRiverParameters(dataset, config, inds) +function TransportCapacityRiverParameters(dataset, config, indices) density = ncread( dataset, config, "lateral.river.transport_capacity.parameters.density"; - sel = inds, + sel = indices, defaults = 2650.0, type = Float, ) @@ -461,7 +461,7 @@ function TransportCapacityRiverParameters(dataset, config, inds) dataset, config, "lateral.river.transport_capacity.parameters.d50"; - sel = inds, + sel = indices, defaults = 0.1, type = Float, ) @@ -478,12 +478,12 @@ end e_bagnold::Vector{T} | "-" end -function TransportCapacityBagnoldParameters(dataset, config, inds) +function TransportCapacityBagnoldParameters(dataset, config, indices) c_bagnold = ncread( dataset, config, "lateral.river.transport_capacity.parameters.c_bagnold"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -491,7 +491,7 @@ function TransportCapacityBagnoldParameters(dataset, config, inds) dataset, config, "lateral.river.transport_capacity.parameters.e_bagnold"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -507,10 +507,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityBagnoldModel(dataset, config, inds) - n = length(inds) +function TransportCapacityBagnoldModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityBagnoldParameters(dataset, config, inds) + params = TransportCapacityBagnoldParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityBagnoldModel(; boundary_conditions = bc, @@ -520,7 +520,7 @@ function TransportCapacityBagnoldModel(dataset, config, inds) return model end -function update!(model::TransportCapacityBagnoldModel, geometry::RiverParameters, ts) +function update!(model::TransportCapacityBagnoldModel, geometry::RiverParameters, dt) (; q, waterlevel) = model.boundary_conditions (; c_bagnold, e_bagnold) = model.parameters (; amount) = model.variables @@ -536,7 +536,7 @@ function update!(model::TransportCapacityBagnoldModel, geometry::RiverParameters e_bagnold[i], geometry.width[i], geometry.length[i], - ts, + dt, ) end end @@ -548,10 +548,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityEngelundModel(dataset, config, inds) - n = length(inds) +function TransportCapacityEngelundModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityRiverParameters(dataset, config, inds) + params = TransportCapacityRiverParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityEngelundModel(; boundary_conditions = bc, @@ -561,7 +561,7 @@ function TransportCapacityEngelundModel(dataset, config, inds) return model end -function update!(model::TransportCapacityEngelundModel, geometry::RiverParameters, ts) +function update!(model::TransportCapacityEngelundModel, geometry::RiverParameters, dt) (; q, waterlevel) = model.boundary_conditions (; density, d50) = model.parameters (; amount) = model.variables @@ -576,7 +576,7 @@ function update!(model::TransportCapacityEngelundModel, geometry::RiverParameter geometry.width[i], geometry.length[i], geometry.slope[i], - ts, + dt, ) end end @@ -593,12 +593,12 @@ end d_kodatie::Vector{T} | "-" end -function TransportCapacityKodatieParameters(dataset, config, inds) +function TransportCapacityKodatieParameters(dataset, config, indices) a_kodatie = ncread( dataset, config, "lateral.river.transport_capacity.parameters.a_kodatie"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -606,7 +606,7 @@ function TransportCapacityKodatieParameters(dataset, config, inds) dataset, config, "lateral.river.transport_capacity.parameters.b_kodatie"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -614,7 +614,7 @@ function TransportCapacityKodatieParameters(dataset, config, inds) dataset, config, "lateral.river.transport_capacity.parameters.c_kodatie"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -622,7 +622,7 @@ function TransportCapacityKodatieParameters(dataset, config, inds) dataset, config, "lateral.river.transport_capacity.parameters.d_kodatie"; - sel = inds, + sel = indices, optional = false, type = Float, ) @@ -642,10 +642,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityKodatieModel(dataset, config, inds) - n = length(inds) +function TransportCapacityKodatieModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityKodatieParameters(dataset, config, inds) + params = TransportCapacityKodatieParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityKodatieModel(; boundary_conditions = bc, @@ -655,7 +655,7 @@ function TransportCapacityKodatieModel(dataset, config, inds) return model end -function update!(model::TransportCapacityKodatieModel, geometry::RiverParameters, ts) +function update!(model::TransportCapacityKodatieModel, geometry::RiverParameters, dt) (; q, waterlevel) = model.boundary_conditions (; a_kodatie, b_kodatie, c_kodatie, d_kodatie) = model.parameters (; amount) = model.variables @@ -672,7 +672,7 @@ function update!(model::TransportCapacityKodatieModel, geometry::RiverParameters geometry.width[i], geometry.length[i], geometry.slope[i], - ts, + dt, ) end end @@ -684,10 +684,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityYangModel(dataset, config, inds) - n = length(inds) +function TransportCapacityYangModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityRiverParameters(dataset, config, inds) + params = TransportCapacityRiverParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityYangModel(; boundary_conditions = bc, @@ -697,7 +697,7 @@ function TransportCapacityYangModel(dataset, config, inds) return model end -function update!(model::TransportCapacityYangModel, geometry::RiverParameters, ts) +function update!(model::TransportCapacityYangModel, geometry::RiverParameters, dt) (; q, waterlevel) = model.boundary_conditions (; density, d50) = model.parameters (; amount) = model.variables @@ -712,7 +712,7 @@ function update!(model::TransportCapacityYangModel, geometry::RiverParameters, t geometry.width[i], geometry.length[i], geometry.slope[i], - ts, + dt, ) end end @@ -724,10 +724,10 @@ end variables::TransportCapacityModelVariables{T} end -function TransportCapacityMolinasModel(dataset, config, inds) - n = length(inds) +function TransportCapacityMolinasModel(dataset, config, indices) + n = length(indices) vars = TransportCapacityModelVariables(n) - params = TransportCapacityRiverParameters(dataset, config, inds) + params = TransportCapacityRiverParameters(dataset, config, indices) bc = TransportCapacityBC(n) model = TransportCapacityMolinasModel(; boundary_conditions = bc, @@ -737,7 +737,7 @@ function TransportCapacityMolinasModel(dataset, config, inds) return model end -function update!(model::TransportCapacityMolinasModel, geometry::RiverParameters, ts) +function update!(model::TransportCapacityMolinasModel, geometry::RiverParameters, dt) (; q, waterlevel) = model.boundary_conditions (; density, d50) = model.parameters (; amount) = model.variables @@ -752,7 +752,7 @@ function update!(model::TransportCapacityMolinasModel, geometry::RiverParameters geometry.width[i], geometry.length[i], geometry.slope[i], - ts, + dt, ) end end \ No newline at end of file diff --git a/src/sediment/sediment_transport/transport_capacity_process.jl b/src/sediment/sediment_transport/transport_capacity_process.jl index f4b85e4df..2e8e2338e 100644 --- a/src/sediment/sediment_transport/transport_capacity_process.jl +++ b/src/sediment/sediment_transport/transport_capacity_process.jl @@ -36,7 +36,7 @@ end waterlevel, width, length, - ts, + dt, ) Limit to stremaflow and not debris flow and convert transport in ton/m3 to ton. @@ -47,7 +47,7 @@ Limit to stremaflow and not debris flow and convert transport in ton/m3 to ton. - `waterlevel` (water level [m]) - `width` (drain width [m]) - `length` (drain length [m]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) @@ -58,12 +58,12 @@ function limit_and_convert_transport_capacity( waterlevel, width, length, - ts, + dt, ) # 1285 g/L: boundary between streamflow and debris flow (Costa, 1988) transport_capacity = min(transport_capacity, 1.285) # Transport capacity [ton] - transport_capacity = transport_capacity * (waterlevel * width * length + q * ts) + transport_capacity = transport_capacity * (waterlevel * width * length + q * dt) return transport_capacity end @@ -79,7 +79,7 @@ end width, waterbodies, rivers, - ts, + dt, ) Total sediment transport capacity based on Govers. @@ -94,7 +94,7 @@ Total sediment transport capacity based on Govers. - `width` (drain width [m]) - `waterbodies` (waterbodies mask [-]) - `rivers` (rivers mask [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) @@ -109,7 +109,7 @@ function transport_capacity_govers( width, waterbodies, rivers, - ts, + dt, ) # Transport capacity from govers 1990 sinslope = sin(atan(slope)) #slope in radians @@ -125,7 +125,7 @@ function transport_capacity_govers( else TCf = 0.0 end - transport_capacity = TCf * q * ts * 1e-3 #[ton/cell] + transport_capacity = TCf * q * dt * 1e-3 #[ton/cell] # Mask transport capacity values for waterbodies and rivers transport_capacity = mask_transport_capacity(transport_capacity, waterbodies, rivers) @@ -143,7 +143,7 @@ end width, waterbodies, rivers, - ts, + dt, ) Total sediment transport capacity based on Yalin. @@ -157,7 +157,7 @@ Total sediment transport capacity based on Yalin. - `width` (drain width [m]) - `waterbodies` (waterbodies mask [-]) - `rivers` (rivers mask [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) @@ -171,7 +171,7 @@ function transport_capacity_yalin( width, waterbodies, rivers, - ts, + dt, ) sinslope = sin(atan(slope)) #slope in radians # Transport capacity from Yalin without particle differentiation @@ -189,7 +189,7 @@ function transport_capacity_yalin( delta * (1 - log(1 + alphay) / (alphay)) ) # [kg/m3] - transport_capacity = TC * q * ts * 1e-3 #[ton] + transport_capacity = TC * q * dt * 1e-3 #[ton] else transport_capacity = 0.0 end @@ -262,7 +262,7 @@ end waterbodies, rivers, dtot, - ts, + dt, ) Transport capacity for a specific grain size based on Yalin with particle differentiation. @@ -277,7 +277,7 @@ Transport capacity for a specific grain size based on Yalin with particle differ - `waterbodies` (waterbodies mask [-]) - `rivers` (rivers mask [-]) - `dtot` (total flow transportability [t dt-1]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) @@ -292,7 +292,7 @@ function transport_capacity_yalin_differentiation( waterbodies, rivers, dtot, - ts, + dt, ) sinslope = sin(atan(slope)) #slope in radians # Transport capacity from Yalin with particle differentiation @@ -314,7 +314,7 @@ function transport_capacity_yalin_differentiation( 0.635 * d_part * (1 - log(1 + d_part * TCb) / d_part * TCb) # [kg/m3] - transport_capacity = TC * q * ts * 1e-3 #[ton] + transport_capacity = TC * q * dt * 1e-3 #[ton] else transport_capacity = 0.0 end @@ -333,7 +333,7 @@ end e_bagnold, width, length, - ts, + dt, ) Total sediment transport capacity based on Bagnold. @@ -345,12 +345,12 @@ Total sediment transport capacity based on Bagnold. - `e_bagnold` (Bagnold transport capacity exponent [-]) - `width` (drain width [m]) - `length` (drain length [m]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) """ -function transport_capacity_bagnold(q, waterlevel, c_bagnold, e_bagnold, width, length, ts) +function transport_capacity_bagnold(q, waterlevel, c_bagnold, e_bagnold, width, length, dt) # Transport capacity from Bagnold if waterlevel > 0.0 # Transport capacity [tons/m3] @@ -361,7 +361,7 @@ function transport_capacity_bagnold(q, waterlevel, c_bagnold, e_bagnold, width, waterlevel, width, length, - ts, + dt, ) else transport_capacity = 0.0 @@ -379,7 +379,7 @@ end width, length, slope, - ts, + dt, ) Total sediment transport capacity based on Engelund and Hansen. @@ -392,12 +392,12 @@ Total sediment transport capacity based on Engelund and Hansen. - `width` (drain width [m]) - `length` (drain length [m]) - `slope` (slope [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) """ -function transport_capacity_engelund(q, waterlevel, density, d50, width, length, slope, ts) +function transport_capacity_engelund(q, waterlevel, density, d50, width, length, slope, dt) # Transport capacity from Engelund and Hansen if waterlevel > 0.0 # Hydraulic radius of the river [m] (rectangular channel) @@ -423,7 +423,7 @@ function transport_capacity_engelund(q, waterlevel, density, d50, width, length, waterlevel, width, length, - ts, + dt, ) else @@ -444,7 +444,7 @@ end width, length, slope, - ts, + dt, ) Total sediment transport capacity based on Kodatie. @@ -458,7 +458,7 @@ Total sediment transport capacity based on Kodatie. - `d_kodatie` (Kodatie transport capacity coefficient [-]) - `width` (drain width [m]) - `slope` (slope [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) @@ -473,7 +473,7 @@ function transport_capacity_kodatie( width, length, slope, - ts, + dt, ) # Transport capacity from Kodatie if waterlevel > 0.0 @@ -485,14 +485,14 @@ function transport_capacity_kodatie( a_kodatie * velocity^b_kodatie * waterlevel^c_kodatie * slope^d_kodatie # Transport capacity [tons/m3] - transport_capacity = transport_capacity * width / (q * ts) + transport_capacity = transport_capacity * width / (q * dt) transport_capacity = limit_and_convert_transport_capacity( transport_capacity, q, waterlevel, width, length, - ts, + dt, ) else @@ -511,7 +511,7 @@ end width, length, slope, - ts, + dt, ) Total sediment transport capacity based on Yang sand and gravel equations. @@ -524,12 +524,12 @@ Total sediment transport capacity based on Yang sand and gravel equations. - `width` (drain width [m]) - `length` (drain length [m]) - `slope` (slope [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) """ -function transport_capacity_yang(q, waterlevel, density, d50, width, length, slope, ts) +function transport_capacity_yang(q, waterlevel, density, d50, width, length, slope, dt) # Transport capacity from Yang omegas = 411 * d50^2 / 3600 # Hydraulic radius of the river [m] (rectangular channel) @@ -575,7 +575,7 @@ function transport_capacity_yang(q, waterlevel, density, d50, width, length, slo waterlevel, width, length, - ts, + dt, ) return transport_capacity @@ -590,7 +590,7 @@ end width, length, slope, - ts, + dt, ) Total sediment transport capacity based on Molinas and Wu. @@ -603,12 +603,12 @@ Total sediment transport capacity based on Molinas and Wu. - `width` (drain width [m]) - `length` (drain length [m]) - `slope` (slope [-]) -- `ts` (time step [s]) +- `dt` (time step [s]) # Output - `transport_capacity` (total sediment transport capacity [t dt-1]) """ -function transport_capacity_molinas(q, waterlevel, density, d50, width, length, slope, ts) +function transport_capacity_molinas(q, waterlevel, density, d50, width, length, slope, dt) # Transport capacity from Molinas and Wu if waterlevel > 0.0 # Flow velocity [m/s] @@ -637,7 +637,7 @@ function transport_capacity_molinas(q, waterlevel, density, d50, width, length, waterlevel, width, length, - ts, + dt, ) else diff --git a/src/sediment_flux.jl b/src/sediment_flux.jl index 87aa5e874..753299303 100644 --- a/src/sediment_flux.jl +++ b/src/sediment_flux.jl @@ -54,12 +54,9 @@ function OverlandFlowSediment(dataset, config, indices, waterbodies, rivers) end function update!(model::OverlandFlowSediment, erosion_model::SoilErosionModel, network, dt) - # Convert dt to integer - ts = tosecond(dt) - # Transport capacity update_boundary_conditions!(model.transport_capacity, model.hydrological_forcing, :land) - update!(model.transport_capacity, model.geometry, model.waterbodies, model.rivers, ts) + update!(model.transport_capacity, model.geometry, model.waterbodies, model.rivers, dt) # Update boundary conditions before transport update_boundary_conditions!( @@ -142,20 +139,17 @@ function update!( indices_river, dt, ) - # Convert dt to integer - ts = tosecond(dt) - # Transport capacity update_boundary_conditions!( model.transport_capacity, model.hydrological_forcing, :river, ) - update!(model.transport_capacity, model.geometry, ts) + update!(model.transport_capacity, model.geometry, dt) # Potential maximum river erosion update_boundary_conditions!(model.potential_erosion, model.hydrological_forcing) - update!(model.potential_erosion, model.geometry, ts) + update!(model.potential_erosion, model.geometry, dt) # River transport update_boundary_conditions!( @@ -166,7 +160,7 @@ function update!( model.potential_erosion, indices_river, ) - update!(model.sediment_flux, network, model.geometry, model.waterbodies, ts) + update!(model.sediment_flux, network, model.geometry, model.waterbodies, dt) # Concentrations update_boundary_conditions!( @@ -174,5 +168,5 @@ function update!( model.hydrological_forcing, model.sediment_flux, ) - update!(model.concentrations, model.geometry, ts) + update!(model.concentrations, model.geometry, dt) end \ No newline at end of file diff --git a/src/sediment_model.jl b/src/sediment_model.jl index a12fbaab7..1cceab4d7 100644 --- a/src/sediment_model.jl +++ b/src/sediment_model.jl @@ -152,7 +152,7 @@ end function update!(model::Model{N, L, V, R, W, T}) where {N, L, V, R, W, T <: SedimentModel} (; lateral, vertical, network, config, clock) = model - dt = clock.dt + dt = tosecond(clock.dt) # Soil erosion update!(vertical, dt)