Chi-Tech
|
Modules | |
Post-Processor utils | |
chi.AggregateNodalValuePostProcessor | |
chi.CellVolumeIntegralPostProcessor | |
chi.PostProcessor | |
chi.SolverInfoPostProcessor | |
A post-processor, implemented via chi::PostProcessor
, computes simple quantities derived from simulation entities (i.e., meshers, solvers, etc.). The most common form of a post-processor is a SCALAR
which computes a single value, however, there is a also a VECTOR
type and an ARBITRARY
type.
Below is an example of the simplest (and first created) post-processors called the chi::SolverInfoPostProcessor
. This post-processor obtains information from a solver, where each solver can override the virtual method chi_physics::Solver::GetInfo
to provide any piece(s) of information. In this case the prk::TransientSolver
is a mesh-less solver that computes the time-dependent neutron population of a Point-Reactor model.
Post-processors have a few standard parameters.The name
parameter is always required among all post-processors. Additionally we have the following:
execute_on
controlling the events on which to execute the post-processor (more on this later).print_on
controlling the events on which to print the post-processor.initial_value
can be used to set an initial value for the post-processor.Post-processors are executed using the event system (see I Event System). Each post-processor can be subscribed to objects deriving from chi::EventPublisher
that call the Post-Processors at different stages (Subscriber design pattern). One example is the physics solver-system which has a wrapper to call the post processors on calls to Initialize
, Execute
, Step
and Advance
execute_on
eventsBy default a post-processor subscribes to the following events for execution:
SolverInitialized
SolverAdvanced
SolverExecuted
ProgramExecuted
This behavior can be customized by using the execute_on
parameter. For example:
Post-Processors are printed to console or file using the chi::PostProcessorPrinter
singleton. It has the options described in chi.PostProcessorPrinterOptions which can be set using chi.PostProcessorPrinterSetOptions.
The following example shows the printing of a simple post processor.
for which the last portion of the output would be:
[0] Final program time 00:00:00 [0] 2023-09-04 08:32:02 ChiTech finished execution of scratch/RPK/rpk1.lua [0] [0] SCALAR post-processors history at event "ProgramExecuted" [0] *----------*--------------------* [0] | Time | neutron_population | [0] *----------*--------------------* [0] | 0.060000 | 1.000000 | [0] | 0.070000 | 1.000000 | [0] | 0.080000 | 1.000000 | [0] | 0.090000 | 1.000000 | [0] | 0.100000 | 1.000000 | [0] | 0.110000 | 1.000000 | [0] | 0.120000 | 3.285132 | [0] | 0.130000 | 4.316595 | [0] | 0.140000 | 4.807549 | [0] | 0.150000 | 5.065645 | [0] | 0.160000 | 5.223603 | [0] | 0.170000 | 5.338682 | [0] | 0.180000 | 5.435592 | [0] | 0.190000 | 5.524998 | [0] | 0.200000 | 5.611508 | [0] | Latest | 5.611508 | [0] *----------*--------------------* [0] [0] SCALAR post-processors latest values at event "ProgramExecuted" [0] *------------------------------*-----------------* [0] | Post-Processor Name | Value | [0] *------------------------------*-----------------* [0] | neutron_population(latest) | 5.611508 | [0] *------------------------------*-----------------*
Here we can see that the chi::PostProcessorPrinter
printed both the time history of the post-processor as well its latest value.
The time history can be suppressed by adding the following to the input
which results in only the latest value being printed
[0] Final program time 00:00:00 [0] 2023-09-04 08:34:41 ChiTech finished execution of scratch/RPK/rpk1.lua [0] [0] SCALAR post-processors latest values at event "ProgramExecuted" [0] *------------------------------*-----------------* [0] | Post-Processor Name | Value | [0] *------------------------------*-----------------* [0] | neutron_population(latest) | 5.611508 | [0] *------------------------------*-----------------*
The time history of a post-processor can also be exported to a Comma Separated Value file (CSV-file) by setting the csv_filename
option in chi.PostProcessorPrinterSetOptions. Example:
Post-processors can be printing manually whenever needed by using either a list of post-processor names or handles. For example:
Each post-processor has the options print_numeric_format
and print_precision
that controls how numbers are printed. For more about this see chi.PostProcessor.