Patch System Description
-
std::unique_ptr<PatchSystem> MultiPatch::the_patch_system
Pointer to the global PatchSystem objct use during a simulation
-
constexpr int MultiPatch::dim = 3
The number of spatial dimentions each patch will cover
-
struct PatchSystem
Describes a patch system, that is, a collection of patches and patch transformations
Public Functions
-
inline int num_patches() const
Returns the current number of patches in the system.
- Returns:
an
int
containing the number of patches in the system.
-
inline PatchSystem()
Constructs a new empty PatchSystem object
-
inline PatchSystem(std::string name, std::vector<Patch> patches, PatchTransformations transformations)
Construct a new Patch System object
- Inputs:
std::string name
: The name of the patch system.std::vector<Patch> patches
: The patches comprising the patch system.PatchTransformations transformations
: The patch system coordinate transformations and data object.
Public Members
-
std::string name
String repreentation of the name of the patch system
-
PatchTransformations transformations
A PatchTransformations containing patch data and coordinate transfomation functions.
-
inline int num_patches() const
-
struct Patch
Describes a patch in the patch system
Public Members
-
std::string name
String representation of the name of the patch.
-
vect<int, dim> ncells
The number of cells in the logical x, y and z dimentions that the patch wil contain.
-
vect<CCTK_REAL, dim> xmin
Lower coordinate boundary for each logical x, y, z dimention in the patch
-
vect<CCTK_REAL, dim> xmax
Upper coordinate boundary for each logical x, y, z dimention in the patch
-
bool is_cartesian
Wether or not a patch is cartesian. If true, this flag is used to save time during Jacobian calculations.
-
std::string name
-
struct PatchFace
Describes the connections of one patch with another patch.
The interface between two patches is called a patch face. This struct describes such interfaces wherever two patches meet.
-
struct PatchTransformations
Stores patch transformation functions and patch data.
Patch transformation functions refer to the local -> global and global -> local coordinate transformations, as well as coordinate transformation Jacobian and their respective derivatives. These functions are patch system specific, and so they are stored as funcion pointers within the struct. All function pointers are duplicate, since one set of functions is intended to be executed on hosts (CPUs) and another set is intended to be executed on devices (GPUs).
Patch data refers to each patch specific data that is required to setup a patch, such as the number of cells in the patch, global extensions and other parameters that may be required.
Public Types
-
using svec_t = vec<CCTK_REAL, dim>
Type alias for representing spatial vectors. Used for representing coordinate tuples.
-
using djac_t = vec<smat<CCTK_REAL, dim>, dim>
Type alias for representing Jacobian derivative components
-
using global2local_func = std_tuple<int, svec_t> (*)(const PatchTransformations &pt, const svec_t &global_vars)
Type alias for a function pointer that points to a
global2local
like function, responsible for transforming coordinates from global coordinates to patch local coordinates.- Inputs:
const PatchTransformations &pt
: Reference to a PatchTransformations structure from which patch data will be obtained.const svec_t &global_vars
: Reference to a tuple of global coordinates to be transformed to local coordiantes.
- Returns:
A 2-element tuple containing:
The index of the patch owning the local coordinates.
The local coordinates.
-
using local2global_func = svec_t (*)(const PatchTransformations &pt, int patch, const svec_t &local_vars)
Type alias for a function pointer that points to a
local2global
like function, responsible for transforming coordinates from patch local coordinates to global coordinates.- Inputs:
const PatchTransformations &pt
: Reference to a PatchTransformations structure from which patch data will be obtained.int patch
: The index of the patch that owns the local coordinates to be transformed.const svec_t &local_vars
: Reference to a tuple of local coordinates to be transformed to global coordiantes.
- Returns:
An svec_t object containing the transformd global coordinates.
-
using dlocal_dglobal_fun = std_tuple<svec_t, jac_t> (*)(const PatchTransformations &pt, int patch, const svec_t &local_vars)
Type alias for a function pointer that points to a
dlocal_dglobal
like function, responsible for computing the coordinate transformation’s Jacobian components.- Inputs:
const PatchTransformations &pt
: Reference to a PatchTransformations structure from which patch data will be obtained.int patch
: The index representing the patch for which Jacobians should be calculated.const svec_t &local_vars
: Reference to a tuple of local coordinates where the Jacobian will be evaluated.
- Returns:
A 2 element tuple containing:
The global coordinates obtained by calling
local2global
on thelocal_vars
input.The components of the local -> global coordinate transformation Jacobian.
Note
Mathematically, Jacobians are defined as
\[J^{i}_{\phantom{i}j} = \frac{\mathrm{d} a^i}{\mathrm{d} x^j}\]In code, \(J^{i}_{\phantom{i}j}\) is acessed by callingJ(i)(j)
on ajac_t
type object.
-
using d2local_dglobal2_fun = std_tuple<svec_t, jac_t, djac_t> (*)(const PatchTransformations &pt, int patch, const svec_t &local_vars)
Type alias for a function pointer that points to a
d2local_dglobal2_fun
like function, responsible for computing the coordinate transformation’s Jacobian derivative components.- Inputs:
const PatchTransformations &pt
: Reference to a PatchTransformations structure from which patch data will be obtained.int patch
: The index representing the patch for which Jacobian derivatives should be calculated.const svec_t &local_vars
: Reference to a tuple of local coordinates where the Jacobian will be evaluated.
- Returns:
A 3 element tuple containing:
The global coordinates obtained by calling
local2global
on thelocal_vars
input.The components of the local -> global coordinate transformation Jacobian, obtained by calling
dlocal_dglobal
on the input data.The components of the local -> global coordinate transformation Jacobian derivatives.
Note
Mathematically, Jacobians are defined as
\[J^{i}_{\phantom{i}j} = \frac{\mathrm{d} a^i}{\mathrm{d} x^j}\]and their derivatives as\[J^{i}_{\phantom{i}jk} = \frac{\mathrm{d}^2 a^i}{\mathrm{d} x^j \mathrm{d}x^k}\]In code, \(J^{i}_{\phantom{i}jk}\) is acessed by callingJ(i)(j,k)
on adjac_t
type object.
Public Functions
-
PatchTransformations()
Construct a new Patch Transformations object.
The constructor reads cactus parameters and assigns them to the internal data storage during construction.
-
PatchTransformations(const PatchTransformations&) = default
Construct a new Patch Transformations object by copying another object of the same type
-
PatchTransformations(PatchTransformations&&) = default
Construct a new Patch Transformations object by moving from another object of the same type
-
PatchTransformations &operator=(const PatchTransformations&) = default
Construct a new Patch Transformations object using the assignment operator by copying another object of the same type
-
PatchTransformations &operator=(PatchTransformations&&) = default
Construct a new Patch Transformations object using the assignment operator by moving from another object of the same type
Public Members
-
global2local_func global2local = {nullptr}
Pointer to a function with signature as described in global2local_func, performing global -> local coordinate transformations. This function is called on the host (CPU).
-
local2global_func local2global = {nullptr}
Pointer to a function with signature as described in local2global_func, performing local -> global coordinate transformations. This function is called on the host (CPU).
-
dlocal_dglobal_fun dlocal_dglobal = {nullptr}
Pointer to a function with signature as described in dlocal_dglobal_fun, computing local -> global coordinate transformations Jacobian components. This function is called on the host (CPU).
-
d2local_dglobal2_fun d2local_dglobal2 = {nullptr}
Pointer to a function with signature as described in d2local_dglobal2_fun, computing local -> global coordinate transformations. Jacobian derivative components. This function is called on the host (CPU).
-
global2local_func global2local_device = {nullptr}
Pointer to a function with signature as described in global2local_func, performing global -> local coordinate transformations. This function is called on the device (GPU).
-
local2global_func local2global_device = {nullptr}
Pointer to a function with signature as described in local2global_func, performing local -> global coordinate transformations. This function is called on the device (GPU).
-
dlocal_dglobal_fun dlocal_dglobal_device = {nullptr}
Pointer to a function with signature as described in dlocal_dglobal_fun, computing local -> global coordinate transformations Jacobian components. This function is called on the device (GPU).
-
d2local_dglobal2_fun d2local_dglobal2_device = {nullptr}
Pointer to a function with signature as described in d2local_dglobal2_fun, computing local -> global coordinate transformations. Jacobian derivative components. This function is called on the device (GPU).
-
CCTK_REAL cartesian_xmax
Cartesian Patch: Upper x coordinate boundary
-
CCTK_REAL cartesian_xmin
Cartesian Patch: Lower x coordinate boundary
-
CCTK_REAL cartesian_ymax
Cartesian Patch: Upper y coordinate boundary
-
CCTK_REAL cartesian_ymin
Cartesian Patch: Lower y coordinate boundary
-
CCTK_REAL cartesian_zmax
Cartesian Patch: Upper z coordinate boundary
-
CCTK_REAL cartesian_zmin
Cartesian Patch: Lower z coordinate boundary
-
CCTK_INT cartesian_ncells_i
Cartesian Patch: Number of cells in the x direction
-
CCTK_INT cartesian_ncells_j
Cartesian Patch: Number of cells in the y direction
-
CCTK_INT cartesian_ncells_k
Cartesian Patch: Number of cells in the z direction
-
CCTK_REAL cubed_sphere_rmin
Cubed Sphere Patch: Inner radius
-
CCTK_REAL cubed_sphere_rmax
Cubed Sphere Patch: Outer radius
-
CCTK_INT swirl_ncells_i
Swirl Patch: Number of cells in the x direction
-
CCTK_INT swirl_ncells_j
Swirl Patch: Number of cells in the y direction
-
CCTK_INT swirl_ncells_k
Swirl Patch: Number of cells in the z direction
-
CCTK_REAL cake_outer_boundary_radius
Cake Patch: Radius of the outer boundary
-
CCTK_REAL cake_inner_boundary_radius
Cake Patch: Half the coordinate length of the central cartesian cube’s face
-
CCTK_INT cake_cartesian_ncells_i
Cake Patch: The number of cells in the x direction of the central cartesian cube.
-
CCTK_INT cake_cartesian_ncells_j
Cake Patch: The number of cells in the y direction of the central cartesian cube.
-
CCTK_INT cake_cartesian_ncells_k
Cake Patch: The number of cells in the z direction of the central cartesian cube.
-
CCTK_INT cake_angular_cells
Cake Patch: The number of cells in the angular direction of spherical patches.
-
CCTK_INT cake_radial_cells
Cake Patch: The number of cells in the radial direction of spherical patches.
-
CCTK_REAL two_cubes_xmin
Two Cubes Patch: The starting x value of the coordinate system.
-
CCTK_REAL two_cubes_xmax
Two Cubes Patch: The final x value of the coordinate system.
-
CCTK_REAL two_cubes_ymin
Two Cubes Patch: The starting y value of the coordinate system.
-
CCTK_REAL two_cubes_ymax
Two Cubes Patch: The final y value of the coordinate system.
-
CCTK_REAL two_cubes_zmin
Two Cubes Patch: The starting z value of the coordinate system.
-
CCTK_REAL two_cubes_zmax
Two Cubes Patch: The final z value of the coordinate system.
-
CCTK_REAL two_cubes_delta_y
Two Cubes Patch:The shift of the patch interface in the y axis.
-
CCTK_INT two_cubes_ncells_left
Two Cubes Patch: Number of cells in the left cube.
-
CCTK_INT two_cubes_ncells_right
Two Cubes Patch: Number of cells in the right cube.
-
CCTK_INT two_cubes_ncells_y
Two Cubes Patch: Number of cells in the y direction.
-
CCTK_INT two_cubes_ncells_z
Two Cubes Patch: Number of cells in the z direction.
-
CCTK_REAL thornburg06_outer_boundary_radius
Thornburg06 patch outer boundary radius.
-
CCTK_REAL thornburg06_inner_boundary_radius
Thornburg06 patch inner boundary radius.
-
CCTK_INT thornburg06_angular_cells
Thornburg06 patch angular cells.
-
CCTK_INT thornburg06_radial_cells
Thornburg06 patch radial cells.
-
using svec_t = vec<CCTK_REAL, dim>