Go to the documentation of this file.00001 #include "../copyright.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <stdio.h>
00012 #include <stdlib.h>
00013 #include "../defs.h"
00014 #include "../athena.h"
00015 #include "prototypes.h"
00016 #include "../prototypes.h"
00017
00018
00019 static int dim=0;
00020
00021
00022
00023
00024 VDFun_t integrate_init(MeshS *pM)
00025 {
00026 int i;
00027 Real cfl;
00028
00029 dim = 0;
00030 for (i=0; i<3; i++) if(pM->Nx[i] > 1) dim++;
00031
00032
00033 switch(dim){
00034
00035 case 1:
00036 if(pM->Nx[0] <= 1) break;
00037 integrate_init_1d(pM);
00038 #if defined(CTU_INTEGRATOR)
00039 return integrate_1d_ctu;
00040 #elif defined(VL_INTEGRATOR)
00041 cfl = par_getd("time","cour_no");
00042 if (cfl > 0.5)
00043 ath_error("<time>cour_no=%e, must be <= 0.5 with 1D VL integrator\n",cfl);
00044 return integrate_1d_vl;
00045 #else
00046 ath_err("[integrate_init]: Invalid integrator defined for 1D problem");
00047 #endif
00048
00049 case 2:
00050 if(pM->Nx[2] > 1) break;
00051 integrate_init_2d(pM);
00052 #if defined(CTU_INTEGRATOR)
00053 return integrate_2d_ctu;
00054 #elif defined(VL_INTEGRATOR)
00055 cfl = par_getd("time","cour_no");
00056 if (cfl > 0.5)
00057 ath_error("<time>cour_no=%e, must be <= 0.5 with 2D VL integrator\n",cfl);
00058 return integrate_2d_vl;
00059 #else
00060 ath_err("[integrate_init]: Invalid integrator defined for 2D problem");
00061 #endif
00062
00063 case 3:
00064 integrate_init_3d(pM);
00065 #if defined(CTU_INTEGRATOR)
00066 cfl = par_getd("time","cour_no");
00067 if (cfl > 0.5)
00068 ath_error("<time>cour_no=%e, must be <= 0.5 with 3D CTU integrator\n",cfl);
00069 return integrate_3d_ctu;
00070 #elif defined(VL_INTEGRATOR)
00071 cfl = par_getd("time","cour_no");
00072 if (cfl > 0.5)
00073 ath_error("<time>cour_no=%e, must be <= 0.5 with 3D VL integrator\n",cfl);
00074 return integrate_3d_vl;
00075 #else
00076 ath_err("[integrate_init]: Invalid integrator defined for 3D problem");
00077 #endif
00078
00079 }
00080
00081 if (dim == 1)
00082 ath_error("[integrate_init]: 1D problem must have Nx1 > 1: Nx1=%d, Nx2=%d, Nx3=%d\n",pM->Nx[0],pM->Nx[1],pM->Nx[2]);
00083 if (dim == 2)
00084 ath_error("[integrate_init]: 2D problem must have Nx1 and Nx2 > 1: Nx1=%d, Nx2=%d, Nx3=%d\n",pM->Nx[0],pM->Nx[1],pM->Nx[2]);
00085
00086
00087 return NULL;
00088 }
00089
00090
00091
00092
00093 void integrate_destruct()
00094 {
00095 switch(dim){
00096 case 1:
00097 integrate_destruct_1d();
00098 return;
00099 case 2:
00100 integrate_destruct_2d();
00101 return;
00102 case 3:
00103 integrate_destruct_3d();
00104 return;
00105 }
00106
00107 ath_error("[integrate_destruct]: Grid dimension = %d\n",dim);
00108 }