コード例 #1
0
    cn      = out['eig_coeffs']
    M_c2th  = out['edge_lhs']['M_c2th']
    semiinf = True
    width   = None

    if 0:
        # test edge conditions
        Fbs.test_edge_cons(out,semiinf=semiinf,lhs=True)

    # # plot energy
    # out_plot = Fbs.plot_energy(out,width=None,n_test=0,Hs=Hs)
    if 1:
        L      = 200.e3
        xx     = np.linspace(0.,L,num=800)
        E_all  = Fbs.calc_expansion(out,xx)
        En_all = E_all.dot(out['M_E2En'].transpose())
        #
        fig    = plt.figure()
        Na     = 2
        ax1    = fig.add_subplot(1,Na,1)
        ax1.plot(xx/1.e3,4*np.sqrt(En_all[:,0]))
        ax1.set_xlabel('$x$, km',fontsize=16)
        ax1.set_ylabel('$H_s$, m',fontsize=16)
        #
        Lmat   = out['solution']['Lmat']
        Rmat   = out['solution']['Rmat']
        th_vec = out['angles']
        dth    = 2*np.pi/N

        if Na==2:
コード例 #2
0
   alp_dis     = 2*c_in*atten_out[0]      # damping [m^{-1}]
   kwtr        = atten_out[2]
   cp          = om/kwtr # phase vel (open water) [m/s]
   cg          = cp/2.   # group vel (open water, inf depth relation) [m/s]
   print('alp_scat = '+str(alp)+'; alp_dis = '+str(alp_dis))
   #
   N           = pow(2,7);
   nx0         = 500
   x_ice       = np.linspace(0.,ice_width,nx0)

   #############################################################
   # solve in position space
   out   = Fbs.solve_boltzmann(width=ice_width,
            alp=alp,N=N,alp_dis=alp_dis,cg=cg,f_inc=Fbs.dirspec_inc_spreading,Hs=Hs_in)
   #
   E_th        = Fbs.calc_expansion(out,x_ice,L=ice_width)
   dtheta      = 2*np.pi/float(N)
   E0          = dtheta*E_th.sum(1)                      # integral over directions (freq spec)
   Hs_steady   = 4*np.sqrt(E0.real)
   #
   S_th        = E_th.dot(out['solution']['Rmat'].transpose())
   S_cos       = S_th.dot(dtheta*np.cos(out['angles']))  # integral with cos over directions
   rhow        = 1025 # kg/m^3
   gravity     = 9.81 # m/s^2
   tx_steady   = -(rhow*gravity/cp)*S_cos.real
   #############################################################

   # plot Hs
   pobj  = Fplt.plot_1d(1.e-3*(xe+x_ice),Hs_steady,pobj=[fig,ax1],plot_steps=False,\
            labs=labs1,color='y',linewidth=3)
   lines_h.append(pobj[-1])