53 int ghosts = solver->
ghosts;
57 fprintf(stderr,
"Error in VlasovInitialize(): nvars has to be %d.\n",
_MODEL_NVARS_);
63 fprintf(stderr,
"Error in VlasovInitialize(): ndims has to be %d.\n",
_MODEL_NDIMS_);
76 in = fopen(
"physics.inp",
"r");
78 printf(
"Reading physical model inputs from file \"physics.inp\".\n");
80 int ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
81 if (!strcmp(word,
"begin")){
82 while (strcmp(word,
"end")){
83 int ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
84 if (!strcmp(word,
"self_consistent_electric_field")) {
87 if (ferr != 1)
return(1);
88 }
else if (!strcmp(word,
"x_ndims")) {
90 int ferr = fscanf(in,
"%d", &physics->
ndims_x);
91 if (ferr != 1)
return(1);
92 }
else if (!strcmp(word,
"v_ndims")) {
94 int ferr = fscanf(in,
"%d", &physics->
ndims_v);
95 if (ferr != 1)
return(1);
96 }
else if (strcmp(word,
"end")) {
98 int ferr = fscanf(in,
"%s",useless);
if (ferr != 1)
return(ferr);
99 printf(
"Warning: keyword %s in file \"physics.inp\" with value %s not ",
101 printf(
"recognized or extraneous. Ignoring.\n");
105 fprintf(stderr,
"Error: Illegal format in file \"physics.inp\".\n");
114 fprintf(stderr,
"Error in VlasovInitialize:\n");
115 fprintf(stderr,
" space + vel dims not equal to ndims!\n");
122 fprintf(stderr,
"Error in VlasovInitialize: This physical model does not have a splitting ");
123 fprintf(stderr,
"of the hyperbolic term defined.\n");
141 for (
int d=0; d<physics->
ndims_x; d++) {
167 fprintf(stderr,
"Error in VlasovInitialize(): Using FFTW requires MPI to be enabled.\n");
172 fprintf(stderr,
"Error in VlasovInitialize():\n");
173 fprintf(stderr,
" Self-consistent electric field is implemented for only 1 space dimension.\n");
178 physics->sum_buffer = (
double*) calloc(dim_local[0],
sizeof(
double));
182 physics->alloc_local = fftw_mpi_local_size_1d(dim_global[0], mpi->
comm[0],
185 &physics->local_i_start,
187 &physics->local_o_start);
188 if (dim_local[0] != physics->local_ni) {
189 fprintf(stderr,
"Error in VlasovInitialize(): The FFTW data distribution is incompatible with the HyPar one.\n");
190 fprintf(stderr,
"Decompose the spatial dimension so that the degrees of freedom are evenly divided.\n");
194 physics->phys_buffer_e = fftw_alloc_complex(physics->alloc_local);
195 physics->fourier_buffer_e = fftw_alloc_complex(physics->alloc_local);
197 physics->plan_forward_e = fftw_mpi_plan_dft_1d(dim_global[0],
198 physics->phys_buffer_e,
199 physics->fourier_buffer_e,
204 physics->plan_backward_e = fftw_mpi_plan_dft_1d(dim_global[0],
205 physics->fourier_buffer_e,
206 physics->phys_buffer_e,
211 physics->phys_buffer_phi = fftw_alloc_complex(physics->alloc_local);
212 physics->fourier_buffer_phi = fftw_alloc_complex(physics->alloc_local);
214 physics->plan_forward_phi = fftw_mpi_plan_dft_1d(dim_global[0],
215 physics->phys_buffer_phi,
216 physics->fourier_buffer_phi,
221 physics->plan_backward_phi = fftw_mpi_plan_dft_1d(dim_global[0],
222 physics->fourier_buffer_phi,
223 physics->phys_buffer_phi,
229 fprintf(stderr,
"Error in VlasovInitialize():\n");
230 fprintf(stderr,
" Self-consistent electric field requires FFTW library.\n");
244 if (ierr)
return ierr;
int(* PhysicsOutput)(void *, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
int self_consistent_electric_field
int MPIBroadcast_integer(int *, int, int, void *)
int VlasovUpwind(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* FFunction)(double *, double *, int, void *, double)
double(* ComputeCFL)(void *, void *, double, double)
Structure containing all solver-specific variables and functions.
#define _MAX_STRING_SIZE_
int VlasovWriteEFieldAndPotential(void *, void *, double)
int VlasovPreStep(double *, void *, void *, double)
long npts_global_x_wghosts
int VlasovEField(double *, void *, double)
int(* PreStep)(double *, void *, void *, double)
int(* PostStage)(double *, void *, void *, double)
int VlasovPostStage(double *, void *, void *, double)
int VlasovAdvection(double *, double *, int, void *, double)
Structure of MPI-related variables.
double VlasovComputeCFL(void *, void *, double, double)