Exemplo n.º 1
0
# Set out:
# Source -> start point
# Sink -> end point
# doublet -> island (none - traversable area)

# Set up grid
nx, ny = 30, 30
x = np.linspace(minlon, maxlon, nx)
y = np.linspace(minlat, maxlat, ny)
X, Y = np.meshgrid(x, y)

# Create flow types
source_str = 200
x_source = 9.31318
y_source = 63.604
flow0 = Flow.Velocity(source_str, x_source, y_source)
u_source, v_source = flow0.source(X, Y)

sink_str = 1e3
x_sink = 9.48137
y_sink = 63.7375
flow1 = Flow.Velocity(sink_str, x_sink, y_sink)
u_sink, v_sink = flow1.sink(X, Y)

# Trying to represent source and doublets as islands. Use correct strengths in for loop
source_strs = [100, 200, 300, 400, 500, 750]
doublet_strs = [0.01, 0.1, 0.2, 0.3, 0.5, 1]

gs = gridspec.GridSpec(nrows=3, ncols=2)
fig, ax = plt.subplots(3, 2, figsize=(10, 10), sharex=True, sharey=True)
Exemplo n.º 2
0
I = sourcepanel.solveGeometricIntegrals(XC, YC, panels, phi, beta, XB, YB)
np.fill_diagonal(I, np.pi)
b = -2 * np.pi * Vinf * np.cos(beta)
lamda = linalg.solve(I, b)

# grid for flow computations
nxx, nyy = 100, 100

# lon and lat rep
x_flow = np.linspace(minlon, maxlon, nxx)
y_flow = np.linspace(minlat, maxlat, nyy)
X, Y = np.meshgrid(x_flow, y_flow)

# sink located at Trondheim
lamda_trond = 0.1  # sink strength
trond_flow = Flow.Velocity(lamda_trond, trond_lon, trond_lat)
vx_sink, vy_sink = trond_flow.sink(X, Y)

vx = np.zeros((nxx, nyy))
vy = np.zeros((nxx, nyy))

# compute velocites at every grid cell (XP, YP)
for i in range(nxx):
    for j in range(nyy):
        XGeom, YGeom = sourcepoint.solvePointGeometry(X[i, j], Y[i, j], panels,
                                                      phi, XB, YB)
        if m.is_land(X[i, j], Y[i, j]) == True:
            vx[i, j] = 0
            vy[i, j] = 0
        else:
            vx[i, j] = Vinf * np.cos(AoA) + np.dot(