Changeset 2486 in lmdz_wrf
- Timestamp:
- Apr 30, 2019, 3:08:19 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2485 r2486 676 676 677 677 def zsailing_boat(length=10., beam=1., lbeam=0.4, sternbp=0.5, lmast=0.6, wmast=0.1, \ 678 sd=0., lheads=0.38, lmains=0.55):678 hsd=5., msd=5., lheads=0.38, lmains=0.55): 679 679 """ Function to define an schematic sailing boat from the z-plane with sails 680 680 length: length of the boat (without stern, default 10) … … 684 684 lmast: position of the mast (as percentage of length, default 0.6) 685 685 wmast: width of the mast (default 0.1) 686 sd: sails direction respect to center line (default 0.) 686 hsd: head sail direction respect to center line (default 5.) 687 msd: main sail direction respect to center line (default 5.) 687 688 lheads: length of head sail (as percentage of legnth, defaul 0.38) 688 689 lmains: length of main sail (as percentage of legnth, defaul 0.55) … … 712 713 # head sails 713 714 lsail = lheads*length 714 sailsa = np.pi/2. - np.pi* 5./180. - np.pi*sd/180.715 sailsa = np.pi/2. - np.pi*hsd/180. 715 716 endsail = np.array([lsail*np.sin(sailsa), lsail*np.cos(sailsa)]) 716 717 endsail[0] = length - endsail[0] 717 hsail = circ_sec(endsail, bow, lsail*2.15) 718 if bow[1] < endsail[1]: 719 hsail = circ_sec(endsail, bow, lsail*2.15) 720 else: 721 hsail = circ_sec(bow, endsail, lsail*2.15) 718 722 719 723 # main sails 724 sailsa = np.pi/2. - np.pi*msd/180. 720 725 lsail = lmains*length 726 begsail = np.array([length*lmast, 0.]) 721 727 endsail = np.array([lsail*np.sin(sailsa), lsail*np.cos(sailsa)]) 722 728 endsail[0] = length*lmast - endsail[0] 723 msail = circ_sec(endsail, np.array([length*lmast, 0.]), lsail*2.15) 729 if endsail[1] < begsail[1]: 730 msail = circ_sec(begsail, endsail, lsail*2.15) 731 else: 732 msail = circ_sec(endsail, begsail, lsail*2.15) 724 733 725 734 sailingboat = np.zeros((dpts*8+4,2), dtype=np.float) … … 743 752 '_lb' + str(int(lbeam*100.)) + '_sb' + str(int(sternbp*100.)) + \ 744 753 '_lm' + str(int(lmast*100.)) + '_wm' + str(int(wmast)) + \ 745 '_ sd' + str(int(sd)) + '_hs' + str(int(lheads*100.)) +\746 '_ms' + str(int(lheads*100.)) + ' .dat'754 '_hsd' + str(int(hsd)) + '_hs' + str(int(lheads*100.)) + \ 755 '_ms' + str(int(lheads*100.)) + '_msd' + str(int(msd)) +'.dat' 747 756 if not os.path.isfile(fname): 748 757 print infmsg … … 752 761 'length_at_max_beam:' + str(lbeam) + '% beam at stern: ' + str(sternbp)+ \ 753 762 ' % mast position: '+ str(lmast) + ' % mast width: ' + str(wmast) + ' ' + \ 754 ' sails direction:' + str(sd) + ' head sail length: ' + str(lheads) + ' %'+\ 755 ' main sail length' + str(lmains) + '\n') 763 ' head sail direction:' + str(hsd) + ' head sail length: ' + str(lheads) + \ 764 ' %' + ' main sail length' + str(lmains) + ' main sail direction:' + \ 765 str(msd) +'\n') 756 766 for ip in range(dpts*5): 757 767 of.write(str(sailingboat[ip,0]) + ' ' + str(sailingboat[ip,1]) + '\n')
Note: See TracChangeset
for help on using the changeset viewer.