Skip to content

Commit

Permalink
Add plates mobility time series
Browse files Browse the repository at this point in the history
  • Loading branch information
amorison committed Apr 20, 2018
1 parent b65c608 commit ecd70c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions stagpy/phyvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
TIME_EXTRA = OrderedDict((
('dTdt', Vart(processing.dt_dt, r'dT/dt')),
('ebalance', Vart(processing.ebalance, r'\mathrm{Nu}')),
('mobility', Vart(processing.mobility, 'M')),
))

Varp = namedtuple('Varp', ['description'])
Expand Down
24 changes: 24 additions & 0 deletions stagpy/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ def ebalance(sdat, tstart=None, tend=None):
return ebal, time


def mobility(sdat, tstart=None, tend=None):
"""Plates mobility.
Compute the ratio vsurf / vrms.
Args:
sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance.
tstart (float): time at which the computation should start. Use the
beginning of the time series data if set to None.
tend (float): time at which the computation should end. Use the
end of the time series data if set to None.
Returns:
tuple of :class:`numpy.array`: mobility and time arrays.
"""
tseries = sdat.tseries_between(tstart, tend)
steps = sdat.steps[tseries.index[0]:tseries.index[-1]]
time = []
mob = []
for step in steps.filter(rprof=True):
time.append(step.timeinfo['t'])
mob.append(step.rprof.iloc[-1].loc['vrms'] / step.timeinfo['vrms'])
return np.array(mob), np.array(time)


def r_edges(step):
"""Cell border.
Expand Down

0 comments on commit ecd70c5

Please sign in to comment.