XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
DiffusionProfilesDiag Class Reference

Diagnostic for writing diffusion profile data using ADIOS2. More...

#include <diag_diffusion_profiles.hpp>

Inheritance diagram for DiffusionProfilesDiag:
Inheritance graph
[legend]
Collaboration diagram for DiffusionProfilesDiag:
Collaboration graph
[legend]

Public Member Functions

 DiffusionProfilesDiag ()
 
void init (NLReader::NamelistReader &nlr, const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const Plasma &plasma, int f_source_period)
 Initialize the DiffusionProfilesDiag diagnostic. More...
 
int get_n_species () const
 Return whether the diffusion diagnostic is on. More...
 
int get_n_surf () const
 Get the number of flux-surfaces sampled. More...
 
int get_n_samples () const
 Get the number of samples taken. More...
 
bool is_triggered_output (int step)
 Returns whether the buffer should be written out on this step. More...
 
void collect_sample (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, Plasma &plasma, const Moments &f0_moments, const DomainDecomposition< DeviceType > &pol_decomp)
 Collect a sample of diffusion profile data. More...
 
void write ()
 Write the buffered diffusion profile data to disk. More...
 
void reset_buffer ()
 Reset the profile data buffer. More...
 
- Public Member Functions inherited from Diagnostic
bool is_triggered (int step)
 
bool has_been_triggered (int step)
 
int get_period () const
 
 Diagnostic ()
 
void init (const std::string &name, int period, int first_step=-1)
 
void open_stream (const std::string &filename, const XGC_IO_Mode &mode)
 
void close_stream ()
 
void write (const XGC_IO &xgc_io)
 
void start_write_step ()
 
bool is_first_step ()
 
void end_write_step ()
 

Public Attributes

bool is_on
 Flag to indicate if this diagnostic is active. More...
 
View< double ***, CLayout,
HostType
profiles_buffer_n
 
View< double ***, CLayout,
HostType
profiles_buffer_u
 
View< double ***, CLayout,
HostType
profiles_buffer_T
 
View< double *, CLayout, HostTypepsi_grid
 Poloidal flux grid of the sampled profile data. More...
 
View< double *, CLayout, HostTypetime_buffer
 Time (in s) of each sample. More...
 
View< int *, CLayout, HostTypestep_buffer
 Time step index of each sample. More...
 
- Public Attributes inherited from Diagnostic
bool is_on
 

Private Attributes

int output_rate
 Rate (time steps) at which the collected data is written out. More...
 
int sampling_rate
 Rate (multiples of sml_f_source_period) at which the profile data is sampled. More...
 
StepTrigger step_trigger_output
 Trigger for writing the diagnostic output. (The default trigger is used for the data sampling step.) More...
 
int n_species
 
int n_surf
 
int n_samples
 
int sample_count
 

Additional Inherited Members

- Protected Attributes inherited from Diagnostic
StepTrigger step_trigger
 

Detailed Description

Diagnostic for writing diffusion profile data using ADIOS2.

This diagnostic is controlled by a boolean switch (is_on) and an output interval. It collects and buffers the evolution of the flux-surface averaged plasma profiles—specifically density, parallel mean flow, and temperature profiles—along with the corresponding poloidal flux grid, time stamps, and simulation step indices. The diagnostic is defined in diagnostics.hpp and utilizes the diagnostic template interface.

Constructor & Destructor Documentation

DiffusionProfilesDiag::DiffusionProfilesDiag ( )
inline

Member Function Documentation

void DiffusionProfilesDiag::collect_sample ( const Simulation< DeviceType > &  sml,
const Grid< DeviceType > &  grid,
Plasma plasma,
const Moments f0_moments,
const DomainDecomposition< DeviceType > &  pol_decomp 
)

Collect a sample of diffusion profile data.

This function gathers global moment data (density, parallel flow, and temperature) from the simulation. It first copies the host-resident moment data to temporary device views, then performs a toroidal average. The data is further averaged over flux-surfaces by mapping the simulation data from the 2D planar mesh representation to the required number of surfaces. Finally, the averaged data is copied into the host buffers.

Parameters
smlReference to the Simulation object.
gridReference to the Grid object.
plasmaReference to the Plasma object.
f0_momentsReference to the Moments object containing the f0 moment data.
pol_decompReference to the DomainDecomposition object for the poloidal plane.

Here is the call graph for this function:

Here is the caller graph for this function:

int DiffusionProfilesDiag::get_n_samples ( ) const
inline

Get the number of samples taken.

Returns
Number of samples.
int DiffusionProfilesDiag::get_n_species ( ) const
inline

Return whether the diffusion diagnostic is on.

Returns
Whether the diffusion diagnostic is on Get the number of species being buffered.
Number of species.
int DiffusionProfilesDiag::get_n_surf ( ) const
inline

Get the number of flux-surfaces sampled.

Returns
Number of flux-surfaces.
void DiffusionProfilesDiag::init ( NLReader::NamelistReader nlr,
const Simulation< DeviceType > &  sml,
const Grid< DeviceType > &  grid,
const Plasma plasma,
int  f_source_period 
)

Initialize the DiffusionProfilesDiag diagnostic.

This function reads the necessary configuration options from the input namelists. The on/off switch and output rate are taken from the "diff_param" namelist, while the sampling rate is read from the "diag_param" namelist. It also performs a consistency check to ensure that the output rate is divisible by both the sampling rate and the base source period. In addition, the function allocates the buffers for the profile data and initializes the output trigger.

Parameters
nlrReference to the NamelistReader holding configuration options.
smlReference to the Simulation object.
gridReference to the Grid object.
plasmaReference to the Plasma object.
f_source_periodThe base period for sampling.

< Rate (multiples of sml_f_source_period) at which the profile data is sampled. (Must be compatible with diff_update_period!)

Here is the call graph for this function:

Here is the caller graph for this function:

bool DiffusionProfilesDiag::is_triggered_output ( int  step)
inline

Returns whether the buffer should be written out on this step.

Returns
TRUE if buffer should be written, FALSE otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

void DiffusionProfilesDiag::reset_buffer ( )
inline

Reset the profile data buffer.

Resets the internal buffer for the profile data and the sample counter to zero.

Here is the caller graph for this function:

void DiffusionProfilesDiag::write ( )

Write the buffered diffusion profile data to disk.

This function is executed on the rank-zero process. It creates an XGC_IO object, adds the various buffered arrays (including the number of species, number of samples, flux-surface grid, time and step data, and the profile arrays for density, flow, and temperature) to the IO object, and then invokes the base diagnostic write routines. The output is wrapped between a start and end write step.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool DiffusionProfilesDiag::is_on

Flag to indicate if this diagnostic is active.

int DiffusionProfilesDiag::n_samples
private
int DiffusionProfilesDiag::n_species
private
int DiffusionProfilesDiag::n_surf
private
int DiffusionProfilesDiag::output_rate
private

Rate (time steps) at which the collected data is written out.

View<double***,CLayout,HostType> DiffusionProfilesDiag::profiles_buffer_n
View<double***,CLayout,HostType> DiffusionProfilesDiag::profiles_buffer_T
View<double***,CLayout,HostType> DiffusionProfilesDiag::profiles_buffer_u
View<double*,CLayout,HostType> DiffusionProfilesDiag::psi_grid

Poloidal flux grid of the sampled profile data.

int DiffusionProfilesDiag::sample_count
private
int DiffusionProfilesDiag::sampling_rate
private

Rate (multiples of sml_f_source_period) at which the profile data is sampled.

View<int*,CLayout,HostType> DiffusionProfilesDiag::step_buffer

Time step index of each sample.

StepTrigger DiffusionProfilesDiag::step_trigger_output
private

Trigger for writing the diagnostic output. (The default trigger is used for the data sampling step.)

View<double*,CLayout,HostType> DiffusionProfilesDiag::time_buffer

Time (in s) of each sample.


The documentation for this class was generated from the following files: