# New Equation Format¶

## Introduction¶

This equation format aims at simplifying the way to write oscillation equations. With this format equation are written in there mathematical expression after projection on the spherical harmonics.

Here is an example of such equation if the 1D case:

lh*(lh+1) * Et =
avg(r/Gamma1) * dP_P    +
avg(r)        * Er'     +
2             * Er
with (r=1)
dr(Er, -1) = lh * dr(Et, -1)
at r = 0

Note

TOP solves eigenvalue problems. Therefore equations written for TOP must be linear.

## Language Description¶

### The Parameters Section¶

At the beginning of an equation file, one is able to define several parameter that can be used within the definition of equation. These parameters can be defined with the input keyword, followed by its type (double, int or string) ant its name:

input double mass
input double rota

### Variable and Model Definition¶

In order to understand the meaning of the equation to appear, TOP’s compiler need to know what are the variables of the problem, and what are the field of the model.

#### Variable Definition¶

In order to define variables of the problem, one has to define them using the var keyword followed by a comma separated list of names.

Note

2 or 3 variables surrounded by parenthesis means that they are component of vector.

var Phi, PhiP, (Er, Et), dP_P

Will define 5 variables, Er and Et being first and second component of a vector.

#### Model’s Field definition¶

In the same way variables can be defined, fields and scalar defined from the stellar model can be defined with field or scalar keywords:

field pm, g_m, r, rhom, dg_m, rhom_z
scalar Gamma1, Lambda

### Equation Definition¶

After the definition/declaration section, we can start defining the equation after the in keyword.

#### Defining an equation¶

In order to add an equation in the system, one can use the equation keyword, followed by the name of the equation, followed by a : (colon) and the expression of the equation.

equation eqdP_P:
lh*(lh+1) * Et =
avg(r/Gamma1) * dP_P    +
avg(r)        * Er'     +
2             * Er

Note

Every identifier (i.e., name) involved in an equation need to be defined (either as a variable, a field or a scalar or a parameter).

#### Boundary Condition¶

In order to define boundary condition, one simply need to define of after the equation with the following syntax:

Syntax:

with (r=numerical_location) epxression at r = location where:

numerical_location:
is the line of the matrix to be replaced with the boundary condition.
expression:if the expression of the boundary condition.
location:is the physical location of the boundary condition.
Example:
equation eqdP_P:
lh*(lh+1) * Et =
avg(r/Gamma1) * dP_P    +
avg(r)        * Er'     +
2             * Er
with (r=1)
dr(Er, -1) = lh * dr(Et, -1)
at r = 0

### Internal variables, and Functions¶

A few functions and variables are already defined with TOP and can be used without prior declarations, here is a list of such symbols:

#### Internal Variables¶

fp:
Syntax: fp fp is the eigenvalue of the problem. It should appear in equation definition fp^2 * r * Et - pm/rhom * dP_P - Phi - g_m = 0

#### Internal Functions¶

dr:
Syntax: dr(var, order) derivative of var of order order dr(Phi, 2) stands for $$\frac{\partial^2\Phi}{\partial r^2}$$

Note

Radial derivatives can also be expressed with the ' (apostrophe) post-fixed operator: dr(Phi, 2) and Phi'' are two notations strictly equivalent.

avg:
Syntax: avg(expr) average of expression expr on the point of the grid used for for derivation or interpolation (therefore it depends on the numerical scheme used). avg(r/Gamma1) * dP_P

# define the first equation
avg(r) * Er'