[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8

Stephane Popinet popinet at users.sf.net
Tue Nov 24 12:24:42 UTC 2009


The following commit has been merged in the upstream branch:
commit 6e0ff62c54b8fda2198af52182f3282a9c53c2cd
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Tue Jul 14 11:21:20 2009 +1000

    New parallel vortex street example
    
    darcs-hash:20090714012120-d4795-231e8796dee223153b71b65dd2167450512e9d0c.gz

diff --git a/doc/examples/cylinder/parallel/parallel.gfs b/doc/examples/cylinder/parallel/parallel.gfs
new file mode 100644
index 0000000..e13426e
--- /dev/null
+++ b/doc/examples/cylinder/parallel/parallel.gfs
@@ -0,0 +1,139 @@
+# Title: Parallel simulation on four processors
+#
+# Description:
+#
+# The simulation is run in parallel on four processors. Load balancing
+# is used to dynamically redistribute the elements across processors
+# in order to maintain roughly equal mesh sizes on each processor as
+# the resolution varies due to adaptive mesh refinement.
+#
+# \begin{figure}[htbp]
+# \caption{\label{pid}MPEG movie of the processor number
+# assigned to each cell (colour field) together with isolines of
+# vorticity.}
+# \begin{center}
+# \htmladdnormallinkfoot{\includegraphics[width=\hsize]{pid.eps}}{pid.mpg}
+# \end{center}
+# \end{figure}
+#
+# \begin{figure}[htbp]
+# \caption{\label{balance}Imbalance in mesh size as a function of time
+# expressed as the percent difference in number of elements between
+# the largest and smallest subdomain.}
+# \begin{center}
+# \includegraphics[width=0.8\hsize]{balance.eps}
+# \end{center}
+# \end{figure}
+#
+# Author: St\'ephane Popinet
+# Command: sh parallel.sh
+# Version: 090713
+# Required files: parallel.sh pid.gfv
+# Running time: 32 minutes
+# Generated files: pid.mpg pid.eps balance.eps
+#
+8 7 GfsSimulation GfsBox GfsGEdge {} {
+
+  # Stop the simulation at t = 15
+  Time { end = 15 }
+
+  # Insert the solid boundary defined as x*x + y*y - 0.0625*0.0625 = 0
+  # (i.e. a cylinder of radius 0.0625 centered on the origin)
+  Solid (x*x + y*y - 0.0625*0.0625)
+
+  # Use an initial refinement of 6 levels (i.e. 2^6=64x64 for each
+  # box) only around the solid boundary
+  RefineSolid 6
+
+  # Add a passive tracer called T
+  VariableTracer {} T
+
+  # Set the initial x-component of the velocity to 1
+  Init {} { U = 1 }
+
+  # Adapt the mesh using the vorticity criterion at every timestep
+  # down to a maximum level of 6 and with a maximum tolerance of 1e-2
+  AdaptVorticity { istep = 1 } { maxlevel = 6 cmax = 1e-2 }
+
+  # Adapt the mesh using the gradient criterion on variable T at
+  # every timestep, down to a maximum level of 6 and with a maximum tolerance of 1e-2
+  AdaptGradient { istep = 1 } { maxlevel = 6 cmax = 1e-2 } T
+
+  # Set a viscosity source term on the velocity vector
+  # The Reynolds number is Re = D*U/Nu = 0.125*1/0.00078125 = 160
+  # where D is the cylinder diameter (as defined in cylinder.gts)
+  SourceViscosity 0.00078125
+
+  # Balance the number of elements across parallel subdomains at every
+  # timestep if the imbalance is larger than 0.1 (i.e. 10% difference
+  # between the largest and smallest subdomains).
+  EventBalance { istep = 1 } 0.1
+
+  # Writes the time and timestep every 10 timesteps on standard error
+  OutputTime { istep = 10 } stderr
+
+  # Writes the time and simulation balance every timestep in 'balance'
+  OutputTime { istep = 1 } balance
+  OutputBalance { istep = 1 } balance
+
+  # Writes info about the convergence of the Poisson solver on standard error
+  OutputProjectionStats { istep = 10 } stderr
+
+  # Outputs the simulation to standard output every 0.05 time unit
+  OutputSimulation { step = 0.05 } stdout
+  
+  # Sends a command to gfsview on standard output to save PPM images
+  EventScript { step = 0.05 } {
+      echo "Save stdout { width = 1600 height = 200 }" 
+  }
+
+  # Outputs profiling information at the end of the simulation to standard error
+  OutputTiming { start = end } stderr
+
+  # Generate graphics
+  OutputSimulation { start = end } end.gfs
+  EventScript { start = end } {
+      echo "Save pid.eps { format = EPS width = 800 height = 100 line_width = 0.2 }" | \
+	  gfsview-batch2D end.gfs pid.gfv
+      awk '{
+        if ($1 == "step:")
+          t = $4;
+        else if ($1 == "domain")
+          print t, 100.*($9/$3 - 1.);
+      }' < balance > balance1
+      cat <<EOF | gnuplot
+      set term postscript eps lw 3 solid 20 colour
+      set output 'balance.eps'
+      set xlabel 'Time'
+      set ylabel 'Imbalance (%)'
+      set grid
+      unset key
+      plot [][0:100]'balance1' w l, 10
+EOF
+  }
+}
+GfsBox {
+  # Left boundary on the leftmost box is:
+  #   Dirichlet U=1 for the x-component of the velocity
+  #   Dirichlet T = 1 if y < 0, 0 otherwise
+  left = Boundary {
+    BcDirichlet U 1
+    BcDirichlet T { return y < 0. ? 1. : 0.; }
+  }
+}
+GfsBox {}
+GfsBox {}
+GfsBox {}
+GfsBox {}
+GfsBox {}
+GfsBox {}
+# Right boundary on the rightmost box is outflow
+GfsBox { right = BoundaryOutflow }
+# All the boxes are linked by left to right links
+1 2 right
+2 3 right
+3 4 right
+4 5 right
+5 6 right
+6 7 right
+7 8 right
diff --git a/doc/examples/cylinder/parallel/parallel.sh b/doc/examples/cylinder/parallel/parallel.sh
new file mode 100644
index 0000000..a4c3329
--- /dev/null
+++ b/doc/examples/cylinder/parallel/parallel.sh
@@ -0,0 +1,11 @@
+# !/bin/sh
+
+# split the domain twice to get enough boxes to redistribute
+gerris2D -s 2 parallel.gfs > parallel-s2.gfs
+
+# create the initial partition into 2^2=4 subdomains
+gerris2D -p 2 parallel-s2.gfs > parallel-p2.gfs
+
+# run the parallel simulation on 4 processors, pipe the output to
+# gfsview and ppm2mpeg to generate the pid movie
+mpirun -np 4 gerris2D parallel-p2.gfs | gfsview-batch2D pid.gfv | ppm2mpeg -s 800x100 > pid.mpg
diff --git a/doc/examples/garden/mesh.gfv b/doc/examples/cylinder/parallel/pid.gfv
similarity index 74%
copy from doc/examples/garden/mesh.gfv
copy to doc/examples/cylinder/parallel/pid.gfv
index 83b64cb..ed18cbd 100644
--- a/doc/examples/garden/mesh.gfv
+++ b/doc/examples/cylinder/parallel/pid.gfv
@@ -1,9 +1,9 @@
 # GfsView 2D
 View {
-  tx = 0 ty = 0
+  tx = -3.50148 ty = -0.000614477
   sx = 1 sy = 1 sz = 1
   q0 = 0 q1 = 0 q2 = 0 q3 = 1
-  fov = 24.9119
+  fov = 3.57418
   r = 0.3 g = 0.4 b = 0.6
   res = 1
   lc = 0.001
@@ -16,21 +16,25 @@ Isoline {
 } {
   n.x = 0 n.y = 0 n.z = 1
   pos = 0
-} Hs {
-  amin = 1
-  amax = 1
+} Vorticity {
+  amin = 0 min = -20
+  amax = 0 max = 20
   cmap = Jet
 } 0 {
   reversed = 0
   use_scalar = 1
 } {
-  n = 7
+  n = 20
 }
-Cells {
+Squares {
   r = 0 g = 0 b = 0
   shading = Constant
   maxlevel = -1
 } {
   n.x = 0 n.y = 0 n.z = 1
   pos = 0
+} Pid {
+  amin = 1
+  amax = 1
+  cmap = Jet
 }
diff --git a/doc/examples/template.tex b/doc/examples/template.tex
index 8098749..100fc70 100644
--- a/doc/examples/template.tex
+++ b/doc/examples/template.tex
@@ -47,6 +47,7 @@ The usefulness and quality of this document very much depend on the contribution
 
 \input{cylinder/cylinder.tex}
 \input{cylinder/heated/heated.tex}
+\input{cylinder/parallel/parallel.tex}
 \input{rt/rt.tex}
 \input{boussinesq/boussinesq.tex}
 \input{logo/logo.tex}

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list