GfsAdvection

From Gerris

Jump to: navigation, search

Examples

  • Convergence of the Godunov advection scheme
  • 1 0 GfsAdvection GfsBox GfsGEdge {} {
      Time { end = 0.785398 }
      Refine LEVEL
      VariableTracer {} T { gradient = gfs_center_gradient }
      AdvectionParams { cfl = 0.5 }
      Init {} {
        U = -8.*y
        V = 8.*x
        T = {
          double r2 = x*x + y*y; 
          double coeff = 20. + 20000.*r2*r2*r2*r2;
          return (1. + cos(20.*x)*cos(20.*y))*exp(-coeff*r2)/2.;
        }
      }
      OutputErrorNorm { start = end } { awk '{ print LEVEL " " $5 " " $7 " " $9}' } { v = T } {
        s = {
          double r2 = x*x + y*y; 
          double coeff = 20. + 20000.*r2*r2*r2*r2;
          return (1. + cos(20.*x)*cos(20.*y))*exp(-coeff*r2)/2.;
        }
      }
    }
    

  • Time-reversed VOF advection in a shear flow
  • 1 0 GfsAdvection GfsBox GfsGEdge {} {
        Time { end = 5 }
        Refine 8
    
        # Add tracer T, using a VOF advection scheme.
        # The default scheme is a Van-Leer limited, second-order upwind scheme.
        VariableTracerVOF T
    
        InitFraction T (ellipse (0, -.236338, 0.2, 0.2))
    
        # Initialize U and V with the vortical shear flow field
        Init {} {
            U = sin((x + 0.5)*M_PI)*cos((y + 0.5)*M_PI)
            V = -cos((x + 0.5)*M_PI)*sin((y + 0.5)*M_PI)
        }
    
        # At t = 2.5 re-initialize U and V with the reversed flow field
        Init { start = 2.5 } { U = -U V = -V }
        
        # Adapt the mesh dynamically so that at any time the maximum of the gradient
        # of T is less than 1e-2 per cell length
        AdaptGradient { istep = 1 } { cmax = 1e-2 maxlevel = 8 minlevel = 6 } T
        
        OutputPPM { start = 0 } { convert ppm:- t-0.eps } { v = T }
        OutputPPM { start = 2.5 } { convert ppm:- t-2.5.eps } { v = T }
        OutputPPM { start = 5 } { convert ppm:- t-5.eps } { v = T }
    
        # Add a new variable 
        Variable Tref
    
        # Initialize Tref with the initial shape
        InitFraction { start = end } Tref (ellipse (0, -.236338, 0.2, 0.2))
    
        # Output the norms of the difference between T and Tref, stores that into
        # new variable DT
        OutputErrorNorm { start = end } norms { v = T } {
            s = Tref v = DT
        }
    
        OutputPPM { start = end } { convert ppm:- dt-5.eps } { v = DT }
    }
    

  • Time-reversed advection with curvature-based refinement
  • 1 0 GfsAdvection GfsBox GfsGEdge {} {
        Time { end = 5 }
        Refine 8
    
        # Add tracer T, using a VOF advection scheme.
        # The default scheme is a Van-Leer limited, second-order upwind scheme.
        VariableTracerVOF T
    
        # Curvature K of the interface defined by T
        VariableCurvature K T
    
        InitFraction T (ellipse (0, -.236338, 0.2, 0.2))
    
        # Initialize U and V with the vortical shear flow field
        Init {} {
            U = sin((x + 0.5)*M_PI)*cos((y + 0.5)*M_PI)
            V = -cos((x + 0.5)*M_PI)*sin((y + 0.5)*M_PI)
        }
    
        # At t = 2.5 re-initialize U and V with the reversed flow field
        Init { start = 2.5 } { U = -U V = -V }
        
        # Adapt the mesh dynamically using a custom cost function returning
        # the cell size times the local curvature (only for cells cut by
        # the interface).
        # The maximum cost is set to 0.1 i.e. the radius of curvature must be
        # resolved with at least 10 cells.
        AdaptFunction { istep = 1 } { cmax = 0.1 maxlevel = 8 minlevel = 6 } {
            return T > 0. && T < 1. ? ftt_cell_size (cell)*fabs (K) : 0.;
        }
    
        OutputSimulation { start = 2.5 } stdout
        EventScript { start = 2.5 } { echo "Save t-2.5.eps { format = EPS line_width = 0.5 }" }
        
        # Add a new variable 
        Variable Tref
    
        # Initialize Tref with the initial shape
        InitFraction { start = end } Tref (ellipse (0, -.236338, 0.2, 0.2))
    
        # Output the norms of the difference between T and Tref, stores that into
        # new variable DT
        OutputErrorNorm { start = end } norms { v = T } {
            s = Tref v = DT
        }
    
        OutputPPM { start = end } { convert ppm:- dt-5.eps } { v = DT }
    }
    

Personal tools
communication