11import matplotlib .pyplot as plt
22import numpy as np
33
4+ from slenderpy .future ._constant import _GRAVITY
5+ from slenderpy .future .cable .static import blondel
6+ from slenderpy .future .cable .static import catenary
47from slenderpy .future .cable .static import nleq
58from slenderpy .future .cable .static import parabolic
69
@@ -9,15 +12,16 @@ def _aster570():
912 linm = 1.571
1013 axs = 3.653e07
1114 rts = 1.853e05
12- return linm , axs , rts
15+ alpha = 2.300e-05
16+ return linm , axs , rts , alpha
1317
1418
15- def parabolic_vs_nleq ():
19+ def parabolic_vs_catenary_vs_nleq ():
1620 """Check differences between parabolic and nleq models when everything
1721 except mechanical tension is set."""
1822
1923 # conductor properties
20- linm , axs , rts = _aster570 ()
24+ linm , axs , rts , _ = _aster570 ()
2125
2226 # span properties
2327 lspan = 400
@@ -28,10 +32,14 @@ def parabolic_vs_nleq():
2832 xa1 = np .linspace (0 , lspan * np .ones_like (tension ), 401 )
2933 ya1 = parabolic .shape (xa1 , lspan , tension , sld , linm )
3034
35+ # position (catenary)
36+ xa2 = np .array (xa1 )
37+ ya2 = catenary .shape (xa1 , lspan , tension , sld , linm )
38+
3139 # position (nleq)
3240 lcab , lve = nleq .solve (lspan , tension , sld , linm , axs , rtol = 1.0e-99 , maxiter = 2 )
3341 s = np .linspace (0 , lcab * np .ones_like (tension ), 401 )
34- xa2 , ya2 = nleq .shape (s , lspan , tension , sld , linm , axs , lcab = lcab , lve = lve )
42+ xa3 , ya3 = nleq .shape (s , lspan , tension , sld , linm , axs , lcab = lcab , lve = lve )
3543
3644 # sag-to-length ratio
3745 ratio = nleq .sag (lspan , tension , sld , linm , axs ) / np .sqrt (lspan ** 2 + sld ** 2 )
@@ -44,7 +52,8 @@ def parabolic_vs_nleq():
4452 plt .plot (
4553 xa1 [:, n ], ya1 [:, n ], c = f"C{ n } " , ls = "-" , label = f"parabolic r={ ratio [n ]:.3f} "
4654 )
47- plt .plot (xa2 [:, n ], ya2 [:, n ], c = f"C{ n } " , ls = "--" , label = "nleq" )
55+ plt .plot (xa2 [:, n ], ya2 [:, n ], c = f"C{ n } " , ls = "--" , label = "catenary" )
56+ plt .plot (xa3 [:, n ], ya3 [:, n ], c = f"C{ n } " , ls = ":" , lw = 2 , label = "nleq" )
4857 plt .grid (True )
4958 plt .xlabel ("$x$ (m)" )
5059 plt .ylabel ("$y$ (m)" )
@@ -56,13 +65,11 @@ def parabolic_vs_nleq():
5665def compare_all (lspan = 400.0 , ratio = 0.25 , sld = 0.0 ):
5766 """Quick plot script to make visual check"""
5867
59- # NB: we can see that the sag/argsag functions in cable are max chord and not sag ...
60-
6168 # lspan = 100.
6269 # ratio = 0.01
6370 # sld = 10.
6471
65- linm , axs , rts = _aster570 ()
72+ linm , axs , rts , _ = _aster570 ()
6673 tension = ratio * rts
6774
6875 # [parabolic] compute cable stuff
@@ -97,32 +104,37 @@ def compare_all(lspan=400.0, ratio=0.25, sld=0.0):
97104 sx_ = np .max (nleq .stress (1001 , lspan , tension , sld , linm , axs , lcab = lcab , lve = lve ))
98105 sa_ = nleq .mean_stress (lspan , tension , sld , linm , axs , lcab = lcab , lve = lve )
99106
100- # [old] [catenary]
101- from slenderpy .future ._constant import _GRAVITY
102- import slenderpy .cable as sc
107+ # [catenary] compute cable stuff
103108
104109 # static shape
105- s = np .linspace (0 , 1 , 101 )
106- a = tension / (linm * _GRAVITY )
107- y = sc ._alts (s , lspan , a , sld )
108-
110+ xc = np .linspace (0 , 1 , 101 )
111+ yc = catenary .shape (xc , lspan , tension , sld , linm )
112+ # cable length
113+ lc = catenary .length (lspan , tension , sld , linm )
114+ # cable sag
115+ sagc = catenary .sag (lspan , tension , sld , linm )
109116 # sag points
110- xc = sc .argsag (lspan , a , sld ) * lspan
111- yc = sc ._alts (xc / lspan , lspan , a , sld )
117+ xu = catenary .argsag (lspan , tension , sld , linm )
118+ yu = catenary .shape (xu , lspan , tension , sld , linm )
119+ # stress
120+ nn = float ("nan" )
121+ # > not implemented yet
112122
113123 # [print]
114124 print (f"[all] flat length { lspan :.6f} " )
115125 print (f"[all] 3dim length { np .sqrt (lspan ** 2 + sld ** 2 ):.6f} " )
116126 print (f"[pbl] cable length { length :.6f} " )
117- print (f"[cat] cable length { sc . catenary_length ( lspan , a , sld ) :.6f} " )
127+ print (f"[cat] cable length { lc :.6f} " )
118128 print (f"[nle] cable len 0 { lcab :.6f} " )
119129 print (f"[nle] cable len 1 { length_ :.6f} " )
120130 print (f"[pbl] sag { sag :.6f} " )
121- print (f"[cat] sag { sc . sag ( lspan , a , sld ) :.6f} " )
131+ print (f"[cat] sag { sagc :.6f} " )
122132 print (f"[nle] sag { sag_ :.6f} " )
123133 print (f"[pbl] max stress { sx :.6f} " )
134+ print (f"[cat] max stress { nn :.6f} " )
124135 print (f"[nle] max stress { sx_ :.6f} " )
125136 print (f"[pbl] avg stress { sa :.6f} " )
137+ print (f"[cat] avg stress { nn :.6f} " )
126138 print (f"[nle] avg stress { sa_ :.6f} " )
127139
128140 # [plot]
@@ -132,8 +144,8 @@ def compare_all(lspan=400.0, ratio=0.25, sld=0.0):
132144 plt .plot ([xs , xs ], [ys , xs * sld / lspan ], ls = "--" , c = "C0" )
133145 plt .plot (xn , yn , label = "NL eq." , c = "C1" )
134146 plt .plot ([xt , xt ], [yt , xt * sld / lspan ], ls = "--" , c = "C1" )
135- plt .plot (s * lspan , y , c = "C2" , label = "catenary" )
136- plt .plot ([xc , xc ], [yc , xc * sld / lspan ], ls = "--" , c = "C2" )
147+ plt .plot (xc , yc , c = "C2" , label = "catenary" )
148+ plt .plot ([xu , xu ], [yu , xu * sld / lspan ], ls = "--" , c = "C2" )
137149 plt .legend ()
138150 plt .xlabel ("$x$" )
139151 plt .ylabel ("$y$" )
@@ -147,13 +159,62 @@ def compare_all(lspan=400.0, ratio=0.25, sld=0.0):
147159 return
148160
149161
162+ def test_blondel ():
163+
164+ # conductor properties
165+ linm , axs , rts , alpha = _aster570 ()
166+
167+ # span properties
168+ lspan = 400
169+ tensions = rts * np .array ([0.02 , 0.05 , 0.1 , 0.2 ])
170+ slds = np .array ([0.0 , 20.0 , 50.0 , 100.0 ])
171+
172+ # temperatures
173+ Tref = 15.0
174+ Tend = Tref + np .linspace (- 20 , + 80 , 101 )
175+ dt = Tend - Tref
176+
177+ #
178+ fig , ax = plt .subplots (nrows = len (slds ), ncols = len (tensions ))
179+ for i in range (len (slds )):
180+ for j in range (len (tensions )):
181+
182+ sld = slds [i ]
183+ tension = tensions [j ]
184+
185+ # compute new tensions
186+ w = linm * _GRAVITY * lspan
187+ tb = blondel .tension (w , tension , Tref , Tend , axs , alpha )
188+ tp = parabolic .thermal_expansion_tension (
189+ lspan , tension , sld , Tref , Tend , linm , alpha
190+ )
191+ tn = nleq .thermal_expansion_tension (
192+ lspan , tension , sld , Tref , Tend , linm , axs , alpha
193+ )
194+
195+ ax [i , j ].plot (dt , tb - tension , label = "blondel" )
196+ ax [i , j ].plot (dt , tp - tension , label = "parabolic" )
197+ ax [i , j ].plot (dt , tn - tension , label = "nleq" )
198+ ax [i , j ].grid (True )
199+ ax [i , j ].set_title (f"With H={ tension / 1000. } kN and h={ sld } m" )
200+
201+ ax [- 1 , - 1 ].legend ()
202+ for i in range (len (slds )):
203+ ax [i , 0 ].set_ylabel ("Tension difference (N)" )
204+ for j in range (len (tensions )):
205+ ax [- 1 , j ].set_xlabel ("Temperature difference (K)" )
206+
207+
150208if __name__ == "__main__" :
151209 import matplotlib
152210
153211 matplotlib .use ("TkAgg" )
154212 plt .close ("all" )
155213
156- parabolic_vs_nleq ()
214+ parabolic_vs_catenary_vs_nleq ()
215+
157216 compare_all (lspan = 400.0 , ratio = 0.25 , sld = 10.0 )
158217 print ()
159218 compare_all (lspan = 100.0 , ratio = 0.01 , sld = 15.0 )
219+ #
220+ test_blondel ()
0 commit comments