Skip to content

Update add-vars.md#4332

Open
timothy-nunn wants to merge 5 commits into
mainfrom
3664-update-add-varsmd
Open

Update add-vars.md#4332
timothy-nunn wants to merge 5 commits into
mainfrom
3664-update-add-varsmd

Conversation

@timothy-nunn

@timothy-nunn timothy-nunn commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Updated the guide for adding variables, inputs, scan vars, figures of merit, and iteration vars. They needed a refresh due to changes in the Python conversion, recent data structure changes, and enumification.

I have also reduced the need for users to manually increment some variables (was not possible for the scan variables due to circular imports).

@timothy-nunn timothy-nunn linked an issue Jun 17, 2026 that may be closed by this pull request
@codecov-commenter

codecov-commenter commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.80%. Comparing base (89e1ebe) to head (5f0c0e2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4332   +/-   ##
=======================================
  Coverage   48.79%   48.80%           
=======================================
  Files         151      151           
  Lines       29383    29387    +4     
=======================================
+ Hits        14337    14341    +4     
  Misses      15046    15046           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timothy-nunn timothy-nunn marked this pull request as ready for review June 18, 2026 08:32
@timothy-nunn timothy-nunn requested a review from a team as a code owner June 18, 2026 08:32
@timothy-nunn

Copy link
Copy Markdown
Collaborator Author

Requesting a couple of reviews to ensure these docs make sense and are sufficiently detailed

@timothy-nunn timothy-nunn force-pushed the 3664-update-add-varsmd branch from 0aba1cf to d1dd370 Compare June 18, 2026 14:55

@clmould clmould left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All minor things, mostly suggested changes, but otherwise happy with the content

-----------------

## Add a new variable
You may need to add a variable to PROCESS when changing or creating models. In most cases, you will want to add your variable to an existing data structure. Creating an entierly new data structure is beyond the scope of this guide, so please seek support from the PROCESS maintainers.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You may need to add a variable to PROCESS when changing or creating models. In most cases, you will want to add your variable to an existing data structure. Creating an entierly new data structure is beyond the scope of this guide, so please seek support from the PROCESS maintainers.
You may need to add a variable to PROCESS when changing or creating models. In most cases, you will want to add your variable to an existing data structure. Creating an entirely new data structure is beyond the scope of this guide, so please seek support from the PROCESS maintainers.

INPUT_VARIABLES = {
...
"rho_tf_joints": InputVariable("tfcoil", float, range=(0.0, 0.01)),
"my_new_blanket_variable": InputVariable("blanket", str),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"my_new_blanket_variable": InputVariable("blanket", str),
"my_new_blanket_variable": InputVariable("blanket", float),

Continuing with the example from the previous section:
```python
INPUT_VARIABLES = {
INPUT_VARIABLES = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Around here can you make a note about choices, ranges and array=True that people may need to know about

- `0.1` is the default lower bound of the variable.
- `1.0` is the default upper bound of the variable.

You will often want to add a variable as an input if it is an iteration variable. That way, you can specify the initial value of the iteration variable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You will often want to add a variable as an input if it is an iteration variable. That way, you can specify the initial value of the iteration variable.
You will often want to add a variable to the input file if it is an iteration variable. That way, you can specify the initial value of the iteration variable.

Think this might be clearer, so as not to be confused with setting it as an InputVariable

Also why might someone have an iteration variable they don't add to the input file? Would it just take a default initial value in this case?

```
ixc = 123

my_new_blanket_variable = 0.5 * initial value (optional)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help to specify here that * is a comment in the .DAT file, or is the user assumed to know this already? Or perhaps just removing this inline comment

-----------------
In general, a variable within a data structure could act as an:

- Input variable: is specified by the user in an `IN.DAT`/has a default value and is not changed once PROCESS is running.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Input variable: is specified by the user in an `IN.DAT`/has a default value and is not changed once PROCESS is running.
- Input variable: is specified by the user in an `IN.DAT` or has a default value, and is not changed once PROCESS is running.

Might look nicer than using the / ? Or maybe splitting into 2 parts, with a 'Note' about its value remains unchanged during a PROCESS run?

- Iteration variable: is modified by the solver to try and optimise for some figure of merit.
- Scan variable: is sequentially modified by the `Scan` class to some `IN.DAT`-defined values.
- Intermediate variable: is calculated within a model and then used within other models.
- Output variable: is calculated within a model and then written out the `MFILE.DAT`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Output variable: is calculated within a model and then written out the `MFILE.DAT`.
- Output variable: is calculated within a model and then written out to the `MFILE.DAT`.


IPEQNS = 92
"""number of constraint equations available"""
IPEQNS = 500

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How/why is this 500? Is it just an arbitrary upper limit?

Also would it be worth renaming it to reflect its updated definition?

"""maximum number of constraint equations available"""

IPNFOMS = 19
IPNFOMS = len(FiguresOfMerit)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is being used anywhere any more? Or at least if I search for it it just comes up once? (Might've been missed in my numerics dataclass pr tbh, whoops!)

@ConstraintManager.register_constraint(1234, "m", "=")
def my_constraint_function(constraint_registration):
return geq(value, bound, constraint_registration)
return geq(value, bound, constraint_registration)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return geq(value, bound, constraint_registration)
return eq(value, bound, constraint_registration)

@clmould clmould self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update add-vars.md

3 participants