HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <common_cpp.h>
#include <io_cpp.h>
#include <timeintegration_cpp.h>
#include <mpivars_cpp.h>
#include <simulation_object.h>
#include <librom_interface.h>
Go to the source code of this file.
Functions | |
int | ComputeRHSOperators (void *, void *, double) |
int | CalculateError (void *, void *) |
int | OutputSolution (void *, int, double) |
void | ResetFilenameIndex (char *, int) |
int | CalculateROMDiff (void *, void *) |
int | OutputROMSolution (void *, int, double) |
int | Solve (void *s, int nsims, int rank, int nproc) |
int ComputeRHSOperators | ( | void * | s, |
void * | m, | ||
double | t | ||
) |
Computes the matrices representing the Jacobians of the hyperbolic (HyPar::HyperbolicFunction), parabolic (HyPar::ParabolicFunction), and the source (HyPar::SourceFunction) terms.
Each element is compute through finite-differences, by perturbing one DOF of the solution at a time. The matrices are not stored in the memory, instead the non-zero are written to file as soon as they are computed. The filenames for the matrices are "Mat_*Function_nnnnn.dat", where "nnnnn" is a time-dependent index.
Note: Parabolic terms have not yet been included.
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
t | Current simulation time |
Definition at line 50 of file ComputeRHSOperators.c.
int CalculateError | ( | void * | s, |
void * | m | ||
) |
Calculate the error in the final solution
Calculates the error in the solution if the exact solution is available. If the exact solution is not available, the errors are reported as zero. The exact solution should be provided in the file "exact.inp" in the same format as the initial solution.
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
Definition at line 25 of file CalculateError.c.
int OutputSolution | ( | void * | s, |
int | nsims, | ||
double | a_time | ||
) |
Write solutions to file
Write out the solution to file
s | Array of simulation objects of type SimulationObject |
nsims | Number of simulation objects |
a_time | Current simulation time |
Definition at line 27 of file OutputSolution.cpp.
void ResetFilenameIndex | ( | char * | f, |
int | len | ||
) |
Reset filename index
Resets the index to "0000..." of a desired length.
f | Character string representing the integer |
len | Length of the string |
Definition at line 64 of file IncrementFilename.c.
int CalculateROMDiff | ( | void * | s, |
void * | m | ||
) |
Calculate the diff of PDE and ROM solutions
Calculates the L1, L2, & Linf norms of the diff between the PDE solution and the predicted solution by libROM. error in the solution if the exact solution is
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
Definition at line 24 of file CalculateROMDiff.c.
int OutputROMSolution | ( | void * | s, |
int | nsims, | ||
double | a_time | ||
) |
Write ROM solutions to file
Write out the ROM solution to file
s | Array of simulation objects of type SimulationObject |
nsims | Number of simulation objects |
a_time | Current simulation time |
Definition at line 24 of file OutputROMSolution.cpp.
int Solve | ( | void * | s, |
int | nsims, | ||
int | rank, | ||
int | nproc | ||
) |
This function integrates the semi-discrete ODE (obtained from discretizing the PDE in space) using natively implemented time integration methods. It initializes the time integration object, iterates the simulation for the required number of time steps, and calculates the errors. After the specified number of iterations, it writes out some information to the screen and the solution to a file.
s | Array of simulation objects of type SimulationObject |
nsims | number of simulation objects |
rank | MPI rank of this process |
nproc | Number of MPI processes |
Definition at line 37 of file Solve.cpp.