T10: Viscosity:
flow between tow plates and jets
Before the tutorials:
  Think about:
  -  The effect of viscosity can be important for astronomical objects, like galaxy clusters.
    See, for example, this paper.
    Note that here viscosity is dependent on the plasma parameters (like temperature).
   -  What does viscosity mean?
    You might find this video from the 1960s useful,
    even more information can be found here.
 
During the tutorials:
 First experiment (viscous flow betwen two plates)
To run the first experiment, we first need to
  - Use a basic 100x100x10 setup similar to T09 to check the role of
    viscosity between two moving plates, as shown in Figure 1 of the
    above mentioned paper.
    
      - Bring the grid to a dimension of 1x1x0.1 and set density and pressure to 1.
      
 - Mark two (thin) boundary layers (left and right) as boundary particles (i.e., set their 
ID to zero).
       - Give them opposite velocities in the y direction.
      
 - Just to avoid unwanted effects, set the pressure in the walls 5% larger than in the rest.
    
 
   - To run the simulation:
    
      - Set 
LONG_X=1, LONG_Y=1
      and LONG_Z=0.1 in the Config.sh for the box
	geometry.
       - Set 
SPH_BND_PARTICLES  in the Config.sh to switch on boundary particles.
       - Set 
NAVIERSTOKES and NAVIERSTOKES_CONSTANT in the Config.sh to switch on viscosity.
       - Add 
ShearViscosityTemperature 5.0e7 and FractionSpitzerViscosity 1.0 to the parameter file.
       - Also set 
UnitLength_in_cm 3.085678e21, UnitMass_in_g 1.989e43 and UnitVelocity_in_cm_per_s 1e5 in the parameter file to get the right unit system.
     
   - Look at the evolution of the y velocity and explain what happens.
  
 - Do you see the similarity to the glacier shown in the above movie?
 
 Second experiment (viscous jet penetrating a medium)
To run the second experiment, we first need to to build the jet as shown in the first part
  of the movie above to test different viscosities.
  Therefore, just:
  - Use a 100x300x10 setup based on setups you created already:
    
      - Insert a wall at the bottom.
      
 - Make the upper fluid (e.g., the upper 2/3) a factor of 5 lighter.
      
 - Create the walls of the tube in the upper part, with some small distance to the lower part.
      
 - Insert a wall moving down in the tube at the top.
      
 - Make the fluid inside the tube somewhat heavier and give it the initial velocity of the wall.
      
 - Hint: here is a sketch of the geometry:
	
       - Hint: To make things working better you should try to use same mass of tracer particles in the fluids
	(still fine to use diferent masses for particles in walls). Therefore realize the different densities by
	making the particles distributions in these regions more or less populated.
      
 - Hint: use 
ShearViscosityTemperature 1e+08 and FractionSpitzerViscosity 0.1 for
	a medium viscosity setup and FractionSpitzerViscosity 2.0 for high viscosity setup.
     
   -  You can run the simulation with and without viscosity switched on.
    Note that:
    
      -  you need to set 
LONG_Y=3 in the Config.sh file.
       -  you can switch on some gravity by setting  
CONSTANT_GRAVITY_Y=0.1 in the Config.sh file.
     
   -  What does the run without viscosity look like?
    Hint: As you might remember, SPH uses artificial viscosity, and also does not include any explicit mixing,
    so you can try to improve it by:
    
      -  Set 
ArtBulkViscConst 0.05 in the parameter file
       -  Switch on a tiny bit of conduction, similar to what was done in the last experiment and use 
ConductionEfficiency 0.001
     
   -  Have a closer look at the differences. What happens in the run without conduction?
 
Programming goals for T10:
Improve your ability to set up special geometries in the initial conditions.
Solutions
First test problem
  - Again, extending the setup script from T08 for the first test problem.
    
    you should get something like:
    
   - To look at the evolution of the velocity in y direction.
    
    you should get something like shown below 
    
   - Example using Fortran and gnuplot:
    
      ifort -g -traceback -check all -fpe0 -o shearsetup shearsetup.f90
        (this uses glass.txt from T04)
      ./shearsetup
      gnuplot grid.plt (to check that the particle positions are set up correctly)
      - compile Gadget with 
PERIODIC and NOGRAVITY
          and with LONG_X=10, LONG_Y=10, and LONG_Z=1.
       - run Gadget using 
shear.ic as the initial conditions file
          and output as the snapshot file base in the parameter file,
          and BoxSize = 1
          (and TimeMax = 200, TimeBetSnapshot = 1.0)
       ifort -g -traceback -check all -fpe0 -o readsnap readsnap.f90
      for file in output_???; do ./readsnap $file | sort -g -k8,8 >$file.txt; done
      gnuplot shear.plt
        (this requires ffmpeg, which is installed on our ltsp machines)
      xine -l shear.mp4
        
    
 
Second test problem
  - Again, extending the setup script from T08 for the second test problem.
    
    you should get something like shown below 
    
   - Again, you can basically use the script from T08 for looking at the results.
    
    you should get something like shown below 
    
    
   - Example using Fortran and gnuplot:
    
      ifort -g -traceback -check all -fpe0 -o jetsetup jetsetup.f90
        (this uses glass.txt from T04)
      ./jetsetup
      gnuplot grid2.plt (to check that the particle positions are set up correctly)
      - compile Gadget with 
PERIODIC and NOGRAVITY
          and with LONG_X=10, LONG_Y=30, and LONG_Z=1
          (and NAVIERSTOKES and NAVIERSTOKES_CONSTANT,
          and optionally CONSTANT_GRAVITY_Y=-0.01)
       - run Gadget using 
jet.ic as the initial conditions file
          and output as the snapshot file base in the parameter file,
          and BoxSize = 1
       ifort -g -traceback -check all -fpe0 -o readsnap readsnap.f90
      for file in output_???; do ./readsnap $file | sort -g -k8,8 >$file.txt; done
      gnuplot jet.plt
        (this requires ffmpeg, which is installed on our ltsp machines)
      xine -l jet.mp4