From 3e3f247a9cbc050172aa1c69d4e268de4073ec89 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 2 Dec 2024 10:44:28 +0000 Subject: [PATCH 01/10] :art: Enhance variable naming standards in documentation with detailed prefixes for various data types --- .../proc-pages/development/standards.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 59a7b4497e..4e2c7e80df 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -56,14 +56,117 @@ If the constants doesn't exist then add it with a source link and uncertainty va Use a lowercase single letter, word, or words. Separate words with underscores to improve readability. If converting between units it may be required to have some capital letters at the end of the variable name to differentiate between different orders of magnitude, `m` and `M` etc. +The agreed upon style is to name the variables by the following scheme: + +`var = ___` + +If the variables are physics variables and do not belong to a system then: + +`var = _` + +The data types of different variables can be seen below: + +--------------------- + +#### Radii and thicknesses + +- Radial positions should start with the `r_` prefix +- Radial thicknesses should start with the `dr_` prefix + +- Vertical positions should start with the `z_` prefix +- Vertical thicknesses should start with the `dz_` prefix + +--------------------- + +#### Integer countable items + +- Integer countable items should start with the `n_` prefix + +Example, the total number of TF coils: `n_tf_coils` + +--------------------- + +#### Areas + +- Areas should start with the `a_` prefix + +Example, the area of the TF winding pack: `a_tf_wp` + +--------------------- + +#### Lengths + +- Lengths should start with the `len_` prefix + +--------------------- + +#### Mass + +- Masses should start with the `m_` prefix + +--------------------- + +#### Densities + +- Densities should start with the `den_` prefix + +--------------------- + +#### Resistances + +- Resistances should start with the `res_` prefix + +--------------------- + +#### Resistivity + +- Resistivity variables should start with the `rho_` prefix + +--------------------- + +#### Current densities + +- Current densities should start with the `j_` prefix + +--------------------- + +#### Powers + +- Powers should start with the `p_` prefix + +--------------------- + +#### Temperatures + +- Temperatures should start with the `temp_` prefix + +--------------------- + +#### Times + +- Times should start with the `t_` prefix +- Time intervals should start with the `dt_` prefix + +--------------------- + +#### Magnetic field strengths + +- Magnetic field strengths should start with the `b_prefix` + +--------------------- + #### Variables representing fractions If a variable is intended to demonstrate a fraction of a value or distribution etc. Then it should start with the `f_` prefix. +--------------------- + #### F-values Variables used within constraint equations to scale iteration variables (f-values) should start with the `f` prefix without an underscore before the next word. +--------------------- + ### Length Try to keep names to a sensible length while also keeping the name explicit and descriptive. From fd0392a77b8c33d5d0a537571af86bb982110e7b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 2 Dec 2024 10:57:22 +0000 Subject: [PATCH 02/10] :art: Update documentation to include variable naming standards for volumes, pressures, voltages, currents, energies, and frequencies --- .../proc-pages/development/standards.md | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 4e2c7e80df..fd8de4d165 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -94,6 +94,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Volumes + +- Volumes should start with the `vol_` prefix + +--------------------- + #### Lengths - Lengths should start with the `len_` prefix @@ -106,12 +112,25 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Pressures + +- Pressures should start with the `pres_` prefix + +--------------------- + + #### Densities - Densities should start with the `den_` prefix --------------------- +#### Voltages + +- Voltages should start with the `v_` prefix + +--------------------- + #### Resistances - Resistances should start with the `res_` prefix @@ -124,6 +143,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Currents + +- Currents should start with the `amps_` prefix + +--------------------- + #### Current densities - Current densities should start with the `j_` prefix @@ -136,6 +161,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Energies + +- Energies should start with the `e_` prefix + +--------------------- + #### Temperatures - Temperatures should start with the `temp_` prefix @@ -151,7 +182,13 @@ Example, the area of the TF winding pack: `a_tf_wp` #### Magnetic field strengths -- Magnetic field strengths should start with the `b_prefix` +- Magnetic field strengths should start with the `b_` + +--------------------- + +#### Frequencies + +- Frequencies should start with the `hz_` --------------------- From 959d2b4f57946c82fe1f2a78a24fa0dba6801df8 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Tue, 3 Dec 2024 14:17:27 +0000 Subject: [PATCH 03/10] :art: Update variable naming standards for currents, inductances, frequencies, and angles in documentation --- .../proc-pages/development/standards.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index fd8de4d165..7988b65050 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -145,7 +145,13 @@ Example, the area of the TF winding pack: `a_tf_wp` #### Currents -- Currents should start with the `amps_` prefix +- Currents should start with the `c_` prefix + +--------------------- + +#### Inductances + +- Inductances should start with the `h_` prefix --------------------- @@ -188,7 +194,13 @@ Example, the area of the TF winding pack: `a_tf_wp` #### Frequencies -- Frequencies should start with the `hz_` +- Frequencies should start with the `freq_` + +--------------------- + +#### Angles + +- Angles should start with the `deg_` or `rad_` depending on the units used --------------------- From 0262815377e0fd46aace49655e7e9ec915b07425 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Tue, 3 Dec 2024 16:26:23 +0000 Subject: [PATCH 04/10] :art: Add number density prefix standards to documentation --- documentation/proc-pages/development/standards.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 7988b65050..9b05fca901 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -86,6 +86,14 @@ Example, the total number of TF coils: `n_tf_coils` --------------------- +#### Number densities + +- Number density items should start with the `nd_` prefix + +Example, the plasma electron density: `dn_electron` + +--------------------- + #### Areas - Areas should start with the `a_` prefix From b04280a32496bbe14606432e7e0494261cad3e9b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 5 Dec 2024 14:42:51 +0000 Subject: [PATCH 05/10] :art: Update variable naming standards in documentation to include units and new prefixes for velocities --- .../proc-pages/development/standards.md | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 9b05fca901..676d4fd1fd 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -58,7 +58,9 @@ If converting between units it may be required to have some capital letters at t The agreed upon style is to name the variables by the following scheme: -`var = ___` +`var = ___` + +It is not always necessary to add the units abbreviation to the end of the variable but if doing so make sure it is case sensitive. If the variables are physics variables and do not belong to a system then: @@ -90,8 +92,6 @@ Example, the total number of TF coils: `n_tf_coils` - Number density items should start with the `nd_` prefix -Example, the plasma electron density: `dn_electron` - --------------------- #### Areas @@ -114,6 +114,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Velocities + +- Velocities should start with the `vel_` prefix + +--------------------- + #### Mass - Masses should start with the `m_` prefix @@ -293,26 +299,26 @@ ii | Variable name | Description | Units | | ------------- | ----------- | :---: | -| `plasma_current` | Plasma current | A | -| `plasma_current_MA` | Plasma current | MA | +| `c_plasma` | Plasma current | A | +| `c_plasma_MA` | Plasma current | MA | | `b_t_onaxis` | Toroidal field on-axis | T | | `b_t_max` | Max toroidal field | T | -| `n_electron_vol` | Volume average electron density | m-3 | -| `t_electron_vol_ev` | Volume avgerage electron temperature | eV | -| `mass_steel` | Mass of steel | kg | -| `mass_steel_tonne` | Mass of steel | tonne | -| `e_neutron_ev` | Energy of neutron | eV | +| `nd_electron_vol` | Volume average electron density | m-3 | +| `temp_electron_vol_eV` | Volume avgerage electron temperature | eV | +| `m_steel` | Mass of steel | kg | +| `m_steel_tonne` | Mass of steel | tonne | +| `e_neutron_eV` | Energy of neutron | eV | | `e_neutron_MeV` | Energy of neutron | MeV | | `v_tf_dump` | TF dump voltage | V | -| `time_plant_life` | Plant lifetime | s | -| `time_plant_life_yrs` | Plant lifetime | years | +| `t_plant_life` | Plant lifetime | s | +| `t_plant_life_yrs` | Plant lifetime | years | | `dr_tf_inboard_leg` | TF coil inboard leg radial thickness | m | | `dr_blanket_inboard` | Inboard blanket thickness | m | -| `velocity_coolant` | TF centrepost coolant velocity | m/s | -| `plasma_volume` | Plasma volume | m3 | -| `plasma_area` | Plasma area | m2 | -| `angle_div_target` | Divertor target angle | radians | -| `angle_div_target_deg` | Divertor target angle | deg | +| `vel_coolant` | TF centrepost coolant velocity | m/s | +| `vol_plasma` | Plasma volume | m3 | +| `a_plasma` | Plasma area | m2 | +| `rad_div_target` | Divertor target angle | radians | +| `deg_div_target` | Divertor target angle | deg | | `sig_tf_r` | TF radial stress | Pa | | `` | | | From 2dc338e67941d22d9ec3af90c721b591686ccb7b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 6 Dec 2024 14:30:17 +0000 Subject: [PATCH 06/10] :art: Update documentation to include prefix standards for pressure changes and power densities --- documentation/proc-pages/development/standards.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 676d4fd1fd..cd63421c46 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -129,6 +129,7 @@ Example, the area of the TF winding pack: `a_tf_wp` #### Pressures - Pressures should start with the `pres_` prefix +- Pressure changes or drops should start with the `dpres_` prefix --------------------- @@ -181,6 +182,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Power densities + +- Power densities should start with the `pden_` prefix + +--------------------- + #### Energies - Energies should start with the `e_` prefix From 73e33ca127291d214c93d2148d2e38ce749b2513 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 6 Dec 2024 15:43:02 +0000 Subject: [PATCH 07/10] :art: Update documentation to include systems designations --- .../proc-pages/development/standards.md | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index cd63421c46..d60ceb7ee1 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -40,10 +40,14 @@ all new models should have their own function Use a lowercase word or words. Separate words by underscores(`_`) to improve readability. +--------------------- + ### Switches Switches should start with the `i_` prefix in their name, be of integer type and should be indexed from 0. +--------------------- + ### Constants Use an uppercase single letter, word, or words. Separate words with underscores to improve readability. @@ -51,8 +55,14 @@ Use an uppercase single letter, word, or words. Separate words with underscores Refrain from declaring or typing known numerical constants directly in the code. Instead call the value from `constants.f90` If the constants doesn't exist then add it with a source link and uncertainty value. +--------------------- + ### Variables +!!! note + + Variable names are slowly being converted to their new verbose form as development progresses. Therefore you may come across variables that do not match the style mentioned below. + Use a lowercase single letter, word, or words. Separate words with underscores to improve readability. If converting between units it may be required to have some capital letters at the end of the variable name to differentiate between different orders of magnitude, `m` and `M` etc. @@ -60,7 +70,19 @@ The agreed upon style is to name the variables by the following scheme: `var = ___` -It is not always necessary to add the units abbreviation to the end of the variable but if doing so make sure it is case sensitive. +#### System designations + +Below are a few shorthand designations for different systems that should be used in variable names + +- Toroidal field coils: `_tf_` +- Poloidal field coils: `_pf_` +- Vacuum Vessel: `_vv_` +- Divertor: `_div_` +- Blanket: `_blkt_` +- Shield: `_shield_` +- Central Solenoid: `_cs_` +- Heating & Current Drive: `_hcd_` +- Neutral Beam: `_nb_` If the variables are physics variables and do not belong to a system then: @@ -241,6 +263,8 @@ Variables used within constraint equations to scale iteration variables (f-value Try to keep names to a sensible length while also keeping the name explicit and descriptive. +--------------------- + ### Physical Type The physical type of the variable should form the first part of the variable name, e.g. for plasma resistance the variable should be named: @@ -264,11 +288,22 @@ Inside PROCESS all variables should be in SI units unless otherwise stated. For ```fortran ! Fusion power [W] fusion_power = 1000.0d6 +``` + +If a variable is not in SI units then its units should be put at the end of of the variable name. +Example: +```fortran ! Fusion power [MW] fusion_power_MW = 1000.0d0 ``` +!!! note + + With `f2py` you may encounter a Fortran error where the variable with units at the end in capital letters is not recognised. If so for the meantime put the units in their lowercase form. This problem will be solved in the future by full Pythonisation. + +--------------------- + ### Coordinates and dimensions Coordinates should be defined as @@ -291,6 +326,8 @@ dz_cs = dtheta_description = ``` +--------------------- + ### Loop order Loop variables that use I, j etc. should use @@ -302,6 +339,8 @@ ii mm ``` +--------------------- + ### Examples | Variable name | Description | Units | From f766898d00a3d289fb8510f841c58670c7635d13 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 6 Dec 2024 15:59:23 +0000 Subject: [PATCH 08/10] :art: Add documentation for power fluxes and efficiency variable naming standards --- documentation/proc-pages/development/standards.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index d60ceb7ee1..2bb8e34daf 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -210,6 +210,12 @@ Example, the area of the TF winding pack: `a_tf_wp` --------------------- +#### Power fluxes + +- Power fluxes should start with the `pflux_` prefix + +--------------------- + #### Energies - Energies should start with the `e_` prefix @@ -251,6 +257,10 @@ Example, the area of the TF winding pack: `a_tf_wp` If a variable is intended to demonstrate a fraction of a value or distribution etc. Then it should start with the `f_` prefix. +Similar to this is variables representing efficiencies. + +If a variable is intended to represent an engineering efficiency then it should start with the `eta_` prefix to represent $\eta$ + --------------------- #### F-values From 9494991b5108cb1523824819af7ee487696cb560 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 6 Dec 2024 17:01:52 +0000 Subject: [PATCH 09/10] :art: Add shorthand designation for Centre post in documentation --- documentation/proc-pages/development/standards.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 2bb8e34daf..04579a60d2 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -83,6 +83,7 @@ Below are a few shorthand designations for different systems that should be used - Central Solenoid: `_cs_` - Heating & Current Drive: `_hcd_` - Neutral Beam: `_nb_` +- Centre post: `_cp_` Should only be used for ST's If the variables are physics variables and do not belong to a system then: From a3840303e017e4df4e4967ad2e5c06c0984c8254 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 9 Dec 2024 11:11:21 +0000 Subject: [PATCH 10/10] :art: Update shorthand designations in documentation to include first wall and additional current drive types --- documentation/proc-pages/development/standards.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 04579a60d2..79c2e75888 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -77,12 +77,16 @@ Below are a few shorthand designations for different systems that should be used - Toroidal field coils: `_tf_` - Poloidal field coils: `_pf_` - Vacuum Vessel: `_vv_` +- First wall: `_fw_` - Divertor: `_div_` - Blanket: `_blkt_` - Shield: `_shield_` - Central Solenoid: `_cs_` - Heating & Current Drive: `_hcd_` -- Neutral Beam: `_nb_` + - Electron cyclotron current drive: `_eccd_` + - Ion cyclotron current drive: `_iccd_` + - Electron Bernstein Wave: `_ebw_` + - Neutral Beam: `_nb_` - Centre post: `_cp_` Should only be used for ST's If the variables are physics variables and do not belong to a system then: