From e7917b740e8907476d9fb440ba1c9cafb7bafcaa Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 1 Dec 2014 12:57:45 +0100 Subject: Add a function for evaluating the metric. --- brill_data.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'brill_data.h') diff --git a/brill_data.h b/brill_data.h index 85e1aac..a3f897b 100644 --- a/brill_data.h +++ b/brill_data.h @@ -161,3 +161,28 @@ int bd_eval_psi(BDContext *bd, const double *rho, int nb_coords_rho, const double *z, int nb_coords_z, const unsigned int diff_order[2], double *psi); + +/** + * Evaluate the 3-metric γ_ij at the specified rectangular grid (in cylindrical + * coordinates { ρ, z, φ }). + * + * @param bd the solver context + * @param rho the array of ρ coordinates. + * @param nb_coords_rho the number of elements in rho. + * @param z the array of z coordinates. + * @param nb_coords_z the number of elements in z. + * @param comp the component of the metric to evaluate. + * @param diff_order the order of the derivatives of the metric to evaluate. The first element + * specifies the derivative wrt ρ, the second wrt z. I.e. diff_order = { 0, 0 } + * evaluates the metric itself, diff_order = { 0, 1 } evaluates ∂γ/∂z etc. + * @param out the array into which the values of the metric will be written. The metric + * is evaluated on the grid formed by the outer product of the rho + * and z vectors. I.e. out[j * nb_coords_rho + i] = γ_comp[0]comp[1](rho[i], z[j]). + * The length of out must be nb_coords_rho * nb_coords_z. + * + * @return >= 0 on success, a negative error code on failure. + */ +int bd_eval_metric(BDContext *bd, const double *rho, int nb_coords_rho, + const double *z, int nb_coords_z, + const unsigned int comp[2], const unsigned int diff_order[2], + double *out); -- cgit v1.2.3