HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
CompactSchemeInitialize.c File Reference

Initializes the compact schemes. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <interpolation.h>
#include <mpivars.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int CompactSchemeInitialize (void *s, void *m, char *type)
 

Detailed Description

Initializes the compact schemes.

Author
Debojyoti Ghosh

Definition in file CompactSchemeInitialize.c.

Function Documentation

◆ CompactSchemeInitialize()

int CompactSchemeInitialize ( void *  s,
void *  m,
char *  type 
)

This function initializes the compact finite-difference methods: allocates the arrays to store the tridiagonal system.

Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables
typeType of interpolation

Definition at line 17 of file CompactSchemeInitialize.c.

22 {
23  HyPar *solver = (HyPar*) s;
24  MPIVariables *mpi = (MPIVariables*) m;
25  CompactScheme *compact = (CompactScheme*) solver->compact;
26 
27  int nvars = solver->nvars;
28  int ndims = solver->ndims;
29 
30  int size = 1, d;
31  for (d=0; d<solver->ndims; d++) size *= (solver->dim_local[d]+1);
32  size *= solver->nvars;
33  if (!strcmp(solver->interp_type,_CHARACTERISTIC_)) size *= solver->nvars;
34 
35  compact->A = (double*) calloc (size, sizeof(double));
36  compact->B = (double*) calloc (size, sizeof(double));
37  compact->C = (double*) calloc (size, sizeof(double));
38  compact->R = (double*) calloc (size, sizeof(double));
39 
40  compact->sendbuf = (double*) calloc (size, sizeof(double));
41  compact->recvbuf = (double*) calloc (size, sizeof(double));
42 
43  return(0);
44 }
int nvars
Definition: hypar.h:29
#define _CHARACTERISTIC_
Definition: interpolation.h:33
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
char interp_type[_MAX_STRING_SIZE_]
Definition: hypar.h:88
double * recvbuf
Structure of variables/parameters needed by the compact schemes.
int * dim_local
Definition: hypar.h:37
Structure of MPI-related variables.
void * compact
Definition: hypar.h:364
double * sendbuf