/// <summary> /// Script that takes Snow parameters from RDI (NAM) /// and applies it to the matching urban catchment (Model A or Model B). /// Assumes the model is set up as RDI+A or RDI+B. /// </summary> //[Script] // Disabled right now. Remove the // in front of [Script] to enable again public void CatchmenUrbanSnowFromRDI(Mike1DData m1DData) { if (m1DData.UseRR && m1DData.RainfallRunoffData != null) { // Loop over all catchments foreach (ICatchment catchment in m1DData.RainfallRunoffData.Catchments) { // Find the combined catchment if (catchment is CatchmentCombined) { // Find the two catchment models, being RDI+A or RDI+B CatchmentCombined catchmentCombined = catchment as CatchmentCombined; ICatchmentNamData catchmentNAM = null; // RDI catchment ICatchmentUrbanData catchmentUrb = null; // Urban catchment // Loop through all sub-catchments foreach (string subCatchId in catchmentCombined.SubCatchmentNames.Keys) { // Based on sub-catchment id, find actual catchment ICatchment c = m1DData.RainfallRunoffData.Catchments.Find(subCatchId); // Check if catchment is RDI/NAM or urban catchment (Model A/B) if (c is ICatchmentNamData) { catchmentNAM = (ICatchmentNamData)c; } if (c is ICatchmentUrbanData) { catchmentUrb = (ICatchmentUrbanData)c; } } // Check if both RDI and A/B was found if (catchmentNAM != null && catchmentUrb != null) { // Apply RDI snow parameters on urban catchment. catchmentUrb.UseSnowModule = catchmentNAM.IncludeSnow; // Convert from mm/day to m/s catchmentUrb.SnowMeltCoefficient = catchmentNAM.ConstDegreeDayCoef * 0.001 / (3600 * 24); } } } } }
public void CatchmenUrbanSnow(Mike1DData m1DData) { // Snow melt coefficient in [mm/C/day] // This snow melt coefficient is applied to all Model A and Model B catchments. double snowMeltMmCelsDay = 2; if (m1DData.UseRR && m1DData.RainfallRunoffData != null) { // Loop over all catchments foreach (ICatchment catchment in m1DData.RainfallRunoffData.Catchments) { // Check if it is an urban catchment if (catchment is ICatchmentUrbanData) { ICatchmentUrbanData catchmentUrb = catchment as ICatchmentUrbanData; // Apply snow parameters on urban catchment. catchmentUrb.UseSnowModule = true; // SnowMeltCoefficient is in [m/C/s], convert from [mm/C/day] catchmentUrb.SnowMeltCoefficient = snowMeltMmCelsDay * 0.001 / (3600 * 24); } } } }