/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7  
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

//startFrom       firstTime; // Earliest time step from the set of time directories.
//startFrom       startTime; // Time specified by the startTime keyword entry.
startFrom       latestTime; // Most recent time step from the set of time directories.

startTime       0; // Start time for the simulation with startFrom startTime;

stopAt          endTime;    // Time specified by the endTime keyword entry.
//stopAt          writeNow;   // Stops simulation on completion of current time step and writes data.
//stopAt          noWriteNow; // Stops simulation on completion of current time step and does not write out data.
//stopAt          nextWrite;  // Stops simulation on completion of next scheduled write time, specified by writeControl.

endTime         100000; // End time for the simulation when "stopAt endTime" is specified.

deltaT          1.0; // Time step of the simulation.

writeControl    timeStep;

writeInterval   100000;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

functions
{
	
	forceCoeffs
	{
		// Definition of terms:
		// rhoInf - reference density
		// CofR - Centre of rotation
		// dragDir - Direction of drag coefficient
		// liftDir - Direction of lift coefficient
		// pitchAxis - Pitching moment axis
		// magUinf - free stream velocity magnitude
		// lRef - reference length
		// Aref - reference area 
		
		// Mandatory entries
		type forceCoeffs;
		functionObjectLibs ("libforces.so");
		patches	(ballsurface);
		
		// Optional entries
		enabled true;
		log true;
		
		// Field names
		p			p;
		U 			U;
		
		// For incompressible cases, i.e. solved using the kinematic pressure
		// the rho entry can be used to set the freestream density: 
		rho         rhoInf;
		rhoInf      100000;
		
		// Reference pressure
		pRef 		0;
		
		// Include porosity effects?
		porosity        no;
		
		// Store and write volume field representations of forces and moments
		writeFields     yes;
		writeControl 	timeStep;
		outputInterval 	1;
		
		// Centre of rotation for moment calculations
		CofR            (0 0 0);
		
		// Lift direction
		liftDir         (1 0 0);
		
		// Drag direction
		dragDir         (0 0 1);
		
		// Pitch axis
		pitchAxis       (0 1 0);
		
		// Freestream velocity magnitude [m/s]
		magUInf         0.08116883116883118;
		
		// Reference length [m]
		lRef            12.32e-3;    // dk
		
		// Reference area [m2]
		Aref            0.000059605; // pi/4 * dk^2 * 1/2 (due to symmetry only half sphere is modelled)
	}
	
	forces1
    {
        // Mandatory entries
        type            forces;
        libs            ("libforces.so");
        patches	        (ballsurface);
        
        
        // Optional entries
        
        // Field names
        p               p;
        U               U;
        rho          rhoInf;
		rhoInf       100000;
        
        // Reference pressure [Pa]
        pRef            0;
        
        // Include porosity effects?
        porosity        no;

        // Store and write volume field representations of forces and moments
        writeFields     no;
        
        // Centre of rotation for moment calculations
        CofR            (0 0 0);
    }
}; 


// ************************************************************************* //
