Skip to content

Commit 6dd166f

Browse files
committed
Various documentation updates
1 parent 0c5b1de commit 6dd166f

File tree

4 files changed

+67
-78
lines changed

4 files changed

+67
-78
lines changed

docs/sources/apiref/step.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ _step
44
.. automodule:: stagpy._step
55
:members:
66
:private-members:
7-
:exclude-members: _init_shape, _get_raw_data
7+
:exclude-members: _init_shape, _get_raw_data, _scale_radius_mo

docs/sources/cookbook/nura.rst

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,38 @@ for that. The following script can be used to make a loglog plot of the Nusselt
99
number as function of the Rayleigh number using all directories stored where
1010
the script is executed::
1111

12-
#!/usr/bin/env python3
13-
"""Nu=f(Ra) from a set of stagyy results in different directories"""
14-
15-
import matplotlib.pyplot as plt
16-
import numpy as np
17-
from stagpy import stagyydata
18-
from pathlib import Path
19-
20-
ran = []
21-
nun = []
22-
23-
pwd = Path('Examples')
24-
for rep in pwd.glob('ra-*'):
25-
print('In directory ', rep)
26-
sdat = stagyydata.StagyyData(rep)
27-
# get the value of the Rayleigh number
28-
ran.append(sdat.par['refstate']['ra0'])
29-
# get the last value of the Nusselt number
30-
nun.append(sdat.steps[-1].timeinfo['Nutop'])
31-
32-
ran = np.array(ran)
33-
nun = np.array(nun)
34-
35-
# sort by Ra#
36-
indexes = ran.argsort()
37-
38-
fig = plt.figure()
39-
plt.loglog(ran[indexes], nun[indexes], 'o--')
40-
plt.xlabel(r'Rayleigh number')
41-
plt.ylabel(r'Nusselt number')
42-
plt.savefig('Ra-Nu.pdf')
43-
plt.close(fig)
12+
#!/usr/bin/env python3
13+
"""Nu=f(Ra) from a set of stagyy results in different directories"""
14+
15+
from pathlib import Path
16+
from stagpy.stagyydata import StagyyData
17+
import matplotlib.pyplot as plt
18+
import numpy as np
19+
20+
ran = []
21+
nun = []
22+
23+
pwd = Path('Examples')
24+
for folder in pwd.glob('ra-*'):
25+
print('In directory', folder)
26+
sdat = StagyyData(folder)
27+
# get the value of the Rayleigh number
28+
ran.append(sdat.par['refstate']['ra0'])
29+
# get the last value of the Nusselt number
30+
nun.append(sdat.tseries['Nutop'].values[-1])
31+
32+
ran = np.array(ran)
33+
nun = np.array(nun)
34+
35+
# sort by Ra#
36+
indexes = ran.argsort()
37+
38+
plt.loglog(ran[indexes], nun[indexes], 'o--')
39+
plt.xlabel('Rayleigh number')
40+
plt.ylabel('Nusselt number')
41+
plt.savefig('Ra-Nu.pdf')
4442

4543
Note that this particular example is only relevant if the solutions
4644
have all reached a steady-state. In the case where the solution is
4745
only in statistical steady state, a time average is more relevant. It
48-
can be computed using the whole sdat.tseries table in each directory.
46+
can be computed using :func:`~stagpy.time_series.compstat`.

docs/sources/cookbook/vrmsra.rst

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,26 @@ parameters. Suppose again that several directories named ra-* are present in
77
your working directory. The following script will plot the RMS velocity as
88
function of time for all these directories::
99

10-
#!/usr/bin/env python3
11-
"""Nu=f(Ra) from a set of stagyy results in different directories"""
10+
#!/usr/bin/env python3
11+
"""vrms(t) from a set of StagYY runs."""
1212

13-
import matplotlib.pyplot as plt
14-
from stagpy import stagyydata
15-
from pathlib import Path
16-
from numpy import log10
13+
from pathlib import Path
14+
from stagpy.stagyydata import StagyyData
15+
import matplotlib.pyplot as plt
16+
import numpy as np
1717

18-
fig = plt.figure()
18+
pwd = Path('Examples/')
19+
for folder in pwd.glob('ra-*'):
20+
print('In directory', folder)
21+
sdat = StagyyData(folder)
22+
# Reference Rayleigh number as a power of ten
23+
ra0_log10 = int(np.log10(sdat.par['refstate']['ra0']))
24+
# vrms time series object
25+
vrms = sdat.tseries['vrms']
26+
# plot time vs vrms values
27+
plt.plot(vrms.time, vrms.values, label=f'$Ra=10^{{{ra0_log10}}}$')
1928

20-
pwd = Path('Examples/')
21-
for rep in pwd.glob('ra-*'):
22-
print('In directory ', rep)
23-
sdat = stagyydata.StagyyData(rep)
24-
# get the value of the Rayleigh number
25-
ra0 = sdat.par['refstate']['ra0']
26-
# get the time vector
27-
time = sdat.tseries['t']
28-
# get the vrms vector
29-
vrms = sdat.tseries['vrms']
30-
# plot
31-
plt.plot(time, vrms, label=r'$Ra=10^{%1d}$' % log10(ra0))
32-
33-
plt.legend()
34-
plt.xlabel(r'Time')
35-
plt.ylabel(r'RMS velocity')
36-
plt.savefig('time-vrms.pdf')
37-
plt.close(fig)
29+
plt.legend()
30+
plt.xlabel('Time')
31+
plt.ylabel('RMS velocity')
32+
plt.savefig('time-vrms.pdf')

docs/sources/stagyydata.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ A :class:`~stagpy.stagyydata.StagyyData` instance has two attributes to access
2525
time steps and snapshots in a consistent way:
2626
:attr:`~stagpy.stagyydata.StagyyData.steps` and
2727
:attr:`~stagpy.stagyydata.StagyyData.snaps`. Accessing the ``n``-th time step
28-
or the ``m-th`` snapshot is done using the item access notation (square
28+
or the ``m``-th snapshot is done using the item access notation (square
2929
brackets)::
3030

3131
sdat.steps[n]
3232
sdat.snaps[m]
3333

34-
These two expressions each return a :class:`~stagpy.stagyydata._Step` instance.
34+
These two expressions each return a :class:`~stagpy._step.Step` instance.
3535
Moreover, if the ``m``-th snapshot was done at the ``n``-th step, both
36-
expressions return the same :class:`~stagpy.stagyydata._Step` instance. In
36+
expressions return the same :class:`~stagpy._step.Step` instance. In
3737
other words, if for example the 100th snapshot was made at the 1000th step,
3838
``sdat.steps[1000] is sdat.snaps[100]`` is true. The correspondence between
3939
time steps and snapshots is deduced from available binary files.
@@ -134,8 +134,8 @@ Both are :class:`pandas.Series` indexed by the available variables.
134134
Geometry
135135
--------
136136

137-
Geometry information are read from binary files. :attr:`_Step.geom
138-
<stagpy.stagyydata._Step.geom>` has various attributes defining the geometry of
137+
Geometry information are read from binary files. :attr:`Step.geom
138+
<stagpy._step.Step.geom>` has various attributes defining the geometry of
139139
the problem.
140140

141141
``cartesian``, ``curvilinear``, ``cylindrical``, ``spherical`` and ``yinyang``
@@ -152,24 +152,20 @@ are the total number of points in the various spatial directions. Note that
152152
``nttot``, ``nptot`` and ``nrtot`` are the same as ``nxtot``, ``nytot`` and
153153
``nztot`` regardless of whether the geometry is cartesian or curvilinear.
154154

155-
``x_coord``, ``y_coord`` and ``z_coord`` as well as ``t_coord``, ``p_coord``
156-
and ``r_coord`` are the coordinates of cell centers in the three directions.
157-
As for the total number of points, they are the same regardless of the actual
158-
geometry.
155+
``x_centers``, ``y_centers``, and ``z_centers`` as well as ``t_centers``,
156+
``p_centers``, and ``r_centers`` are the coordinates of cell centers in the
157+
three directions. As for the total number of points, they are the same
158+
regardless of the actual geometry.
159159

160-
``x_mesh``, ``y_mesh`` and ``z_mesh`` are three dimensional meshes containing
161-
the **cartesian** coordinates of cell centers (even if the geometry is
162-
curvilinear).
163-
164-
``t_mesh``, ``p_mesh`` and ``r_mesh`` are three dimensional meshes containing
165-
the **spherical** coordinates of cell centers (these are set as ``None`` if the
166-
geometry is cartesian).
160+
Similarly to ``*_centers`` attributes, ``x_walls``, ``y_walls``, and
161+
``z_walls`` as well as ``t_walls``, ``p_walls``, and ``r_walls`` are the
162+
coordinates of cell walls in the three directions.
167163

168164
Scalar and vector fields
169165
------------------------
170166

171-
Vector and scalar fields are accessible through :attr:`_Step.fields
172-
<stagpy.stagyydata._Step.fields>` using their name as key. For example, the
167+
Vector and scalar fields are accessible through :attr:`Step.fields
168+
<stagpy._step.Step.fields>` using their name as key. For example, the
173169
temperature field of the 100th snapshot is obtained with
174170
``sdat.snaps[100].fields['T']``. Valid names of fields can be obtained by
175171
running ``% stagpy var``. Fields are four dimensional arrays, with indices in
@@ -179,7 +175,7 @@ Tracers data
179175
------------
180176

181177
Tracer data (position, mass, composition...) are accessible through
182-
:attr:`_Step.tracers<stagpy.stagyydata._Step.tracers>` using the
178+
:attr:`Step.tracers<stagpy._step.Step.tracers>` using the
183179
property name as key. They are organized by block. For example,
184180
the masses of tracers in the first block is obtained with
185181
``sdat.snaps[-1].tracers['Mass'][0]``. This is a one dimensional

0 commit comments

Comments
 (0)