Commits

Britton Smith committed 13c552d

Adding option to add lower limit to timestep of dx/c.

  • Participants
  • Parent commits 1826c4e

Comments (0)

Files changed (5)

src/enzo/Grid_ComputeConductionTimeStep.C

   FLOAT a = 1.0, dadt;
   double MassUnits = 1.0;
   float *rho;
-  float dt, dt_est;
+  float dt, dt_est, light_cross_time;
   double all_units;
 
   float SpitzerFraction;
   dt *= float(all_units);
   dt *= ConductionCourantSafetyNumber;  // for stability, this has to be < 0.5
 
+  if (SpeedOfLightTimeStepLimit) {
+    light_cross_time = dx * VelocityUnits / clight;
+    dt = max(dt, light_cross_time);
+  }
+
   delete [] Temp;
 
   return dt;

src/enzo/ReadParameterFile.C

     ret += sscanf(line, "IsotropicConductionSpitzerFraction = %"FSYM, &IsotropicConductionSpitzerFraction);
     ret += sscanf(line, "AnisotropicConductionSpitzerFraction = %"FSYM, &AnisotropicConductionSpitzerFraction);
     ret += sscanf(line, "ConductionCourantSafetyNumber = %"FSYM, &ConductionCourantSafetyNumber);
+    ret += sscanf(line, "SpeedOfLightTimeStepLimit = %"ISYM, &SpeedOfLightTimeStepLimit);
 
     ret += sscanf(line, "RadiativeTransfer = %"ISYM, &RadiativeTransfer);
     ret += sscanf(line, "RadiationXRaySecondaryIon = %"ISYM, &RadiationXRaySecondaryIon);

src/enzo/SetDefaultGlobalValues.C

   IsotropicConductionSpitzerFraction = 0.0;
   AnisotropicConductionSpitzerFraction = 0.0;
   ConductionCourantSafetyNumber = 0.5;
+  SpeedOfLightTimeStepLimit = FALSE;
 
   PythonTopGridSkip                = 0;
   PythonSubcycleSkip               = 1;

src/enzo/WriteParameterFile.C

   fprintf(fptr, "IsotropicConductionSpitzerFraction    = %"FSYM"\n", IsotropicConductionSpitzerFraction);
   fprintf(fptr, "AnisotropicConductionSpitzerFraction  = %"FSYM"\n", AnisotropicConductionSpitzerFraction);
   fprintf(fptr, "ConductionCourantSafetyNumber   = %"FSYM"\n", ConductionCourantSafetyNumber);
+  fprintf(fptr, "SpeedOfLightTimeStepLimit             = %"ISYM"\n", SpeedOfLightTimeStepLimit);
 
   fprintf(fptr, "RefineByJeansLengthUnits              = %"ISYM"\n",RefineByJeansLengthUnits);
   fprintf(fptr, "IsothermalSoundSpeed                  = %"GSYM"\n",IsothermalSoundSpeed);

src/enzo/global_data.h

 EXTERN float IsotropicConductionSpitzerFraction;  // f_Spitzer
 EXTERN float AnisotropicConductionSpitzerFraction;  // f_Spitzer
 EXTERN float ConductionCourantSafetyNumber;
+EXTERN int SpeedOfLightTimeStepLimit; // TRUE OR FALSE
 
 /* For the database */
 EXTERN char *DatabaseLocation;