Extension: Json and NetCDF utilities
#include "dg/file/file.h"
|
Classes | |
struct | dg::file::Probes< NcFile, Topology > |
Facilitate output at selected points. More... | |
struct | dg::file::ProbesParams |
Parameter struct for probe values. More... | |
Functions | |
ProbesParams | dg::file::parse_probes (const dg::file::WrappedJsonValue &js, enum error probes_err=file::error::is_silent) |
Parse probe field in json file for use with Probes class. | |
|
inline |
Parse probe field in json file for use with Probes class.
A synthetic diagnostics in FELTOR is equivalent to outputting the computational fields including their first derivatives in time interpolated to any grid location (as if a measurement was done at that location). The output frequency is typically higher than the output frequency of the entire computation fields (otherwise you could just interpolate those at the end of the simulation).
In the input file, it is required to define the interpolation coordinates named coords-names
(in this example "R", "Z" and "P") as arrays. The length of the position arrays must match each other. There is no limit on the size of the arrays; they are typically not performance relevant unless a large percentage of actual grid coordinates is reached
The "coords" field can be read from an external json file alternatively using
All measurements from points, lines, surfaces and volumes with different purposes and different diagnostics, must be concatenated and flattened into the one-dimensional coordinate arrays and the measurements are written to file as one-dimensional arrays. In this way the book-keeping "which point belongs to which diagnostics and is neighbor to which other point" may become challening. This is why the "format" field exists.
The format value is a user-defined json value that is ignored by feltor, converted to a styled string and then stored as an attribute to the probes group in the output file. Its purpose is to hold parsing information for the (flat) \( R \), \( Z \), \( P \) arrays for post-processing. For example
interprets the first ten points in the probes array as a linear "x-probe" line, while the remaining 1000 points belong to a 3d measurement volume called "omp". From this information e.g. array views can be easily created in python:
js | input json value |
probes_err | what to do if "probes" is missing from js (overwrites js error mode) If silent, the ProbesParams remain empty if the field is absent |
ProbesParams.coords[i]
the others are empty (and thus also the ProbesParams.get_coords_sizes()
function will return zero on non-master ranks)