Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions documentation/source/usage/running-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ will produce the following output files in the same directory as the input file:

### VaryRun

VaryRun is a tool which takes an input file that does not converge and varies the initial values of the iteration variables, within a tolerance, to find an initial point that converges, and creates an input file using these variables.

VaryRun requires a `.conf` file, which specifies certain parameters needed for VaryRun. These
include a path to the original input file, the maximum number of iterations to perform, and a
factor within which the iteration variables are changed.

For a given iteration, `X`, of VaryRun, the values of the iteration variables will be
changed and a new input file, `X_IN.DAT` will be created in the same directory as the `.conf` file. `PROCESS` will be run on this input file to produce the associated output files, `X_MFILE.DAT`, `X_OUT.DAT` and `X_process.log`. If `VaryRun` is not able to find a converging input file within the maximum number of iterations, some more information on error status can be found in the created README.txt file. If no converging solution is found, you could try increasing the maximum number of iterations, changing the factor within which the iteration variables are changed, or by changing the initial values of the iteration variables.

The default VaryRun configuration filename is `run_process.conf`. If no configuration filename is given as an argument in the command line, `run_process.conf` is assumed to be present in the current directory:
```bash
# Use a configuration file called run_process.conf in the current directory
Expand Down Expand Up @@ -87,10 +96,10 @@ The configuration file has the following format:
* Path to working directory in which PROCESS is run.
WDIR = .

* original IN.DAT name (should not be called IN.DAT!)
ORIGINAL_IN_DAT = large_tokamak_IN.DAT
* original IN.DAT name
ORIGINAL_IN_DAT = path/to/original_IN.DAT

* ONE line comment to be put into README.txt
* optional ONE line comment to be put into README.txt
COMMENT =

* Maximum number of runs
Expand Down
4 changes: 2 additions & 2 deletions examples/data/run_process.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Path to working directory in which PROCESS is run.
WDIR = .

* original IN.DAT name (should not be called IN.DAT!)
ORIGINAL_IN_DAT = large_tokamak_IN.DAT
* original IN.DAT name
ORIGINAL_IN_DAT = large_tokamak_varyrun_IN.DAT

* Max no. iterations
NITER = 30
Expand Down
14 changes: 7 additions & 7 deletions examples/vary_run_example.ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
# `VaryRun` requires a `.conf` file which specifies certain parameters needed for `VaryRun`.
# In this file, you specify the original input file, the maximum number of iterations to be performed, and a factor within which the iteration variables are changed.
#
# If `VaryRun` is able to find a new initial point within the maximum number of iterations, it produces a new input file, called `IN.DAT`, in the same directory as your initial input file. This new file will now converge when you run `PROCESS`.
#
# If `VaryRun` is able to find a new initial point within the maximum number of iterations, you can find this file in the same directory as your initial input file. This new file will now converge when you run `PROCESS`.
# `VaryRun` will produce new, numbered sets of files for each iteration it performs.
# %% [markdown]
# # VaryRun setup
#
Expand All @@ -55,7 +55,7 @@
# * Path to working directory in which PROCESS is run.
# WDIR = .
#
# * original IN.DAT name (should not be called IN.DAT!)
# * original IN.DAT name
# ORIGINAL_IN_DAT = ORIGINAL_IN.DAT
#
# * Max no. iterations
Expand All @@ -71,7 +71,7 @@
# %% [markdown]
# ## Run `VaryRun`
#
# Run `PROCESS` on an input file using the `VaryRun` class. The initial input file, `large_tokamak_varyrun_IN.DAT` does not converge. `VaryRun` will vary the initial values of the iteration variables to find an initial point that converges, and will create a new input file, `IN.DAT`, with these new values.
# Run `PROCESS` on an input file using the `VaryRun` class. The initial input file, `large_tokamak_varyrun_IN.DAT` does not converge. `VaryRun` will vary the initial values of the iteration variables to find an initial point that converges, and will create a new input file with these new values.

# %%
# %load_ext autoreload
Expand All @@ -92,7 +92,7 @@
input_file = data_dir / "large_tokamak_varyrun_IN.DAT"

temp_dir = tempfile.TemporaryDirectory()
input_path = Path(temp_dir.name) / "large_tokamak_IN.DAT"
input_path = Path(temp_dir.name) / "large_tokamak_varyrun_IN.DAT"
conf_path = Path(temp_dir.name) / "run_process.conf"
shutil.copy(input_file, input_path)
shutil.copy(conf_file, conf_path)
Expand All @@ -110,7 +110,7 @@
vary_run.run()
os.chdir(cwd)


# %%
# Get the initial values from the original input file
iteration_variable_names, original_iteration_variable_values = (
get_mfile_initial_ixc_values(input_file)
Expand All @@ -120,7 +120,7 @@
# VaryRun always produces a file called IN.DAT in the same directory
# as the conf file
_, updated_iteration_variable_values = get_mfile_initial_ixc_values(
Path(temp_dir.name) / "IN.DAT"
Path(temp_dir.name) / "2_IN.DAT"
)

# %% [markdown]
Expand Down
5 changes: 4 additions & 1 deletion process/core/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

import process
from process import data_structure
from process.core.exceptions import ProcessValidationError, ProcessValueError
from process.core.exceptions import (
ProcessValidationError,
ProcessValueError,
)
from process.core.solver.constraints import ConstraintManager

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion process/core/io/mfile/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def get_mfile_initial_ixc_values(file_path: Path):
Parameters
----------
file_path :
The path to the MFile to get the initial iteration variable values from.
The path to the input file to get the initial iteration variable values from.
Notes
-----
Expand Down
59 changes: 0 additions & 59 deletions process/core/io/run_process.conf

This file was deleted.

Loading
Loading