wavelength = wave.wavelength # ____ _ # | _ \ ___ _ __ ___ __ _(_)_ __ # | | | |/ _ \| '_ ` _ \ / _` | | '_ \ # | |_| | (_) | | | | | | (_| | | | | | # |____/ \___/|_| |_| |_|\__,_|_|_| |_| # Domain # All geometrical options go here (but not mesh options) domain = Domain.PlanarStraightLineGraphDomain() # ----- SHAPES ----- # # TANK tank = st.Tank2D(domain, dim=(2 * wavelength, 2 * water_level)) # SPONGE LAYERS # generation zone: 1 wavelength # absorption zone: 2 wavelengths tank.setSponge(x_n=wavelength, x_p=2 * wavelength) caisson = st.Rectangle(domain, dim=(0.5, 0.2), coords=(0., 0.)) # set barycenter in middle of caisson caisson.setBarycenter([0., 0.]) # caisson is considered a hole in the mesh caisson.setHoles([[0., 0.]]) # 2 following lines only for py2gmsh caisson.holes_ind = np.array([0]) tank.setChildShape(caisson, 0) # translate caisson to middle of the tank
rho_0 = 1000. nu_0 = 1.004e-6 rho_1 = 1.205 nu_1 = 1.500e-5 sigma_01 = 0.0 g = [0., -9.81] he = 0.2 water_level = 2.5 # GEOMETRY domain = Domain.PlanarStraightLineGraphDomain() tank_dim = [5., 5.] tank = st.Tank2D(domain, dim=tank_dim) rect = st.Rectangle( domain, dim=[1., 1.], coords=[old_div(tank_dim[0], 2.), old_div(tank_dim[1], 2.)]) rect.setHoles(holes=np.array([rect.coords])) domain.MeshOptions.he = he # BOUNDARY CONDITIONS tank.BC['x+'].setNoSlip() tank.BC['x-'].setNoSlip() tank.BC['y-'].setNoSlip() tank.BC['y+'].setAtmosphere()
# tank options waterLevel = opts.water_level tank_dim = opts.tank_dim tank_sponge = opts.tank_sponge # ----- DOMAIN ----- # domain = Domain.PlanarStraightLineGraphDomain() # refinement smoothing = opts.he * 3. # ----- TANK ------ # tank = st.Tank2D(domain, tank_dim) # ----- GENERATION / ABSORPTION LAYERS ----- # tank.setSponge(x_n=tank_sponge[0], x_p=tank_sponge[1]) dragAlpha = 5. * omega / 1e-6 if opts.generation: tank.setGenerationZones(x_n=True, waves=wave, dragAlpha=dragAlpha, smoothing=smoothing) if opts.absorption: tank.setAbsorptionZones(x_p=True, dragAlpha=dragAlpha) # ----- BOUNDARY CONDITIONS ----- #
# | | | |/ _ \| '_ ` _ \ / _` | | '_ \ # | |_| | (_) | | | | | | (_| | | | | | # |____/ \___/|_| |_| |_|\__,_|_|_| |_| # Domain # All geometrical options go here (but not mesh options) domain = Domain.PlanarStraightLineGraphDomain() # ----- SHAPES ----- # # TANK tank_dim = np.array([3., 10.]) tank_x = tank_dim[0] tank_y = tank_dim[1] water_level=tank_y*2 tank = st.Tank2D(domain, [tank_x, tank_y]) # ____ _ ____ _ _ _ _ # | __ ) ___ _ _ _ __ __| | __ _ _ __ _ _ / ___|___ _ __ __| (_) |_(_) ___ _ __ ___ # | _ \ / _ \| | | | '_ \ / _` |/ _` | '__| | | | | / _ \| '_ \ / _` | | __| |/ _ \| '_ \/ __| # | |_) | (_) | |_| | | | | (_| | (_| | | | |_| | |__| (_) | | | | (_| | | |_| | (_) | | | \__ \ # |____/ \___/ \__,_|_| |_|\__,_|\__,_|_| \__, |\____\___/|_| |_|\__,_|_|\__|_|\___/|_| |_|___/ # |___/ # Boundary Conditions #tank.BC['y+'].setFreeSlip() tank.BC['y+'].setAtmosphere() #tank.BC['y-'].setFreeSlip() #tank.BC['x+'].setFreeSlip() #tank.BC['x-'].setFreeSlip()
("K", 0.41, "von Karman coefficient for the turbulence model"), ("B", 5.57, "Wall coefficient for the turbulence model"), ("Cmu", 0.09, "Cmu coefficient for the turbulence model"), # simulation options ('duration', 10., 'Simulation duration'), ('dt_init', 0.001, 'Initial timestep'), ('dt_output', 0.1, 'time output interval'), ("he", 0.03, "Mesh size"), ("cfl", 0.5, "Target cfl") ]) ######################################### #domain ######################################### domain = Domain.PlanarStraightLineGraphDomain() tank = st.Tank2D(domain, dim=[opts.Lx, opts.Ly]) ################################## #turbulence calculations ################################## # Reynodls Re0 = opts.U[0] * opts.Ly / opts.nu # Skin friction and friction velocity for defining initial shear stress at the wall cf = 0.045 * (Re0**(-1. / 4.)) Ut = opts.U[0] * np.sqrt(cf / 2.) kappaP = (Ut**2) / np.sqrt(opts.Cmu) Y_ = opts.he Yplus = Y_ * Ut / opts.nu dissipationP = (Ut**3) / (0.41 * Y_) # ke or kw useRANS = opts.useRANS # 0 -- None
# --- Wave input wave = wt.MonochromaticWaves(period=opts.T, waveHeight=opts.wave_height, mwl=opts.water_level, depth=opts.depth, g=opts.g, waveDir=opts.waveDir, waveType=opts.waveType, autoFenton=True, Nf=opts.Nf) wave_length = wave.wavelength # --- Tank Setup tank = st.Tank2D(domain, opts.tank_dim) ################### Caisson ################### # --- Caisson2D Geometry / Shapes xc1 = opts.center[0] - 0.5 * opts.dim[0] yc1 = opts.center[1] - 0.5 * opts.dim[1] xc2 = xc1 + opts.dim[0] yc2 = yc1 xc3 = xc2 yc3 = yc2 + opts.dim[1] xc4 = xc1 yc4 = yc3 # --- Caisson2D Properties if opts.caisson2D:
("wave_height", 0.02, "Height of the waves"), # Gauges ("want_gauges", False, "Output for water height point gauge") ]) # ----- TANK / DOMAIN ----- # domain = Domain.PlanarStraightLineGraphDomain() waterLevel = opts.still_water_depth tank_dim = opts.tank_dim tank_sponge = opts.tank_sponge he = opts.he domain.he = he tank = st.Tank2D(domain=domain, dim=tank_dim, coords=opts.tank_centroid) # ----- GENERATION / ABSORPTION LAYERS ----- # tank.setSponge(x_n=tank_sponge[0], x_p=tank_sponge[1]) if opts.generation: gen_start = tank.x0 gen_length = tank_sponge[0] if opts.absorption: abs_start = tank.x1 abs_length = tank_sponge[1] # ----- ASSEMBLE DOMAIN ----- # domain.MeshOptions.he = he st.assembleDomain(domain)