示例#1
0
##########################################
#              Mesh & Domain             #
##########################################

# ----- DOMAIN ----- #

domain = Domain.PlanarStraightLineGraphDomain()
he = tank_dim[0] / float(4 * refinement - 1)

# ----- TANK ----- #

weir = [[[obstacle_x_start, 0], [obstacle_x_highest, obstacle_height],
         [obstacle_x_end, 0]]]

tank = st.TankWithObstacles2D(domain=domain, dim=tank_dim, obstacles=weir)

# ----- SPONGE & WAVES ----- #
if opts.sponge_layers:
    omega = 1.
    dragAlpha = 5. * omega / nu_0
    tank.setSponge(x_n=opts.tank_sponge[0], x_p=opts.tank_sponge[1])
    tank.setAbsorptionZones(x_n=True, dragAlpha=dragAlpha)
    tank.setAbsorptionZones(x_p=True, dragAlpha=dragAlpha)

if opts.waves:
    # TODO: for now this is an actual wave, which we don't want.  We want a placid
    # wave such that our generation and absorption zones enforce a steady flow.
    omega = 2 * np.pi / 2.
    dragAlpha = 5. * omega / nu_0
    wave = wt.MonochromaticWaves(period=2,
he = opts.he
smoothing = he*3.

# ----- TANK ------ #

sloped_shore = [[[9.22, 0.],
                 [9.64, 0.06],
                 [15.01, 0.06],
                 [27.04, 0.66],
                 [31.04, 0.66],
                 [37.07, 0.06],
                 [45.39, 0.06],
                 [45.81, 0.]],]

tank = st.TankWithObstacles2D(domain=domain,
                              dim=tank_dim,
                              obstacles=sloped_shore)

# ----- GENERATION / ABSORPTION LAYERS ----- #

tank.setSponge(x_n=tank_sponge[0], x_p=tank_sponge[1])
dragAlpha = 10.*omega/1e-6

if opts.generation:
    tank.setGenerationZones(x_n=True, waves=waves, dragAlpha=dragAlpha, smoothing = smoothing)
if opts.absorption:
    tank.setAbsorptionZones(x_p=True, dragAlpha = dragAlpha)

# ----- BOUNDARY CONDITIONS ----- #

# Waves
T = opts.T
dt_fixed = opts.dt_fixed
dt_init = min(0.1 * dt_fixed, opts.dt_init)
runCFL = opts.cfl
nDTout = int(round(T / dt_fixed))

# ----- DOMAIN ----- #

domain = Domain.PlanarStraightLineGraphDomain()

# ----- TANK ----- #

tank = st.TankWithObstacles2D(domain=domain,
                              dim=tank_dim,
                              obstacles=[[[obstacle_x_start, 0],
                                          [obstacle_x_start, obstacle_height],
                                          [obstacle_x_end, obstacle_height],
                                          [obstacle_x_end, 0]]])

# ----- GAUGES ----- #

if opts.gauge_output:

    tank.attachPointGauges('twp',
                           gauges=((('p', ), (opts.gauge_location_p, )), ),
                           activeTime=(0, opts.T),
                           sampleRate=0,
                           fileName='pressureGauge.csv')

# ----- EXTRA BOUNDARY CONDITIONS ----- #
示例#4
0
x0 = opts.Ls * wavelength
x1 = x0 + hs / slope1
x2 = x1 + b
x3 = x2 + hs / slope2

obs = [
    [[x0, 0.], [x1, hs], [x2, hs], [x3, 0.]],
]

obstacle_regions = [[x1 + (x2 - x1) / 2., hs / 2.]]

tank_dim = [x3 + opts.Lend * wavelength, opts.h]

tank = st.TankWithObstacles2D(domain=domain,
                              dim=tank_dim,
                              obstacles=obs,
                              hole=False,
                              obstacle_regions=obstacle_regions)

# ---- POROUS MEDIA ---- #

porosity = opts.porosity
voidFrac = 1.0 - porosity
d50 = opts.d50
d15 = d50 / 1.2

term1 = 3.12 * (10**-3.)
term2 = (gAbs / (nu_0**2.))**(2. / 3.)
term3 = (d15**2.)
Alpha1 = 1684 + term1 * term2 * term3
示例#5
0
           

# --- Tank Set up

if air_vent:
    weir = [[[opts.obstacle_x_start, 0], [opts.obstacle_x_start, obstacle_height],
             [obstacle_x_end, obstacle_height], [obstacle_x_end, airvent_y2],
             [obstacle_x_end, airvent_y1], [obstacle_x_end, 0]]]
    vent = {'airvent': [[obstacle_x_end, airvent_y2]]}
else:
    weir = [[[opts.obstacle_x_start, 0], [opts.obstacle_x_start, obstacle_height],
             [obstacle_x_end, obstacle_height], [obstacle_x_end, 0]]]
    vent = None

tank = st.TankWithObstacles2D(domain=domain,
                              dim=opts.tank_dim,
                              obstacles=weir,
                              special_boundaries=vent)
 
# --- Genetation & Absorption Zones
he=opts.tank_dim[0]/opts.refinement
smoothing=opts.ecH*he
dragAlpha = 5.*opts.omega/opts.nu_0

tank.setSponge(x_n = opts.tank_sponge[0], x_p = opts.tank_sponge[1])


tank.setGenerationZones(x_n=True, 
 			waves=current,
 			dragAlpha=dragAlpha,
			smoothing = smoothing)
			 Tt=opts.period*np.array(opts.free_x), 
			 rampStart=rampS, 
			 rampEnd=rampE,
			 Tend=Tpaddle)
##############################################################################################################################################################################################################
# Tank
#########################################################################################################################################################################################################
obstacle = [
           [ [9.21,0.],
            [9.64,0.216],
            [9.84,0.216],
            [9.84,0.]]
            ]
                     

tank = st.TankWithObstacles2D(domain = domain, dim = tank_dim, obstacles = obstacle, hole = True)
#############################################################################################################################################################################################################################################################################################################################################################################################
# ----- BOUNDARY CONDITIONS ----- #
#############################################################################################################################################################################################################################################################################################################################################################################################

# --- Paddle2D
for bc in paddle.BC_list:
    bc.setFreeSlip()
# --- Tank
tank.BC['y+'].setAtmosphere()
tank.BC['y-'].setFreeSlip()
tank.BC['x+'].setFreeSlip()
tank.BC['x-'].setFreeSlip()

tank.BC['x-'].setFixedNodes()
tank.BC['x+'].setFixedNodes()
示例#7
0
# ----- DOMAIN ----- #

domain = Domain.PlanarStraightLineGraphDomain()
he = tank_dim[0] / float(4 * refinement - 1)

# ----- TANK ----- #

weir = [[[obstacle_x_end, tank_dim[1]], [obstacle_x_end, obstacle_height],
         [obstacle_x_start, obstacle_height], [obstacle_x_start, tank_dim[1]]]]
gate = {
    'gate': [[obstacle_x_end, tank_dim[1]], [obstacle_x_end, obstacle_height],
             [obstacle_x_start, obstacle_height]]
}

tank = st.TankWithObstacles2D(domain=domain,
                              dim=tank_dim,
                              obstacles=weir,
                              special_boundaries=gate)

# ----- Sponge Layers ----- #
if opts.sponge_layers:

    # TODO: for now this is an actual wave, which we don't want.  We want a placid
    # wave such that our generation and absorption zones enforce a steady flow.
    wave = wt.MonochromaticWaves(period=2,
                                 waveHeight=0.0,
                                 mwl=inflow_level,
                                 depth=inflow_level,
                                 g=np.array(g),
                                 waveDir=(1., 0., 0.),
                                 wavelength=0.5,
                                 meanVelocity=np.array(