Beispiel #1
0
void Flat::think(unsigned long frame)
{
	back1.Step(
		simParams().inv_frame_rate,
		simParams().velocityIterations,
		simParams().positionIterations);
	back2.Step(
		simParams().inv_frame_rate,
		simParams().velocityIterations,
		simParams().positionIterations);
	back3.Step(
		simParams().inv_frame_rate,
		simParams().velocityIterations,
		simParams().positionIterations);
}
Beispiel #2
0
int main(int argc, char *argv[])
{
	int i,j,k;

	// Load the simulation parameters from a file (or hard code here)

	// (KW) Added flag to Param object which determines if the static or dynamic case is being evolved.

	// Set the grid spacing.  Timestep is 1/4 grid spacing. Units are r/M.
	double gridspacing = 0.5;

	// Set the starting orbital seperation.  NS are on x-axis. Units are r/M.
	double R = 7.5;

	// Calculate the number of gridpoints between the center of the particle and the center of the grid
	double nR = R/gridspacing;

	// Set the radius of the NS. The constant is the number of gridpoints in each direction.  Units are r/M.
	double radius = 0.3;

	// Set the central masses of one NS.
	double mass0 = 0.1;

	// Set the mass ratio between the NS
	double mu = 1.;

	// Set the exponent of the smoothing kernel
	double exponent = 3.0;

	// Set the number of gridpoints
	double gridpoints = 39.; // Increase 2*(R+radius)/gridspacing + 6 to the next odd integer

	// Set the radius of extraction
	double re = 9.; // Increase R+radius+(1.5*gridspacing) to next integer gridpoint;

	// Calculate the number of gridpoints between the radius of extraction and the center of the grid
	double nRe = re/gridspacing;

	// Set the ending orbital separation.  By default, this is when the NS just touch. Units are r/M.
	double Rend = radius;

	// Set the number of snapshots to take of the evolution
	int snapshots = 10;

	// Calculate the ending grid spacing.  Units are r/M.
	double endgridspacing = Rend/nR;

	// Calculate the delta gridspacing
	double deltaspacing = (gridspacing + endgridspacing)/((double)snapshots);

	// Set initial omega
	double startOmega = 0.1;

	// Set convergence tolerance
	double convCriterion = 0.001;

	// Set diffusion coefficient
	double diffCoeff = 2.42;

	// Calculate the starting size of the grid.  Radius of extraction is R+radius+3*gridspacing3
	// Create a simulation parameters object
	Param simParams(0., (int)gridpoints, (int)gridpoints, (int)gridpoints, gridspacing/4., gridspacing, gridspacing, gridspacing,
			diffCoeff, convCriterion, startOmega, HARM_DECOMP, 500, 2, 2, re,
			mass0, mu*mass0, radius,radius,radius, radius,radius,radius,
			-R,0.0,0.0, R,0.0,0.0, 0.,0.,0., 0.,0.,0.,exponent,
         -1.3,-1.3,-1.3,1.3,1.3,1.3,0);   // <======================= Added 0 as last parameter, set to non-zero for dynamic case
										  // <======================= According to my reading of the simParams() routine, this should
	                                      //                            be -1.3,1.3,-1.3,1.3,-1.3,1.3,0);

	// Create a flat scalar field and send it a copy of the simulation parameters
	MSField field;
    field.SetParams(simParams);
 	cout << "Field object created.\n";

#ifdef PART
	Particle swarm;
	swarm.SetParams(simParams);  <======================== Seems to crash when attempting to set inverse deltas