Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
spherical.h File Reference

Go to the source code of this file.

Functions

macro VARIABLES (Point point=point, int _ig=ig, int _jg=jg, int _kg=kg)
 Rather than the classical mathematical convention, we use the geographic convention: x is the longitude within \([-180:180]\) degrees and y is the latitude within \([-90:90]\) degrees.
 
static void refine_cm_lonlat (Point point, scalar cm)
 On trees we need to define consistent refinement functions.
 
static void refine_face_x_lonlat (Point point, scalar fm)
 
static void refine_face_y_lonlat (Point point, scalar fm)
 
void event_metric (void)
 Event: metric (i = 0)
 

Variables

double Radius = 1.
 

Function Documentation

◆ event_metric()

void event_metric ( void  )

Event: metric (i = 0)

We initialise the scale factors, taking care to first allocate the fields if they are still constant.

We set our refinement/prolongation functions on trees.

Definition at line 83 of file spherical.h.

References _i, all, cm, fm, free(), l, list_concat(), list_copy(), phi, pi, Radius, refine_cm_lonlat(), refine_face_x_lonlat(), refine_face_y_lonlat(), vector::x, x, vector::y, and y.

Here is the call graph for this function:

◆ refine_cm_lonlat()

static void refine_cm_lonlat ( Point  point,
scalar  cm 
)
static

On trees we need to define consistent refinement functions.

The default restriction functions (averages) are already consistent (i.e. they preserve volume and length integrals).

Mathematically we have

\[ cm = fm.y = \cos(\phi) \]

\[ fm.x = 1 \]

with \(\phi\) the latitude in radians. This is the definition we use for the length scale factors fm.

For the volume scale factor cm, more care needs to be taken to guarantee discrete volume conservation i.e.

\[ \sum_{children}cm_{child} = 4cm_{parent} \]

This is achieved by computing the exact area of a cell i.e.

\[ \Delta^2 \int^{\phi + d\phi/2}_{\phi - d \phi/2} \cos\phi d\phi = \Delta^2 (\sin(\phi + d\phi/2) - \sin(\phi - d\phi/2)) = \Delta^2 cm \]

Definition at line 54 of file spherical.h.

References cm, fine(), phi, pi, Radius, x, and y.

Referenced by event_metric().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refine_face_x_lonlat()

static void refine_face_x_lonlat ( Point  point,
scalar  fm 
)
static

Definition at line 62 of file spherical.h.

References fine(), fm, is_refined, and neighbor().

Referenced by event_metric().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refine_face_y_lonlat()

static void refine_face_y_lonlat ( Point  point,
scalar  fm 
)
static

Definition at line 71 of file spherical.h.

References fine(), fm, is_refined, neighbor(), phi, pi, Radius, x, and y.

Referenced by event_metric().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VARIABLES()

macro VARIABLES ( Point  point = point,
int  _ig = ig,
int  _jg = jg,
int  _kg = kg 
)

Rather than the classical mathematical convention, we use the geographic convention: x is the longitude within \([-180:180]\) degrees and y is the latitude within \([-90:90]\) degrees.

\(\Delta\) is the characteristic cell length expressed in the same units as Radius.

Definition at line 18 of file spherical.h.

References _ig, _jg, pi, point, Radius, VARIABLES(), and x.

Referenced by VARIABLES().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ Radius

double Radius = 1.

Spherical coordinates

The default radius of the sphere is set to one.

Definition at line 8 of file spherical.h.

Referenced by event_metric(), refine_cm_lonlat(), refine_face_y_lonlat(), and VARIABLES().