diff options
author | schnetter <schnetter@57fe0bb3-ccba-405f-9b23-de0201f165b7> | 2009-12-07 17:12:39 +0000 |
---|---|---|
committer | schnetter <schnetter@57fe0bb3-ccba-405f-9b23-de0201f165b7> | 2009-12-07 17:12:39 +0000 |
commit | 14ffe105794fb00a3306852953986bcc39747e38 (patch) | |
tree | bc2c05f2433e3ee54a3808b630a5266209a38b5e /src | |
parent | 2036580101df874a2f1dea044f43b48f7516cfcb (diff) |
Add a new group "Bvec" to HydroBase, containing the magnetic field.
Same as the velocity "vel", this is a vector group with three
components.
There are also two new parameters "initial_Bvec" with default value
"none", specifying that Bvec does not have storage. This keeps things
backward compatible. Another parameter "Bvec_evolution_method"
specifies its method; the default value is also "none". These
parameters need to be extended by initial data and evolution thorns
that handle magnetic fields.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/HydroBase/trunk@18 57fe0bb3-ccba-405f-9b23-de0201f165b7
Diffstat (limited to 'src')
-rw-r--r-- | src/Initialisation.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/Initialisation.c b/src/Initialisation.c index a739091..fcd71f5 100644 --- a/src/Initialisation.c +++ b/src/Initialisation.c @@ -111,3 +111,58 @@ void HydroBase_Y_e_one (CCTK_ARGUMENTS) "Unsupported parameter value for InitBase::initial_data_setup_method"); } } + + + +void HydroBase_Bvec_zero (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + int const np = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2]; + +#pragma omp parallel for + for (int i=0; i<np; ++i) { + Bvec[i] = 0.0; + Bvec[i+ np] = 0.0; + Bvec[i+2*np] = 0.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::Bvec") >= 2) { +#pragma omp parallel for + for (int i=0; i<np; ++i) { + Bvec_p[i] = 0.0; + Bvec_p[i+ np] = 0.0; + Bvec_p[i+2*np] = 0.0; + } + } + + if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Bvec") >= 3) { +#pragma omp parallel for + for (int i=0; i<np; ++i) { + Bvec_p_p[i] = 0.0; + Bvec_p_p[i+ np] = 0.0; + Bvec_p_p[i+2*np] = 0.0; + } + } + + if (CCTK_ActiveTimeLevels(cctkGH, "HydroBase::Bvec") >= 4) { + CCTK_WARN (CCTK_WARN_ABORT, + "Too many active time levels for HydroBase::Bvec"); + } + + } + else + { + CCTK_WARN (CCTK_WARN_ABORT, + "Unsupported parameter value for InitBase::initial_data_setup_method"); + } +} |