main
Run Process by calling into the Fortran.
This uses a Python module called fortran.py, which uses an extension module called "_fortran.cpython... .so", which are both generated from process_module.f90. The process_module module contains the code to actually run Process.
This file, process.py, is now analogous to process.f90, which contains the Fortran "program" statement. This Python module effectively acts as the Fortran "program".
Power Reactor Optimisation Code for Environmental and Safety Studies
This is a systems code that evaluates various physics and engineering aspects of a fusion power plant subject to given constraints, and can optimise these parameters by minimising or maximising a function of them, such as the fusion power or cost of electricity.
This program is derived from the TETRA and STORAC codes produced by Oak Ridge National Laboratory, Tennessee, USA. The main authors in the USA were J.D.Galambos and P.C.Shipe.
The code was transferred to Culham Laboratory, Oxfordshire, UK, in April 1992, and the physics models were updated by P.J.Knight to include the findings of the Culham reactor studies documented in Culham Report AEA FUS 172 (1992). The standard of the Fortran has been thoroughly upgraded since that time, and a number of additional models have been added.
During 2012, PROCESS was upgraded from FORTRAN 77 to Fortran 95, to facilitate the restructuring of the code into proper modules (with all the benefits that modern software practices bring), and to aid the inclusion of more advanced physics and engineering models under development as part of a number of EFDA-sponsored collaborations.
Box file F/RS/CIRE5523/PWF (up to 15/01/96) Box file F/MI/PJK/PROCESS and F/PL/PJK/PROCESS (15/01/96 to 24/01/12) Box file T&M/PKNIGHT/PROCESS (from 24/01/12)
PACKAGE_LOGGING = True
module-attribute
Can be set False to disable package-level logging, e.g. in the test suite
VaryRun
Vary iteration parameters until a solution is found.
This is the old run_process.py utility.
Code to run PROCESS with a variation of the iteration parameters until a feasible solution is found. If running in sweep mode, the allowed number of unfeasible solutions can be changed in the config file.
Input files: run_process.conf (config file, in the same directory as this file) An IN.DAT file as specified in the config file
Output files: All of them in the work directory specified in the config file OUT.DAT - PROCESS output MFILE.DAT - PROCESS output process.log - logfile of PROCESS output to stdout README.txt - contains comments from config file
Source code in process/main.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
config = RunProcessConfig.from_file(Path(config_file).resolve(), solver)
instance-attribute
data = DataStructure()
instance-attribute
mfile_path
property
run()
Perform a VaryRun by running multiple SingleRuns.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
if input file doesn't exist |
Source code in process/main.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
SingleRun
Perform a single run of PROCESS.
Source code in process/main.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
input_file = Path(input_file)
instance-attribute
data = DataStructure()
instance-attribute
models = Models(self.data)
instance-attribute
solver = solver
instance-attribute
run()
Run PROCESS
This is separate from init to allow model instances to be modified before a run.
Source code in process/main.py
329 330 331 332 333 334 335 336 337 | |
init_module_vars()
staticmethod
Initialise all module variables in the Fortran.
This "resets" all module variables to their initialised values, so each new run doesn't have any side-effects from previous runs.
Source code in process/main.py
339 340 341 342 343 344 345 346 | |
set_filenames(filepath_out)
Validate the input filename and create other filenames from it.
Source code in process/main.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
set_input()
Validate and set the input file path.
Source code in process/main.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
set_output()
Set the output file name.
Set Path object on the Process object, and set the prefix in the Fortran.
Source code in process/main.py
386 387 388 389 390 391 392 393 394 | |
set_mfile()
Set the mfile filename.
Source code in process/main.py
396 397 398 | |
initialise()
Run the init module to call all initialisation routines.
Source code in process/main.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
run_scan()
Create scan object if required.
Source code in process/main.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
show_errors()
Report all informational/error messages encountered.
Source code in process/main.py
433 434 435 | |
finish()
Run the finish subroutine to close files open in the Fortran.
Files being handled by Fortran must be closed before attempting to write to them using Python, otherwise only parts are written.
Source code in process/main.py
437 438 439 440 441 442 443 444 445 446 | |
append_input()
Append the input file to the output file and mfile.
Source code in process/main.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
validate_input(replace_obsolete=False)
Checks the input IN.DAT file for any obsolete variables in the OBS_VARS dict contained
within obsolete_variables.py. If obsolete variables are found, and if replace_obsolete
is set to True, they are either removed or replaced by their updated names as specified
in the OBS_VARS dictionary.
Source code in process/main.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
validate_user_model()
Checks that a user-created model has been injected correctly
Ensures that the corresponding model variable in Models is defined and that any relevant switches are set correctly.
Source code in process/main.py
562 563 564 565 566 567 568 569 570 571 572 | |
CostsProtocol
Bases: Protocol
Protocol layout for costs models
Source code in process/main.py
575 576 577 578 579 580 581 582 | |
run()
Run the model
Source code in process/main.py
578 579 | |
output()
Write model output
Source code in process/main.py
581 582 | |
Models
Creates instances of physics and engineering model classes.
Creates objects to interface with corresponding Fortran physics and engineering modules.
Source code in process/main.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | |
data = data
instance-attribute
cs_fatigue = CsFatigue()
instance-attribute
cs_coil = CSCoil(cs_fatigue=(self.cs_fatigue))
instance-attribute
pfcoil = PFCoil(cs_fatigue=(self.cs_fatigue), cs_coil=(self.cs_coil))
instance-attribute
power = Power()
instance-attribute
cryostat = Cryostat()
instance-attribute
build = Build()
instance-attribute
sctfcoil = SuperconductingTFCoil()
instance-attribute
cicc_sctfcoil = CICCSuperconductingTFCoil()
instance-attribute
croco_sctfcoil = CROCOSuperconductingTFCoil()
instance-attribute
tfcoil = TFCoil(build=(self.build))
instance-attribute
resistive_tf_coil = ResistiveTFCoil()
instance-attribute
copper_tf_coil = CopperTFCoil()
instance-attribute
aluminium_tf_coil = AluminiumTFCoil()
instance-attribute
divertor = Divertor()
instance-attribute
structure = Structure()
instance-attribute
plasma_geom = PlasmaGeom()
instance-attribute
availability = Availability()
instance-attribute
buildings = Buildings()
instance-attribute
vacuum = Vacuum()
instance-attribute
vacuum_vessel = VacuumVessel()
instance-attribute
water_use = WaterUse()
instance-attribute
pulse = Pulse()
instance-attribute
shield = Shield()
instance-attribute
ife = IFE(availability=(self.availability), costs=(self.costs))
instance-attribute
plasma_profile = PlasmaProfile()
instance-attribute
fw = FirstWall()
instance-attribute
blanket_library = BlanketLibrary(fw=(self.fw))
instance-attribute
ccfe_hcpb = CCFE_HCPB(fw=(self.fw))
instance-attribute
current_drive = CurrentDrive(plasma_profile=(self.plasma_profile), electron_cyclotron=(ElectronCyclotron(plasma_profile=(self.plasma_profile))), ion_cyclotron=(IonCyclotron(plasma_profile=(self.plasma_profile))), lower_hybrid=(LowerHybrid(plasma_profile=(self.plasma_profile))), neutral_beam=(NeutralBeam(plasma_profile=(self.plasma_profile))), electron_bernstein=(ElectronBernstein(plasma_profile=(self.plasma_profile))))
instance-attribute
plasma_beta = PlasmaBeta()
instance-attribute
plasma_inductance = PlasmaInductance()
instance-attribute
plasma_density_limit = PlasmaDensityLimit()
instance-attribute
plasma_exhaust = PlasmaExhaust()
instance-attribute
plasma_bootstrap_current = PlasmaBootstrapCurrent(plasma_profile=(self.plasma_profile))
instance-attribute
plasma_confinement = PlasmaConfinementTime()
instance-attribute
plasma_transition = PlasmaConfinementTransition()
instance-attribute
plasma_current = PlasmaCurrent()
instance-attribute
plasma_fields = PlasmaFields()
instance-attribute
plasma_dia_current = PlasmaDiamagneticCurrent()
instance-attribute
physics = Physics(plasma_profile=(self.plasma_profile), current_drive=(self.current_drive), plasma_beta=(self.plasma_beta), plasma_inductance=(self.plasma_inductance), plasma_density_limit=(self.plasma_density_limit), plasma_exhaust=(self.plasma_exhaust), plasma_bootstrap_current=(self.plasma_bootstrap_current), plasma_confinement=(self.plasma_confinement), plasma_transition=(self.plasma_transition), plasma_current=(self.plasma_current), plasma_fields=(self.plasma_fields), plasma_dia_current=(self.plasma_dia_current), plasma_geometry=(self.plasma_geom))
instance-attribute
physics_detailed = DetailedPhysics(plasma_profile=(self.plasma_profile))
instance-attribute
neoclassics = Neoclassics()
instance-attribute
stellarator = Stellarator(availability=(self.availability), buildings=(self.buildings), vacuum=(self.vacuum), costs=(self.costs), power=(self.power), plasma_profile=(self.plasma_profile), hcpb=(self.ccfe_hcpb), current_drive=(self.current_drive), physics=(self.physics), neoclassics=(self.neoclassics), plasma_beta=(self.plasma_beta), plasma_bootstrap=(self.plasma_bootstrap_current))
instance-attribute
dcll = DCLL(fw=(self.fw))
instance-attribute
costs
property
writable
models
property
setup_data_structure()
Source code in process/main.py
723 724 725 726 727 728 | |
process_cli(ctx, indat, solver, varyiterparams, config_file, mfile_path, mfilejson, update_obsolete, full_output)
PROCESS Power Reactor Optimisation Code Copyright © [2023][United Kingdom Atomic Energy Authority]
Contact James Morris : james.morris2@ukaea.uk Jonathan Maddock : jonathan.maddock@ukaea.uk
GitHub : https://github.com/ukaea/PROCESS
Source code in process/main.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |