Skip to content

Commit

Permalink
Include settings from BoutMesh in documentation
Browse files Browse the repository at this point in the history
Some settings that are not included in TokamakEquilibrium.user_options
or TokamakEquilibrium.nonorthogonal_options were previously missed in
the online documentation. This commit adds a 'Mesh options' page that
includes them (avoiding duplicating any settings that were already
included on the 'Tokamak options' page).
  • Loading branch information
johnomotani committed Jan 19, 2024
1 parent f9eceb0 commit 6e5f88e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 19 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys

import hypnotoad
from optionsfactory import OptionsFactory

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
Expand Down Expand Up @@ -84,7 +85,18 @@ def reformat_Texttable(tt_string):
return result


def create_options_rst(filename, title, options_factory):
def create_options_rst(filename, title, options_factory, *, exclude=None):
print("create options for", filename)
if exclude is not None:
# Exclude entries from `options_factory` that are in some other OptionsFactory
# object, so we can avoid duplicating descriptions
settings_to_keep = {
k: v
for k, v in options_factory.defaults.items()
if k not in exclude.defaults
}
options_factory = OptionsFactory(**settings_to_keep)

with open(tempdir.joinpath(filename), "w") as f:
f.write(":orphan:\n\n")
f.write(
Expand All @@ -109,6 +121,12 @@ def create_options_rst(filename, title, options_factory):
"Nonorthogonal options",
hypnotoad.tokamak.TokamakEquilibrium.nonorthogonal_options_factory,
)
create_options_rst(
"mesh-options.rst",
"Mesh options",
hypnotoad.core.mesh.BoutMesh.user_options_factory,
exclude=hypnotoad.tokamak.TokamakEquilibrium.user_options_factory,
)
create_options_rst(
"circular-options.rst",
"Circular options",
Expand Down
3 changes: 2 additions & 1 deletion doc/inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Relevant options will be described in the following sections. A complete list
of the options for both orthogonal and nonorthogonal grids is here:
:ref:`_temp/options:Tokamak options`. Options that only apply to nonorthogonal
grids are listed here: :ref:`_temp/nonorthogonal-options:Nonorthogonal
options`.
options`. Some other options used to set tolerances, etc. for the grid
generation process are here: :ref:`_temp/mesh-options:Mesh options`.

All the settings used for grid generation are saved (with all defaults
evaluated) in YAML format in the grid file for provenance tracking. They can be
Expand Down

0 comments on commit 6e5f88e

Please sign in to comment.