Esempio n. 1
0
	def setUp(self):
		self.file = tempfile.NamedTemporaryFile()
		self.path = self.file.name
		self.family = os.path.basename(self.path)
		self.prefix = os.path.dirname(self.path)
		self.file.close()
		from odelab.scheme.classic import ExplicitEuler

		self.params = params = {
			'family': self.family,
			'system': System,
			'system_params': {'f': f},
			'solver': Solver,
			'scheme': ExplicitEuler,
			'scheme_params': {
				'h': .1,
				},
			'initialize': {
				'u0' : np.array([1.]),
				'name': self.name,
				},
			}
		scheme = ExplicitEuler(**params['scheme_params'])
		s = Solver(system=System(f), scheme=scheme, path=self.path)
		s.catch_runtime = False
		s.initialize(**params['initialize'])
		s.run(1.)
Esempio n. 2
0
    def setUp(self):
        self.file = tempfile.NamedTemporaryFile()
        self.path = self.file.name
        self.family = os.path.basename(self.path)
        self.prefix = os.path.dirname(self.path)
        self.file.close()
        from odelab.scheme.classic import ExplicitEuler

        self.params = params = {
            'family': self.family,
            'system': System,
            'system_params': {
                'f': f
            },
            'solver': Solver,
            'scheme': ExplicitEuler,
            'scheme_params': {
                'h': .1,
            },
            'initialize': {
                'u0': np.array([1.]),
                'time': 1.,
                'name': self.name,
            },
        }
        scheme = ExplicitEuler(**params['scheme_params'])
        s = Solver(system=System(f), scheme=scheme, path=self.path)
        s.catch_runtime = False
        s.initialize(**params['initialize'])
        s.run()
Esempio n. 3
0
def test_rkdae(s):
	sys = GraphSystem(sq)
	u0 = np.array([0.,0.,1.])
	scheme = RKDAE(.1, tableau=RK.RadauIIA.tableaux[s])
	sol = Solver(scheme, sys)
	sol.initialize(u0=u0)
	CompareExact('RadauIIA-{0}'.format(s)), sol, u0, 2