aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschnetter <schnetter@57fe0bb3-ccba-405f-9b23-de0201f165b7>2009-12-07 16:56:16 +0000
committerschnetter <schnetter@57fe0bb3-ccba-405f-9b23-de0201f165b7>2009-12-07 16:56:16 +0000
commit2036580101df874a2f1dea044f43b48f7516cfcb (patch)
tree532d3efd42c26a006e423a728e6b64aae8d51ec4 /src
parent37042043126ff646f862dad9a9555ed3eb94391b (diff)
Add a parameter "initial_hydro" to HydroBase with a default setting of
"zero". This parameter, which can be extended by hydro initial data thorns, determines which hydro thorn is setting up initial data. The default setting "zero" is implemented by HydroBase itself, setting all hydro variables to zero. This corresponds to a vacuum, but without atmosphere. Reformat and/or clarify some comments in the ccl files. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/HydroBase/trunk@17 57fe0bb3-ccba-405f-9b23-de0201f165b7
Diffstat (limited to 'src')
-rw-r--r--src/Initialisation.c120
1 files changed, 101 insertions, 19 deletions
diff --git a/src/Initialisation.c b/src/Initialisation.c
index de2411c..a739091 100644
--- a/src/Initialisation.c
+++ b/src/Initialisation.c
@@ -1,31 +1,113 @@
-#include "cctk.h"
+#include <cctk.h>
+#include <cctk_Arguments.h>
+#include <cctk_Parameters.h>
-#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
-void HydroBase_Y_e_one(CCTK_ARGUMENTS)
+
+void HydroBase_Zero (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
- int i;
-
- for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++)
- Y_e[i] = 1.0;
- if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Y_e") > 1)
- for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++)
- Y_e_p[i] = 1.0;
+ int const np = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2];
+
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ rho[i ] = 0.0;
+ vel[i ] = 0.0;
+ vel[i+ np] = 0.0;
+ vel[i+2*np] = 0.0;
+ eps[i ] = 0.0;
+ }
- if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Y_e") > 2)
- for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++)
- Y_e_p_p[i] = 1.0;
+ if (CCTK_EQUALS (initial_data_setup_method, "init_some_levels") ||
+ CCTK_EQUALS (initial_data_setup_method, "init_single_levels"))
+ {
+ /* do nothing */
+ }
+ else if (CCTK_EQUALS (initial_data_setup_method, "init_all_levels"))
+ {
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::rho") >= 2) {
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ rho_p[i ] = 0.0;
+ vel_p[i ] = 0.0;
+ vel_p[i+ np] = 0.0;
+ vel_p[i+2*np] = 0.0;
+ eps_p[i ] = 0.0;
+ }
+ }
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::rho") >= 3) {
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ rho_p_p[i ] = 0.0;
+ vel_p_p[i ] = 0.0;
+ vel_p_p[i+ np] = 0.0;
+ vel_p_p[i+2*np] = 0.0;
+ eps_p_p[i ] = 0.0;
+ }
+ }
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::rho") >= 4) {
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Too many active time levels for HydroBase variables");
+ }
+
+ }
+ else
+ {
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Unsupported parameter value for InitBase::initial_data_setup_method");
+ }
}
-/*void HydroBase_SetY_eStateOn(CCTK_ARGUMENTS)
+
+
+void HydroBase_Y_e_one (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
-
- *Y_e_state = 1;
-}*/
-
+
+ int const np = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2];
+
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ Y_e[i] = 1.0;
+ }
+
+ if (CCTK_EQUALS (initial_data_setup_method, "init_some_levels") ||
+ CCTK_EQUALS (initial_data_setup_method, "init_single_levels"))
+ {
+ /* do nothing */
+ }
+ else if (CCTK_EQUALS (initial_data_setup_method, "init_all_levels"))
+ {
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Y_e") >= 2) {
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ Y_e_p[i] = 1.0;
+ }
+ }
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Y_e") >= 3) {
+#pragma omp parallel for
+ for (int i=0; i<np; ++i) {
+ Y_e_p_p[i] = 1.0;
+ }
+ }
+
+ if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Y_e") >= 4) {
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Too many active time levels for HydroBase::Y_e");
+ }
+
+ }
+ else
+ {
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Unsupported parameter value for InitBase::initial_data_setup_method");
+ }
+}