Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SN1D

C++ code for 1D (slab and spherical) solution of neutron transport equation using diamond differencing, using Diffusion Synthetic Acceleration

Uses architecture from hankyleh/SN2D.

CODE STATUS

  • Code skeleton and input specifications written

TO DO

  • Add necessary data types
  • Add input file parsing
  • Add time-dependent cross sections options (via python definition) -- maybe
  • Add BC options (reflected, incoming flux)
  • Add DD kernel and sweep functions
  • Add adjoint problem
  • Add parameters, solution, residual, and iteration summary output options
  • Add fission deposition (W) to input
  • Add cumulative fission deposition to output
  • Create python scripts for data processing (write input, read+plot output)
  • Add DSA
  • Add time-differencing (Crank-Nicholson and Backward Euler) with constant step size
  • Add partisn-style (increasing step size) differencing
  • Add time-step summary output file, modify iter. summ. output to include all time steps

Input file format

Input files are plaintext formatted, and may have any extension, except .out, which is reserved for the output file.

Comments are denoted by # and !: all characters after the first instance of # or before the final instance of ! are ignored by the input parser, e.g.

no. of cells !   5
Cell widths  !   0.1 0.1 0.1 0.05 0.05   # narrow cells in moderator region

The input file (besides comments) contains only the numeric data or the case-sensitive keyword(s):

  • READ: copies the contents of the file at the proceeding path into the input file at this location. Useful for running multiple meshes with a single set of material data, etc. For example, READ lwr_materials.txt.

The parser does not recognize line breaks in the main content of the file, so

# Cross sections:
 1.2e-3    0.00         1e-4  
 4.0e-3    2.0e-4       1.0e-4
 1.2e-3    0.00     1e-4  4.0e-3
 2.0e-4    1.0e-4
 1.2e-3    0.00     1e-4  4.0e-3  2.0e-4    1.0e-4

will all be interepreted the same way by the parser. This is useful for large meshes or scattering matrices which may be broken into multiple lines if needed.

Numeric data may be entered in decimal or E-notation using either capital E or lowercase e. Positive values may optionally include +. The following are all valid entries:

  • 1.2e-3
  • -0.23
  • 4.4E+1
  • +1.2

Input file contents

The input file is separated into sections, separted by case-sensitive headers. The sections required for all problem types are:

  • Problem Parameters -- note this section does not have a header
  • MESH: Spatial Mesh
  • QUAD: Angular Quadrature
  • MATS: Material specification
  • REGION: Cell layout
  • BCS: Boundary conditions

Time-dependent problems should contain the additional section:

  • TIME: Time discretization

Problem Parameters

This section contains general problem parameters that are read before any of the rest of the input. It should contain the following content:

Name Details Syntax
Case title Must be unique (output files with the same name will be over-written) Stem only, no spaces, must be valid for a file name (e.g. lwr_2group'). May not use the section header keywords (MESH, MATS, etc.)
Problem type 0 - Criticality calculation
1 - Steady-state
2 -Time-dependent
Integer 0-2
1D geometry type 0 - 1D slab
1 - 1D sphere
Integer 0-1
Acceleration on/off 0 - No acceleration
1 - DSA
Integer 0-1
Problem direction 0 - Forward
1 - ADjoint
Integer 0-1
Inner, Outer convergence tolerance Relative tolerance for inner and outer iterations. 2 floats, must be $0 < \epsilon <1$
Inner, Outer maximum iterations Maximum allowed inner and outer iterations. 2 integers, must be $\geq 1$

Spatial Mesh

The number of cells (I) and their widths in the mesh. For example,

10
0.1 0.1 0.1 0.1 0.1 0.1
0.2 0.2 0.2 0.2

I must be an integer $\geq 1$, followed by I positive double-precision floats.

These widths are $\Delta x_i$ in slab geometry and $\Delta r_i$ in spherical geometry.

Angular Quadrature

The number of quadrature cosines and their weights. For example,

8                  
-0.9602898 0.101228
-0.7966664 0.222381
-0.5255324 0.313706
-0.1834346 0.362683
 0.1834346 0.362683
 0.5255324 0.313706
 0.7966664 0.222381
 0.9602898 0.101228

The first entry is M, the total number of quadrature cosines.

There should be M pairs of values, each corresponding to a cosine and weight pairmu_m, w_m. The cosines must be ascending and be $\in[-1, 1]$, and all weights must be positive.

There must be an equal number of positive and negative quadrature points. If reflective boundary conditions (or 1D spherical geometry) are used, the set must be symmtric.

Material Specification

The first three values in this section are discretization details:

Name Syntax
Number of materials Integer $\geq$1
G, Number of energy groups Integer $\geq$1
L, maximum Legendre moment of scattering xs Integer $\geq$0

This is then followed by the cross section values for each material, starting with total and fission cross sections.

  • $\sigma_{t, g}$, total cross section
  • $\overline{\nu}\sigma_{f, g}$, fission production cross section times multiplicity
  • $\sigma_{f, g}$, fission cross section

For example,

 # Material 1
 # total   nu*fission   fission # Group
 1.2e-3    0.00         1e-4    # 1 
 4.0e-3    2.0e-4       1.0e-4  # 2 

This is then followed by the scattering matrices, one $G \times G$ matrix for each Legendre moment ($L + 1$ total matrices). Each row corresponds with the initial neutron energy group, and the columns correspond with the scattered neutron energy group. For example,

 # zeroth moment
 1.0e-4    4.1e-5     # 1->g
 0.0       6.0e-4     # 2->g

 # first moment:
 1.0e-8 1.0e-8
 0.0    1.0e-6

Cell layout

This section contains two sets of values. First is the material arrangement, which should contain I integers, up to the number of specified materials. For example,

1 1 1 1 1 1 2 2 2 2

Next is the source specification -- note that the units are str$^{-1}$cm$^{-2}$s$^{-1}$, and is considered to be isotropic. There should be $G\times I$ entries, 1 row of $I$ positive double-precision floats for each group. For example,

0.10 0.10 0.10 0.10 0.10 0.10 0.0 0.0 0.0 0.0
0.01 0.01 0.01 0.01 0.01 0.01 0.0 0.0 0.0 0.0

Note that source entries will be ignored and set to zero for criticality calculations.

Boundary conditions

Three types of boundary conditions are supported; vacuum, incoming flux, and reflective.

The first entry of this section should be two integers, corresponding with the left and right boundary conditions. Note that for spherical boundary conditions, the left entry will be ignored.

The conditions are

  • 0 - vacuum
  • 1 - incoming flux
  • 2 - reflective

For example,

2 1

which corresponds with a reflective left boundary and an incoming-flux right boundary.

If incoming flux is specified for either boundary, they should be provided. For each incoming-flux boundary, $M/2$ rows of $G$ values should be provided, corresponding with the flux for that direction and energy group. For example,

0.01 0.02
0.01 0.02
0.01 0.02
0.01 0.02

The rows should be ordered such that the corresponding cosines are ascending.

Note that incoming flux conditions will be forced to vacuum for criticality calculations.

Time discretization -- (time-dependent problems only)

TODO

Example input file: Steady-state

This file can be found at examples/steady/.

# SN1D example input file

# --------------------------------------------
# ---------- Problem Parameters --------------
# --------------------------------------------

example_steady 

1 # steady-state solve
0 # 1D slab geometry
0 # DSA off
0 # forward solve

1e-5 1e-7 # Inner, outer tolerance
100 200   # inner, outer max. iterations

# --------------------------------------------
# -------------- Spatial mesh ----------------
# --------------------------------------------

# Number of cells
10

# Cell widhts
0.1 0.1 0.1 0.1 0.1
0.1 0.2 0.2 0.2 0.2

# --------------------------------------------
# ----------- Angular Quadrature -------------
# --------------------------------------------

# Number of quadrature angles
8

# quadrature nodes and weights
-0.7966664 0.222381
-0.5255324 0.313706
-0.1834346 0.362683
 0.1834346 0.362683
 0.5255324 0.313706
 0.7966664 0.222381
 0.9602898 0.101228 

# --------------------------------------------
# ---------- Material Specification ----------
# --------------------------------------------

 2 # Number of materials
 3 # G = Number of energy groups 
 1 # L = max. Legendre moment of scattering xs

 # Material 1
 # total   nu*fission   fission # Group
 1.2e-3    0.00         1e-4    # 1 (highest energy)
 4.0e-3    2.0e-4       1.0e-4  # 2 (lowest  energy)

 # scattering matrices
 # zeroth moment:
 1.0e-4    4.1e-5    # scattering FROM group 1 (into [1, 2])
 0.0       6.0e-4    # scattering FROM group 2

 # first moment:
 1.0e-8 1.0e-8
 0.0    1.0e-6


 # Material 2
 # total   nu*fission   fission # Group
 1.2e-3    0.00         1e-4    # 1
 4.0e-3    0.00         1.0e-4  # 2

 # scattering matrices
 # zeroth moment:
 1.0e-4    4.1e-5    # scattering FROM group 1 (into [1, 2])
 0.0       6.0e-4    # scattering FROM group 2

 # first moment:
 1.0e-8 1.0e-8
 0.0    1.0e-6

# --------------------------------------------
# --------------- Cell Layout ----------------
# --------------------------------------------

# material arrangement
1 1 1 1 1 1 2 2 2 2

# source
0.10 0.10 0.10 0.10 0.10 0.10 0.0 0.0 0.0 0.0
0.01 0.01 0.01 0.01 0.01 0.01 0.0 0.0 0.0 0.0

# --------------------------------------------
# ----------- Boundary Conditions ------------
# --------------------------------------------

# boundary conditions
2 1 # Reflective, incoming-flux

# incoming flux, right side
0.01 0.02
0.01 0.02
0.01 0.02
0.01 0.02

About

C++ code for 1D (slab and spherical) solution of neutron transport equation using diamond differencing, using Diffusion Synthetic Acceleration

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages