Note: Parabolic terms have not yet been included.
59 double *f, *f0, *u, *u0, *rhs, *drhs;
63 if (mpi->
nproc > 1)
return(0);
65 int ndims = solver->
ndims;
66 int nvars = solver->
nvars;
67 int ghosts = solver->
ghosts;
71 double epsilon = 1e-6;
72 double tolerance = 1e-15;
76 u = (
double*) calloc (size,
sizeof(
double));
77 u0 = (
double*) calloc (size,
sizeof(
double));
78 rhs = (
double*) calloc (size,
sizeof(
double));
79 drhs = (
double*) calloc (size,
sizeof(
double));
81 f = (
double*) calloc (ndof,
sizeof(
double));
82 f0 = (
double*) calloc (ndof,
sizeof(
double));
93 strcpy(filename,
"Mat_FFunction_");
95 strcat(filename,
".dat");
96 printf(
"ComputeRHSOperators(): Computing linearized matrix operator for FFunction. ndof=%d.\n",ndof);
97 printf(
"ComputeRHSOperators(): Writing to sparse matrix file %s.\n",filename);
98 fout = fopen(filename,
"w");
99 fprintf(fout,
"%d\n",ndof);
107 for (i=0; i<ndof; i++) {
118 u[nvars*p+v] += epsilon;
133 for (j=0; j<ndof; j++) {
134 double mat_elem = f[j] / epsilon;
136 if (
absolute(mat_elem) > tolerance) fprintf(fout,
"%5d %5d %+1.16e\n",j+1,i+1,mat_elem);
144 strcpy(filename,
"Mat_FdFFunction_");
146 strcat(filename,
".dat");
147 printf(
"ComputeRHSOperators(): Computing linearized matrix operator for (FFunction-dFFunction). ndof=%d.\n",ndof);
148 printf(
"ComputeRHSOperators(): Writing to sparse matrix file %s.\n",filename);
149 fout = fopen(filename,
"w");
150 fprintf(fout,
"%d\n",ndof);
167 for (i=0; i<ndof; i++) {
178 u[nvars*p+v] += epsilon;
202 for (j=0; j<ndof; j++) {
203 double mat_elem = f[j] / epsilon;
205 if (
absolute(mat_elem) > tolerance) fprintf(fout,
"%5d %5d %+1.16e\n",j+1,i+1,mat_elem);
210 strcpy(filename,
"Mat_dFFunction_");
212 strcat(filename,
".dat");
213 printf(
"ComputeRHSOperators(): Computing linearized matrix operator for dFFunction. ndof=%d.\n",ndof);
214 printf(
"ComputeRHSOperators(): Writing to sparse matrix file %s.\n",filename);
215 fout = fopen(filename,
"w");
216 fprintf(fout,
"%d\n",ndof);
224 for (i=0; i<ndof; i++) {
235 u[nvars*p+v] += epsilon;
250 for (j=0; j<ndof; j++) {
251 double mat_elem = f[j] / epsilon;
253 if (
absolute(mat_elem) > tolerance) fprintf(fout,
"%5d %5d %+1.16e\n",j+1,i+1,mat_elem);
261 strcpy(filename,
"Mat_SFunction_");
263 strcat(filename,
".dat");
264 printf(
"ComputeRHSOperators(): Computing linearized matrix operator for SFunction. ndof=%d.\n",ndof);
265 printf(
"ComputeRHSOperators(): Writing to sparse matrix file %s.\n",filename);
266 fout = fopen(filename,
"w");
267 fprintf(fout,
"%d\n",ndof);
273 for (i=0; i<ndof; i++) {
284 u[nvars*p+v] += epsilon;
297 for (j=0; j<ndof; j++) {
298 double mat_elem = f[j] / epsilon;
300 if (
absolute(mat_elem) > tolerance) fprintf(fout,
"%5d %5d %+1.16e\n",j+1,i+1,mat_elem);
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
int(* ApplyBoundaryConditions)(void *, void *, double *, double *, double)
int(* FdFFunction)(double *, double *, int, void *, double)
int(* ApplyIBConditions)(void *, void *, double *, double)
int(* SFunction)(double *, double *, void *, void *, double)
#define _ArrayIndexnD_(N, index, imax, i, ghost)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* SourceFunction)(double *, double *, void *, void *, double)
int(* HyperbolicFunction)(double *, double *, void *, void *, double, int, int(*)(double *, double *, int, void *, double), int(*)(double *, double *, double *, double *, double *, double *, int, void *, double))
int(* FFunction)(double *, double *, int, void *, double)
Structure containing all solver-specific variables and functions.
#define _MAX_STRING_SIZE_
#define _ArrayAXPY_(x, a, y, size)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
INLINE int ArrayCopynD(int, const double *, double *, int *, int, int, int *, int)
int(* UpwindFdF)(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _ArraySetValue_(x, size, value)
int(* dFFunction)(double *, double *, int, void *, double)
int(* UpwinddF)(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure of MPI-related variables.
#define _ArrayScale1D_(x, a, size)
int npoints_local_wghosts
#define _ArrayCopy1D_(x, y, size)