Ejemplo n.º 1
0
###############################
#     BOUNDARY CONDITIONS     #
###############################


def x_mom_DBC(X, flag):
    if X[0] == X_coords[0] or X[0] == X_coords[1]:
        return lambda x, t: 0.0


# ********************************** #
# ***** Create mySWFlowProblem ***** #
# ********************************** #

outputStepping = SWFlowProblem.OutputStepping(opts.final_time,
                                              dt_output=opts.dt_output)
initialConditions = {
    'water_height': water_height_at_t0(),
    'x_mom': x_mom_at_t0(),
    'y_mom': y_mom_at_t0(),
    'h_times_eta': heta_at_t0(),
    'h_times_w': hw_at_t0()
}
boundaryConditions = {
    'water_height': lambda x, flag: None,
    'x_mom': x_mom_DBC,
    'y_mom': lambda x, flag: lambda x, t: 0.0,
    'h_times_eta': lambda x, flag: None,
    'h_times_w': lambda x, flag: None
}
analytical_Solution = {
Ejemplo n.º 2
0
    
##############################
##### INITIAL CONDITIONS #####
##############################
class water_height_at_t0(object):
    def uOfXT(self,X,t):
        return h1

class Zero(object):
    def uOfXT(self,X,t):
        return 0.0

# ********************************** #
# ***** Create mySWFlowProblem ***** #
# ********************************** #
outputStepping = SWFlowProblem.OutputStepping(opts.final_time,dt_output=opts.dt_output)
initialConditions = {'water_height': water_height_at_t0(),
                     'x_mom': Zero(),
                     'y_mom': Zero()}
boundaryConditions = {'water_height': water_height_DBC,
                      'x_mom': x_mom_DBC,
                      'y_mom': lambda x,flag: lambda x,t: 0.0}
mySWFlowProblem = SWFlowProblem.SWFlowProblem(sw_model=0,
                                              cfl=0.33,
                                              outputStepping=outputStepping,
                                              structured=True,
                                              he=he,
                                              nnx=nnx,
                                              nny=nny,
                                              domain=domain,
                                              initialConditions=initialConditions,
Ejemplo n.º 3
0
        if (X[1] <= dam1 and X[1] <= dam2):
            return np.maximum(100.0 - X[2], 0.)
        else:
            return 0.


class Zero(object):
    """still water conditions"""
    def uOfXT(self, x, t):
        return 0.0


# ********************************** #
# ***** Create mySWFlowProblem ***** #
# ********************************** #
outputStepping = SWFlowProblem.OutputStepping(opts.final_time,
                                              dt_output=opts.dt_output)
initialConditions = {
    'water_height': water_height_at_t0(),
    'x_mom': Zero(),
    'y_mom': Zero()
}
boundaryConditions = {
    'water_height': lambda x, flag: None,
    'x_mom': lambda x, flag: None,
    'y_mom': lambda x, flag: None
}
mySWFlowProblem = SWFlowProblem.SWFlowProblem(
    sw_model=0,
    cfl=0.33,
    outputStepping=outputStepping,
    structured=True,
Ejemplo n.º 4
0
class heta_at_t0(object):
    def uOfXT(self, X, t):
        h = water_height_at_t0().uOfXT(X, t)
        return h**2


class hw_at_t0(object):
    def uOfXT(self, X, t):
        return 0.0


# ********************************** #
# ***** Create mySWFlowProblem ***** #
# ********************************** #
outputStepping = SWFlowProblem.OutputStepping(opts.final_time,
                                              dt_output=opts.dt_output)
initialConditions = {
    'water_height': water_height_at_t0(),
    'x_mom': Zero(),
    'y_mom': Zero(),
    'h_times_eta': heta_at_t0(),
    'h_times_w': Zero()
}
boundaryConditions = {
    'water_height': lambda x, flag: None,
    'x_mom': lambda x, flag: None,
    'y_mom': lambda x, flag: None,
    'h_times_eta': lambda x, flag: None,
    'h_times_w': lambda x, flag: None
}
mySWFlowProblem = SWFlowProblem.SWFlowProblem(