Exemple #1
0
def plot_surface(x , y, t):
    fig,ax = plt.subplots(nrows = 1, ncols = 1)
    surface = water.Surface(N=N,M=M,U10=5,wind= np.pi/6)
    x, y = np.meshgrid(x, y)
    z = surface.model([x,y],t)
    print(z.shape)
    from matplotlib.cm import winter
    plt.contourf(z,100,cmap=winter)
    plt.colorbar()
    plt.ylabel('Y, м',fontsize=16)
    plt.xlabel('X, м',fontsize=16)
    plt.savefig('/home/kannab/documents/water/poster/fig/water5.png',  pdi=10**6,transparent=True)
Exemple #2
0
import water
from matplotlib import rc
plt.rcParams['axes.labelsize'] = 20
rc('text',usetex=False)
rc('text.latex',preamble=[r'\usepackage[russian]{babel}',r'\usepackage{amsmath}'])
rc('font',family = 'serif')

N = 128
M = 1

t = 0
x0 = np.linspace(0,400,400)
y0 = 0


surface = water.Surface(N=N, M=M, whitening=1,KT=[0.05,2000])
k = surface.k
k0 = surface.k0
S = surface.spectrum(k)


def angles(rho):
    k= np.logspace(np.log10(surface.KT[0]), np.log10(surface.KT[-1]), 5*10**4)
    integral=np.zeros(len(rho))
    y=lambda k: k**2*surface.spectrum(k)
    for i in range(len(rho)):
        integral[i]=np.trapz(y(k)*np.cos(k*rho[i]),x=k)
    return integral


def angles_sum(k,rho):
Exemple #3
0
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi
from scipy import interpolate, integrate
from tqdm import tqdm
import water
from matplotlib import rc
plt.rcParams['axes.labelsize'] = 20
rc('text', usetex=True)
rc('text.latex', preamble=[r'\usepackage[russian]{babel}'])
rc('font', family='serif')

N = 1000
M = 1
surface = water.Surface(N=N, M=M)
print(surface.k_m)
print(surface.sigma_sqr)
x0 = np.linspace(0, 50, 10**5)
y0 = 0
T = [0]

fig, ax = plt.subplots(nrows=1, ncols=1)
x, y = np.meshgrid(x0, y0)
for t in T:
    z_real = surface.model([x, y], t)[0]
    Dx, Dy = surface.D([x, y], t)
    ax.plot(x0 + Dx[0], z_real, label='CWM', color='darkblue')
    ax.plot(x0, z_real, '--r', label='Стандартный метод')
    ax.set_xlabel(r'X, м')
    ax.set_ylabel(r'Z, м')
# # ax.plot(ans)
Exemple #4
0
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi
from scipy import interpolate, integrate
from tqdm import tqdm
import water
from matplotlib import rc

surface = water.Surface(wind=np.pi / 2)

# rcParams['figure.figzise'] = [8,8]
plt.rcParams['axes.labelsize'] = 20
rc('text', usetex=False)
rc('text.latex', preamble=[r'\usepackage[russian]{babel}'])
rc('font', family='serif')

k_m = surface.k_m
x = np.linspace(-np.pi, np.pi, 1000)
temp = [k_m / 2, k_m, 2 * k_m]

plt.figure()
for i in temp:
    y = surface.Phi(i, x)
    plt.polar(x, y / k_m, label=r'$k/k_m$=' + str(round(i / k_m, 3)))
plt.legend()
temp = [10 * k_m, 50 * k_m, 100 * k_m]
plt.figure()
for i in temp:
    y = surface.Phi(i, x)
    plt.polar(x, y / k_m, label=r'$k/k_m$=' + str(round(i / k_m, 3)))
plt.legend()
Exemple #5
0
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi
from scipy import interpolate,integrate
from tqdm import tqdm
import water
from matplotlib import rc


plt.rcParams['axes.labelsize'] = 20
rc('text',usetex=True)
rc('text.latex',preamble=[r'\usepackage[russian]{babel}'])
rc('font',family = 'serif')

# for U in range(5,20,5):
    # surface = water.Surface(U10=U)
    # k = surface.k0
    # spectrum = surface.spectrum(k)
    # plt.loglog(k,spectrum,label=r'$U_{10}=$'+str(U)+r' м/с')
    # plt.xlim(0.007,50)
# plt.legend()
# plt.show()

for X in range(5000,25000,5000):
    surface = water.Surface(x=X)
    k = surface.k0
    spectrum = surface.spectrum(k)
    plt.loglog(k,spectrum,label=r'$\tilde x=$'+str(X) )
plt.legend()
plt.show()
Exemple #6
0
import water
from matplotlib import rc
plt.rcParams['axes.labelsize'] = 20
rc('text', usetex=True)
rc('text.latex',
   preamble=[r'\usepackage[russian]{babel}', r'\usepackage{amsmath}'])
rc('font', family='serif')
N = 50000

M = 1

t = 0
x0 = np.linspace(0, 400, 400)
y0 = 0

surface = water.Surface(N=N, M=M, whitening=1)
k = surface.k
k0 = surface.k0
S = surface.spectrum(k)
plt.figure(figsize=[8, 6])
plt.loglog(k0, surface.spectrum(k0), '-', color='black')
plt.stem(surface.k_heights,
         surface.spectrum(surface.k_heights),
         use_line_collection=True,
         markerfmt=' ',
         linefmt='darkblue',
         label='Высоты',
         bottom=0)

plt.stem(surface.k_slopes,
         surface.spectrum(surface.k_slopes),