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

Forward Euler method. More...

#include <basic.h>
#include <arrayfunctions.h>
#include <simulation_object.h>
#include <timeintegration.h>

Go to the source code of this file.

Functions

int TimeForwardEuler (void *ts)
 

Detailed Description

Forward Euler method.

Author
Debojyoti Ghosh

Definition in file TimeForwardEuler.c.

Function Documentation

◆ TimeForwardEuler()

int TimeForwardEuler ( void *  ts)

Advance the ODE given by

\begin{equation} \frac{d{\bf u}}{dt} = {\bf F} \left({\bf u}\right) \end{equation}

by one time step of size HyPar::dt using the forward Euler method given by

\begin{equation} {\bf u}^{n+1} = {\bf u}^n + \Delta t {\bf F}\left( {\bf u}^n \right) \end{equation}

where the superscript represents the time level, \(\Delta t\) is the time step size HyPar::dt, and \({\bf F}\left({\bf u}\right)\) is computed by TimeIntegration::RHSFunction.

Parameters
tsTime integrator object of type TimeIntegration

Definition at line 25 of file TimeForwardEuler.c.

28 {
29  TimeIntegration* TS = (TimeIntegration*) ts;
31  int ns, nsims = TS->nsims;
33 
34  for (ns = 0; ns < nsims; ns++) {
35 
36  HyPar* solver = &(sim[ns].solver);
37  MPIVariables* mpi = &(sim[ns].mpi);
38 
39  double* rhs = TS->rhs + TS->u_offsets[ns];
40 
41  /* Evaluate right-hand side */
42  IERR TS->RHSFunction( rhs,
43  solver->u,
44  solver,
45  mpi,
46  TS->waqt ); CHECKERR(ierr);
47 
48  /* update solution */
49  _ArrayAXPY_( rhs,
50  TS->dt,
51  solver->u,
52  TS->u_sizes[ns] );
53 
55  TS->dt,
56  solver->StepBoundaryIntegral,
57  TS->bf_sizes[ns] );
58  }
59 
60  return(0);
61 }
Structure of variables/parameters and function pointers for time integration.
#define IERR
Definition: basic.h:16
#define CHECKERR(ierr)
Definition: basic.h:18
Structure defining a simulation.
double * u
Definition: hypar.h:116
int(* RHSFunction)(double *, double *, void *, void *, double)
#define _ArrayScaleCopy1D_(x, a, y, size)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayAXPY_(x, a, y, size)
double * StageBoundaryIntegral
Definition: hypar.h:382
double * StepBoundaryIntegral
Definition: hypar.h:384
Structure of MPI-related variables.
#define _DECLARE_IERR_
Definition: basic.h:17