Пример #1
0
    1,
    1,
    2,
    3,
    4,
])

regions = [[0.1, 0.1]]

regionFlags = np.array([1])

tank = st.CustomShape(domain,
                      vertices=vertices,
                      vertexFlags=vertexFlags,
                      segments=segments,
                      segmentFlags=segmentFlags,
                      regions=regions,
                      regionFlags=regionFlags,
                      boundaryTags=boundaryTags,
                      boundaryOrientations=boundaryOrientations)

# ----- EXTRA BOUNDARY CONDITIONS ----- #
tank.BC['y+'].setAtmosphere()
tank.BC['y-'].setFreeSlip()
tank.BC['x-'].setTwoPhaseVelocityInlet(
    U=[opts.inflow_vel, 0., 0.],
    waterLevel=waterLine_y,
    smoothing=1.5 * opts.he,
)
tank.BC['x+'].setHydrostaticPressureOutletWithDepth(
    seaLevel=outflow_level,
Пример #2
0
        facetFlags[i] = 4
    elif (vertices[facets[i][0][0]][2] == max(SG.vertices[:, 2])
          and vertices[facets[i][0][1]][2] == max(SG.vertices[:, 2])
          and vertices[facets[i][0][2]][2] == max(SG.vertices[:, 2])):
        facetFlags[i] = 5
    else:
        facetFlags[i] = 1
regions = [[0.5, 0.5, 0.5]]
regionFlags = [1]
holes = [[18.0, 0.0, 1.5]]
L = [max(SG.vertices[:, 0]), max(SG.vertices[:, 1]), max(SG.vertices[:, 2])]
tank = st.CustomShape(domain,
                      vertices=vertices,
                      vertexFlags=vertexFlags,
                      facets=facets,
                      facetFlags=facetFlags,
                      regions=regions,
                      regionFlags=regionFlags,
                      holes=holes,
                      boundaryTags=boundaryTags,
                      boundaryOrientations=boundaryOrientations)

tank.BC['top'].setAtmosphere()
tank.BC['bottom'].setFreeSlip()
tank.BC['gate'].setFreeSlip()
tank.BC['front'].setFreeSlip()
tank.BC['back'].setFreeSlip()
tank.BC['right'].setFreeSlip()

wave = wt.MonochromaticWaves(period=2.0,
                             waveHeight=1.0,
                             mwl=waterLevel,
Пример #3
0
segmentFlags = np.array([1 for ii in range(len(segments))])
# define regions inside the body
regions = np.array([[0.001, 0.001]])
regionFlags = np.array([1])
# define holes inside the body
holes = np.array([[0.001, 0.001]])
regionFlags = np.array([1])
boundaryTags = {'wall': 1}
# barycenter
barycenter = np.array([dims[0]/2., bottom_height/2., 0.])
caisson = st.CustomShape(
    domain=domain,
    vertices=vertices,
    vertexFlags=vertexFlags,
    segments=segments,
    segmentFlags=segmentFlags,
    regions=regions,
    regionFlags=regionFlags,
    holes=holes,
    boundaryTags=boundaryTags,
    barycenter=barycenter,
)
# translate caisson to middle of the tank
caisson.translate(np.array([1*wavelength-dims[0]/2., water_level-bottom_height-0.1]))

#   ____ _
#  / ___| |__  _ __ ___  _ __   ___
# | |   | '_ \| '__/ _ \| '_ \ / _ \
# | |___| | | | | | (_) | | | | (_) |
#  \____|_| |_|_|  \___/|_| |_|\___/
# Chrono
Пример #4
0
# define length and width of rectangle
length = 40.0
width = 10.0

# define vertices and segments
my_vertices = [[0.0, 0.0], [length, 0.0], [length, width], [0.0, width]]
my_segments = [[0, 1], [1, 2], [2, 3], [3, 0]]

# boundary tags dictionary
bt = {'inflow': 1, 'reflecting': 99}
my_vertexFlags = [bt['inflow'], bt['reflecting'], bt['reflecting'], bt['inflow']]
my_segmentFlags = [bt['reflecting'], bt['reflecting'], bt['reflecting'], bt['inflow']]

my_customShape = st.CustomShape(domain, boundaryTags=bt,
                           vertices=my_vertices, vertexFlags=my_vertexFlags,
                           segments=my_segments, segmentFlags=my_segmentFlags)

# define cylindrical obstacle. boundaryTag value is set to 99-2 here because of
# weird 'start_flag' issue in `_assembleGeometry` in SpatialTools.py
center_x = 10.0
center_y = 5.0
my_circle = st.Circle(domain=domain,
                      radius=1.,
                      barycenter=[center_x, center_y],
                      coords=[center_x, center_y],
                      nPoints=20,
                      boundaryTag={'reflecting': 99-2})

# set obstacle to be hole and set boundary tag to reflecting
my_circle.setHoles([[center_x, center_y]])
Пример #5
0
                                      angle=angle1[i], angle0=angle0[i],
                                      v_start=v_start)
            else:
                v = [centers[i]]
                if v_start > 1:
                    s = [[v_start-1, v_start]]
                else:
                    s = []
            vertices += v
            vertexFlags += [1]*len(v)
            segments += s+[[len(vertices)-1, len(vertices)]]
            segmentFlags += [1]*len(s)+[1]
        segments[-1][1] = 0  # last segment links to vertex 0
        boundaryTags = {'caisson': 1}
        caisson = st.CustomShape(domain, barycenter=barycenter,
                                 vertices=vertices, vertexFlags=vertexFlags,
                                 segments=segments, segmentFlags=segmentFlags,
                                 boundaryTags=boundaryTags)
        facet = []
        for i, vert in enumerate(caisson.vertices):
            facet += [i]
        caisson.facets = np.array([[facet]])
        caisson.facetFlags = np.array([1])
        caisson.regionFlags = np.array([1])
    else:
        caisson = st.Rectangle(domain, dim=opts.caisson_dim)
    caisson.translate([caisson_coords[0], caisson_coords[1]])

    ang = rotation_angle
    caisson.setHoles([[0., 0.]])
    caisson.holes_ind = np.array([0])
    # system = crb.System(np.array([0., -9.81, 0.]))