Changeset 2647 in lmdz_wrf


Ignore:
Timestamp:
Jun 29, 2019, 10:30:42 PM (5 years ago)
Author:
lfita
Message:

Adding 'cabin' to the yboat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nautical.py

    r2646 r2647  
    5757
    5858# FROM: http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html
    59 def yboat(length=10., flength=0.7, freeboard=2., hskeg=2.,fskeg=0.2,  N=200):
     59def yboat(length=10., fcab=0.3, hcab=0.5, flength=0.7, freeboard=2., hskeg=2.,       \
     60  fskeg=0.2, N=200):
    6061    """ Function to define an schematic boat from the y-plane
    6162      length: length of the boat (without stern, default, 10)
     63      fcab: length of the cabin as percentage of length (default, 0.3)
     64      hcab: height of the cabin (default, 0.5)
    6265      flength: floating length of the boat as percentage of length (defatult, 0.7)
    6366      freeboard: height above the water (default, 2)
     
    7073    lflength = length*flength
    7174    ilf3 = length*(1.-flength)/3
     75    lcab = length*fcab
     76    ilcab3 = length*(1.-fcab)/4.
    7277
    7378    bow = np.array([length, freeboard])
    7479    hbow = np.array([lflength + ilf3, 0.])
     80    icab = np.array([ilcab3, freeboard])
     81    ihcab = np.array([ilcab3, freeboard+hcab])
     82    ecab = np.array([ilcab3+lcab, freeboard])
    7583    sternp = np.array([0., freeboard])
    7684    sternlp = np.array([0., freeboard*0.8])
     85
     86    print 'hbow', hbow, 'bow', bow, 'icab', icab, 'ihcab', ihcab, 'ecab', ecab, 'sternp', sternp, 'sternlp', sternlp
    7787
    7888    boat = np.zeros((N,2), dtype=np.float)
     
    8393    N14 = N1/4
    8494    stern = np.zeros((N14,2), dtype=np.float)
    85     ipt = hbow
    86     ept = bow
     95    ipt = sternlp
     96    ept = sternp
    8797    dy = (ept[0] - ipt[0])/(N14-1)
    8898    dz = (ept[1] - ipt[1])/(N14-1)
     
    92102    # deck
    93103    deck = np.zeros((N14,2), dtype=np.float)
    94     ipt = bow
    95     ept = sternp
    96     dy = (ept[0] - ipt[0])/(N14-1)
    97     dz = (ept[1] - ipt[1])/(N14-1)
    98     for ip in range(N14):
     104    N144 = int(N14/4.)
     105
     106    ipt = sternp
     107    ept = icab
     108    dy = (ept[0] - ipt[0])/(N144-1)
     109    dz = (ept[1] - ipt[1])/(N144-1)
     110    for ip in range(N144):
    99111        deck[ip,:] = ipt + [dy*ip, dz*ip]
     112    ipt = icab
     113    ept = ihcab
     114    dy = (ept[0] - ipt[0])/(N144-1)
     115    dz = (ept[1] - ipt[1])/(N144-1)
     116    for ip in range(N144):
     117        deck[N144:2*N144,:] = ipt + [dy*ip, dz*ip]
     118    deck[2*N144:3*N144,:] = geo.circ_sec(ihcab, ecab, 2*lcab, arc='short',           \
     119      pos='right', Nang=N144)
     120    N1442 = N14 - 3*N144
     121    ipt = ecab
     122    ept = bow
     123    dy = (ept[0] - ipt[0])/(N144-1)
     124    dz = (ept[1] - ipt[1])/(N144-1)
     125    for ip in range(N144):
     126        deck[3*N144:N14,:] = ipt + [dy*ip, dz*ip]
    100127
    101128    # sternl
    102129    sternl = np.zeros((N14,2), dtype=np.float)
    103     ipt = sternp
    104     ept = sternlp
     130    ipt = bow
     131    ept = hbow
    105132    dy = (ept[0] - ipt[0])/(N14-1)
    106133    dz = (ept[1] - ipt[1])/(N14-1)
     
    110137    # keel
    111138    N12 = N1 - 3*N14
    112     keel = geo.circ_sec(sternlp, hbow, length, arc='short', pos='left', Nang=N12)
     139    keel = geo.circ_sec(hbow, sternlp, length, arc='short', pos='right', Nang=N12)
    113140
    114141    # skeg
     
    13861413      zn: minimum length on z-axis (draught)
    13871414      zx: maximum length on z-axis (draught)
    1388       zlf: freeboard line
     1415      zlf: water line
    13891416    """
    13901417    fname = 'boatnames'
     
    14111438      'port': ['port', 'babor', np.array([xn,y0,zx])],                               \
    14121439      'waterline': ['waterline', 'l'+unichr(237)+'nea de flotaci'+ unichr(243)+'n',  \
    1413         np.array([xn,zlf,0.])],                                                      \
    1414       'keel': ['keel', 'quillote', np.array([xn,yn,zn])],                            \
     1440        np.array([xn,y0,zlf])],                                                      \
     1441      'keel': ['keel', 'quillote', np.array([xn,y0,zn])],                            \
    14151442      }
    14161443
    14171444    # Dimensions
    14181445    boatls = {
    1419       'length': ['length', 'eslora', np.array([x0,yn,zx], [x0,yx,zx])],              \
    1420       'beam': ['beam', 'manga', np.array([xn,y0,zx], [xx,y0,zx])],                   \
    1421       'draught': ['draught', 'calado', np.array([xn,y0,zlf], [xn,y0,zn])],           \
     1446      'length': ['length', 'eslora', np.array([[x0,yn,zx], [x0,yx,zx]])],            \
     1447      'beam': ['beam', 'manga', np.array([[xn,y0,zx], [xx,y0,zx]])],                 \
     1448      'freeboard': ['freeboard (air \ndraught)', 'francobordo (obra \nviva)',        \
     1449        np.array([[xn,yn,zlf], [xn,yn,zx]])],                                        \
     1450      'draught': ['draught', 'calado (obra \nmuerta)',                               \
     1451        np.array([[xn,yx,zlf],[xn,yx,zn]])],                                         \
    14221452      }
    14231453
Note: See TracChangeset for help on using the changeset viewer.