# plotting parameters params.plotter = Data() params.plotter.always_plot = False params.plotter.never_plot = False params.plotter.plot_interval = 0.1 params.t_max = 100.0 wavelengths = 3 # params.analytical = lambda x: wave_forms.sin_4(x, wavelengths * np.pi / width) params.analytical = wave_forms.square # Define project and run parameters in order to save the results to # the proper data folder. params.proj_name = "fvm" params.run_name = "development" # Define the set of experiments to be run class Play(Experiment): def _initialize(self): self.cont = Controller(self.params) # self.cont.deriv.reconstructor = WENO(self.cont.mesh) et = ErrorTracker(self.cont.mesh, self.cont.analytical, self.params) soln_plot = UpdatePlotter(self.params.plotter) soln_plot.add_line(self.cont.mesh.x, self.cont.init[2:-2], "+") soln_plot.add_line(self.cont.mesh.x, self.cont.init[2:-2], "-") self.cont.observers.append(soln_plot) self.cont.observers.append(et) def _compute(self):
from core.data import Data import numpy as np from material import wetdiabase from experiments.diffusive import Diffusive from core.constants import consts params = Data() params.material = wetdiabase params.proj_name = 'diffusive' params.run_name = 'test' params.low_x = 0.0 params.high_x = 0.1 params.low_t = 0.001 * consts.secs_in_a_year params.high_t = 1000000.0 * consts.secs_in_a_year params.x_count = 25 params.t_count = 100 params.x_domain = np.linspace(params.low_x, params.high_x, params.x_count) params.t_domain = np.linspace(params.low_t, params.high_t, params.t_count) params.time_scale = 100.0 * consts.secs_in_a_year # 100 years params.init_temp = 350.0 + 273.0 # initial temperature params.delta_t = 2.5 # total increase in temperature for an event params.stress = 100.0e6 # MPa experiment = Diffusive