You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/capabilities/optimization.rst
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,14 +36,15 @@ For this tutorial we will need the following modules:
36
36
37
37
import torch
38
38
import numpy as np
39
+
from pathlib import Path
39
40
from mitim_tools.opt_tools import STRATEGYtools
40
41
41
42
Select the location of the MITIM namelist (see :ref:`Understanding the MITIM namelist` to understand how to construct the namelist file) and the folder to work on:
Then create your custom optimization object as a child of the parent ``STRATEGYtools.opt_evaluator`` class.
49
50
You only need to modify what operations need to occur inside the ``run()`` (where operations/simulations happen) and ``scalarized_objective()`` (to define what is the target to maximize) methods.
@@ -58,11 +59,11 @@ In this example, we are using ``x**2`` as our function with a 2% evaluation erro
58
59
# ----------------------------------------
59
60
60
61
# Problem description (rest of problem parameters are taken from namelist)
The TGLF class can be initialized by providing the radial location (in square root of normalized toroidal flux, ``rho``) to run. Note that the values are given as a list, and several radial locations can be run at once:
61
62
62
63
.. code-block:: python
63
64
64
65
tglf = TGLFtools.TGLF(rhos=[0.5, 0.7])
65
66
66
-
To generate the input files (input.tglf) to TGLF at each radial location, MITIM needs to run a few commands to correctly map the quantities in the input.gacode file to the ones required by TGLF. This is done automatically with the ``prep()`` command. Note that MITIM has a *only-run-if-needed* philosophy and if it finds that the input files to TGLF already exist in the working folder, the preparation method will not run any command, unless a ``restart = True`` argument is provided.
67
+
To generate the input files (input.tglf) to TGLF at each radial location, MITIM needs to run a few commands to correctly map the quantities in the input.gacode file to the ones required by TGLF. This is done automatically with the ``prep()`` command. Note that MITIM has a *only-run-if-needed* philosophy and if it finds that the input files to TGLF already exist in the working folder, the preparation method will not run any command, unless a ``cold_start = True`` argument is provided.
The ``.prep()`` method, when applied to a case that starts with an input.gacode file, launches a `TGYRO` run for a "zero" iteration to generate *input.tglf* at specific ``rho`` locations from the *input.gacode*. This method to generate input files is inspired by how the `OMFIT framework <https://omfit.io/index.html>`_ works.
75
76
76
-
Now, we are ready to run TGLF. Once the ``prep()`` command has finished, one can run TGLF with different settings and assumptions. That is why, at this point, a sub-folder name for this specific run can be provided. Similarly to the ``prep()`` command, a ``restart`` flag can be provided.
77
+
Now, we are ready to run TGLF. Once the ``prep()`` command has finished, one can run TGLF with different settings and assumptions. That is why, at this point, a sub-folder name for this specific run can be provided. Similarly to the ``prep()`` command, a ``cold_start`` flag can be provided.
77
78
The set of control inputs to TGLF (like saturation rule, electromagnetic effects, etc.) are provided in two ways.
78
79
First, the argument ``TGLFsettings`` indicates the base case to start with.
79
80
The user is referred to ``templates/input.tglf.models.json`` to understand the meaning of each setting, and ``templates/input.tglf.controls`` for the default setup.
@@ -82,17 +83,17 @@ For example, the following two commands will run TGLF with saturation rule numbe
82
83
83
84
.. code-block:: python
84
85
85
-
tglf.run( subFolderTGLF='yes_em_folder/',
86
+
tglf.run( subFolderTGLF='yes_em_folder',
86
87
TGLFsettings=5,
87
88
extraOptions= {},
88
-
restart=False )
89
+
cold_start=False )
89
90
90
91
tglf.read( label='yes_em' )
91
92
92
-
tglf.run( subFolderTGLF='no_em_folder/',
93
+
tglf.run( subFolderTGLF='no_em_folder',
93
94
TGLFsettings=5,
94
95
extraOptions= {'USE_BPER':False},
95
-
restart=False )
96
+
cold_start=False )
96
97
97
98
tglf.read( label='no_em' )
98
99
@@ -123,10 +124,11 @@ If instead of an input.gacode, you have a TRANSP .CDF file (``cdf_file``) and wa
Copy file name to clipboardExpand all lines: docs/capabilities/transp_capabilities.rst
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,32 +22,33 @@ For this tutorial we will need the following modules:
22
22
.. code-block:: python
23
23
24
24
import os
25
+
from pathlib import Path
25
26
from mitim_tools.transp_tools import TRANSPtools
26
27
27
28
TRANSP runs are very personal and specific to each tokamak and plasma, as diagnostic availability strongly varies and namelist settings are not standarized.
28
29
For this reason, this workflow assumes that a folder exists with all the plasma information (UFILES) and namelist required to run TRANSP:
First, one would initialize the TRANSP class with the given folder and the tokamak name:
38
39
39
40
.. code-block:: python
40
41
41
-
tokamak ='CMOD'
42
+
tokamak ="CMOD"
42
43
transp = TRANSPtools.TRANSP( folder, tokamak )
43
44
44
45
Then, select a shotnumber and run name, such that the TRANSP simulation will have the complete name `shotnumber+runname`, and the MPI settings for the TRANSP run:
If the user wants to run VITALS as a slurm job in a cluster, it is recommended that the keyword argument ``askQuestions = False`` is passed to ``PRF_BO()``.
149
+
If the user wants to run VITALS as a slurm job in a cluster, it is recommended that the keyword argument ``askQuestions = False`` is passed to ``MITIM_BO()``.
Copy file name to clipboardExpand all lines: docs/installation.rst
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,9 +68,18 @@ There are different options to handle this config file.
68
68
from mitim_tools import config_manager
69
69
config_manager.set(file_location)
70
70
71
-
Apart from machine configurations, ``preferences`` in ``config_user.json`` also includes a ``verbose_level`` flag, which indicates the amount of messages that are printed to the terminal when running MITIM.
72
-
For debugging purposes, it is recommended a maximum verbose level of ``5``.
73
-
For production runs, a minimum verbose level of ``1`` is recommended so that you only get important messages.
71
+
Apart from machine configurations, ``preferences`` in ``config_user.json`` also includes a ``verbose_level`` flag, which indicates the amount of messages that are printed to the terminal when running MITIM:
72
+
73
+
.. code-block:: console
74
+
75
+
5: everything (normal prints + information prints + warning prints + questions + optimization progress)
76
+
4: information prints + warning prints + questions + optimization progress
77
+
3: information prints + warning prints + questions
78
+
2: warning prints + questions
79
+
1: warning prints
80
+
0: nothing
81
+
82
+
74
83
``preferences`` also allows a ``dpi_notebook`` value (in percent from standard), which should be adjusted for each user's screen configuration if the MITIM notebook figures are too small or too large.
75
84
76
85
This is an example of a ``config_user.json`` file that specifies that TGLF should be run in the *eofe7.mit.edu* machine and TGYRO in the *perlmutter.nersc.gov* machine.
0 commit comments