nd = 2 T = opts.T nDTout = opts.nDTout L = (75.0, 30.0) g = 9.81 # PARAMETERS # mannings = 0.02 domainRect = RectangularDomain(L=L) if opts.structured: domain = domainRect else: domainRect.writePoly("hump") domain = PlanarStraightLineGraphDomain("hump") domain.boundaryTags = domainRect.boundaryTags #This is relevant just when use_second_order_NonFlatB_with_EV_stabilization=True cE = 1 LUMPED_MASS_MATRIX = 0 bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] domain.writePoly("tank2d") ###################### ##### BATHYMETRY ##### ###################### def bathymetry_function(X):
# DOMAIN AND MESH # ################### L = (75.0, 30.0) refinement = opts.refinement rectangle = RectangularDomain(L=L) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 2) + 1 he = old_div(L[0], float(nnx - 1)) if opts.structured: domain = rectangle else: rectangle.writePoly("dam3bumps") domain = PlanarStraightLineGraphDomain(fileprefix="dam3bumps") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None domain.MeshOptions.nnx = nnx domain.MeshOptions.nny = nny ###################### ##### BATHYMETRY ##### ###################### def bathymetry_function(X): x = X[0] y = X[1]
def create_domain2D(): return PlanarStraightLineGraphDomain()
runCFL = 0.25 useSuperlu = True triangleFlag = 1 reflecting_BCs = opts.reflecting_BCs ################## ##### DOMAIN ##### ################## nd = 2 domainRect = RectangularDomain(L=L) if opts.structured: domain = domainRect else: pathfile = os.path.dirname(os.path.abspath(__file__)) + "/" + "hump" #domainRect.writePoly(pathfile) domain = PlanarStraightLineGraphDomain(pathfile) domain.boundaryTags = domainRect.boundaryTags domain.polyfile = pathfile genMesh = False bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] if opts.structured: domain.writePoly("tank2d") ################ ##### MESH ##### ################ nnx0 = 6
# DOMAIN AND MESH # ################### L = (48.8, 26.5) # this is length in x direction and y direction refinement = opts.refinement rectangle = RectangularDomain(L=L, x=[0, -13.25, 0]) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 2) + 1 he = old_div(L[0], float(nnx - 1)) if opts.structured: domain = rectangle else: rectangle.writePoly("reef") domain = PlanarStraightLineGraphDomain(fileprefix="reef") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None ############################### # CONSTANTS NEEDED FOR SETUP # ############################### g = 9.81 # stuff for solitary wave h0 = 0.78 alpha = 0.4 # 0.5 * h0 xs = 5.0 r = np.sqrt(old_div(3. * alpha, (4. * h0**2 * (h0 + alpha)))) c = np.sqrt(g * (h0 + alpha))
################### L = (25.0, 2.0) refinement = opts.refinement rectangle = RectangularDomain(L=L, x=[0, 0, 0]) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 10) + 1 he = old_div(L[0], float(nnx - 1)) triangleOptions = "pAq30Dena%f" % (0.5 * he**2, ) if opts.structured: domain = rectangle else: rectangle.writePoly("solitary") domain = PlanarStraightLineGraphDomain(fileprefix="solitary") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None domain.MeshOptions.nnx = nnx domain.MeshOptions.nny = nny ################################## # SOLITARY WAVE FUCTION AND BATH # ################################## g = 9.81 # constants for solitary wave h0 = 0.5 alpha = 0.2 * h0 xs = 5.0 r = np.sqrt(old_div(3. * alpha, (4. * h0**2 * (h0 + alpha))))
################### L = (25.0, 1.0) refinement = opts.refinement rectangle = RectangularDomain(L=L, x=[0, 0, 0]) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 10) + 1 he = old_div(L[0], float(nnx - 1)) triangleOptions = "pAq30Dena%f" % (0.5 * he**2, ) if opts.structured: domain = rectangle else: rectangle.writePoly("bump") domain = PlanarStraightLineGraphDomain(fileprefix="bump") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None ########################################## # DEFINE INITIAL CONSTANTS AND FUNCTIONS # ########################################## g = 9.81 # constants for transcritical bump hL = 0.28205279813802181 q_in = 0.18 def bathymetry_function(X):
# DOMAIN AND MESH # ################### L = (15.0, 2.0) # this is domain length in x direction and y direction refinement = opts.refinement rectangle = RectangularDomain(L=L) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 10) + 1 he = old_div(L[0], float(nnx - 1)) if opts.structured: domain = rectangle else: rectangle.writePoly("seawall") domain = PlanarStraightLineGraphDomain(fileprefix="seawall") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2,) nnx = None nny = None ############################### # CONSTANTS NEEDED FOR SETUP # ############################### g = 9.81 h0 = 0.2 # water depth a = 0.35 # relative amplitude k_wavenumber = np.sqrt(3.0 * a / (4.0 * h0**3)) # wavenumber z = np.sqrt(3.0 * a * h0) / (2.0 * h0 * np.sqrt(h0 * (1.0 + a))) # width c = np.sqrt(g * (1.0 + a) * h0) # wave celerity x0 = 5.9 # initial location of solitary wave
################### # DOMAIN AND MESH # ################### L = (20.0, 20.0) # this is length in x direction and y direction refinement = opts.refinement rectangle = RectangularDomain(L=L) # CREATE REFINEMENT # nnx = 50 nny = 50 he = old_div(L[0], float(nnx - 1)) if opts.structured: domain = rectangle else: rectangle.writePoly("circular_damBreak") domain = PlanarStraightLineGraphDomain(fileprefix="circular_damBreak") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None ###################### ##### BATHYMETRY ##### ###################### def bathymetry_function(X): x = X[0] return x * 0. ##############################
# DOMAIN AND MESH # ################### L = (25.0, 30.0) # this is length in x direction and y direction refinement = opts.refinement rectangle = RectangularDomain(L=L) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 2) + 1 he = old_div(L[0], float(nnx - 1)) if opts.structured: domain = rectangle else: rectangle.writePoly("island") domain = PlanarStraightLineGraphDomain(fileprefix="island") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None ############################### # CONSTANTS NEEDED FOR SETUP # ############################### g = 9.81 # stuff for solitary wave h0 = 0.32 alpha = 0.181 * h0 xs = 7.56023 if opts.which_case == 1: alpha = 0.091
g = 9.81 # PARAMETERS # mannings = 0.02 # DOMAIN # vertices = [ [0.0, 0.0], #0 [75.0, 0.0], #1 [90.0, 15.0], #2 [75.0, 30.0], #3 [0.0, 30.0] ] #4 segments = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]] domain = PlanarStraightLineGraphDomain(vertices=vertices, segments=segments) domain.writePoly("tank2d") #This is relevant just when use_second_order_NonFlatB_with_EV_stabilization=True cE = 1 LUMPED_MASS_MATRIX = 0 ###################### ##### BATHYMETRY ##### ###################### def bathymetry_function(X): import numpy as np x = X[0] y = X[1] bump1 = 1 - 1. / 8 * np.sqrt((x - 30)**2 + (y - 6)**2)
################### L = (30.0, 25.0) # this is length in x direction and y direction refinement = opts.refinement rectangle = RectangularDomain(L=L) # CREATE REFINEMENT # nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 2) + 1 he = old_div(L[0], float(nnx - 1)) triangleOptions = "pAq30Dena%f" % (0.5 * he**2, ) if opts.structured: domain = rectangle else: rectangle.writePoly("well_balancing") domain = PlanarStraightLineGraphDomain(fileprefix="well_balancing") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None ############################### # CONSTANTS NEEDED FOR SETUP # ############################### g = 9.81 h0 = 1.0 # stuff for cone bathymetry htop = 0.625 rcone = 3.6 scone = 4.0 hcone = 0.9