# calcrhs

The "calcrhs" or "calculate right hand side" functions are where the
user-defined application equations are defined.

All user-defined applications must include two routines as part of
discretizing the application equations:
- calcrhs(dtu, u, v, dxu, dyu, dzu, dxv, dyv, dzv, w, par)

CCTK_REAL, dimension(NU) :: dtu

CCTK_REAL, dimension(NU) :: u,dxu,dyu,dzu

CCTK_REAL, dimension(NV) :: dxv,dyv,dzv, v

CCTK_REAL, dimension(NW) :: w

CCTK_REAL, dimension(NPAR) :: par

- calcrhs2(dtu, u, v, w, dxu, dyu, dzu, dxv, dyv, dzv, imask, par)

type(gridfunction), dimension(NU) :: dtu

type(gridfunction), dimension(NU) :: u, dxu, dyu, dzu

type(gridfunction), dimension(NV) :: v, dxv, dyv, dzv

type(gridfunction), dimension(NW) :: w

CCTK_INT, dimension(:,:,:) :: imask

CCTK_REAL, dimension(NPAR),intent(in) :: par

These two routines are called
by the hyper interface in *hyperrhs.f90*.
Routine *calcrhs* is called if the right hand side of the application
equations are to be calculated in a pointwise fashion ( that is, the routine
*calcrhs* will called repeatedly as *hyperrhs.f90* loops
over all the grid points ); otherwise, routine *calcrhs2* is called
just once and passed the memory pointers to all necessary grid functions.

The
setup file controls which of the
two routines is called by setting the parameters
**hyper_rhs1** and
**hyper_rhs2**.

- If pragma
**NoHyperRHS1** is given in the
setup
file, then routine *calcrhs* will not be called
and parameter **hyper_rhs1** will be 0.
- If pragma
**NoHyperRHS2** is given in the
setup
file, then routine *calcrhs2* will not be called
and parameter **hyper_rhs2** will be 0.
- If neither pragma is given, both
*calcrhs* and *calcrhs2*
will be called.

### Notes

- Parameters
**hyper_rhs1** and **hyper_rhs2**, which control
whether routine *calcrhs* or *calcrhs2* is called,
are not set directly by the user. They are set
by the pragma statements in the setup file.
- The routines are passed the spatial derivatives of the
ufuncs and
vfuncs in order to calculate
the time derivatives of the ufuncs, dtu.

### See Also

setup,
List of required routines

Index of all manual pages
### Examples

had/src/hyperCurvedWave/rhs.f90