QdataManager

template<typename cons_t>
class QdataManager
#include “QdataManager.h”

Generic Qdata manager to handle operations on the data of a p4est quadrant.

Template Parameters:

cons_t – A type containing a set of conservative variables

Public Types

using prim_t = to_prim_t<cons_t>
using qdata_t = to_qdata_t<cons_t>
using param_t = to_param_t<cons_t>

Public Functions

QdataManager(SettingManager *stg_mgr)

Implementation of the constructor is done at specialization. It will set all the parameters needed for this simulation type.

Parameters:

stg_mgr[in] a SettingManager object (to parse input setting file)

~QdataManager() = default
inline param_t *get_param()

getter for a pointer to m_param

inline void *get_user_param()

getter for a pointer to m_user_param

inline void set_user_param(void *pointer)

setter for a pointer to m_user_param

inline void quad_set_qdata(p4est_quadrant_t *quad_dst, qdata_t *qdata_src)

set qdata in one quadrant

Parameters:
  • quad_dst[inout] a p4est quadrant

  • qdata_src[in] source qdata

inline void quad_copy_qdata(p4est_quadrant_t *quad_dst, p4est_quadrant_t *quad_src)

copy qdata from one quadrant to another

Parameters:
  • quad_dst[inout] a p4est quadrant

  • quad_src[in] a p4est quadrant

inline void quad_print(int log_priority, p4est_quadrant_t *quad)

print coordinates

Parameters:
  • log_priority[in]

  • quad[in] a p4est quadrant

inline void quad_copy_w_to_wnext(p4est_quadrant_t *quad)

copy w into wnext

Parameters:

quad[in] a p4est quadrant

inline void quad_copy_wnext_to_w(p4est_quadrant_t *quad)

copy wnext into w

Parameters:

quad[in] a p4est quadrant

inline void quad_wm_wp_delta_zero(p4est_quadrant_t *quad)

set wm wp delta to zero

Parameters:

quad[in] a p4est quadrant

inline void prim_zero(prim_t &pdata)

set a primitive state to zero

Parameters:

pdata[in] a primitive state

inline void prim_copy(prim_t &pdata1, const prim_t &pdata2)

copy a primitive state into another

Parameters:
  • pdata1[inout] a primitive state

  • pdata2[in] a primitive state

inline void prim_swap(prim_t &pdata1, prim_t &pdata2)

swap two primitive state

Parameters:
  • pdata1[inout] a primitive state

  • pdata2[inout] a primitive state

inline void prim_change_sign(prim_t &pdata)

change the sign of all fields in a primitive state

Parameters:

pdata[inout] a primitive state

inline void qdata_copy(qdata_t *qdata_dst, qdata_t *qdata_src)

copy a qdata into another

Parameters:
  • qdata_dst[inout] a qdata

  • qdata_src[in] a qdata

std::vector<double> quad_get_field(const std::string &field_name, p4est_quadrant_t *quad)

get a given field by name from a quadrant. Implementation is done at specialization

Parameters:
  • field_name[in] The name of the field in cons_t or prim_t

  • quad[in] a p4est quadrant

void cons_to_prim(const cons_t &cdata, prim_t &pdata)

Convert a conservative state into a primitive state. Implementation is done at specialization.

Parameters:
  • cdata[in] a conservative state

  • pdata[inout] a primitive state

void prim_to_cons(const prim_t &pdata, cons_t &cdata)

Convert a primitive state into a conservative state. Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state

  • cdata[inout] a conservative state

void get_hydro_flux_predictor(int idir, const cons_t &cdata, const prim_t &pdata, cons_t &flux)

Get the hydrodynamics flux for the Hancock prediction step. Implementation is done at specialization.

Parameters:
  • idir[in] the direction of the face

  • cdata[in] a conservative state (at cell centre)

  • pdata[in] a primitive state (at celle face)

  • flux[inout] a conservative state storing the flux

void get_grav_source_predictor(const prim_t &pdata, cons_t &source)

Get the gravity source term for the Hancock prediction step. Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state (at celle centre)

  • source[inout] a conservative state storing the source term

double get_hydro_invdt(const prim_t &pdata, const double dx)

Get the inverse of the hydrodynamics time step. Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state (at celle centre)

  • dx[in] the size of the quadrant

double get_cond_invdt(const prim_t &pdata, const double dx)

Get the inverse of the conductivity time step. Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state (at celle centre)

  • dx[in] the size of the quadrant

double get_visc_invdt(const prim_t &pdata, const double dx)

Get the inverse of the viscosity time step. Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state (at celle centre)

  • dx[in] the size of the quadrant

inline double get_user_invdt(const prim_t &pdata, const double dx)

Get the inverse of the user time step. Return 0 unless Implementation is done at specialization.

Parameters:
  • pdata[in] a primitive state (at celle centre)

  • dx[in] the size of the quadrant

void swap_dir(int idir, prim_t &pdata, cons_t &cdata, array<prim_t> &delta)

swap direction (used before flux computation). Implementation is done at specialization

Parameters:
  • idir[in] the direction of the face

  • pdata[inout] a primitive state (at cell face)

  • cdata[inout] a conservative state (at cell centre) #param[inout] delta an array of gradients of the primitive state

void swap_dir(int idir, cons_t &cdata)

swap direction (used after flux computation). Implementation is done at specialization

Parameters:
  • idir[in] the direction of the face

  • cdata[inout] a conservative state storing e.g. the flux

Public Members

param_t m_param

parameters needed for this simulation type

void *m_user_param

parameters defined by the user

Public Static Functions

static inline qdata_t *quad_get_qdata(p4est_quadrant_t *quad)

get qdata from a given quad

Parameters:

quad[in] A p4est quadrant

static inline void quad_set_cons(p4est_quadrant_t *quad_dst, cons_t *cons_src)

set conservative variables in a given quad

Parameters:
  • quad_dst[inout] a p4est quadrant

  • cons_src[in] a conservative set of variables

static inline void quad_set_cons(p4est_quadrant_t *quad_dst, p4est_quadrant_t *quad_src)

set conservative variables in a given quad from another quad

Parameters:
  • quad_dst[inout] a p4est quadrant

  • quad_src[in] a p4est quadrant

static inline void quad_mean_cons(p4est_quadrant_t *quad_dst, p4est_quadrant_t *quad_src[])

set conservative variables in a given quad from the mean of a set of children quads

Parameters:
  • quad_dst[inout] a p4est quadrant

  • [] – quad_src a list of p4est quadrants

static inline void quad_replace_fn(p4est_t *p4est, p4est_topidx_t which_tree, int num_outgoing, p4est_quadrant_t *quadout[], int num_incoming, p4est_quadrant_t *quadin[])

This replace callback can be used either when refining or coarsening.

When refining, num_outgoing = 1 and num_incoming = P4EST_CHILDREN. num_outgoing == 1 is used to trigger the refining behavior and actually num_incoming is discarded

When coarsening, num_outgoing = P4EST_CHILDREN and num_incoming = 1. num_incoming == 1 is used to trigger the coarsening behavior and actually num_outgoing is discarded

Parameters:
  • p4est[in] the forest

  • which_tree[in] the tree in the forest containing children

  • num_outgoing[in] the number of quadrants that are being replaced: either 1 if a quadrant is being refined, or P4EST_CHILDREN if a family of children are being coarsened.

  • quadout[inout] the outgoing quadrants

  • num_incoming[in] the number of quadrants that are being added: either P4EST_CHILDREN if a quadrant is being refined, or 1 if a family of children are being coarsened.

  • quadin[inout] quadrants whose data are initialized.