damyarou

python, GMT などのプログラム

Stability analysis of large dam non-overflow section

Code is shown below.

# Concrete gravity dam stability analysis
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tick


#global variants
wc=23.5 # unit weight of concrete (kN/m3) 
ww=10.0 # unit weight of water (kN/m3) 
ws=12.0 # unit weight of sedimrntation (submerged) (kN/m3) 
ce=0.5  # sedimentation pressure coefficient
kh=0.15 # seismic coefficient
cc=3200 # cohesion of foundation rock (kN/m2) 
ff=1.20 # internal friction coefficient of foundation rock


def barrow(x1,y1,x2,y2):
    col='#333333'
    arst='<->,head_width=3,head_length=10'
    aprop=dict(arrowstyle=arst,connectionstyle='arc3',facecolor=col,edgecolor=col,shrinkA=0,shrinkB=0,lw=1)
    plt.annotate('',
        xy=(x1,y1), xycoords='data',
        xytext=(x2,y2), textcoords='data', fontsize=0, arrowprops=aprop)

    
def drawfig(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara,fnameF):
    fsz=12
    xmin=fpara[0]
    xmax=fpara[1]
    dx  =fpara[2]
    ymin=fpara[3]
    ymax=fpara[4]
    dy  =fpara[5]
    iw=12
    ih=iw*(ymax-ymin)/(xmax-xmin)
    plt.figure(figsize=(iw,ih),facecolor='w')
    plt.rcParams['font.size']=fsz
    plt.rcParams['font.family']='sans-serif'

    plt.xlim([xmin,xmax])
    plt.ylim([ymin,ymax])
    plt.xlabel('Distance (m)')
    plt.ylabel('Elevation (EL.m)')
    plt.xticks(np.arange(xmin,xmax+dx,dx))
    plt.yticks(np.arange(ymin,ymax+dy,dy))
    plt.gca().spines['right'].set_visible(False)
    plt.gca().spines['top'].set_visible(False)
    plt.gca().yaxis.set_ticks_position('left')
    plt.gca().xaxis.set_ticks_position('bottom')
    plt.gca().set_aspect('equal',adjustable='box')
    plt.title(tstr,loc='left',fontsize=fsz)

    plt.fill([xmin+5,xmax-5,xmax-5,xmin+5],[ELB,ELB,ELB-5,ELB-5],fill=False, hatch='///',color='#aaaaaa',lw=0)
    plt.fill([xmin+5,0,0,xmin+5],[UWL,UWL,UWL-10,UWL-10],color='#00ffff',alpha=0.3,lw=0)
    plt.fill([xmin+5,0,0,xmin+5],[USL,USL,USL-10,USL-10],fill=False, hatch='...',color='#aaaaaa',lw=0)
    x1=n*(ELT-(DSL-10)); x2=n*(ELT-DSL); x3=xmax-5; x4=x3
    y1=DSL-10; y2=DSL; y3=y2; y4=y1
    plt.fill([x1,x2,x3,x4],[y1,y2,y3,y4],fill=False, hatch='...',color='#aaaaaa',lw=0)
    x1=n*(ELT-(DWL-10)); x2=n*(ELT-DWL); x3=xmax-5; x4=x3
    y1=DWL-10; y2=DWL; y3=y2; y4=y1
    plt.fill([x1,x2,x3,x4],[y1,y2,y3,y4],color='#00ffff', alpha=0.3,lw=0)
    
    x=np.array([-m*(ELF-ELB),0,0,tw,tw,n*(ELT-ELB)])
    y=np.array([ELB,ELF,ELT,ELT,ELT-tw/n,ELB])    
    plt.fill(x,y,facecolor='#eeeeee',edgecolor='#000000',lw=2)
    plt.plot([0,tw],[ELT,ELT-tw/n],'--',color='#000000',lw=1)
    
    plt.plot([xmin+5,xmax-5],[ELB,ELB],'-',color='#000000',lw=2)
    plt.plot([xmin+5,0],[UWL,UWL],'-',color='#000000',lw=1)
    plt.plot([xmin+5,0],[USL,USL],'-',color='#000000',lw=1)
    plt.plot([n*(ELT-DWL),xmax-5],[DWL,DWL],'-',color='#000000',lw=1)
    plt.plot([n*(ELT-DSL),xmax-5],[DSL,DSL],'-',color='#000000',lw=1)
    plt.text(xmin+5,ELB,'EL.{0:.3f}'.format(ELB),ha='left',va='bottom',fontsize=fsz)
    plt.text(xmax-5,ELB,'EL.{0:.3f}'.format(ELB),ha='right',va='bottom',fontsize=fsz)
    plt.text(xmin+5,UWL,'UWL:EL.{0:.3f}'.format(UWL),ha='left',va='bottom',fontsize=fsz)
    plt.text(xmin+5,USL,'USL:EL.{0:.3f}'.format(USL),ha='left',va='bottom',fontsize=fsz)
    plt.text(xmax-5,DWL,'DWL:EL.{0:.3f}'.format(DWL),ha='right',va='bottom',fontsize=fsz)
    plt.text(xmax-5,DSL,'DSL:EL.{0:.3f}'.format(DSL),ha='right',va='top',fontsize=fsz)
    plt.plot([tw,tw+30],[ELT,ELT],'-',color='#000000',lw=1)
    plt.text(tw+30,ELT,'EL.{0:.3f}'.format(ELT),ha='right',va='bottom',fontsize=fsz)
    xs=0.5*n*(ELT-ELB); ys=0.5*(ELT+ELB); ang=np.degrees(np.arctan(1/n))
    plt.text(xs+5,ys,'1:{0:.2f}'.format(n),va='center',ha='center',rotation=-ang)   
    if 0<m:
        plt.plot([0,n*(ELT-ELF)],[ELF,ELF],'--',color='#000000',lw=2)
        plt.plot([0,-30],[ELF,ELF],'-',color='#000000',lw=1)
        plt.text(-30,ELF,'EL.{0:.3f}'.format(ELF),ha='left',va='bottom',fontsize=fsz)
        xs=-0.5*m*(ELF-ELB); ys=0.5*(ELF+ELB); ang=np.degrees(np.arctan(1/m))
        plt.text(xs-5,ys,'1:{0:.2f}'.format(m),va='center',ha='center',rotation=ang)   
    r=1.0
    theta=np.radians(np.arange(0,181,1))
    x=r*np.cos(theta)+xg-m*(ELF-ELB)
    y=r*np.sin(theta)+ELB+yg+r
    xx=np.append(x,[x[-1],x[0]])
    yy=np.append(y,[ELB+yg,ELB+yg])
    plt.fill(xx,yy,facecolor='#ffffff',edgecolor='#000000',lw=1)

    barrow(20,ELT,20,ELB)
    plt.text(20,0.5*(ELT+ELB),'H={0:.1f}m'.format(ELT-ELB),ha='right',va='center',fontsize=fsz,rotation=90)
    
    plt.plot([0,0],[ELB-5,ELT+15],'-.',color='#000000',lw=1)
    plt.text(0,ELT+15,'Dam axis',ha='center',va='bottom',fontsize=fsz,rotation=0)    
    
    plt.plot([tw,tw],[ELT,ELT+7],'-',color='#000000',lw=1)
    barrow(0,ELT+5,tw,ELT+5)
    plt.text(tw/2,ELT+7,'{0:.3f}'.format(tw),ha='center',va='bottom',fontsize=fsz,rotation=0)
    
    plt.plot([-m*(ELF-ELB),-m*(ELF-ELB)],[ELB,ELB-17],'-',color='#000000',lw=1)
    plt.plot([n*(ELT-ELB),n*(ELT-ELB)],[ELB,ELB-17],'-',color='#000000',lw=1)
    x1=-m*(ELF-ELB); x2=n*(ELT-ELB)
    barrow(x1,ELB-15,x2,ELB-15)
    plt.text(0.5*(x1+x2),ELB-15,'{0:.3f}'.format(x2-x1),ha='center',va='bottom',fontsize=fsz,rotation=0)

    xs=70; ys=ELT+15
    plt.text(xs,ys- 0,'UWL: U/S water level (FSL)',ha='left',va='center',fontsize=fsz)
    plt.text(xs,ys- 5,'USL: U/S sedimentation level',ha='left',va='center',fontsize=fsz)
    plt.text(xs,ys-10,'DWL: D/S water level',ha='left',va='center',fontsize=fsz)
    plt.text(xs,ys-15,'DSL: D/S sedimentation level',ha='left',va='center',fontsize=fsz)
    
    plt.tight_layout()
    plt.savefig(fnameF, dpi=100, bbox_inches="tight", pad_inches=0.1)
    plt.show()


def inp_BU():
    tw=7.5     # top width
    ELT=1850.0 # dam top level
    UWL=1845.0 # upstream water level
    USL=1805.8 # upstream sedimentation level
    DWL=1778.0 # downstream water level
    DSL=1778.0 # downstream sedimentation level
    ELB=1763.0 # dam foundation level
    ELF=ELB    # fillet level 
    n=0.85     # downstream gradient
    m=0.0     # fillet gradient
    xg=m*(ELF-ELB)+10.0 # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    tstr='* Basochhu PSPP Upper dam non-overflow section (H={0:.1f}m)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=1740
    ymax=ymin+140
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   


def inp_BL1():
    tw=7.5     # top width
    ELT=1120.0 # dam top level
    UWL=1115.0 # upstream water level
    USL=1078.1 # upstream sedimentation level
    DWL=1045.0 # dowstream water level
    DSL=1045.0 # downstream sedimentation level
    ELB=1025.0 # dam foundation level
    ELF=ELB   # fillet level 
    n=0.85     # downstream gradient
    m=0.00     # fillet gradient
    xg=m*(ELF-ELB)+10.0 # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    if USL<ELB: USL=ELB
    if DWL<ELB: DWL=ELB
    if DSL<ELB: DSL=ELB
    tstr='* Basochhu PSPP Lower dam non-overflow section (H={0:.1f}m, Fillet elevation)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=960
    ymax=ymin+190
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   


def inp_BL2():
    tw=7.5     # top width
    ELT=1120.0 # dam top level
    UWL=1115.0 # upstream water level
    USL=1078.1 # upstream sedimentation level
    DWL=1045.0 # dowstream water level
    DSL=1045.0 # downstream sedimentation level
    ELB=985.0 # dam foundation level
    ELF=1025.0    # fillet level 
    n=0.85     # downstream gradient
    m=0.20     # fillet gradient
    xg=m*(ELF-ELB)+10.0 # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    tstr='* Basochhu PSPP Lower dam (non-overflow section (H={0:.1f}m)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=960
    ymax=ymin+190
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   


def inp_JU():
    tw=7.5     # top width
    ELT=1345.0 # dam top level
    UWL=1340.0 # upstream water level
    USL=1305.4 # upstream sedimentation level
    DWL=1278.0 # downstream water level
    DSL=1278.0 # downstream sedimentation level
    ELB=1258.0 # dam foundation level
    ELF=ELB  # fillet level 
    n=0.85     # downstream gradient
    m=0.00     # fillet gradient
    xg=m*(ELF-ELB)+10.0    # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    tstr='* Jerichhu PSPP Upper dam non-overflow section (H={0:.1f}m)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=1240
    ymax=ymin+140
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   


def inp_JL1():
    tw=7.5     # top width
    ELT=675.0 # dam top level
    UWL=670.0 # upstream water level
    USL=620.4 # upstream sedimentation level
    DWL=540.0 # downstream water level
    DSL=540.0 # downstream sedimentation level
    ELB=560.0 # dam foundation level
    ELF=ELB  # fillet level 
    n=0.85     # downstream gradient
    m=0.00     # fillet gradient
    xg=m*(ELF-ELB)+10.0    # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    if USL<ELB: USL=ELB
    if DWL<ELB: DWL=ELB
    if DSL<ELB: DSL=ELB
    tstr='* Jerichhu PSPP Lower dam non-overflow section (H={0:.1f}m, Fillet elevation)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=500
    ymax=ymin+200
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   


def inp_JL2():
    tw=7.5     # top width
    ELT=675.0 # dam top level
    UWL=670.0 # upstream water level
    USL=620.4 # upstream sedimentation level
    DWL=540.0 # downstream water level
    DSL=540.0 # downstream sedimentation level
    ELB=520.0 # dam foundation level
    ELF=560.0  # fillet level 
    n=0.85     # downstream gradient
    m=0.50     # fillet gradient
    xg=m*(ELF-ELB)+10.0    # location ogf gallery from upstream edge 
    yg=10.0    # height of gallery from dam foundation
    tstr='* Jerichhu PSPP Lower dam non-overflow section (H={0:.1f}m)'.format(ELT-ELB)
    xmin=-60
    xmax=xmin+260
    dx=20
    ymin=500
    ymax=ymin+200
    dy=10
    fpara=np.array([xmin,xmax,dx,ymin,ymax,dy])
    return tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara   



def dambody(tw,ELT,ELB,ELF,n,m):
    # self weight of dam concrete
    d1=ELT-ELB
    d2=ELF-ELB
    w1=wc*tw*tw/n/2; x1=m*d2+tw/3*2; y1=d1-tw/n/3
    w2=wc*n*d1*d1/2; x2=m*d2+n*d1/3; y2=d1/3
    w3=wc*m*d2*d2/2; x3=m*d2/3*2   ; y3=d2/3
    vv=w1+w2+w3
    pp=vv*kh
    xx=(w1*x1+w2*x2+w3*x3)/vv
    yy=(w1*y1+w2*y2+w3*y3)/vv
    
    return vv,pp,xx,yy


def p_uwl(ELB,UWL):
    # U/S water pressure
    h=UWL-ELB
    vv=0.0
    pp=ww*h*h/2
    xx=0.0
    yy=h/3
    return vv,pp,xx,yy


def pd_uwl(ELB,UWL):
    # U/S dynamic water pressure
    h=UWL-ELB
    vv=0.0
    pp=ww*7/12*kh*h*h
    xx=0.0
    yy=0.4*h
    return vv,pp,xx,yy


def p_usl(ELB,USL):
    # U/S sedimentation pressure
    h=USL-ELB
    vv=0.0
    pp=ws*ce*h*h/2
    xx=0.0
    yy=h/3
    return vv,pp,xx,yy


def w_uwl(ELF,ELB,m,UWL):
    # U/S water weight
    if ELF<UWL:    
        h1=UWL-ELF
        h2=ELF-ELB
        w1=ww*h1*h2*m  ; x1=h2*m/2; y1=0.0
        w2=ww*h2*h2*m/2; x2=h2*m/3; y2=0.0
    else:
        h2=UWL-ELB
        w1=0.0         ; x1=0.0   ; y1=0.0
        w2=ww*h2*h2*m/2; x2=h2*m/3; y2=0.0
    vv=w1+w2
    pp=0.0
    xx=0.0
    yy=0.0
    if 0<m: 
        xx=(w1*x1+w2*x2)/vv
        yy=(w1*y1+w2*y2)/vv
    return vv,pp,xx,yy
    

def w_usl(ELF,ELB,m,USL):
    # U/S sedimentation weight
    if ELF<USL:    
        h1=USL-ELF
        h2=ELF-ELB
        w1=ws*h1*h2*m  ; x1=h2*m/2; y1=0.0
        w2=ws*h2*h2*m/2; x2=h2*m/3; y2=0.0
    else:
        h2=USL-ELB
        w1=0.0         ; x1=0.0   ; y1=0.0
        w2=ws*h2*h2*m/2; x2=h2*m/3; y2=0.0
    vv=w1+w2
    pp=0.0
    xx=0.0
    yy=0.0
    if 0<m:
        xx=(w1*x1+w2*x2)/vv
        yy=(w1*y1+w2*y2)/vv
    return vv,pp,xx,yy

    
def uplift(ELT,ELF,ELB,xg,yg,m,n,UWL,DWL):
    b=(ELF-ELB)*m+(ELT-ELB)*n
    h1=UWL-ELB
    h2=DWL-ELB
    hg=0.2*(h2-h1)+h2+yg
    u1=ww*xg*(h1-h2)/2    ; x1=xg/3       ; y1=0.0
    u2=ww*xg*h2           ; x2=xg/2       ; y2=0.0
    u3=ww*(b-xg)*(yg-h2)/2; x3=xg+(b-xg)/3; y3=0.0
    u4=ww*(b-xg)*h2       ; x4=xg+(b-xg)/2; y4=0.0
    uu=u1+u2+u3+u4
    pp=0.0
    xx=(u1*x1+u2*x2+u3*x3+u4*x4)/uu
    yy=(u1*y1+u2*y2+u3*y3+u4*y4)/uu
    return -uu,pp,xx,yy
    
    
def p_dwl(ELB,DWL):
    # D/S water pressure
    h=DWL-ELB
    vv=0.0
    pp=ww*h*h/2
    xx=0.0
    yy=h/3    
    return vv,-pp,xx,yy


def p_dsl(ELB,DSL):
    # D/S sedimentation pressure
    h=DSL-ELB
    vv=0.0
    pp=ws*ce*h*h/2
    xx=0.0
    yy=h/3    
    return vv,-pp,xx,yy


def w_dwl(ELT,ELF,ELB,n,m,DWL):
    # D/S water weight
    b=(ELF-ELB)*m+(ELT-ELB)*n
    h=DWL-ELB
    vv=ww*n*h*h/2
    pp=0.0
    xx=b-n*h/3
    yy=0.0
    return vv,pp,xx,yy


def w_dsl(ELT,ELF,ELB,n,m,DSL):
    # D/S sedimentation weight
    b=(ELF-ELB)*m+(ELT-ELB)*n
    h=DSL-ELB
    vv=ws*n*h*h/2
    pp=0.0
    xx=b-n*h/3
    yy=0.0
    return vv,pp,xx,yy


def calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m):
    num=11
    fv=np.zeros(num,dtype=np.float64)
    fh=np.zeros(num,dtype=np.float64)
    x =np.zeros(num,dtype=np.float64)
    y =np.zeros(num,dtype=np.float64)
    si=['dam body weught',
        'U/S water pressure',
        'U/S dynamic pressure',
        'U/S sedimentation pressure',
        'U/S water weight',
        'U/S sedimentation weight',
        'Uplift',
        'D/S water pressure',
        'D/S sedimentation pressure',
        'D/S water weight',
        'D/S sedimentation weight'
    ]
    i=0;  fv[i],fh[i],x[i],y[i]=dambody(tw,ELT,ELB,ELF,n,m) # self-weight of concrete
    i=1;  fv[i],fh[i],x[i],y[i]=p_uwl(ELB,UWL)              # U/S water pressure
    i=2;  fv[i],fh[i],x[i],y[i]=pd_uwl(ELB,UWL)             # U/S dynamic water pressure
    i=3;  fv[i],fh[i],x[i],y[i]=p_usl(ELB,USL)              # U/S sedimentation pressure
    i=4;  fv[i],fh[i],x[i],y[i]=w_uwl(ELF,ELB,m,UWL)        # U/S water weight
    i=5;  fv[i],fh[i],x[i],y[i]=w_usl(ELF,ELB,m,USL)        # U/S sedimentation weight
    i=6;  fv[i],fh[i],x[i],y[i]=uplift(ELT,ELF,ELB,xg,yg,m,n,UWL,DWL) # uplift
    i=7;  fv[i],fh[i],x[i],y[i]=p_dwl(ELB,DWL)              # D/S water pressure
    i=8;  fv[i],fh[i],x[i],y[i]=p_dsl(ELB,DSL)              # D/S sedimentation pressure
    i=9;  fv[i],fh[i],x[i],y[i]=w_dwl(ELT,ELF,ELB,n,m,DWL)  # D/S water weight
    i=10; fv[i],fh[i],x[i],y[i]=w_dsl(ELT,ELF,ELB,n,m,DSL)  # D/S sedimentation weight
    fv=np.round(fv,decimals=3)
    fh=np.round(fh,decimals=3)
    x =np.round(x,decimals=3)
    y =np.round(y,decimals=3)
    fm=np.round(fv*x+fh*y,decimals=3)
    sum_v=np.sum(fv)
    sum_h=np.sum(fh)
    sum_m=np.sum(fm)
    bb=np.round(m*(ELF-ELB)+n*(ELT-ELB),decimals=3)
    ee=np.round(sum_m/sum_v-bb/2,decimals=3)
    pu=np.round(sum_v/bb*(1-6*ee/bb),decimals=3)
    pd=np.round(sum_v/bb*(1+6*ee/bb),decimals=3)
    sf=np.round((cc*bb+sum_v*ff)/sum_h,decimals=3)
    b6=np.round(bb/6,decimals=3)
    sj1='NG'
    sj2='NG'
    if 0<pu: sj1='ok'
    if 4<sf: sj2='ok'    

    ss=[]    
    ss=ss+[tstr]
    s='{0:30s},{1:>14s},{2:>14s},{3:>14s},{4:>14s},{5:>14s}'.format('Item','V(kN/m)','H(kN/m)','x(m)','y(m)','M(kN-m/m)')
    ss=ss+[s]
    for i in range(len(si)):
        s='{0:30s},{1:14.3f},{2:14.3f},{3:14.3f},{4:14.3f},{5:14.3f}'.format(si[i],fv[i],fh[i],x[i],y[i],fm[i])
        ss=ss+[s]
    s='{0:30s},{1:14.3f},{2:14.3f},{3:14s},{4:14s},{5:14.3f}'.format('Sum',sum_v,sum_h,'','',sum_m)
    ss=ss+[s]
    s='{0:30s},{1:>14s},{2:>14s},{3:>14s},{4:>14s},{5:>14s}'.format('Overturning','b/6(m)','e(m)','pu(kN/m2)','pd(kN/m2)','')
    ss=ss+[s]
    s='{0:30s},{1:14.3f},{2:14.3f},{3:14.3f},{4:14.3f},{5:>14s}'.format('',b6,ee,pu,pd,sj1)
    ss=ss+[s]
    s='{0:30s},{1:>14s},{2:>14s},{3:>14s},{4:>14s},{5:>14s}'.format('Sliding','c(kN/m2)','f','b(m)','SF','')
    ss=ss+[s]
    s='{0:30s},{1:14.3f},{2:14.3f},{3:14.3f},{4:14.3f},{5:>14s}'.format('',cc,ff,bb,sf,sj2)
    ss=ss+[s]
    ss=ss+['']
    for i in range(len(ss)):
        print(ss[i])

    return ss


def main():
    fnameF='fig_sec_BU.png'
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_BU()
    s_BU=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    drawfig(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara,fnameF)

    fnameF='fig_sec_BL.png'
    # above fillet
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_BL1()  
    s_BL1=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    # below fillet
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_BL2()  
    s_BL2=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    drawfig(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara,fnameF)
    
    fnameF='fig_sec_JU.png'
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_JU()   
    s_JU=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    drawfig(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara,fnameF)

    fnameF='fig_sec_JL.png'
    # above fillet
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_JL1()   
    s_JL1=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    #below fillet
    tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara=inp_JL2()   
    s_JL2=calc(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m)
    drawfig(tstr,tw,ELT,UWL,USL,DWL,DSL,ELB,ELF,xg,yg,n,m,fpara,fnameF)

    fnameW='test.txt'
    f=open(fnameW,'w')
    for fn in [s_BU,s_BL1,s_BL2,s_JU,s_JL1,s_JL2]:
        for i in range(len(fn)):
            print(fn[i],file=f)
    f.close()    
    

#---------------
# Execute
#---------------
if __name__ == '__main__': main()

Sample of result is shown below.

* Basochhu PSPP Upper dam non-overflow section (H=87.0m)
Item                          ,       V(kN/m),       H(kN/m),          x(m),          y(m),     M(kN-m/m)
dam body weught               ,     76372.961,     11455.944,        24.450,        29.561,   2205968.057
U/S water pressure            ,         0.000,     33620.000,         0.000,        27.333,    918935.460
U/S dynamic pressure          ,         0.000,      5883.500,         0.000,        32.800,    192978.800
U/S sedimentation pressure    ,         0.000,      5495.520,         0.000,        14.267,     78404.584
U/S water weight              ,         0.000,         0.000,         0.000,         0.000,         0.000
U/S sedimentation weight      ,         0.000,         0.000,         0.000,         0.000,         0.000
Uplift                        ,    -12843.750,         0.000,        28.905,         0.000,   -371248.594
D/S water pressure            ,         0.000,     -1125.000,         0.000,         5.000,     -5625.000
D/S sedimentation pressure    ,         0.000,      -675.000,         0.000,         5.000,     -3375.000
D/S water weight              ,       956.250,         0.000,        69.700,         0.000,     66650.625
D/S sedimentation weight      ,      1147.500,         0.000,        69.700,         0.000,     79980.750
Sum                           ,     65632.961,     54654.964,              ,              ,   3162669.682
Overturning                   ,        b/6(m),          e(m),     pu(kN/m2),     pd(kN/m2),              
                              ,        12.325,        11.212,        80.148,      1694.915,            ok
Sliding                       ,      c(kN/m2),             f,          b(m),            SF,              
                              ,      3200.000,         1.200,        73.950,         5.771,            ok

Thank you.