コード例 #1
0
ファイル: Frame.py プロジェクト: lewisamarshall/emigrate
    def _create_ions(self, constructor):
        self.ions = []
        for solution in constructor['solutions']:
            self.ions.extend([ion.name for ion in solution.ions])
        self.ions = list(set(self.ions))

        # Replace strings with ion objects.
        self.ions = ionize.Solution(self.ions, [0.1] * len(self.ions)).ions
コード例 #2
0
ファイル: tests.py プロジェクト: lewisamarshall/emigrate
 def test_reference_frame(self):
     solutions = [ionize.Solution(['acetic acid', 'b-alanine'],
                                  [.02, .012]),
                  ionize.Solution(['acetic acid', 'pyridine', 'aniline'],
                                  [.02, .009/2, .011/2]),
                  ionize.Solution(['acetic acid', 'sodium'],
                                  [.02, .018]),
                  ]
     system = Frame(dict(lengths=[.01, .004, .01],
                         n_nodes=100,
                         interface_length=.0005,
                         solutions=solutions,
                         current_density=500,
                         domain_mode='left',
                         ))
     solver = Solver(system,
                     precondition=True,
                     flux_mode='slip')
     db = ionize.Database()
     solver.set_reference_frame(db['acetic acid'], 'right')
     solver.solve('examples/test_reference_frame.hdf5', self.dt, self.tmax)
コード例 #3
0
import emigrate
import ionize
import cProfile

solutions = [ionize.Solution(['hepes', 'tris'],
                             [.05, .105]),
             ionize.Solution(['caproic acid', 'tris', 'fluorescein',
                              'alexa fluor 488', 'mops', 'acetic acid'],
                             [.01, .1, .01, .01, .01, .01]),
             ionize.Solution(['hydrochloric acid', 'tris'],
                             [.04, .08]),
             ]

system = emigrate.Frame(dict(
                         n_nodes=137,
                         lengths=[.005, .001, .02],
                         interface_length=.0005,
                         solutions=solutions,
                         current=-500.,
                         ))

solver = emigrate.Solver(system,
                         precondition=True,
                         flux_mode='slip')
tmax = 200
dt = 1
ode_solver = 'dopri5'
profile = True
cProfile.run("solver.solve('examples/benchmark.hdf5', dt, tmax)")