Example #1
0

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


def y_mom_DBC(X, flag):
    if X[1] == Y_coords[0] or X[1] == Y_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': y_mom_DBC,
    'h_times_eta': lambda x, flag: None,
    'h_times_w': lambda x, flag: None
}
# **************************** #
Example #2
0
##############################
class water_height_at_t0(object):
    def uOfXT(self,X,t):
        eta = eta_function(X[0],0)
        h = eta-bathymetry(X)
        hp = max(h,0.)
        return hp

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': lambda x,flag: None,
                      'x_mom': lambda x,flag: None,
                      'y_mom': lambda x,flag: lambda x,t: 0.0}
mySWFlowProblem = SWFlowProblem.SWFlowProblem(sw_model=opts.sw_model,
                                              cfl=0.33,
                                              outputStepping=outputStepping,
                                              structured=True,
                                              he=he,
                                              nnx=nnx,
                                              nny=nny,
                                              domain=domain,
                                              initialConditions=initialConditions,
Example #3
0
def water_height_DBC(X, flag):
    return None


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 ***** #
# ********************************** #
# redefine time here
T = opts.final_time
Tstar = T * np.sqrt(h0 / g)
outputStepping = SWFlowProblem.OutputStepping(Tstar, 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': y_mom_DBC,
    'h_times_eta': lambda x, flag: None,
    'h_times_w': lambda x, flag: None
}
Example #4
0
        return lambda x, t: 0.0

def heta_DBC(X, flag):
    if X[0] == X_coords[0]:
        return lambda x, t: h_inflow**2

def hw_DBC(X, flag):
    if X[0] == X_coords[0]:
        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(),
                     'h_times_beta':Zero()}
boundaryConditions = {'water_height': h_DBC,
                      'x_mom': x_mom_DBC,
                      'y_mom': y_mom_DBC,
                      'h_times_eta': heta_DBC,
                      'h_times_w': hw_DBC,
                      'h_times_beta':x_mom_DBC}
# if want to use reflecting conditions on all boundaries switch above to
# boundaryConditions = {'water_height': lambda x, flag: None,
#                       'x_mom': lambda x, flag: None,
Example #5
0
    x = X[0]
    if (x == X_BC_coords[0] or x == X_BC_coords[1]):
        return lambda X, t: 0.0


# ----- WAVE GAUGES  ----- #
HeightPointGauges = PointGauges(
    gauges=((('h', ), ((5.7, 0, 0), (10.5, 0, 0), (12.5, 0, 0), (13.5, 0, 0),
                       (14.5, 0, 0), (15.7, 0, 0), (17.3, 0, 0))), ),
    activeTime=(0.01, opts.final_time),
    fileName='island_wave_gauges.csv')

# ********************************** #
# ***** Create mySWFlowProblem ***** #
# ********************************** #
outputStepping = SWFlowProblem.OutputStepping(opts.final_time,
                                              dt_output=opts.dt_output)
initialConditions = {
    'water_height': h_at_t0(),
    'x_mom': hu_at_t0(),
    'y_mom': hv_at_t0(),
    'h_times_eta': heta_at_t0(),
    'h_times_w': hw_at_t0(),
    'h_times_beta': hbeta_at_t0()
}
boundaryConditions = {
    'water_height': lambda x, flag: None,
    'x_mom': lambda x, flag: None,
    'y_mom': h_v_DBC,
    'h_times_eta': lambda x, flag: None,
    'h_times_w': lambda x, flag: None,
    'h_times_beta': lambda x, flag: None
Example #6
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,