Beispiel #1
0
    def readLinks ( self, file ):

    
        lineVariables = []   
        line = file.readline ()  # next line
        line = file.readline () 
        lineVariables = line.split() # 0: number, 1,2: nodenumbers[up, down], 3: dx, 4: conductance, 5: velocity, 6: sourceTerm, 7: boundaryCondition
        
        
        while ( len ( lineVariables ) > 0 ):
      
            upwindNodesNumber = [] 
            downwindNodesNumber = []
         
            #                          number                    velocity_dtdx [new, old]                                                                                                                       no ghost
            nodeNew = yNode.yNodeClass ( int ( lineVariables[0] ), [float ( lineVariables[5] ),float ( lineVariables[5] )], 0, upwindNodesNumber, downwindNodesNumber )      
 
            nodeNew.geometry =  ( self.yNetwork.yGrids[0].yNodes[int ( lineVariables[1] )].geometry - self.yNetwork.yGrids[0].yNodes[int ( lineVariables[2] )].geometry ) / float ( lineVariables[3] )
            if ( nodeNew.geometry < 0 ):
                print ( "Warning: Slope < 0 at link " + str( int ( lineVariables[0] ) ) )
            
            nodeNew.dx = float ( lineVariables[3] )
            nodeNew.lawNumber = int ( lineVariables[4] )                                  
            nodeNew.sourceTerm = float ( lineVariables[6] )      # multiplication with dx in network.construct ()
            nodeNew.boundaryCondition = lineVariables[7]                                                         
            nodeNew.upwindNodesNumber.append ( int ( lineVariables[1] ) )  
            nodeNew.downwindNodesNumber.append ( int ( lineVariables[2] ) )                       
            self.yNetwork.yGrids[1].yNodes.append ( nodeNew )
                    
            line = file.readline ()
            lineVariables = line.split()            
Beispiel #2
0
    def readNodes ( self, file ):
   
        lineVariables = []   
        line = file.readline ()  # next line
        line = file.readline () 
        lineVariables = line.split() # 0: number, 1: elevation, 2: initialWaterDepth, 3: sourceTerm, 4: boundaryCondition
        
        
        while ( len ( lineVariables ) > 0 ):

            upwindNodesNumber = []  
            downwindNodesNumber = []
                     
            #                          number                    waterDepth [new, old]                                     no ghost
            nodeNew = yNode.yNodeClass ( int ( lineVariables[0] ), [float ( lineVariables[2] ), float ( lineVariables[2] )], 0, upwindNodesNumber, downwindNodesNumber )  
            
            nodeNew.geometry = float ( lineVariables[1] ) 
            nodeNew.sourceTerm = float ( lineVariables[3] )  
            nodeNew.boundaryCondition = lineVariables[4]                        
            self.yNetwork.yGrids[0].yNodes.append ( nodeNew )
            
            line = file.readline ()
            lineVariables = line.split()