# *************************** # # ***** GENERAL OPTIONS ***** # # *************************** # opts = Context.Options([('sw_model', 0, "sw_model = {0,1} for {SWEs,DSWEs}"), ("final_time", 12.0, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.40, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("reflecting_BCs", False, "Use reflecting BCs")]) ################### # DOMAIN AND MESH # ################### L = (15.0, 1.0) # this is length in x direction and y direction refinement = opts.refinement domain = RectangularDomain(L=L, x=[0, 0, 0]) # x is bottom left corner X_coords = (0.0, 15.0) # this is domain in x direction, used for BCs # 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, ) ############################### # CONSTANTS NEEDED FOR SETUP # ############################### g = 9.81 h0 = 0.2 # amplitude
if pseudo2D: nny=2 L=(L[0],he,L[2]) shock_x = 0.5*L[0] shock_y = -L[0]#hack to get signed distance right in 2D shock_z = 0.5*L[2] else: nny=nnx shock_x = 0.5*L[0] shock_y = 0.5*L[1] shock_z = 0.9*L[2] regularGrid=True if regularGrid: from proteus.Domain import RectangularDomain domain = RectangularDomain(L) else: from tank3dDomain import * domain = tank3d(L=L) domain.writePoly("tank3d") domain.writePLY("tank3d") domain.writeAsymptote("tank3d") triangleOptions="VApq1.25q12ena%21.16e" % ((he**3)/6.0,) bt = domain.boundaryTags waterLevel = 0.5*L[2] slopeAngle = 0.5*(pi/2.0) #water rho_0=998.2 nu_0=1.004e-6
else: nn = nnx = nny = nnz = (2**lRefinement) * 10 + 1 he = 1.0 / (nnx - 1.0) L = [1.0, 1.0, 1.0] unstructured = True #True for tetgen, false for tet or hex from rectangular grid if unstructured: from tank3dDomain import * domain = tank3d(L=L) bt = domain.boundaryTags domain.writePoly("tank3d") domain.writePLY("tank3d") domain.writeAsymptote("tank3d") triangleOptions = "VApq1.3q18ena%21.16e" % ((he**3) / 6.0, ) else: from proteus.Domain import RectangularDomain domain = RectangularDomain(L) #end time of simulation, full problem is T=8.0 T = 8.0 #8.0# #number of output time steps nDTout = 80 #mass correction applyCorrection = True applyRedistancing = True #smoothing factors #eps epsFactHeaviside = 1.5 epsFactDirac = 1.5 epsFactDiffusion = 10.0 epsFactRedistance = 0.33 epsFact_vof = 1.5 #
# *************************** # # ***** GENERAL OPTIONS ***** # # *************************** # opts = Context.Options([('sw_model', 0, "sw_model = {0,1} for {SWEs,DSWEs}"), ("final_time", 100.0, "Final time for simulation"), ("dt_output", 10.0, "Time interval to output solution"), ("cfl", 0.33, "Desired CFL restriction")]) ################### # DOMAIN AND MESH # ################### L = (8000.0, 800.0) refinement = 2 domain = 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, ) ###################### ##### BATHYMETRY ##### ###################### h0 = 10 a = 3000 B = 2
Tstar = T * np.sqrt(h0 / g) opts = Context.Options([ ('sw_model', 0, "sw_model = {0,1} for {SWEs,DSWEs}"), ("final_time", Tstar, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.33, "Desired CFL restriction"), ("refinement", 4, "Refinement level") ]) ################### # DOMAIN AND MESH # ################### L = (45.0, 1.0) refinement = opts.refinement domain = RectangularDomain(L=L, x=[-35.0, 0, 0]) X_coords = (-35.0, 10.0) # this is domain in x direction, used in BCs # 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,) ############################### # CONSTANTS NEEDED FOR SETUP # ############################### a = 0.28 # amplitude
('sw_model', 0, "sw_model = {0,1} for {SWEs, Disperisve SWEs}}"), ("final_time", 40.0, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.25, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("reflecting_BCs", False, "Use reflecting BCs for all boundaries"), ("structured", True, "Structured or unstructured mesh"), ("he", 0.1, "Mesh size for unstructured mesh") ]) ################### # DOMAIN AND MESH # ################### 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
('sw_model', 1, "sw_model = {0,1} for {SWEs, Disperisve SWEs}}"), ("final_time", 10.0, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.25, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("reflecting_BCs", False, "Use reflecting BCs for all boundaries"), ("structured", True, "Structured or unstructured mesh"), ("he", 0.1, "Mesh size for unstructured mesh") ]) ################### # DOMAIN AND MESH # ################### L = (30.0, 2.0) refinement = opts.refinement rectangle = RectangularDomain(L=L, x=[-15, 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("step") domain = PlanarStraightLineGraphDomain(fileprefix="step") domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2, ) nnx = None nny = None
('sw_model', 1, "sw_model = {0,1} for {SWEs,DSWEs}"), ("final_time", 10.0, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.33, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("reflecting_BCs", False, "Use reflecting BCs for all boundaries"), ("structured", True, "Structured or unstructured mesh"), ("he", 0.1, "Mesh size for unstructured mesh") ]) ################### # DOMAIN AND MESH # ################### 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
mannings = 0.02 # NUMERICAL PARAMETERS # cE = 1.0 LUMPED_MASS_MATRIX = 0 SSPOrder = 3 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: domainRect.writePoly("hump") domain = PlanarStraightLineGraphDomain("hump") domain.boundaryTags = domainRect.boundaryTags # bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] domain.writePoly("tank2d") ################ ##### MESH ##### ################
("final_time", 20.0, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("refinement", 4, "Level of refinement"), ("structured", True, "Structured or unstructured mesh"), ("he", 0.5, "Mesh size for unstructured mesh"), ("cfl", 0.33, "Desired CFL restriction"), ("reflecting_BCs", True, "Use reflecting BCs"), ("mannings", 0.02, "Mannings roughness coefficient")]) ################### # 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
T = 1000. #2*math.pi/omega nDTout = 10 L = (10000.0, 10000.0) g = 9.81 # PARAMETERS # h0 = 10.0 a = 3000. B = 5. k = 0.002 p = np.sqrt(8 * g * h0) / a s = np.sqrt(p**2 - k**2) / 2. mannings = k domain = RectangularDomain(L=L) #This is relevant just when use_second_order_NonFlatB_with_EV_stabilization=True cE = 1 LUMPED_MASS_MATRIX = 0 LINEAR_FRICTION = 1 bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] domain.writePoly("tank2d") ###################### ##### BATHYMETRY ##### ######################
mannings = k # NUMERICAL PARAMETERS # cE = 1 LUMPED_MASS_MATRIX = 0 SSPOrder = 3 runCFL = 0.25 useSuperlu = True triangleFlag = 1 reflecting_BCs = False ################## ##### DOMAIN ##### ################## nd = 2 domain = RectangularDomain(L=L, x=[0, 0, 0]) bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] domain.writePoly("tank2d") ################ ##### MESH ##### ################ nnx0 = 6 nnx = (nnx0 - 1) * (2**refinement) + 1 nny = old_div((nnx - 1), 10) + 1 nnz = 1 he = old_div(L[0], float(nnx - 1)) triangleOptions = "pAq30Dena%f" % (0.5 * he**2, ) domain.MeshOptions.triangleOptions = triangleOptions
h0 = 1.0 # water depth Tstar = T * np.sqrt(h0 / g) opts = Context.Options([('sw_model', 1, "sw_model = {0,1} for {SWEs,DSWEs}"), ("final_time", Tstar, "Final time for simulation"), ("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.2, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("reflecting_BCs", False, "Use reflecting BCs")]) ################### # DOMAIN AND MESH # ################### L = (50.0, 1.0) refinement = opts.refinement domain = RectangularDomain(L=L, x=[-35.0, 0, 0]) # x is origin # 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, ) ############################### # CONSTANTS NEEDED FOR SETUP # ############################### a = 0.28 # relative amplitude slope = 1.0 / 19.85 # beach slope k_wavenumber = np.sqrt(3.0 * a / (4.0 * h0**3)) # wavenumber
T=1000. #2*math.pi/omega nDTout=10 L=(10000.0,10000.0) g = 9.81 # PARAMETERS # h0=10.0 a=3000. B=5. k=0.002 p = np.sqrt(8*g*h0)/a s = np.sqrt(p**2 - k**2)/2. mannings=k domain = RectangularDomain(L=L) #This is relevant just when use_second_order_NonFlatB_with_EV_stabilization=True cE=1 LUMPED_MASS_MATRIX=0 LINEAR_FRICTION=1 bt = domain.boundaryTags bt['front'] = bt['bottom'] bt['back'] = bt['top'] domain.writePoly("tank2d") ###################### ##### BATHYMETRY ##### ###################### def bathymetry_function(X):
shock_z = 0.5 * L[2] else: #nny = int((L[1]/he)+0.5) + 1 #nnz = int((L[2]/he)+0.5) + 1 shock_x = L[0] - 0.146 shock_y = -20.0 #L[1] shock_z = 0.292 print he print nnx, nny, nnz print L[0] / float(nnx - 1), L[1] / float(nny - 1), L[2] / float(nnz - 1) regularGrid = True if regularGrid: from proteus.Domain import RectangularDomain domain = RectangularDomain(L) else: from tank3dDomain import * domain = tank3d(L=L) domain.writePoly("tank3d") domain.writePLY("tank3d") domain.writeAsymptote("tank3d") triangleOptions = "VApq2q10ena%21.16e" % ((he**3) / 6.0, ) bt = domain.boundaryTags waterLevel = 0.292 slopeAngle = 0.5 * (pi / 2.0) #water rho_0 = 998.2 nu_0 = 1.004e-6
("refinement",4,"Level of refinement"), ("structured",False,"Use structured mesh"), ("reflecting_BCs",1,"Use reflecting BCs") ]) 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")
("dt_output", 0.1, "Time interval to output solution"), ("cfl", 0.25, "Desired CFL restriction"), ("refinement", 4, "Refinement level"), ("structured", True, "Structured or unstructured mesh"), ("he", 0.5, "Mesh size for unstructured mesh"), ("reflecting_BCs", False, "Use reflecting BCs"), ("want_gauges", False, "Output for water height point gauge"), ("which_case", 0, "which_case = {0,1} for {case_C, case_B}") ]) ################### # 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