# # mon.awk - Reads a .mon file output from FRANC2D/L and processes the data # into more useable tables # # Input Format # ~~~~~~~~~~~~ # # 1 Global Forces: # Step, App_x_react, App_y_react, Fix_x_react, Fix_y_react, FX, FY # 2 Monitor Nodes: # Node Layer X Y UX UY RX RY # 3 Monitor Points: # Face Layer X Y SigX SigY SigXY EpsX EpsY EpsXY UX UY # 4 Crack: # CrkId MaxCTOD Initial_tied Num_tied # 5 Relaxing: # Steps # 6 Tips: # TipId CTOD Dir Rnode Lnode Xtip Ytip # 7 Lengths: # Crk Length # # # Output Format # ~~~~~~~~~~~~~ # # # BEGIN { ignore_relaxing = 0 state = 0 nface[0] = 0 nnode[0] = 0 tips[0] = 0 crks[0] = 0 ntip[0] = 0 ncrk[0] = 0 ntips = 0 ncrks = 0 } /[0-9]/ { if( state == 1 ) { # Global Forces step = $1 nstep[step] = step AppX[step] = $2 AppY[step] = $3 FixX[step] = $4 FixY[step] = $5 FX[step] = $6 FY[step] = $7 } if( state == 2 ) { # Monitor Nodes node = $1 nnode[node] += 1 num = nnode[node] indx = node "," num layer[indx] = $2 NX[indx] = $3 NY[indx] = $4 UX[indx] = $5 UY[indx] = $6 RX[indx] = $7 RY[indx] = $8 } if( state == 3 ) { # Monitor Points face = $1 nface[face] += 1 num = nface[face] indx = face "," num PX[indx] = $3 PY[indx] = $4 SigX[indx] = $5 SigY[indx] = $6 SigXY[indx] = $7 EpsX[indx] = $8 EpsY[indx] = $9 EpsXY[indx] = $10 UXp[indx] = $11 UYp[indx] = $12 } if( state == 4 ) { # Crack ; # ignore for now } if( state == 5 ) { # Relaxing relaxing = $1 } if( state == 6 ) { # Tips tipid = $1 ctod = $2 dir = $3 rnode = $4 lnode = $5 xtip = $6 ytip = $7 ntip[tipid] += 1 if (!(tipid in tips)) tips[++ntips] = tipid indx = tipid "," step xtip_vs_step[indx] = xtip ytip_vs_step[indx] = ytip ctod_vs_step[indx] = ctod } if( state == 7 ) { # Lengths crkid = $1 len = $2 if (!(crkid in crks)) crks[++ncrks] = crkid indx = crkid "," step length_vs_step[indx] = len } } $0 ~ /Global Forces/ { state = 1 } $0 ~ /Monitor Nodes/ { state = 2 } $0 ~ /Monitor Points/ { state = 3 } $0 ~ /Crack/ { state = 4 } $0 ~ /Relaxing/ { state = 5 } $0 ~ /Tips/ { state = 6 } $0 ~ /Lengths/ { state = 7 } END { printf("Global Forces: %d\n", step ) printf("%5s %13s %13s %13s %13s %13s %13s\n", \ "Step", "AppX", "AppY", "FixX", "FixY", "FX", "FY") for( j = 1 ; j <= step ; ++j ) { indx = j printf("%5d %13g %13g %13g %13g %13g %13g\n", \ indx,AppX[indx],AppY[indx], \ FixX[indx],FixY[indx], \ FX[indx],FY[indx] ) } for( node in nnode) { if( nnode[node] > 0 ) { printf("%d For Node %d\n", nnode[node], node) printf("%5s %13s %13s %13s %13s\n", \ "Step", "UX", "UY", "RX", "RY") } for( j = 1 ; j <= nnode[node] ; ++j ) { indx = node "," j printf("%5d %13g %13g %13g %13g\n", \ j, UX[indx],UY[indx],RX[indx],RY[indx] ) } } for( face in nface) { if( nface[face] > 0 ) { printf("%d For Face %d\n", nface[face], face) printf("%13s %13s %13s %13s %13s %13s %13s %13s\n", \ "SigX", "SigY", "SigXY", "EpsX", "EpsY", "EpsXY", "UX", "UY") } for( j = 1 ; j <= nface[face] ; ++j ) { indx = face "," j printf("%13g %13g %13g %13g %13g %13g %13g %13g\n", \ SigX[indx],SigY[indx],SigXY[indx], \ EpsX[indx],EpsY[indx],EpsXY[indx],UXp[indx],UYp[indx] ) } } for( tip in ntip) { if( ntip[tip] > 0 ) { printf("Tip_Id: %d\n", tip) printf("%5s %13s %13s %13s %13s %13s\n", \ "Step", "X_tip", "Y_tip", "CTOD", "FX", "FY") } for( j = 1 ; j <= ntip[tip] ; ++j ) { indx = tip "," j printf("%5d %13g %13g %13g %13g %13g\n", \ j,xtip_vs_step[indx],ytip_vs_step[indx], \ ctod_vs_step[indx], \ FX[j],FY[j] ) } } }