Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML
<script type="text/javascript">
    
 AJS.toInit(function() {
 // unbind directly-embedded images
 AJS.$("img.confluence-embedded-image").unbind("click.fb");
 });
 </script>

scrollbar

Create a new region in your script for this section (you can call it Add external forcings, roughness and initial conditions).

We will now add the values for the boundary conditions by importing the corresponding data from a csv file with the function  ImportBoundaryConditions  Image Added. The information regarding the lateral sources can be similarly imported using the function  ImportLateralData  Image Added. In both cases, for the sake of simplicity, we have assumed that they have constant (not time dependent) values.We start by importing the boundary conditions and lateral data from there csv files (all constants)

Code Block
titleImport boundaries
ImportBoundaryConditions(rootPath + r"\boundaryConditions.csv", flowModel)
ImportLateralData(rootPath + r"\laterals.csv", flowModel)

We continue by setting the roughness . Starting with of the main roughness section. The following code sets the default roughness of , using the SetDefaultRoughness function, sets the main roughness section to StricklerKs the type Strickler ks with a default value of 30.

Code Block
languagepy
titleSet main roughness section
SetDefaultRoughness(flowModel, "Main", RoughnessType.StricklerKs, 30)

 

Now Next, we create a new roughness section and "called FloodPlain" and  and make cross-sections "prof_SW2815-SW2870_Bo" and " and prof_D20060515-DP-295" use  use it. To declare roughness sections on cross-sections, you need to declare specify the start and end distance along the cross-section for which that specific value will be used. Because we want these cross-sections to only use our new "FloodPlain" section we use the min and max FloodPlain section along their entire profile, we need to calculate the minimum and maximum horizontal relative coordinates values of the cross-section profile using the "GetMinYMaxYofCrossSectionProfile" function.the GetMinYMaxYofCrossSectionProfile  Image Added  function. The function GetItemByName  Image Added  will provide us the objects corresponding to the desired cross sections.

Code Block
languagepy
titleSet floodplain roughness on cross-sections
sectionFloodPlain = AddNewRoughnessSection(flowModel,"FloodPlain")

crs1 = GetItemByName(network.CrossSections, "prof_SW2815-SW2870_Bo")
crs2 = GetItemByName(network.CrossSections, "prof_D20060515-DP-295")

minY, maxY = GetMinYMaxYofCrossSectionProfile(crs1)
AddCrossSectionRoughness(flowModel, crs1, minY, maxY, sectionFloodPlain)

minY, maxY = GetMinYMaxYofCrossSectionProfile(crs2)
AddCrossSectionRoughness(flowModel, crs2, minY, maxY, sectionFloodPlain)

 

Now At this point, all we only need to do is to set the initial depth to a default of 3 using the following lines:conditions for the model. Let's assume a uniform water depth value of 3 m in the entire model domain.

Code Block
languagepy
titleSet initial water depth
SetInitialConditionType(flowModel, InitialConditionType.Depth)
flowModel.DefaultInitialDepth = 3

Note: The icon Image Added indicates functions that you might find interesting to see how they have been built. You can do this by opening the corresponding library (another normal script python file on its own) in the toolbox and checking the code which defines the function or method you are interested in.

scrollbar

 

 

 

scrollbar