K iKdZddlmZddlmZmZddlmZmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZed d dgiZGddZy)zJ This module can be used to solve probelsm related to 2D parabolic arches )sympify)Symbolsymbols)diffsqrtcossinatanradMin)Eq)solve) Piecewise)plot)limit)doctest_depends_on) import_modulenumpyfromlistarange) import_kwargsceZdZdZdZedZedZedZedZ edZ edZ dd Z d Z dd Zdd ZddZdZddZddZddZdZeddZdZdZdZdZy )Archa This class is used to solve problems related to a three hinged arch(determinate) structure. An arch is a curved vertical structure spanning an open space underneath it. Arches can be used to reduce the bending moments in long-span structures. Arches are used in structural engineering(over windows, door and even bridges) because they can support a very large mass placed on top of them. Example ======== >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.get_shape_eqn 5 - (x - 5)**2/5 >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,1),crown_x=6) >>> a.get_shape_eqn 9/5 - (x - 6)**2/20 c Jd|_t|dt|df|_t|dt|df|_d|_d|_d|vrt|d|_d|vrt|d|_|j |_i|_i|_|j|jd|_ i|_ ddd|_ d|_ d|_ tddtd dtd dtd di|_t!|_t!|_i|_i|_i|_i|_t/d |_t/d |_t/d |_t/d |_d|_d|_d|_y) Nrcrown_xcrown_y) concentrated distributedhinge)leftrightR_A_xR_A_yR_B_xR_B_yrT) _shape_eqnr _left_support_right_support_crown_x_crown_y get_shape_eqn _conc_loads_distributed_loads_loads_loads_applied _supports_member _member_forcer_reaction_forceset_points_disc_x_points_disc_y _moment_x _moment_y_load_x_load_yr_moment_x_func_moment_y_func _load_x_func _load_y_func_bending_moment _shear_force _axial_force)self left_support right_supportkwargss l/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/physics/continuum_mechanics/arch.py__init__z Arch.__init__&s&|A7 Q8PQ ' a(8 9'-PQBR:ST   #F9$56DM  #F9$56DM,,"$'+'7'7tG^G^_  !(': ! &w6'?1fWoVWY_`gYhijk!e!e  '1'1%h/%h/#  c|jr |jStd\}}}tdd}|jr|jr|j}|j}|||z dzz|z|z }|j ||j d||j di}t||} | d||z dzz|z}|j ||jdi|jdk7r td|S|jr|j}|||z dzz|z|z }|j ||j d||j di}|j ||jd||jdi} t|| f||f} t| dks| |dk(r td | |||z dzz| |z}| ||_|Std ) z3returns the equation of the shape of arch developedzx y caF)positiverrzQprovided coordinates of crown and supports are not consistent with parabolic archzYparabolic arch cannot be constructed with the provided coordinates, try providing crown_yz(please provide crown_x to construct arch) r(rrr+r,subsr)rr* ValueErrorlenKeyError) rDxycrLx0y0 parabola_eqneq1solutioneq2s rHr-zArch.get_shape_eqnHs ???? " !A 3 & ==T]]--BBadQY;+a/L##Qt'9'9!'>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.apply_load(0,'C',start=3,end=5,mag=-10) For applying point/concentrated_loads >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.apply_load(-1,'C',start=2,mag=15,angle=45) rTrSrVz(load with the given label already exists)ABz1cannot use the given label, reserved for supportsrNzprovide end greater than start)startendf_yrNrz!please provide direction of force)rSrTf_xrjmaganglerlrjr)rrr1rPrRr/r8addr:r r< TypeErrorr(rOrr r r.r7r9r;) rDorderlabelrhrmrirnrTrSrVheights rH apply_loadzArch.apply_loadsd 3K 3K D\u~cl D'' 'GH H I PQ Q A:{c%i?@@6;3s-SD # #E *    # #E *&u%c!Cj.>)?UCPQRUJEWYZDZAZ)[[% U#sCAJu,<'==#),c!Cj.>(?UCPQRUJEWYZDZAZ([u%&)3s1:e+;&< U#)6D   & B;} CDD__))3u+6F+0fCCPUJDW`cdghklqhrds`s{~IN'OD  U #    # #E *    # #E *&u%)9)9%)@)G4K[K[\aKbcfKgIg)hh% U#t'7'7'>u'EE#(,(8(8(?(F$JZJZ[`JabeJfHf(gu%&*&6&6u&=e&D U#&u%)9)9%)@)GE)RR% U#t'7'7'>u'EE#)-)9)9%)@)G(GE(Ru%&*&6&6u&=e&D U#)7D   &1 rJc td}td}td}||jvr|jj||j|d}|j|d}|j|d}|jj ||j |xx|t|||z zzcc<|j|xx|t|||z z||t||zdz z zz cc<|jj|}td|d |y ||jvrH|jj||j|d}|jj ||jj ||j|xx|j|d||z zz cc<|j|xx|j|d ||j|dz zzcc<|j|xx|j|d zcc<|j |xx|j|dzcc<|jj|}td|d |y td ) a This methods removes the load applied to the arch Parameters ========== label : String or Symbol The label of the applied load Examples ======== >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.apply_load(0,'C',start=3,end=5,mag=-10) >>> a.remove_load('C') removed load C: {'start': 3, 'end': 5, 'f_y': -10} rTrSrVrhrirjrNz removed load : rlzlabel not foundN)rr/r1popr8remover<r r:printr.r7r9r;rP) rDrrrTrSrVrhrirmvals rH remove_loadzArch.remove_loadso& 3K 3K D\ D++ +    # #E *++E27;E))%07C**51%8C    & &u - LL 3Ac 5(8#9 9  NN5 !S#a*U*:%;RAc ASUV@V=V%W W !))--e4C M%3%0 1 d&& &    # #E *$$U+C0E    & &u -    & &u - NN5 !T%5%5e%>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.change_support_type(right_support="roller") rollerr z%supports must only be roller or hinger!r"N)rPr2)rDrErF support_typess rHchange_support_typezArch.change_support_type]s]2"'* =0 !HII%1DNN6 " M1 !HII&3DNN7 # rJc||jkDs)|t|jd|jdkr?t dt|jd|jdd|jt d}t |j|j||jdzdz }t||jz |z }|j|z}|j|z }|||f|_ y)z This method adds a member/rod at a particular height y. A rod is used for stability of the structure in case of a roller support. rz&position of support must be between y=z and y=rSrNN) r,minr)r*rPrrr(rOr+rr3)rDrTrSrLx_diffx1x2s rH add_memberzArch.add_members T]]?aD$6$6q$9D>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(10,0),crown_x=5,crown_y=5) >>> a.apply_load(0,'C',start=3,end=5,mag=-10) >>> a.solve() >>> a.reaction_force {R_A_x: 8, R_A_y: 12, R_B_x: -8, R_B_y: 8} >>> from sympy import Symbol >>> t = Symbol('t') >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(16,0),crown_x=8,crown_y=5) >>> a.apply_load(0,'C',start=3,end=5,mag=t) >>> a.solve() >>> a.reaction_force {R_A_x: -4*t/5, R_A_y: -3*t/2, R_B_x: 4*t/5, R_B_y: -t/2} >>> a.bending_moment_at(4) -5*t/2 rTrSrVr'rTrr!rr"z5member must be added if any of the supports is rollerNzR_A_x R_A_y R_B_x R_B_y TrNzDnet force in x direction not possible under the specified conditions)#rsortedr7r8rr=r>r?r@r;r9r:r<rOr*r)r+r,r2r3ryrmaxrPr rr5r(rAr rrr rCrB)"rDrTrSrVdiscontinuity_points_xdiscontinuity_points_yaccumulated_x_momentaccumulated_y_momentaccumulated_x_loadaccumulated_y_loadpointcondmoment_Amoment_hinge_leftmoment_hinge_rightnet_xnet_yr#r$r%r&TrYr[eq3eq4eq5rZsymbrnfxfy axial_force shear_forces" rHrz Arch.solves6 3K 3K D\!'(;(;!<!'(;(;!<'1'1%h/%h/  + dEJD $,,u"5 5  DNN5$9 9 )+=d*CTEVEVW[D\ ]D "+-A$,GI\I\]aHb"cD   d, dEJD DNN5$9 9 $,,u"5 5  )+=d*CTEVEVW[D\ ]D "+-A$,GI\I\]aHb"cD   d&&++Ad.A.A!.DEJJ2dN`N`abNcd&&++Ad.A.A!.DEJJ1TM_M_`aMbcd!//44Qt}}EJJ2dmm\ //44Qt}}EJJ1T]][\"0055a8K8KA8NOTTUWX\XeXef!0055a FKKBt}}]^!0055a8K8KA8NOTTUVW[WdWdef"0055a FKKAdmm\] !!&&q)<)>& !X -$..2IX2U||AD$6$6q$9$:M:Ma:P QQ!8$%kllUA,CUA,CUU]U215CUD$7$7$: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dzk(ret|jd| zz |j||jd|jdf|d|||d| zz |dzf|d| zz |dzfdd } | St|jd| zz |j||jd|jdf|d|||d| zz | dzf|d| zz | dzfdd } | S)a7 This method returns a plot object containing the diagram of the specified arch along with the supports and forces applied to the structure. Examples ======== >>> from sympy import Symbol >>> t = Symbol('t') >>> from sympy.physics.continuum_mechanics.arch import Arch >>> a = Arch((0,0),(40,0),crown_x=20,crown_y=12) >>> a.apply_load(-1,'C',8,150,angle=270) >>> a.apply_load(0,'D',start=20,end=40,mag=-4) >>> a.apply_load(-1,'E',10,t,angle=300) >>> p = a.draw() >>> p # doctest: +ELLIPSIS Plot object containing: [0]: cartesian line: 11.325 - 3*(x - 20)**2/100 for x over (0.0, 40.0) [1]: cartesian line: 12 - 3*(x - 20)**2/100 for x over (0.0, 40.0) ... >>> p.show() rSrr皙?皙?rN{Gzt?owhitenoneargsmarker markersizecolormarkerfacecolorQ?F皙?brown)markersshow annotations rectanglesxlimylimaxis line_color)r _draw_loads_draw_supportsr*r)rr,r_draw_rectangles _draw_fillerr3appendr+rr() rDrSrrrr`xmaxxminyminymaxlimfiller sing_plots rHdrawz Arch.draws2 3K&&(  &&(""1%!!!$4%%a()<)$    Sc!!# #T__U3Y6!__!3!3A!68K8KA8NO%,"')4*4#'S=$s(";#'S=$s(";"'(/ 1I2T__U3Y6!__!3!3A!68K8KA8NO%,"')4*4#'S=$s(";#'S=$s(";"'(/ 1IrJc:g}|jd}|jd}t|jd|jd}|j}t d|zd|zz t d|zd|zz kDr d|zd|zz }n d|zd|zz }|j ddk(r<|j |jdg|jdd|zz ggdd d d d n;|j |jdg|jdd |zz ggddd d d |j ddk(r<|j |jdg|jdd|zz ggdd d d d n;|j |jdg|jdd |zz ggddd d d |j |jdg|jdd|zz ggddd d d |j |jdg|jdd|zz ggddd d d |S)Nrrrrr!rg{Gz?r blackrrgy&1|?r"g;On?_)r*r)rr,absr2r)rDsupport_markersrrrrmax_diffs rHrzArch._draw_supportss""1%!!!$4%%a()<)>& !8 +  " "++A./++A.tH}<=!!##&,    " "++A./++A.uX~=>!##&,   >>' "H ,  " ",,Q/0,,Q/X =>!!##&,    " ",,Q/0,,Q/h>?!##&,   ((+,((+E(N:;"(   ''*+''*5>9:"(  rJcg}|jd}|jd}t|jd|jd}|j}t d|zd|zz t d|zd|zz kDr d|zd|zz }n d|zd|zz }|j k|j dt |jd|jdk\rZ|j|j d|j dd|zz f|j d|j dz d|zddd n|j d|jdk\rZ|j|j d|j dd|zz f|jd|j dz d|zddd nb|j|j d|j dd|zz ft |jd|j dz d|zd dd |jrc|jD]T}|j|d }|j|d } |j||j|d zzf| |z |dzddV|S)NrrrrrNrg{Gz?r)xywidthrsrnrrhri333333?orangerrrsr) r*r)rr,rr3rrr/) rDmemberrrrrrloadsrhris rHrzArch._draw_rectanglesRs""1%!!!$4%%a()<)r sO',777$'%84gj(-DEpprJ