Skip to content
Merged
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
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ FILE(GLOB PROCESS_PYTHON_SRC_PATHS ${PROCESS_PYTHON_SRC_DIR}/*.py)
# Define interface source filenames to wrap
LIST(APPEND PROCESS_SRCS
numerics.f90
constants.f90
output.f90
init_module.f90
global_variables.f90
)

PREPROCESS()
Expand Down
4 changes: 2 additions & 2 deletions process/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
from scipy.special import comb as combinations

from process import fortran as ft
from process import constants
from process import process_output as po
from process.data_structure import constraint_variables as ctv
from process.data_structure import cost_variables as cv
Expand Down Expand Up @@ -38,7 +38,7 @@ class Availability:
"""

def __init__(self) -> None:
self.outfile = ft.constants.nout # output file unit
self.outfile = constants.NOUT # output file unit

def run(self, output: bool = False):
"""Run appropriate availability model
Expand Down
4 changes: 2 additions & 2 deletions process/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import numpy as np

from process import constants
from process import process_output as po
from process.coolprop_interface import FluidProperties
from process.data_structure import (
Expand All @@ -19,7 +20,6 @@
primary_pumping_variables,
)
from process.exceptions import ProcessValueError
from process.fortran import constants

logger = logging.getLogger(__name__)

Expand All @@ -40,7 +40,7 @@

class BlanketLibrary:
def __init__(self, fw) -> None:
self.outfile = constants.nout
self.outfile = constants.NOUT

self.fw = fw

Expand Down
9 changes: 5 additions & 4 deletions process/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np

from process import constants
from process import process_output as po
from process.blanket_library import dshellarea, eshellarea
from process.data_structure import (
Expand All @@ -15,15 +16,15 @@
tfcoil_variables,
)
from process.exceptions import ProcessValueError
from process.fortran import constants, numerics
from process.fortran import numerics

logger = logging.getLogger(__name__)


class Build:
def __init__(self):
self.outfile = constants.nout
self.mfile = constants.mfile
self.outfile = constants.NOUT
self.mfile = constants.MFILE

def run(self) -> None:
self.calculate_radial_build(output=False)
Expand Down Expand Up @@ -78,7 +79,7 @@ def calculate_beam_port_size(
# Have kept the single letter variable names to match the original code and documentation diagram.
radius_beam_tangency = f_radius_beam_tangency_rmajor * rmajor

omega = constants.twopi / n_tf_coils
omega = constants.TWOPI / n_tf_coils

a = 0.5e0 * dx_tf_inboard_out_toroidal
try:
Expand Down
6 changes: 2 additions & 4 deletions process/buildings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np

from process import constants
from process import process_output as po
from process.data_structure import (
build_variables,
Expand All @@ -15,9 +16,6 @@
physics_variables,
tfcoil_variables,
)
from process.fortran import (
constants,
)

logger = logging.getLogger(__name__)

Expand All @@ -34,7 +32,7 @@ def __init__(self) -> None:

This routine calls the buildings calculations.
"""
self.outfile = constants.nout # output file unit
self.outfile = constants.NOUT # output file unit

def run(self, output: bool = False):
# Find TF coil radial positions
Expand Down
15 changes: 7 additions & 8 deletions process/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from process.io.mfile import MFile
from process.iteration_variables import set_scaled_iteration_variable
from process.objectives import objective_function
from process.utilities.f2py_string_patch import f2py_compatible_to_string
from process.process_output import OutputFileManager

if TYPE_CHECKING:
from process.main import Models
Expand Down Expand Up @@ -132,16 +132,15 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int) -> None:
for _ in range(10):
# Divert OUT.DAT and MFILE.DAT output to scratch files for
# idempotence checking
ft.init_module.open_idempotence_files()
OutputFileManager.open_idempotence_files()
self._call_models_once(xc)
# Write mfile
finalise(self.models, ifail)

# Extract data from intermediate idempotence-checking mfile
mfile_path = (
f2py_compatible_to_string(ft.global_variables.output_prefix)
+ "IDEM_MFILE.DAT"
)
data_structure.global_variables.output_prefix
) + "IDEM_MFILE.DAT"
mfile = MFile(mfile_path)
# Create mfile dict of float values: only compare floats
mfile_data = {
Expand Down Expand Up @@ -176,7 +175,7 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int) -> None:
logger.debug("Mfiles idempotent, returning")
# Divert OUT.DAT and MFILE.DAT output back to original files
# now idempotence checking complete
ft.init_module.close_idempotence_files()
OutputFileManager.close_idempotence_files()
# Write final output file and mfile
finalise(self.models, ifail)
return
Expand All @@ -202,7 +201,7 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int) -> None:
)

# Close idempotence files, write final output file and mfile
ft.init_module.close_idempotence_files()
OutputFileManager.close_idempotence_files()
finalise(
self.models,
ifail,
Expand All @@ -213,7 +212,7 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int) -> None:
except Exception:
# If exception in model evaluations delete intermediate idempotence
# files to clean up
ft.init_module.close_idempotence_files()
OutputFileManager.close_idempotence_files()
raise

def _call_models_once(self, xc: np.ndarray) -> None:
Expand Down
Loading