The non linear schwarzschild toy example

The modified non linear schwarzschild problem is a serial test case that we are using to illustrate the use of the kinKadath library and compare the performance between the Newton Krylov algorithm provided in kinKadath and the Newton Raphson default Kadath algorithm.

Defining the parameters

This example solves a nonlinear system that arises from a discretized system of partials differentials equations, describing a non linear Schwarzschild 3 dimensional problem with 4 domains. This is defined in the Kadath API as following

int dim = 3;  //3 dimensions
int nbr  = 5; //Number of collocation points in the radial coordinate
Dim_array res (dim);
res.set(0) = nbr; res.set(1) = 5; res.set(2) = 4;

Point center (dim); //Center of the coordinates
for (int i=1 ; i<=dim ; i++)
  center.set(i) = 0;

int ndom = 4; //Number of domains
Array<double> bounds (ndom-1);
double aa = 1.323; //Radius of the Black Hole
bounds.set(0) = aa ; bounds.set(1) = 1.7557*aa ; bounds.set(2) = 2.9861*aa ;

The number of allocation points is given in spherical coordinate, using Chebyshev polynomials, as defined by

int type_coloc = CHEB_TYPE;  //Chebyshev or Legendre
Space_spheric space(type_coloc, center, res, bounds); //Sherical space

Defining the system of equation

You first have to correctly defined the system of equation in a System_of_eqs Kadath class. Following the provided example, here is a brief description of Kadath API syntax :

System_of_eqs syst (space, 1, ndom-1); //using defined space space and ndom
met.set_system (syst, "f");  //Set the metric
syst.add_var ("P", conf);  //Only one unknown
syst.add_cst ("a", aa); //One user defined constant
space.add_inner_bc (syst, "dn(P) + 0.5 / a = 0"); //Inner BC
space.add_eq (syst, "D_i D^i (P) = - D_i P * D^i P", "P", "dn(P)"); //Equation
space.add_outer_bc (syst, "P=0"); //Outer bounday condition

The full code of this example is provided and you can look for the Kadath documentation for more details. In our example, with 4 domains, we obtain a set of \(9\) equations (4 domain equations and 7 boundaries equations). Each of theses equation is related with a set of collocation points conditions, which define the overall set of unknowns of the nonlinear system that arises from the discretized system of partial differential equations. This can be reformulated in the mathematical form, as a non linear system to solve.

\[\begin{aligned} \label{non_linear_eq} F (u) = 0 , \qquad F : \mathbb{R}^N \rightarrow \mathbb{R}^N,\end{aligned}\]

given an initial guess \(u_0\). \(N\) is then the overall set of unknowns, which is also the size of the non linear system, i.e. the number of conditions syst.get_nbr_conditions() of the system to solve.

Solving the system of equations

you can solve this system of equations with the default runCompute routine provided in kinKadath as

runCompute( syst)

The system of equations solution is given in the same format as in the Kadath librairy, throw its defined unknown variable conf, the conformal factor variable defined for this example.

The system solution can then be computed at any defined 3 dimensional point structure coordinate Point M(3) using the

conf.val_point(M)

syntax.