aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--param.ccl45
-rw-r--r--schedule.ccl6
-rw-r--r--src/multipole.cc79
3 files changed, 84 insertions, 46 deletions
diff --git a/param.ccl b/param.ccl
index e752c8d..33485fc 100644
--- a/param.ccl
+++ b/param.ccl
@@ -70,27 +70,11 @@ CCTK_BOOLEAN verbose "Output detailed information about what is happening"
{
} "no"
-KEYWORD mode_type "Which type of mode extraction do we have" STEERABLE=always
-{
- "all modes" :: "Extract all modes up to (l_mode, m_mode)."
- "specific mode" :: "Select one specific (l_mode, m_mode) mode"
-} "all modes"
-
-CCTK_INT l_min "all modes: above which l mode to calculate/ specific mode: which l mode to extract" STEERABLE=always
+CCTK_INT l_max "The maximum l mode to extract" STEERABLE=always
{
0:* :: "l >= 0"
} 2
-CCTK_INT l_mode "all modes: Up to which l mode to calculate/ specific mode: which l mode to extract" STEERABLE=always
-{
- 0:* :: "l >= 0"
-} 2
-
-CCTK_INT m_mode "all modes: Up to which m mode to calculate/ specific mode: which m mode to extract " STEERABLE=always
-{
- 0:* :: "Positive Please"
-} 2
-
CCTK_BOOLEAN enable_test "whether to set a spherical harmonic in the 'harmonic' grid functions"
{
} "no"
@@ -109,3 +93,30 @@ CCTK_INT test_sw "which spin weight to put into the test variables"
{
* :: "Any integer"
} -2
+
+# This parameter is deprecated and is no longer used
+KEYWORD mode_type "Which type of mode extraction do we have" STEERABLE=always
+{
+ "all modes" :: "Extract all modes up to (l_mode, m_mode)."
+ "specific mode" :: "Select one specific (l_mode, m_mode) mode"
+ "deprecated" :: "Deprecated"
+} "deprecated"
+
+# This parameter is deprecated and is no longer used
+CCTK_INT l_min "all modes: above which l mode to calculate/ specific mode: which l mode to extract" STEERABLE=always
+{
+ -1:* :: "Deprecated"
+} -1
+
+# This parameter is deprecated and is only used if set to a nondefault
+# value, in which case it is a synonym for l_max.
+CCTK_INT l_mode "The maximum l mode to extract" STEERABLE=always
+{
+ -1:* :: "Deprecated"
+} -1
+
+# This parameter is deprecated and is no longer used
+CCTK_INT m_mode "all modes: Up to which m mode to calculate/ specific mode: which m mode to extract " STEERABLE=always
+{
+ -100:* :: "Deprecated"
+} -100
diff --git a/schedule.ccl b/schedule.ccl
index a7123ee..3c3ba12 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -18,3 +18,9 @@ if (enable_test)
LANG: C
} "Populate grid functions with spherical harmonics"
}
+
+schedule Multipole_ParamCheck at CCTK_PARAMCHECK
+{
+ LANG: C
+ OPTIONS: GLOBAL
+} "Check Multipole parameters"
diff --git a/src/multipole.cc b/src/multipole.cc
index b0bc015..c79653a 100644
--- a/src/multipole.cc
+++ b/src/multipole.cc
@@ -35,7 +35,6 @@ typedef struct
}
variables_desc;
-
static void fill_variable(int idx, const char *optstring, void *callback_arg)
{
assert(idx >= 0);
@@ -187,10 +186,18 @@ void get_spin_weights(variable_desc vars[], int n_vars, int spin_weights[max_spi
*n_weights = n_spin_weights;
}
+// For backward compatibility we allow the user to set l_mode instead
+// of l_max, but if it is left at the default of -1, l_max is used.
+static int get_l_max()
+{
+ DECLARE_CCTK_PARAMETERS;
+ return l_mode == -1 ? l_max : l_mode;
+}
static
-void setup_harmonics(const int spin_weights[max_spin_weights], int n_spin_weights, int lmin, int lmax,
- int m_mode, bool allmodes, CCTK_REAL th[], CCTK_REAL ph[], int array_size,
+void setup_harmonics(const int spin_weights[max_spin_weights],
+ int n_spin_weights, int lmax,
+ CCTK_REAL th[], CCTK_REAL ph[], int array_size,
CCTK_REAL *reY[max_spin_weights][max_l_modes][max_m_modes],
CCTK_REAL *imY[max_spin_weights][max_l_modes][max_m_modes])
{
@@ -209,22 +216,46 @@ void setup_harmonics(const int spin_weights[max_spin_weights], int n_spin_weight
{
int sw = spin_weights[si];
- for (int l=lmin; l <= lmax; l++)
+ for (int l=0; l <= lmax; l++)
{
- int mmin = (allmodes ? (m_mode > l ? -l : -m_mode) : m_mode);
- int mmax = (allmodes ? (m_mode > l ? l : m_mode) : m_mode);
-
- for (int m=mmin; m <= mmax; m++)
+ for (int m=-l; m <= l; m++)
{
- reY[si][l-lmin][m-mmin] = new CCTK_REAL[array_size];
- imY[si][l-lmin][m-mmin] = new CCTK_REAL[array_size];
+ reY[si][l][m+l] = new CCTK_REAL[array_size];
+ imY[si][l][m+l] = new CCTK_REAL[array_size];
- Multipole_HarmonicSetup(sw, l, m, array_size, th, ph, reY[si][l-lmin][m-mmin], imY[si][l-lmin][m-mmin]);
+ Multipole_HarmonicSetup(sw, l, m, array_size, th, ph,
+ reY[si][l][m+l], imY[si][l][m+l]);
}
}
}
}
+extern "C" void Multipole_ParamCheck(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_PARAMETERS;
+ DECLARE_CCTK_ARGUMENTS;
+
+ if (l_mode != -1)
+ {
+ CCTK_WARN(CCTK_WARN_ALERT, "The parameter l_mode is deprecated. Use l_max instead. For compatibility, l_max = l_mode is being used.");
+ }
+
+ if (!CCTK_Equals(mode_type, "deprecated"))
+ {
+ CCTK_WARN(CCTK_WARN_ALERT, "The parameter mode_type is deprecated and is no longer used. All modes will be computed.");
+ }
+
+ if (l_min != -1)
+ {
+ CCTK_WARN(CCTK_WARN_ALERT, "The parameter l_min is deprecated and is no longer used. Modes from l = 0 will be computed.");
+ }
+
+ if (m_mode != -100)
+ {
+ CCTK_WARN(CCTK_WARN_ALERT, "The parameter m_mode is deprecated. All m modes will be computed.");
+ }
+}
+
extern "C" void Multipole_Calc(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
@@ -245,21 +276,11 @@ extern "C" void Multipole_Calc(CCTK_ARGUMENTS)
int i, array_size=(ntheta+1)*(nphi+1);
CCTK_REAL real_lm = 0.0, imag_lm = 0.0;
- int lmin, lmax, mmin, mmax, allmodes=0;
if (cctk_iteration % out_every != 0)
return;
- // Determine modes to compute
- if (CCTK_EQUALS(mode_type, "all modes"))
- {
- allmodes=1;
- }
- //if mode_type is set to "all modes", all modes with l <= l_mode,
- //abs(m) <= min{l_mode, m_mode} will be output. Otherwise, only
- //the l_mode, m_mode mode will be output.
- lmin = (allmodes ? l_min : l_mode);
- lmax = l_mode;
+ int lmax = get_l_max();
assert(lmax + 1 <= max_l_modes);
@@ -279,7 +300,8 @@ extern "C" void Multipole_Calc(CCTK_ARGUMENTS)
parse_variables_string(variables, vars, &n_variables);
get_spin_weights(vars, n_variables, spin_weights, &n_spin_weights);
Multipole_CoordSetup(ntheta, nphi, xhat, yhat, zhat, th, ph);
- setup_harmonics(spin_weights, n_spin_weights, lmin, lmax, m_mode, allmodes, th, ph, array_size, reY, imY);
+ setup_harmonics(spin_weights, n_spin_weights, lmax, th, ph,
+ array_size, reY, imY);
initialized = true;
}
@@ -298,15 +320,14 @@ extern "C" void Multipole_Calc(CCTK_ARGUMENTS)
// Interpolate Psi4r and Psi4i
Multipole_Interp(CCTK_PASS_CTOC, xs, ys, zs, vars[v].index, vars[v].imag_index,
real, imag);
- for (int l=lmin; l <= lmax; l++)
+ for (int l=0; l <= lmax; l++)
{
- mmin = (allmodes ? (m_mode > l ? -l : -m_mode) : m_mode) ;
- mmax = (allmodes ? (m_mode > l ? l : m_mode) : m_mode);
-
- for (int m=mmin; m <= mmax; m++)
+ for (int m=-l; m <= l; m++)
{
// Integrate sYlm (real + i imag) over the sphere at radius r
- Multipole_Integrate(array_size, ntheta, reY[si][l-lmin][m-mmin], imY[si][l-lmin][m-mmin], real, imag, th, ph,
+ Multipole_Integrate(array_size, ntheta,
+ reY[si][l][m+l], imY[si][l][m+l],
+ real, imag, th, ph,
&real_lm, &imag_lm);
output_mode(CCTK_PASS_CTOC, &vars[v], radius[i], real_lm, imag_lm, l, m);