Skip to content

Funz/fz-Scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fz-scale

A Funz plugin for running SCALE (Standardized Computer Analyses for Licensing Evaluation) calculations.

This plugin provides support for four SCALE calculation types:

  • Scale-keno: KENO criticality calculations (=csas5, =csas6)
  • Scale-shift: CSAS-Shift criticality calculations with Shift Monte Carlo solver (=csas5-shift, =csas6-shift)
  • Scale-tsunami: TSUNAMI sensitivity/uncertainty analysis (=tsunami-3d)
  • Scale-xsdrnpm: XSDRNPM transport calculations (=xsdrnpm, =csas1x)

Features

Input Syntax

  • Variable syntax: &{variable_name}
  • Formula syntax: @{formula}
  • Comment character: ' (single quote)

Supported Output Variables

Scale-keno

  • mean_keff, sigma_keff: Effective multiplication factor and uncertainty
  • mean_E_lethargy, sigma_E_lethargy: Energy of average lethargy of fission
  • mean_nubar, sigma_nubar: Average neutrons per fission
  • mean_free_path, sigma_free_path: System mean free path

Scale-shift

Same output variables as Scale-keno:

  • mean_keff, sigma_keff: Effective multiplication factor and uncertainty
  • mean_E_lethargy, sigma_E_lethargy: Energy of average lethargy of fission
  • mean_nubar, sigma_nubar: Average neutrons per fission
  • mean_free_path, sigma_free_path: System mean free path

Scale-tsunami

All Scale-keno outputs plus sensitivity coefficients for various isotopes:

  • H-1, O-16, Al-27, Ti-48, Fe-56, C
  • U-235, U-238, Pu-239, Pu-240, Rh-103, Mo-95
  • For each isotope: total, scatter, capture, fission, nubar sensitivities

Scale-xsdrnpm

  • lambda: Eigenvalue from XSDRNPM calculation

Installation

This plugin requires:

  1. Funz/fz framework
  2. SCALE 6.2 or later installed at /SCALE/scale6.2 (or set SCALE_HOME environment variable)

Usage

With fz Python API

import fz

# Example: KENO calculation with varying sphere radius
results = fz.fzr(
    input_path="examples/Scale-keno/godiva.inp",
    input_variables={
        "r": [8.5, 8.6, 8.7, 8.741, 8.8, 8.9, 9.0]
    },
    model="Scale-keno",
    calculators="localhost_Scale",
    results_dir="godiva_results"
)

print(results[['r', 'mean_keff', 'sigma_keff']])

# Example: CSAS-Shift calculation with varying sphere radius
# Uses the Shift Monte Carlo solver for improved performance
results = fz.fzr(
    input_path="examples/Scale-shift/godiva.inp",
    input_variables={
        "r": [8.5, 8.6, 8.7, 8.741, 8.8, 8.9, 9.0]
    },
    model="Scale-shift",
    calculators="localhost_Scale",
    results_dir="godiva_shift_results"
)

print(results[['r', 'mean_keff', 'sigma_keff']])

Directory Structure

your_project/
├── examples/
│   ├── Scale-keno/
│   │   └── godiva.inp          # Example KENO input file
│   └── Scale-shift/
│       └── godiva.inp          # Example CSAS-Shift input file
├── .fz/
│   ├── models/
│   │   ├── Scale-keno.json
│   │   ├── Scale-shift.json
│   │   ├── Scale-tsunami.json
│   │   └── Scale-xsdrnpm.json
│   └── calculators/
│       ├── Scale-keno.sh
│       ├── Scale-shift.sh
│       ├── Scale-tsunami.sh
│       ├── Scale-xsdrnpm.sh
│       └── localhost_Scale.json
└── results/                    # Generated by fz

Example Input File

'Input generated by GeeWiz SCALE 6.0.2
=csas6
godiva
ce_v7_endf
read composition
 uranium     1 den=18.742 1 293
                                 92234 1.0202
                                 92235 93.7112
                                 92238 5.2686   end
end composition
read geometry
global unit 1
 sphere 10    &{r}
 media 1 1 10
 boundary 10
end geometry
end data
end

In this example:

  • &{r} is a variable parameter that will be substituted by fz
  • The comment character ' is used for the header line
  • The calculation type is =csas6 (KENO-VI)

CSAS-Shift Input File Example

For CSAS-Shift calculations, simply use =csas5-shift or =csas6-shift instead of =csas5 or =csas6:

'Input generated by GeeWiz SCALE 6.0.2
=csas6-shift
godiva
ce_v7_endf
read composition
 uranium     1 den=18.742 1 293
                                 92234 1.0202
                                 92235 93.7112
                                 92238 5.2686   end
end composition
read geometry
global unit 1
 sphere 10    &{r}
 media 1 1 10
 boundary 10
end geometry
end data
end

The key difference:

  • =csas6-shift uses the Shift Monte Carlo solver instead of KENO
  • Improved performance and scalability, especially for parallel computations
  • Compatible with all KENO V.a and KENO-VI geometries

Expected Output

When running a parametric study, fz returns a pandas DataFrame:

     r  mean_keff  sigma_keff  mean_E_lethargy  sigma_E_lethargy  ...
0  8.5     0.9850      0.0018       820684.0            2191.56  ...
1  8.6     0.9910      0.0019       820684.0            2191.56  ...
2  8.7     0.9965      0.0018       820684.0            2191.56  ...
3  8.741   0.9996      0.0019       820684.0            2191.56  ...
4  8.8     1.0040      0.0019       820684.0            2191.56  ...
5  8.9     1.0095      0.0018       820684.0            2191.56  ...
6  9.0     1.0150      0.0019       820684.0            2191.56  ...

Configuration

Calculator Configuration

The calculator JSON files define how to execute SCALE:

{
    "uri": "sh://",
    "n": 1,
    "models": {
        "Scale-keno": "bash .fz/calculators/Scale-keno.sh"
    }
}
  • uri: Execution method (sh:// for local shell, ssh:// for remote)
  • n: Number of parallel workers
  • models: Mapping of model names to execution commands

Model Configuration

The model JSON files define variable syntax and output parsing:

{
    "id": "Scale-keno",
    "varprefix": "&",
    "formulaprefix": "@",
    "delim": "{}",
    "commentline": "'",
    "output": {
        "mean_keff": "grep 'best estimate system k-eff' *.out | ...",
        "sigma_keff": "grep 'best estimate system k-eff' *.out | ..."
    }
}

Remote Execution

To run SCALE calculations on a remote server:

results = fz.fzr(
    input_path="godiva.inp",
    input_variables={"r": [8.5, 8.6, 8.7]},
    model="Scale-keno",
    calculators="ssh://user@server.com/bash /path/to/scale/calculators/Scale-keno.sh",
    results_dir="remote_results"
)

Troubleshooting

SCALE_HOME not set

If SCALE is not installed at /SCALE/scale6.2, set the environment variable:

export SCALE_HOME=/path/to/your/scale/installation

Congratulations message not found

The calculator scripts check for "Congratulations" in the output to verify successful completion. If this fails:

  1. Check that SCALE is properly installed
  2. Verify the input file syntax is correct
  3. Check the .msg and .out files in the results directory

License

This plugin follows the same license as the Funz framework.

Related Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •