URI:
       tPass shell variables into awk via -v - 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
       ---
   DIR commit f550f3902efd1e03ea9d97e031fe5338229cd250
   DIR parent bb4859557c8a495cbe32920a5be9ecc08cb81691
  HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Thu, 26 Mar 2020 12:35:27 +0100
       
       Pass shell variables into awk via -v
       
       Diffstat:
         M flux_estimate/Makefile              |      18 +++++++++---------
       
       1 file changed, 9 insertions(+), 9 deletions(-)
       ---
   DIR diff --git a/flux_estimate/Makefile b/flux_estimate/Makefile
       t@@ -17,16 +17,16 @@ FLAGS = -m 0.45 -c 3e3 -n 100e3 -d 1e-3 -n 100e3 -s $(VEL) -L 4.0 -p $(POROSITY)
        SPEC_FLUX_STEADY != $(BIN) $(FLAGS) | $(SHEARFLUX)
        
        # total sediment volume passing WIDTH [m^3/s]
       -FLUX_STEADY != awk "BEGIN { print $(WIDTH)*$(SPEC_FLUX_STEADY) }"
       +FLUX_STEADY != awk -v w=$(WIDTH) -v f=$(SPEC_FLUX_STEADY) "BEGIN { print w*f }"
        
        # total sediment volume passing WIDTH [m^3/a]
       -YEARLY_VOL_STEADY != awk "BEGIN { print $(FLUX_STEADY)*3600.0*24.0*365.0 }"
       +YEARLY_VOL_STEADY != awk -v f=$(FLUX_STEADY) "BEGIN { print f*3600.0*24.0*365.0 }"
        
        # target sediment volume [m^3]
        TARGET_VOL = 5.34e11
        
        # time required to reach TARGET_VOLUME [a]
       -YEAR_DURATION_STEADY != awk "BEGIN { print $(TARGET_VOL)/$(YEARLY_VOL_STEADY) }"
       +YEAR_DURATION_STEADY != awk -v t=$(TARGET_VOL) -v v=$(YEARLY_VOL_STEADY) "BEGIN { print t/v }"
        
        default: steady variable_flux
        
       t@@ -48,9 +48,9 @@ variable.output00048.txt:
        variable_flux:
                # variable water-pressure, low amplitude
                @avg_spec_flux=$$($(SHEARFLUX) variable.output*.txt | awk '{sum+=$$1} END{print sum/NR}') && \
       -                avg_flux=$$(awk "BEGIN { print $(WIDTH)*$$avg_spec_flux }" ) && \
       -                yearly_volume=$$(awk "BEGIN { print $$avg_flux*3600.0*24.0*365.0 }" ) && \
       -                duration=$$(awk "BEGIN { print $(TARGET_VOL)/$$yearly_volume }" ) && \
       +                avg_flux=$$(awk -v avg_spec_flux="$$avg_spec_flux" "BEGIN { print $(WIDTH)*avg_spec_flux }" ) && \
       +                yearly_volume=$$(awk -v avg_flux="$$avg_flux" "BEGIN { print avg_flux*3600.0*24.0*365.0 }" ) && \
       +                duration=$$(awk -v target_vol=$(TARGET_VOL) -v yearly_volume="$$yearly_volume" "BEGIN { print target_vol/yearly_volume }" ) && \
                        printf 'Specific flux: %.5g m^2/s\n' "$$avg_spec_flux" && \
                        printf 'Avg. flux:     %.5g m^3/s\n' "$$avg_flux" && \
                        printf 'Yearly volume: %.5g a\n' "$$yearly_volume" && \
       t@@ -67,9 +67,9 @@ variable_hi.output00048.txt:
        variable_flux_hi:
                # variable water-pressure, high amplitude
                @avg_spec_flux=$$($(SHEARFLUX) variable.output*.txt | awk '{sum+=$$1} END{print sum/NR}') && \
       -                avg_flux=$$(awk "BEGIN { print $(WIDTH)*$$avg_spec_flux }" ) && \
       -                yearly_volume=$$(awk "BEGIN { print $$avg_flux*3600.0*24.0*365.0 }" ) && \
       -                duration=$$(awk "BEGIN { print $(TARGET_VOL)/$$yearly_volume }" ) && \
       +                avg_flux=$$(awk -v avg_spec_flux="$$avg_spec_flux" "BEGIN { print $(WIDTH)*avg_spec_flux }" ) && \
       +                yearly_volume=$$(awk -v avg_flux="$$avg_flux" "BEGIN { print avg_flux*3600.0*24.0*365.0 }" ) && \
       +                duration=$$(awk -v target_vol=$(TARGET_VOL) -v yearly_volume="$$yearly_volume" "BEGIN { print target_vol/yearly_volume }" ) && \
                        printf 'Specific flux: %.5g m^2/s\n' "$$avg_spec_flux" && \
                        printf 'Avg. flux:     %.5g m^3/s\n' "$$avg_flux" && \
                        printf 'Yearly volume: %.5g a\n' "$$yearly_volume" && \