![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 // 00004 // Modified by Johan Jansson 2003, 2004. 00005 00006 #ifndef __TIME_STEPPER_H 00007 #define __TIME_STEPPER_H 00008 00009 #include <dolfin/constants.h> 00010 #include <dolfin/Partition.h> 00011 #include <dolfin/Adaptivity.h> 00012 #include <dolfin/RHS.h> 00013 #include <dolfin/Solution.h> 00014 #include <dolfin/File.h> 00015 #include <dolfin/FixedPointIteration.h> 00016 00017 namespace dolfin { 00018 00019 class ODE; 00020 class TimeSlab; 00021 00039 00040 class TimeStepper { 00041 public: 00042 00044 TimeStepper(ODE& ode, Function& function); 00045 00047 ~TimeStepper(); 00048 00050 static void solve(ODE& ode, Function& function); 00051 00053 real step(); 00054 00056 bool finished() const; 00057 00058 private: 00059 00060 // Create the first time slab 00061 bool createFirstTimeSlab(); 00062 00063 // Create a standard (recursive) time slab 00064 bool createGeneralTimeSlab(); 00065 00066 // Prepare for next time slab 00067 void shift(); 00068 00069 // Save interpolated solution (when necessary) 00070 void save(TimeSlab& timeslab); 00071 00072 // Save at fixed sample points 00073 void saveFixedSamples(TimeSlab& timeslab); 00074 00075 // Save using adaptive samples 00076 void saveAdaptiveSamples(TimeSlab& timeslab); 00077 00078 // Stabilize using a sequence of small time steps 00079 void stabilize(real K); 00080 00081 //--- Time-stepping data --- 00082 00083 // Size of system 00084 unsigned int N; 00085 00086 // Current time 00087 real t; 00088 00089 // End time of computation 00090 real T; 00091 00092 // Partition of components into small and large time steps 00093 Partition partition; 00094 00095 // Adaptivity, including regulation of the time step 00096 Adaptivity adaptivity; 00097 00098 // A function representing the solution being computed 00099 Function& function; 00100 00101 // The solution being computed 00102 Solution u; 00103 00105 ODE& ode; 00106 00107 // The right-hand side 00108 RHS f; 00109 00110 // Damped fixed point iteration 00111 FixedPointIteration fixpoint; 00112 00113 // Storing the computed solution 00114 File file; 00115 00116 // Progress bar 00117 Progress p; 00118 00119 // True if we have reached the given end time 00120 bool _finished; 00121 00122 // True if we should save the solution 00123 bool save_solution; 00124 00125 // True if we should solve the dual 00126 bool solve_dual; 00127 00128 // True if we should use adaptive samples 00129 bool adaptive_samples; 00130 00131 // Number of samples to save (for non-adaptive sampling) 00132 unsigned int no_samples; 00133 00134 // Density of sampling (for adaptive sampling) 00135 unsigned int sample_density; 00136 00137 }; 00138 00139 } 00140 00141 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.