The scalar wave equation in Method of Lines form

Ian Hawke

\( \)Date\( \)

Abstract

WaveMoL is an example implementation of a thorn that uses the method of lines thorn MoL. The wave equation in first order form is implemented.

1 Purpose

WaveToy is the simple test thorn that comes with Cactus as standard. This is written so that it solves the wave equation \begin {equation} \label {eq:wave1} \partial _t^2 \phi = \partial _{x^i}^2 \phi ^i \end {equation} directly using the leapfrog scheme. This form of the equations isn’t suitable for use with the method of lines.

The purpose of this thorn is to rewrite the equations in first order form

\begin {eqnarray} \label {eq:wave2} \partial _t \Phi & = & \partial _{x^i} \Pi ^i, \\ \partial _t \Pi ^j & = & \partial _{x^j} \Phi , \\ \partial _t \phi & = & \Phi , \\ \partial _{x^j} \phi & = & \Pi ^j. \end {eqnarray}

The first three equations (which expand to five separate PDEs) will be evolved. The final equation is used to set the initial data and can be thought of as a constraint.

This will be implemented using simple second order differencing in space. Time evolution is performed by the method of lines thorn MoL.

2 How it works

The equations are evolved entirely using the method of lines thorn. So all we have to provide (for the evolution) is a method of calculating the right hand side of equation (??) and boundary conditions. The boundary conditions are standard from wavetoy itself. The right hand side is calculated using second order centred finite differences.

To be compatible with the method of lines thorn we must let it know that the GFs \((\phi , \Pi , \Phi ^j)\) exist and where they are stored. They should all have at least two time levels (although the addition of extra time levels may not cause problems it’s just wasting space). The GFs corresponding to the right hand sides must also be registered with the MoL thorn. These should only have one time level. MoL is informed of the existence of these grid functions through the accumulator parameters and the aliased functions.

3 Parameters




bound
Scope: private KEYWORD



Description: Type of boundary condition to use



Range Default: none
none
No boundary condition
flat
Flat boundary condition
radiation
Radiation boundary condition






wavemol_maxnumconstrainedvars
Scope: restricted INT



Description: The maximum number of constrained variables used by WaveMoL



Range Default: 1
1:1
The energy






wavemol_maxnumevolvedvars
Scope: restricted INT



Description: The maximum number of evolved variables used by WaveMoL



Range Default: 5
5:5
Just 5: phi and the four derivatives






mol_num_constrained_vars
Scope: shared from METHODOFLINESINT






mol_num_evolved_vars
Scope: shared from METHODOFLINESINT






mol_num_saveandrestore_vars
Scope: shared from METHODOFLINESINT



4 Interfaces

General

Implements:

wavemol

Grid Variables

4.0.1 PUBLIC GROUPS





  Group Names     Variable Names   Details    




scalarevolvemol_scalar compact 0
phi description The scalar field and time derivative
phit dimensions 3
distribution DEFAULT
group type GF
tags tensortypealias=”Scalar”
timelevels 3
variable type REAL




scalarevolvemol_vector compact 0
phix description The scalar field spatial derivatives
phiy dimensions 3
phiz distribution DEFAULT
group type GF
tags tensortypealias=”U”
timelevels 3
variable type REAL




scalarrhsmol_scalar compact 0
phirhs description The right hand side for the scalar field
phitrhs dimensions 3
distribution DEFAULT
group type GF
timelevels 1
variable type REAL




scalarrhsmol_vector compact 0
phixrhs description The right hand side for the scalar field derivatives
phiyrhs dimensions 3
phizrhs distribution DEFAULT
group type GF
timelevels 1
variable type REAL




energy energy compact 0
description The energy of the field
dimensions 3
distribution DEFAULT
group type GF
timelevels 1
variable type REAL




Uses header:

Symmetry.h

5 Schedule

This section lists all the variables which are assigned storage by thorn CactusExamples/WaveMoL. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.

Storage

 

Always:  
scalarevolvemol_scalar[3] scalarevolvemol_vector[3]  
scalarrhsmol_scalar scalarrhsmol_vector  
energy  
   

Scheduled Functions

CCTK_STARTUP

  wavemol_startup

  register banner

 

  Language: c
  Type: function

CCTK_BASEGRID

  wavemol_initsymbound

  schedule symmetries

 

  Language: c
  Options: meta
  Type: function

MoL_Register

  wavemol_registervars

  register variables for mol

 

  Language: c
  Options: meta
  Type: function

Driver_BoundarySelect

  wavemol_selectdriverbc

  choose boundary condtion for driver to apply

 

  Language: c
  Options: global
  Type: function

MoL_CalcRHS

  wavemol_calcrhs

  register rhs calculation for mol

 

  Language: c
  Reads: wavemol::phit(everywhere)
    scalarevolvemol_vector
  Type: function
  Writes: wavemol::scalarrhsmol_scalar(interior)
    scalarrhsmol_vector

MoL_PostStep

  wavemol_boundaries

  register boundary enforcement in mol

 

  Language: c
  Options: level
  Sync: scalarevolvemol_scalar
    scalarevolvemol_vector
  Type: function

MoL_PostStep

  applybcs

  apply boundary conditions for wavemol

 

  After: wavemol_boundaries
  Type: group

MoL_PostStep

  wavemol_energy

  calculate the energy

 

  After: wavemol_applybcs
  Language: c
  Reads: wavemol::phit(everywhere)
    scalarevolvemol_vector
  Type: function
  Writes: wavemol::energy(everywhere)

CCTK_POSTINITIAL

  wavemol_energy

  calculate the energy

 

  Language: c
  Reads: wavemol::phit(everywhere)
    scalarevolvemol_vector
  Type: function
  Writes: wavemol::energy(everywhere)

Aliased Functions

 

Alias Name:         Function Name:
ApplyBCs WaveMoL_ApplyBCs