Snoopy Version 6.0 (Albert)
Code configuration

Snoopy configuration is divided in two files: gvars.h and snoopy.cfg, which are described below.

File gvars.h

To activate or deactivate a feature, one uncomments or comments (//) the corresponding #define. Any modification made to this file requires a recompilation of the code (make) to include them in the code. Here is an example of a gvars.h file (an updated version of this file may be found in src/problem/defaut/gvars.h):

	
#define		NX       96                 // X Dimension in real space. Must be multiples of NPROC when using MPI.
#define		NY       96                 // Y Dimension in real space. Must be multiples of NPROC when using MPI.
#define		NZ       96                 // Z Dimension in real space. 

#define		MHD	                        // Uncomment to activate MHD
#define		ELSASSER_FORMULATION        // Use Elsasser formulation for MHD terms 

#define		WITH_BRAGINSKII             // Enable Braginskii viscosity. CAUTION: this is incompatible with the Elsasser formulation
#define		WITH_HALL                   // Enable Hall MHD (in developement). Hall effect amplitude is set by x_hall 
#define		WITH_EXPLICIT_DISSIPATION   // use an explicit (RK3) numerical scheme to integrate linear diffusion effects 
		                                // instead of the standard implicit scheme 
#define		SGS                         // Chollet-Lesieur Subgrid scale model for Hydro. This is in alpha version (see timestep.c).

#define		COMPRESSIBLE                // Solve the isothermal compressible equations (incompatible with Boussinesq for obvious physical reasons) 

#define		BOUSSINESQ                  // Uncomment to activate Boussinesq 
#define		VERTSTRAT                   // Vertical stratification. Otherwise, Boussinesq stratification is in X

#define		WITH_ROTATION               // Enable a Coriolis force, assuming the rotation axis is z. The rotation speed is set up in snoopy.cfg 

#define		WITH_SHEAR                  // Uncomment to activate mean SHEAR 
#define		TIME_DEPENDANT_SHEAR        // Enable Time dependant shear 

#define		WITH_2D                     // 2D (x,y) reduction. Enforce NZ=1 and optimise the Fourier transform routines accordingly. 
                                              // Using this option should lead to a speedup>4 compared to the old NZ=2 method.

#define		WITH_PARTICLES              // Enable Lagrangian test particles tracing.

#define		BOUNDARY_C                  // Enforce NON-PERIODIC boundary conditions to the flow using Fourier space symmetries. The boundary 
			                            // condition has to be set up in boundary.c/boundary_c(); This feature is in alpha version. 

#define		FORCING	                    // Uncomment to use internal forcing of the velocity field (see forcing in timestep.c) 

#define		FFT_PLANNING FFTW_MEASURE   // can be either FFTW_ESTIMATE, FFTW_MEASURE, FFTW_PATIENT or FFTW_EXHAUSTIVE (see fftw3 doc). 
                                               // Measure leads to longer initialisation of fft routines 


	

File snoopy.cfg

The file snoopy.cfg is located where the executable is located and is read at run time. Snoopy uses a variation of the library libconfig to read these files. A standard snoopy file is divided into 5 blocks: physics, particles, code, output and init corresponding to physical parameters, code parameters, input/output and initial conditions. If any of the described parameter (or even block) is ommited, the default value (as given below) will be used. This is a commented example of snoopy.cfg containing all the possible parameters assigned to their default value (an updated version of this file may be found in src/problem/defaut/snoopy.cfg):

	# Example of a Snoopy configuration file

configname = "Default Snoopy configuration file";

physics:                             // Physics parameters
{
	boxsize = (1.0, 1.0, 1.0);       // Box length in X, Y and Z
	
	reynolds = 1.0;                  // Reynolds number (actully the inverse of the viscosity)
	reynolds_magnetic = 1.0;         // Magnetic Reynolds number (actully the inverse of the resistivity).  Used only when MHD is on
	reynolds_thermic = 1.0;          // Thermal Reynolds number (actully the inverse of the thermal diffusivity).  Used only when Boussinesq is on
	reynolds_Braginskii = 1.0;       // Braginskii viscosity-based Reynolds number (inverse of nu_B)
	x_Hall = 1.0;                    // Amplitude of the Hall effect. Used only when WITH_HALL is enabled in gvars.h.

	
	brunt_vaissala_squared = 0.0;    // Brunt Vaissala frequency squared. Used only when Boussinesq is on
	
	omega = 0.0;                     // Vertical rotation rate (if Shear=1, Keplerian if found for 2.0/3.0). Used only when WITH_ROTATION is on
	
	shear = 0.0;                     // Shear rate. Used only when WITH_SHEAR is on.
	omega_shear = 0.0;               // Pulsation of time dependant shear. Used only when both WITH_SHEAR and TIME_DEPENDANT_SHEAR are on.
};

//-------------------------------------------------------------------------------------------------------------------------

particles:                           // Test particles parameters. Only used when WITH_PARTICLES is enabled.
{
	n = 1000;                        // Total number of test particles
	mass = 1.0;                      // Particles mass
	stime = 1.0;                     // Particles stopping time
};


//-------------------------------------------------------------------------------------------------------------------------

code:                                // code parameters
{
	cfl = 1.5;                       // CFL safety factor. Should be smaller than sqrt(3) for RK3 to be stable.
	safety_source = 0.2;             // Safety factor for SHEAR, Coriolis and Boussinesq terms (should be ~0.2 for accuracy)
	
	t_initial = 0.0;                 // Initial time of the simulation
	t_final = 1.0;                   // Simulation will stop if it reaches this time
	max_t_elapsed = 1e30;            // Maximum elapsed time (in hours). Will stop after this elapsed time if t_final is not reached.
	
	interface_check = 5;             // Number of loops between two checks for a user input. On slow filesystems, increase this number 
	interface_output_file = false;   // Set to true to force interface outputs to a file instead of displaying them
	
	force_symmetries = false;        // Uncomment to enforce spectral symmetries and mean flow to zero. Useful when N^2 or kappa^2 < 0. (see enforce_symm() )
	symmetries_step = 20;            // Number of loops between which the symmetries are enforced. Should be around ~20 for Boussinesq convection.
	
	antialiasing = true;             // 2/3 Antialisaing rule. Could be removed if you assume is unimportant (untested feature).
	
	restart = false;                 // set to true to restart from a dump file. If no dump file is found, this option has no effect.
};

//-------------------------------------------------------------------------------------------------------------------------

output:	                             // output parameters
{
	timevar_step = 1.0;	             // Time between two outputs in the timevar file
	snapshot_step = 1.0;             // Time between two snapshot outputs (VTK format)
	dump_step = 1.0;                 // Time between two restart dump outputs (restart dump are erased)
	
									 
	timevar_vars = ( "t","ev","em","vxmax","vxmin","vymax","vymin","vzmax","vzmin","vxvy", 
								"bxmax","bxmin","bymax","bymin","bzmax","bzmin","bxby",
								"dmin","dmax","dvxvy",
								"thmax","thmin","thvx","thvz","w2","j2","hm" );
								
									 // List of statistical quantities to be written in the timevar file
	
	vorticity = false;               // Output the vorticity field in the 3D snapshots
};

//-------------------------------------------------------------------------------------------------------------------------

init:                                // Initial conditions parameters
{
	vortex:                          // Add a 2D Kida vortex in the box. Assumes S=1. Requires b>a
	{
		enable = false;              // Set this to true to enable the vortex
		a = 1.0;                     // x dimension of the vortex
		b = 2.0;                     // y dimension of the vortex
	};
	large_scale_noise:               // Init a large scale random noise down to cut_length
	{
		enable = false;	             // set this to true to enable large scale noise
		amplitude = 0.0;             // noise amplitude
		cut_length = 0.0;            // Wavelength over which the noise is applied
	};
	large_scale_2D_noise:            // Init a large scale random 2D (x,y) noise down to cut_length
	{
		enable = false;              // set this to true to enable large scale 2D noise
		amplitude = 0.0;             // noise amplitude
		cut_length = 0.0;            // Wavelength over which the noise is applied
	};
	white_noise:                     // Init a random noise at all scales
	{
		enable = false;	             // set this to true to enable white noise
		amplitude = 0.0;             // noise amplitude
	};
	mean_field:	                     // Force the mean magnetic field to a given value.
	{
		enable = false;	             // Set this to true to enable mean field
		bx0 = 0.0;                   // Mean magnetic field in the x direction
		by0 = 0.0;                   // Mean magnetic field in the y direction
		bz0 = 0.0;                   // Mean magnetic field in the z direction
	};
	spatial_structure = false;       // set this to true to init a user_defined spatial structure (see initflow.c)
	dump = false;                    // set this to true to use a dump file as an initial condition (this is NOT a restart option!)
	bench = false;                   // set this to true to init a benchmark initial condition.
};