Permalink
Browse files

Added some scripts

  • Loading branch information...
1 parent 8ba70fb commit 91e06828d94439487d70a99ccf40c2377bf867ac Paweł Biernat committed Mar 5, 2010
Showing with 82 additions and 0 deletions.
  1. +23 −0 fitApproach_sy.gp
  2. +11 −0 moving_mesh_plot.gp
  3. +48 −0 moving_mesh_plot.sh
View
@@ -0,0 +1,23 @@
+#!/usr/bin/gnuplot -persist
+
+set macro
+
+FIT_LIMIT=1.e-50
+
+A0=2.857
+A1=5.e-10
+A2=-1
+L1=1
+L2=-.5
+
+file="log/info_1/log000.dat"
+f(t)=A0+A1*exp(L1*t)+A2*exp(L2*t)
+FILE="\"log/info_1/log000.dat\" u ($1/100):($5/10)"
+
+plot [5:] @FILE w l, f(x)
+fit [5:] f(x) @FILE via A0,A1,A2,L1,L2
+replot
+
+set print "fitApproach_sy.dat"
+print "A1=",A1
+print "A2=",A2
View
@@ -0,0 +1,11 @@
+#!/usr/bin/gnuplot -persist
+
+set title "Mesh movement"
+set xlabel "Mesh points"
+set ylabel "Time"
+set logscale x 10
+
+set terminal postscript
+set output "moving_mesh_plot.ps"
+
+load "plotter.gp"
View
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+DIR=harvester_data
+PLOTTER_FILE="plotter.gp"
+info_file="log/info_1/log000.dat"
+snapshot_dir="log/snapshot"
+snapshot_name="*.dat"
+snapshot_files=$(find $snapshot_dir -name "$snapshot_name" |
+ sort| awk 'NR % 5 == 0' )
+ # | awk 'NR % 5 == 0')
+
+file=$(echo "$snapshot_files" | head -n1)
+l=$(grep -v '#' $file | wc -l)
+evr=2
+range=$(seq 2 $evr $l )
+
+echo "Printing point positions to temporary files"
+for i in $range; do
+ temp[i]=$(mktemp)
+ for f in $snapshot_files; do
+ t=$(cat $f | sed -n -e 's|.*t = \(.*\)|\1|p')
+ s=$(cat $f | sed -n -e 's|.*s = \(.*\)|\1|p')
+
+ grep -v '#' $f | awk "NR==$i {print \$1, $s}" >> ${temp[$i]}
+ done
+done
+
+# exit 0
+
+echo "plotting"
+cmd="plot"
+i="1"
+for temp_file in ${temp[*]}; do
+ lw=$(echo "(0==($i % 5))+(0==($i % 10))+1"|bc)
+ lt=$(echo "4-$lw"|bc)
+ i=$((i+1))
+
+ cmd="$cmd \"$temp_file\" w l lt 1 lw 1 t \"\", "
+done
+cmd=${cmd%,*}
+
+echo "" > plotter.gp
+echo "$cmd" >> plotter.gp
+./moving_mesh_plot.gp
+
+for f in ${temp[*]}; do
+ rm $f
+done

0 comments on commit 91e0682

Please sign in to comment.