GfsOutputLocation

From Gerris

Jump to: navigation, search

GfsOutputLocation writes the values of all permanent variables at a set of given locations. The first time GfsOutputLocation is called it writes a comment describing the fields being written.

The values are linearly interpolated to the given location using gfs_interpolate().

The syntax in parameter files is as follows:

[ GfsOutput ] X Y Z

where X, Y and Z are the coordinates of the location.

or:

[ GfsOutput ] FILE

where FILE is the name of a text file containing the space-separated X, Y and Z coordinates of a set of locations.

or:

[ GfsOutput ] { X1 Y1 Z1 ... XN YN ZN }

where the Xi, Yi and Zi are the coordinates of the set of locations.

An optional parameter block can also be appended to the syntax above, for example:

[ GfsOutput ] X Y Z {
  label = "Location 1"
  precision = %g
  interpolate = 1
}

with

label
a label to be displayed by GfsView when using the "Location" object,
precision
the C-format used to output the text-formatted values of variables (default is %g),
interpolate
whether to interpolate (bilinearly) at the given location or just return the value of the variable for the cell which contains this particular location (default is 1).

Note

There is no constraint on the coordinates of the input locations but only locations which are within the simulation domain will be written in the output file.

Examples

  • Tsunami runup onto a complex three-dimensional beach
  •     OutputLocation { istep = 1 } input 1e-3 1.7 0
    

        OutputLocation { istep = 1 } p5 4.521 1.196 0
    

        OutputLocation { istep = 1 } p7 4.521 1.696 0
    

        OutputLocation { istep = 1 } p9 4.521 2.196 0
    

  • The 2004 Indian Ocean tsunami
  •     OutputLocation { start = 6900 } jason.txt jason.xy
    

  • Viscous flow past a sphere
  •     OutputLocation { step = 0.1 } {
    	awk 'BEGIN { t = 2.; oldl = -1.; oldt = 0.; } {
              if ($1 != t) { t = $1; x1 = $2; u1 = $7; }
              else {
                x2 = $2; u2 = $7;
                if (u1 <= 0. && u2 > 0.) {
                  l = (u1*x2 - u2*x1)/(u1 - u2) - A0;
                  dl = (l - oldl)/(t - oldt);
                  print t, l, dl;
                  fflush (stdout);
                  oldl = l;
                  oldt = t;
                }
                x1 = x2; u1 = u2;
              }
            }' > l-LEVEL-RE
        } axis
    

  • Lid-driven cavity at Re=1000
  •   OutputLocation { start = end } xprof xprofile
    

      OutputLocation { start = end } yprof yprofile
    

  • Lid-driven cavity at Re=1000 (explicit scheme)
  •   OutputLocation { start = end } xprof ../xprofile
    

      OutputLocation { start = end } yprof ../yprofile
    

  • Lid-driven cavity with a non-uniform metric
  •   OutputLocation { start = end } xprof xprofile
    

      OutputLocation { start = end } yprof yprofile
    

  • Lid-driven cavity on an anisotropic mesh
  •   OutputLocation { start = end } xprof xprofile
    

      OutputLocation { start = end } yprof yprofile
    

  • Creeping Couette flow of Generalised Newtonian fluids
  •   OutputLocation { start = end } { awk '{if ($1 != "#") print $2,$8;}' > prof-MODEL } profile
    

  • Transcritical flow with multiple layers
  •     OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-10-LEVEL-NL } 10. 10.49 0
    

        OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-15-LEVEL-NL } 15. 10.49 0
    

        OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-20-LEVEL-NL } 20. 10.49 0
    

  • Poisson equation on a sphere with Gaussian forcing
  •   OutputLocation { start = end } prof.dat profile
    

  • Gaussian forcing using longitude-latitude coordinates
  •   OutputLocation { start = end } prof.dat profile
    

  • Relaxation of a charge bump
  •     OutputLocation { istep = 10 } { 
            awk '
             BEGIN {
                    a = 0.05 
                    perm = 2.
                    K = 1.
                    rhoinic = 1./a/sqrt(2.*3.14159265358979)
             } 
             {
                if ($1 != "#")
                    print $1, rhoinic*exp(-$1*K/perm), $12;
             }' > timevol-SCHEME
        } { 0. 0. 0. }
    

  • Equilibrium of a droplet suspended in an electric field
  •     OutputLocation { start = end } {
    	awk '
    	BEGIN {
    	    R0 = 0.1
    	    Ef = 1.34
    	    mu = 0.1
    	    ep2 = 1.
    	    R = 5.1
    	    Q = 10.
    	    lambda = 1.
    	    factor = R0*Ef*Ef*ep2/mu
    	    theta = 3.14159265358979/4.
    	    A=-9./10.*(R-Q)/(R+2.)**2/(1.+lambda)
    	    st = sr = 0.
    	    sn = 0.
    	    
    	}
    	function radius(x,y)
    	{
    	    return sqrt(x*x+y*y)/R0
    	}
    	function vr(x,y,vx,vy)
    	{
    	    return (vx*x+vy*y)/(factor*sqrt(x*x+y*y))
    	}
    	function vt(x,y,vx,vy)
    	{
    	    return (vx*y-vy*x)/(factor*sqrt(x*x+y*y))
    	}
    	#  Theoretical velocity profile
    	function vtr(x)
    	{
    	    if (x < 1.)
    		return A*x*(1.-x**2)*(3.*sin(theta)**2-1.);
    	    else
    		return A*x**(-2)*(x**(-2)-1.)*(3.*sin(theta)**2-1.);
    	}
    	function vtt(x)
    	{
    	    if (x < 1.)
    		return 3.*A/2.*x*(1.-5./3.*x**2)*sin(2.*theta);
    	    else
    		return -A*x**(-4)*sin(2.*theta);
    	}
    	{
    	    if ($1 != "#") {
    		r = radius($2,$3)
    		tvr = vtr(r)
    		tvt = vtt(r)
    		print r,vr($2,$3,$7,$8),vt($2,$3,$7,$8),tvr,tvt
    		sr += (vr($2,$3,$7,$8) - tvr)**2
    		st += (vt($2,$3,$7,$8) - tvt)**2
    		sn += 1.
    	    }
            }
    	END {
    	    print sqrt(sr/sn),sqrt(st/sn) > "/dev/stderr"
    	}' > fprof
        } thetapi4
    

  • Gouy-Chapman Debye layer
  •     OutputLocation { start = end } { 
    	awk '{ if ($1 != "#") print $2, $9, $12, $13; }' > profile 
        } points
    

Views
Navigation
communication