URI: 
       tMakefile - cngf-pf-exp1 - experiments for first paper with continuum granular model
  HTML git clone git://src.adamsgaard.dk/manus_continuum_granular1_exp
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       tMakefile (2030B)
       ---
            1 BIN = ../cngf-pf/cngf-pf
            2 FIG != basename $(PWD)
            3 
            4 default: ../$(FIG).pdf
            5 
            6 sim.output00000.txt: $(BIN)
            7         /bin/sh -c '\
            8         ./$(BIN) -L 8.0 \
            9         -n 200e3 \
           10         -f 0.40 \
           11         -F \
           12         -k 2e-17 \
           13         -O 100e3 \
           14         -a 80e3 \
           15         -q $$( echo "1.0/(3600*24)" | bc -l ) \
           16         -I $$( echo "60*10" | bc -l ) \
           17         -e $$( echo "3600*24*7" | bc -l ) sim'
           18 
           19 timeseries.txt: sim.output00000.txt
           20         /bin/sh -c '\
           21         rm -f $@; \
           22         for f in sim.output*.txt; do \
           23                 tail -n 1 "$$f" | cut -f2- >> $@; \
           24         done'
           25 
           26 max_strainrate_depth.txt: sim.output00000.txt
           27         /bin/sh -c '\
           28         rm -f $@; \
           29         for f in sim.output*.txt; do \
           30                 awk " \
           31                         BEGIN{getline; depth=8.0; max=0.0} \
           32                         NF{ \
           33                                 if (\$$6 >= max && \$$6+0 > 1e-300) \
           34                                 { \
           35                                         max=\$$6; \
           36                                         depth=\$$1; \
           37                                 } \
           38                         } \
           39                         END{ \
           40                                 print depth,\"\t\",max \
           41                         }" \
           42                         "$$f" >> $@; \
           43         done'
           44 
           45 # central finite differences
           46 sediment_flux.txt: sim.output00000.txt
           47         /bin/sh -c '\
           48         rm -f $@; \
           49         for f in sim.output*.txt; do \
           50                 awk " \
           51                         BEGIN{getline; integral=0.0} \
           52                         NF{ \
           53                                 if (NR > 1) \
           54                                 { \
           55                                         integral+=(\$$2+v_prev)/2.0*(\$$1-z_prev); \
           56                                 } \
           57                                 z_prev=\$$1; \
           58                                 v_prev=\$$2; \
           59                         } \
           60                         END{ \
           61                                 print integral \
           62                         }" \
           63                         "$$f" >> $@; \
           64         done'
           65 
           66 ../$(FIG).pdf: fig.gp timeseries.txt max_strainrate_depth.txt sediment_flux.txt
           67         gnuplot fig.gp > $@
           68 
           69 max_pressure_gradient.pdf: max_pressure_gradient.txt
           70         gnuplot -e "set t pdfcairo; \
           71                 set xlabel 'output file [-]'; \
           72                 set ylabel 'max. norm. eff. stress gradient [kPa/m]'; \
           73                 plot 'max_pressure_gradient.txt' u 0:(\$$1/1e3) w l t ''" \
           74                 > $@
           75 
           76 max_pressure_gradient.txt: sim.output00000.txt
           77         > "$@"
           78         for f in sim.output*.txt; do \
           79                 awk ' \
           80                         function abs(x) \
           81                         { \
           82                                 return (x >= 0.0) ? x : -x; \
           83                         } \
           84                         { \
           85                                 if (NR > 1) { \
           86                                         dN_norm = abs(($$3 - N_prev)/($$1 - z_prev)); \
           87                                         if (dN_norm > dN_dx_norm_max) { \
           88                                                 dN_dx_norm_max = dN_norm; \
           89                                         } \
           90                                 } \
           91                                 z_prev = $$1; \
           92                                 N_prev = $$3; \
           93                         } \
           94                         END { \
           95                                 print dN_dx_norm_max \
           96                         }' "$$f" >> "$@"; done
           97 
           98 clean:
           99         rm -f *.txt
          100         rm -f ../$(FIG).pdf
          101 
          102 .PHONY: default clean