GfsElectroHydro

From Gerris

Jump to: navigation, search

GfsElectroHydro solves the 2D/3D electrohydrodynamics equations. Aside from the standard fluid variables defined by GfsSimulation, the default variables are:

Phi
electric potential
Ex
x-component of the electric field
Ey
y-component of the electric field
Ez
z-component of the electric field

The syntax in parameter files is

[ GfsSimulation ] {
  perm = [ GfsFunction ]
  charge = [ GfsFunction ]
  GfsElectricProjectionParams {
    ...
  }
}

where perm defines the electric permittivity of the fluid(s), charge defines optionally the volume electric charge density and GfsElectricProjectionParams optionally controls the accuracy of the numerical solution of the Poisson equation for the electric potential Phi.

Electric volumetric forces can be added to the momentum equation using

GfsSourceElectric

and the electric conduction term can be taken into account using

GfsSourceDiffusionExplicit Rhoe K Phi

where K stands for the conductivity. The electric conduction term can be also computed implicitly using

GfsSourceDiffusion Rhoe K Phi

although it is only available if the charge function is a direct injection of a pure variable (i.e charge = Rhoe). Additionally, the implicit scheme for the conduction term is incompatible with other implicit schemes applied on the same variable (i.e. GfsSourceDiffusion Rhoe Diffusion).

See also

electrohydro module

Examples

  • Dielectric-dieletric planar balance
  • 1 0 GfsElectroHydro GfsBox GfsGEdge {} {
        VariableTracerVOF T
        InitFraction T (-y)
        Init {} { Phi = (y < 0. ? (y/2.+1/4.) : 3.*y/2.+1./4.) }
        Refine 5
        
        Time { iend = 1 dtmax = 1 }
        ProjectionParams { tolerance = 1e-7 }  
        ApproxProjectionParams { tolerance = 1e-7 }
        SourceElectric
    
        OutputTime { istep = 1 } stderr
        OutputSimulation { start = end } result.txt { format = text }
        OutputScalarStats { start = end } p { v = P }
        OutputScalarStats { start = end } ey { v = Ey }
        OutputScalarNorm { start = end } v { v = V }
        EventScript { start = end } { 
           if awk '{
                  deltap = ($11 - $5) - 0.75
                  if (deltap < 0.)
                    deltap = - deltap;
                  if (deltap > 5e-8) { 
                    print "deltap:", deltap > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < p &&
              awk '{
                  deltap = ($11 - $5) - 1.
                  if (deltap < 0.)
                    deltap = - deltap;
                  if (deltap > 0.) { 
                    print "deltaey:", deltap > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < ey &&
              awk '{
                  if ($9 > 3.) { 
                    print "vmax:", $9 > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < v; then
                exit 0;
            else
                exit $GFS_STOP;
            fi
        }
    } {
        # Electric parameters
        perm = 1./(T/3.+(1-T))
        ElectricProjectionParams { tolerance = 1e-7 }
    }
    

  • Balance with solid boundaries
  • 1 0 GfsElectroHydro GfsBox GfsGEdge {} {
        VariableTracerVOF T
        InitFraction T (-y)
        Refine 5
        Solid (-y + 0.3)
        Solid ( y + 0.2)
        SurfaceBc Phi Dirichlet (y > 0)
    
        Time { iend = 1 dtmax = 1 }
        ProjectionParams { tolerance = 1e-7 }  
        ApproxProjectionParams { tolerance = 1e-7 }
        SourceElectric
    
        OutputTime { istep = 1 } stderr
        OutputSimulation { start = end } result.txt { format = text }
        OutputScalarStats { start = end } p { v = P }
        OutputScalarStats { start = end } ey { v = Ey }
        OutputScalarNorm { start = end } v { v = V }
        EventScript { start = end } { 
           if awk '{
                  deltap = ($11 - $5) - 3./(1.1*1.1)
                  if (deltap < 0.)
                    deltap = - deltap;
                  if (deltap > 4e-4) { 
                    print "deltap:", deltap > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < p &&
              awk '{
                  deltap = ($11 - $5) - 2./1.1
                  if (deltap < 0.)
                    deltap = - deltap;
                  if (deltap > 3e-4) { 
                    print "deltaey:", deltap > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < ey &&
              awk '{
                  if ($9 > 10.) { 
                    print "vmax:", $9 > "/dev/stderr"; 
                    exit (1); 
                  }
                }' < v; then
                exit 0;
            else
                exit $GFS_STOP;
            fi
        }
    } {
        # Electric parameters
        perm = 1./(T/3.+(1-T))
        ElectricProjectionParams { tolerance = 1e-7 }
    }
    

  • Relaxation of a charge bump
  • 1 0 GfsElectroHydro GfsBox GfsGEdge {} {
        Global {
    	#define a 0.05
            #define perm 2.0
            #define K 1.0
            double gaussbell (double x, double y, double t) {
    	  double alpha = (x*x + y*y)/2./a/a;
    	  double beta = a*sqrt(2.*M_PI);
              double te = perm/K;
    	  return exp(-alpha)/beta*exp(-t/te);
            }
        }
        VariableTracer Rhoe
        Refine 7*(1. - 4.*(x*x + y*y))
        Time { end = 6 dtmax = 1e-2 }
        Init {} { Rhoe = gaussbell(x,y,0) }
    
    #    OutputTime { istep = 5 } stderr
    #    OutputScalarNorm { istep = 5 } stderr { v = Rhoe }
        SourceDiffusionExplicit Rhoe 1 Phi
    #    SourceDiffusion Rhoe 1 { beta = 0.5 } Phi
    
        OutputSimulation { start = 0 } {
    	awk '{ if ($1 != "#") print sqrt($1*$1+$2*$2),$11 > "t_0-SCHEME"; }'
        } { format = text }
        OutputSimulation { start = 2 } {
    	awk '{ if ($1 != "#") print sqrt($1*$1+$2*$2),$11 > "t_2-SCHEME"; }'
        } { format = text }
        OutputSimulation { start = 4 } {
    	awk '{ if ($1 != "#") print sqrt($1*$1+$2*$2),$11 > "t_4-SCHEME"; }'
        } { format = text }
        OutputSimulation { start = 6 } {
    	awk '{ if ($1 != "#") print sqrt($1*$1+$2*$2),$11 > "t_6-SCHEME"; }'
        } { format = text }
    
        OutputErrorNorm { istep = 10 } norms-SCHEME { v = Rhoe } { s = gaussbell(x,y,t) }
        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. }
    } {
        # Electric parameters
        perm = 2
        charge = Rhoe
        GfsElectricProjectionParams { tolerance = 1e-7 }
    }
    

  • Charge relaxation in a planar cross-section
  • 1 0 GfsElectroHydro GfsBox GfsGEdge {} {
        Global {
            #define R0 0.1
            #define rhoinic 0.5
            #define K 3
            #define E1 3
            #define E2 1
        }
        Time { end = 35 dtmax=1.0 }
    
        VariableTracerVOF T
        GfsVariableTracer Rhoe
        InitFraction T (R0*R0 - y*y - x*x)
        AdaptGradient { istep = 1 } { cmax = 1e-4 minlevel = 5 maxlevel = LEVEL + 1 } T
        PhysicalParams { L = 2 }
        Init {} { Rhoe = rhoinic*T }  
     
        EventStop { istep = 10 } Ex 0.001
    
        SourceDiffusionExplicit Rhoe K*T Phi
    
    #    OutputTime { istep = 1 } stderr
        OutputScalarSum { istep = 1 } { 
           awk 'BEGIN { rhoinic = 0.5 ; R0 = 0.1 ; Q = rhoinic*R0*R0*3.141592654 }
                { print $3,$5,100*sqrt((1.-$5/Q)*(1.-$5/Q)); fflush(stdout); }' > rhoe-LEVEL
        } { v = Rhoe}
        OutputSimulation { start = end } {
    	awk '{ if ($1 != "#") 
                     print sqrt($2*$2+$1*$1),sqrt($4*$4+$5*$5); }' > prof-LEVEL
        } { 
    	format = text 
    	variables = Ex,Ey 
        }
        OutputErrorNorm { start = end } norms-LEVEL { v = sqrt(Ex*Ex + Ey*Ey) } {
    	s = {
    	  double r = sqrt (x*x + y*y);
              return (r < R0 ? 0 : 0.5*R0*R0*rhoinic/r);
    	}
        }
        OutputSimulation { start = end } result-LEVEL.gfs 
    } {
        # Electric parameters
        perm = E1*T+E2*(1.-T)
        charge = Rhoe
        GfsElectricProjectionParams { tolerance = 1e-7 }
    }
    

  • Gouy-Chapman Debye layer
  • 5 4 GfsElectroHydro GfsBox GfsGEdge { x = 0.5 } {
    
        Global {
          #define Volt 1.0
        }
        VariableTracer Cpos { scheme = none }
        VariableTracer Cneg { scheme = none } 
        AdaptGradient { istep = 5 } { cmax = 0.02 minlevel = 3 maxlevel = 5 } Cneg 
    
        Init {} {
           Phi = Volt*(1.-x/5.)
           Cpos =  1. 
           Cneg =  1. 
        }
        Time { end = 3.5 dtmax = 0.01 }
       
        SourceDiffusion Cpos 1.0
        SourceDiffusionExplicit Cpos Cpos Phi
        
        SourceDiffusion Cneg 1.0
        SourceDiffusionExplicit  Cneg -Cneg Phi 
          
        EventStop { istep = 10 } Phi 1e-4 DPhi
    
    #    OutputSimulation { istep = 5 } stdout 
        OutputLocation { start = end } { 
    	awk '{ if ($1 != "#") print $2, $9, $12, $13; }' > profile 
        } points
    } {
        # Electric parameters
        perm = 1.0
        charge = (Cpos - Cneg)
    }
    

Views
Navigation
communication