mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Update particle restart format and documentation
This commit is contained in:
parent
8f2efa19dd
commit
26e2601141
8 changed files with 63 additions and 89 deletions
|
|
@ -4,55 +4,31 @@
|
|||
Particle Restart File Format
|
||||
============================
|
||||
|
||||
The current revision of the particle restart file format is 1.
|
||||
The current version of the particle restart file format is 2.0.
|
||||
|
||||
**/filetype** (*char[]*)
|
||||
**/**
|
||||
|
||||
String indicating the type of file.
|
||||
:Attributes: - **filetype** (*char[]*) -- String indicating the type of file.
|
||||
- **version** (*int[2]*) -- Major and minor version of the summary
|
||||
file format.
|
||||
- **openmc_version** (*int[3]*) -- Major, minor, and release
|
||||
version number for OpenMC.
|
||||
- **git_sha1** (*char[40]*) -- Git commit SHA-1 hash.
|
||||
|
||||
**/revision** (*int*)
|
||||
|
||||
Revision of the particle restart file format. Any time a change is made in
|
||||
the format, this integer is incremented.
|
||||
|
||||
**/current_batch** (*int*)
|
||||
|
||||
The number of batches already simulated.
|
||||
|
||||
**/gen_per_batch** (*int*)
|
||||
|
||||
Number of generations per batch.
|
||||
|
||||
**/current_gen** (*int*)
|
||||
|
||||
The number of generations already simulated.
|
||||
|
||||
**/n_particles** (*int8_t*)
|
||||
|
||||
Number of particles used per generation.
|
||||
|
||||
**/run_mode** (*int*)
|
||||
|
||||
Run mode used. A value of 1 indicates a fixed-source run and a value of 2
|
||||
indicates an eigenvalue run.
|
||||
|
||||
**/id** (*int8_t*)
|
||||
|
||||
Unique identifier of the particle.
|
||||
|
||||
**/weight** (*double*)
|
||||
|
||||
Weight of the particle.
|
||||
|
||||
**/energy** (*double*)
|
||||
|
||||
Energy of the particle in eV for continuous-energy mode, or the energy
|
||||
group of the particle for multi-group mode.
|
||||
|
||||
**/xyz** (*double[3]*)
|
||||
|
||||
Position of the particle.
|
||||
|
||||
**/uvw** (*double[3]*)
|
||||
|
||||
Direction of the particle.
|
||||
:Datasets: - **current_batch** (*int*) -- The number of batches already
|
||||
simulated.
|
||||
- **generations_per_batch** (*int*) -- Number of generations per
|
||||
batch.
|
||||
- **current_generation** (*int*) -- The number of generations already
|
||||
simulated.
|
||||
- **n_particles** (*int8_t*) -- Number of particles used per
|
||||
generation.
|
||||
- **run_mode** (*char[]*) -- Run mode used, either 'fixed source',
|
||||
'eigenvalue', or 'particle restart'.
|
||||
- **id** (*int8_t*) -- Unique identifier of the particle.
|
||||
- **weight** (*double*) -- Weight of the particle.
|
||||
- **energy** (*double*) -- Energy of the particle in eV for
|
||||
continuous-energy mode, or the energy group of the particle for
|
||||
multi-group mode.
|
||||
- **xyz** (*double[3]*) -- Position of the particle.
|
||||
- **uvw** (*double[3]*) -- Direction of the particle.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
State Point File Format
|
||||
=======================
|
||||
|
||||
The current revision of the statepoint file format is 16.0.
|
||||
The current version of the statepoint file format is 16.0.
|
||||
|
||||
**/**
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ class Particle(object):
|
|||
----------
|
||||
current_batch : int
|
||||
The batch containing the particle
|
||||
gen_per_batch : int
|
||||
generations_per_batch : int
|
||||
Number of generations per batch
|
||||
current_gen : int
|
||||
current_generation : int
|
||||
The generation containing the particle
|
||||
n_particles : int
|
||||
Number of particles per generation
|
||||
|
|
@ -50,16 +50,16 @@ class Particle(object):
|
|||
return self._f['current_batch'].value
|
||||
|
||||
@property
|
||||
def current_gen(self):
|
||||
return self._f['current_gen'].value
|
||||
def current_generation(self):
|
||||
return self._f['current_generation'].value
|
||||
|
||||
@property
|
||||
def energy(self):
|
||||
return self._f['energy'].value
|
||||
|
||||
@property
|
||||
def gen_per_batch(self):
|
||||
return self._f['gen_per_batch'].value
|
||||
def generations_per_batch(self):
|
||||
return self._f['generations_per_batch'].value
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ contains
|
|||
|
||||
! Read data from file
|
||||
call read_dataset(current_batch, file_id, 'current_batch')
|
||||
call read_dataset(gen_per_batch, file_id, 'gen_per_batch')
|
||||
call read_dataset(current_gen, file_id, 'current_gen')
|
||||
call read_dataset(gen_per_batch, file_id, 'generations_per_batch')
|
||||
call read_dataset(current_gen, file_id, 'current_generation')
|
||||
call read_dataset(n_particles, file_id, 'n_particles')
|
||||
call read_dataset(tempstr, file_id, 'run_mode')
|
||||
select case (tempstr)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ contains
|
|||
|
||||
integer(HID_T) :: file_id
|
||||
character(MAX_FILE_LEN) :: filename
|
||||
type(Bank), pointer :: src
|
||||
|
||||
! Dont write another restart file if in particle restart mode
|
||||
if (run_mode == MODE_PARTICLE) return
|
||||
|
|
@ -36,35 +35,34 @@ contains
|
|||
! Create file
|
||||
file_id = file_create(filename)
|
||||
|
||||
! Get information about source particle
|
||||
src => source_bank(current_work)
|
||||
|
||||
! Write filetype and version info
|
||||
call write_attribute(file_id, 'filetype', 'particle restart')
|
||||
call write_attribute(file_id, 'version', VERSION_PARTICLE_RESTART)
|
||||
call write_attribute(file_id, "openmc_version", VERSION)
|
||||
associate (src => source_bank(current_work))
|
||||
! Write filetype and version info
|
||||
call write_attribute(file_id, 'filetype', 'particle restart')
|
||||
call write_attribute(file_id, 'version', VERSION_PARTICLE_RESTART)
|
||||
call write_attribute(file_id, "openmc_version", VERSION)
|
||||
#ifdef GIT_SHA1
|
||||
call write_attribute(file_id, "git_sha1", GIT_SHA1)
|
||||
call write_attribute(file_id, "git_sha1", GIT_SHA1)
|
||||
#endif
|
||||
|
||||
! Write data to file
|
||||
call write_dataset(file_id, 'current_batch', current_batch)
|
||||
call write_dataset(file_id, 'gen_per_batch', gen_per_batch)
|
||||
call write_dataset(file_id, 'current_gen', current_gen)
|
||||
call write_dataset(file_id, 'n_particles', n_particles)
|
||||
select case(run_mode)
|
||||
case (MODE_FIXEDSOURCE)
|
||||
call write_dataset(file_id, 'run_mode', 'fixed source')
|
||||
case (MODE_EIGENVALUE)
|
||||
call write_dataset(file_id, 'run_mode', 'eigenvalue')
|
||||
case (MODE_PARTICLE)
|
||||
call write_dataset(file_id, 'run_mode', 'particle restart')
|
||||
end select
|
||||
call write_dataset(file_id, 'id', p%id)
|
||||
call write_dataset(file_id, 'weight', src%wgt)
|
||||
call write_dataset(file_id, 'energy', src%E)
|
||||
call write_dataset(file_id, 'xyz', src%xyz)
|
||||
call write_dataset(file_id, 'uvw', src%uvw)
|
||||
! Write data to file
|
||||
call write_dataset(file_id, 'current_batch', current_batch)
|
||||
call write_dataset(file_id, 'generations_per_batch', gen_per_batch)
|
||||
call write_dataset(file_id, 'current_generation', current_gen)
|
||||
call write_dataset(file_id, 'n_particles', n_particles)
|
||||
select case(run_mode)
|
||||
case (MODE_FIXEDSOURCE)
|
||||
call write_dataset(file_id, 'run_mode', 'fixed source')
|
||||
case (MODE_EIGENVALUE)
|
||||
call write_dataset(file_id, 'run_mode', 'eigenvalue')
|
||||
case (MODE_PARTICLE)
|
||||
call write_dataset(file_id, 'run_mode', 'particle restart')
|
||||
end select
|
||||
call write_dataset(file_id, 'id', p%id)
|
||||
call write_dataset(file_id, 'weight', src%wgt)
|
||||
call write_dataset(file_id, 'energy', src%E)
|
||||
call write_dataset(file_id, 'xyz', src%xyz)
|
||||
call write_dataset(file_id, 'uvw', src%uvw)
|
||||
end associate
|
||||
|
||||
! Close file
|
||||
call file_close(file_id)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
current batch:
|
||||
1.000000E+01
|
||||
current gen:
|
||||
current generation:
|
||||
1.000000E+00
|
||||
particle id:
|
||||
1.030000E+03
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
current batch:
|
||||
7.000000E+00
|
||||
current gen:
|
||||
current generation:
|
||||
1.000000E+00
|
||||
particle id:
|
||||
1.440000E+02
|
||||
|
|
|
|||
|
|
@ -219,8 +219,8 @@ class ParticleRestartTestHarness(TestHarness):
|
|||
outstr = ''
|
||||
outstr += 'current batch:\n'
|
||||
outstr += "{0:12.6E}\n".format(p.current_batch)
|
||||
outstr += 'current gen:\n'
|
||||
outstr += "{0:12.6E}\n".format(p.current_gen)
|
||||
outstr += 'current generation:\n'
|
||||
outstr += "{0:12.6E}\n".format(p.current_generation)
|
||||
outstr += 'particle id:\n'
|
||||
outstr += "{0:12.6E}\n".format(p.id)
|
||||
outstr += 'run mode:\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue