Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More crossection types can be implemented on demand #31

Closed
smultsch opened this issue Apr 30, 2018 · 5 comments
Closed

More crossection types can be implemented on demand #31

smultsch opened this issue Apr 30, 2018 · 5 comments
Assignees
Labels
C++ Need to change C++ files (.h, .cpp) enhancement help wanted python Need to change Python file (.py)
Milestone

Comments

@smultsch
Copy link

Hello,

would be great to have a "TrapezialReachType" for simulating stream flow in addition to existing types as listed in the tutorial:

"If you create a reach for the project, you must give the crossectional geometry of the river. The different basic geometries are:
TriangularReach - T, a river with a triangular crosssection
SWATReachType - S, a river with a trapezoidal crossection, with a flat flood plain, as in the model SWAT
RectangularReach - R, a rectangular crosssection
PipeReach - P, a circular pipe
More crossection types can be implemented on demand.
"

Please find attached some examples of stream types which I am trying to simulate. The wet surface of the stream is a sensitive parameter I am interested in. The existing channel geometries are not sufficient to represent all of them and result in unrealistic estimates of the wet surface.

Cheers,
Sebastian

channel3
channel1
channel2

@philippkraft
Copy link
Owner

While the reach geometry has of course some influence on the transport equation, I would deem the parameter uncertainty of the Manning n as the greater problem. From that perspective I would use for the picture on top SWATReachType (which is a trapezoid crosssection + bank overflow mechanism), the 2nd a TriangularReach, assuming bank overflow never happens (else use SWATReachType again) and the 3rd a RectangularReach.

However, I have thought a long time ago about a generic reach type using a vector of coordinates for the functions P(d) and A(d). The ideas are conserved in the end of ReachType.h:488-503. But I stopped there, because this was not important for me.

I do not think that we gain anything by yet another special reach type - lets rather go for a generalized formulation. I do not have the time to do the math, but I can translate a Python prototype into cmf's C++ code.

@philippkraft
Copy link
Owner

If someone provides the Python prototype, please use the following (Python 3.5+) template:

class CrossSectionReach:
    
    def __init__(self, n_manning: float, x: Sequence[float], depth: Sequence[float]):
        self.x = x
        self.depth = depth
        self.n_manning = n_manning
        
    def set_nManning(self, val: float) -> None:
        self.nManning = val
    
    def get_nManning(self) -> float:
        return self.nManning
    
    def typecode(self) -> str:
        return 'C'
    
    def get_channel_width(self, depth: float) -> float:
        """
        Calculates the flow width from a given actual depth [m] using the actual geometry
        :param depth: Actual depth in m
        :return: Actual channel width in m 
        """
        ...

    def get_wetted_perimeter(self, depth: float) -> float:
        """
        Calculates the wetted perimeter from a given actual depth [m] using the actual geometry
        :return: 
        """
        ...
    
    def get_depth(self, area: float) -> float:
        """
        Calculates the actual depth of the reach from the wetted area using the geometry
        :param area: The actual wetted area in m², can be obtained by V/l, 
                     where V is the stored volume and l is the reach length
        :return: the actual depth in m
        """
        ...        
    
    def get_flux_cross_section(self, depth: float) -> float:
        """
        Calculates the wetted area from a given depth using the IChannel geometry.
        :param depth: depth of the reach m
        :return: Wetted area of a river cross section in m²
        """
        ...

@philippkraft philippkraft added enhancement help wanted python Need to change Python file (.py) C++ Need to change C++ files (.h, .cpp) labels May 3, 2018
@smultsch
Copy link
Author

smultsch commented May 3, 2018

Ok, thanks. A generic reach type would be very interesting, but is not necessary for my current work. So, in order to have trapezoid cross-section I can just use the SWATReachType and disable the flood plain (e.g. by setting FloodPlainSlope=90%)?

@philippkraft
Copy link
Owner

philippkraft commented May 3, 2018

Just make a huuuuge channel depth, eg. 20m

@philippkraft philippkraft self-assigned this May 4, 2018
@smultsch
Copy link
Author

smultsch commented May 4, 2018

Thanks, this solution seems to be working. But it is a little bit tricky to figure out what parameters of the SWATReachType must be set by the user and which one are calculated by CMF. For example, in case of a trapezial shape the user must initialize the reach with "FlowWidht,BankWidth,ChannelDepth" and additionally set the BottomWidth by accessing the related property. Maybe this could be clarified in future.

reachshape = cmf.SWATReachType(FlowWidht,BankWidth,ChannelDepth)
reachshape.BottomWidth = 0.3

test_reachshapes.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ Need to change C++ files (.h, .cpp) enhancement help wanted python Need to change Python file (.py)
Projects
None yet
Development

No branches or pull requests

2 participants