#!/bin/csh # # ctod.awk - Reads the output of mon.awk and extracts the CTOD data. # # # Input Format # ~~~~~~~~~~~~ # # Global Forces: # Step App_x_react App_y_react Fix_x_react Fix_y_react FX FY # Monitor Nodes: # UX UY RX RY # Monitor Points: # Face Layer X Y SigX SigY SigXY EpsX EpsY EpsXY # Tip: # Step Extension CTOD FX FY # BEGIN { state = 0 ; fstep = 0 ; cstep = 0 ; nnode = 0 ; nface = 0 tipid = 0 } $0 ~ /Node/ { state = 0 node = $4 nstep[node] = 0 ++nnode nodes[nnode] = node # print "Node " node " state " state } $0 ~ /Face/ { # only handles one point per face state = 0 face = $4 pstep[face] = 0 ++nface faces[nface] = face # print "Face " face " state " state } $0 ~ /Tip_Id/ { if (tipid > 0) { dump_ctod() } tipid = $2 } /[0-9]/ { if( state == 1 ) { fstep = $1 AppX[fstep] = $2 AppY[fstep] = $3 FixX[fstep] = $4 FixY[fstep] = $5 FX[fstep] = $6 FY[fstep] = $7 } if( state == 2 ) { nstep[node] += 1 indx = node "," nstep[node] UX[indx] = $2 UY[indx] = $3 RX[indx] = $4 RY[indx] = $5 } if( state == 3 ) { pstep[face] += 1 indx = face "," pstep[face] # ignore the stresses and strains for now UXp[indx] = $8 # mostly we want load-line displacements UYp[indx] = $9 } if( state == 4 ) { cstep = $1 xtip[cstep] = $2 ctod[cstep] = $4 } } $0 ~ /FixX/ { state = 1 } $0 ~ /Node/ { state = 2 } $0 ~ /Face/ { state = 3 } $0 ~ /Tip_Id/ { state = 4 } END { dump_ctod() } function dump_ctod() { printf("Tip_Id: %d\n", tipid) #if ( fstep != cstep ) { # printf("ERROR - fstep != cstep (%d != %d)\n", fstep, cstep) # exit 1 #} # printf("%5s %13s %13s %13s %13s %13s %13s ", \ # "Step", "AppX", "AppY", "FixX", "FixY", "FX", "FY") printf("%5s %13s %13s %13s ", \ "Step", "AppY", "FixY", "FY") # print "nnode: " nnode # print "nstep: " nstep[nodes[nnode]] # for( i = 1 ; i <= nnode ; ++i ) { # if ( nstep[nodes[i]] == cstep ) { # printf("%13s %13s %13s %13s ", \ # "UXN" nodes[i], "UYN" nodes[i], "RXN" nodes[i], "RYN" nodes[i] ) # } # } for( i = 1 ; i <= nnode ; ++i ) { if ( nstep[nodes[i]] == cstep ) { printf("%13s ", "UYN" nodes[i] ) } } # print "nface: " nface # print "cstep: " cstep # print "pstep: " pstep[faces[nface]] for( i = 1 ; i <= nface ; ++i ) { if ( pstep[faces[i]] == cstep ) { printf("%13s %13s ", \ "UXP" faces[i], "UYP" faces[i] ) } } printf("%13s %13s\n", "X_Tip", "CTOD") for( step = 1 ; step < cstep ; ++step ) { if ( xtip[step+1] != xtip[step] ) { dump_data() } } dump_data() } function dump_data() { printf("%5d %13g %13g %13g", \ step,AppY[step], \ FixY[step], \ FY[step]) # printf("%5d %13g %13g %13g %13g %13g %13g", \ # step,AppX[step],AppY[step], \ # FixX[step],FixY[step], \ # FX[step],FY[step]) # for( i = 1 ; i <= nnode ; ++i ) { # if ( nstep[nodes[i]] == cstep ) { # indx = nodes[i] "," step # printf(" %13g %13g %13g %13g", \ # UX[indx],UY[indx],RX[indx],RY[indx] ) # } # } for( i = 1 ; i <= nnode ; ++i ) { if ( nstep[nodes[i]] == cstep ) { indx = nodes[i] "," step printf(" %13g", UY[indx] ) } } for( i = 1 ; i <= nface ; ++i ) { if ( pstep[faces[i]] == cstep ) { indx = faces[i] "," step printf(" %13g %13g", UXp[indx],UYp[indx] ) } } printf(" %13g %13g\n", xtip[step], ctod[step] ) }