KADATH SPECTRAL SOLVER

Tutorial 9 : Flat Metrics

This tutorial shows how to use the flat metrics.

Definition

Flat metrics are constructed from the Space and the tensorial basis of decomposition only.

Those objects are designed to be used in System_of_eqs so there are not a lot of things that one can do at this point.

// Assume a spherical space has been defined (put 9 points in theta and 8 in phi to be safe)
// A Cartesian tensorial basis
Base_tensor basis_cart (space, CARTESIAN_BASIS) ;
Metric_flat fmet_cart (space, basis_cart) ; // The associated flat metric

// Same thing in orthonormal spherical basis
Base_tensor basis_spher (space, SPHERICAL_BASIS) ;
Metric_flat fmet_spher (space, basis_spher) ; // The associated flat metric

Associating the metric to the system

The link between a System_of_eqs and a Metric is done by invoking a function of the metric : set_system. Once this is done, it gives access to a lot of additional functions in the system like the manipulation of the indices of tensors and the covariant derivative.

// The system only in the first shell
System_of_eqs syst (space, 1) ;

// Use the orthonormal spherical basis
fmet_spher.set_system (syst, "f") ;
// The string denotes the name by which the metric will be recognized by the system

// Recover and print the inverse of the metric
syst.add_def ("inv^ij = f^ij") ;
//cout << syst.give_val_def("inv") << endl ;

// Assume a contravariant vector vecU has been defined
// Use it as a constant
syst.add_cst ("U", vecU) ;

// One can manipulate its indices :
syst.add_def ("Ucov_i = U_i") ;

// One can compute the scalar product (should be one)
syst.add_def ("product = U_i * U^i") ;
//cout << syst.give_val_def("product") << endl ;

// The covariant derivative
syst.add_def ("der_i^j = D_i U^j") ;
//cout << syst.give_val_def("der") << endl ;