20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "polar_periodic.hpp"
24 #include "array_math.hpp"
25 #include "term_eq.hpp"
26 #include "val_domain.hpp"
27 #include "term_eq.hpp"
29 #include "tensor_impl.hpp"
32 void coef_1d (
int, Array<double>&) ;
33 void coef_i_1d (
int, Array<double>&) ;
34 int der_1d (
int, Array<double>&) ;
38 Domain(num, ttype, nbr), alpha((rout-rin)/2.), beta ((rout+rin)/2.), ome(oome), type_time(TO_PI) {
45 cerr <<
"Unknown case for type_time" << endl ;
56 type_time(so.type_time), maxt(so.maxt) {
63 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
64 fread_be (&
beta,
sizeof(
double), 1, fd) ;
65 fread_be (&
ome,
sizeof(
double), 1, fd) ;
66 fread_be (&
type_time,
sizeof(
int), 1, fd) ;
72 cerr <<
"Unknown case for type_time" << endl ;
81 Domain_polar_periodic_shell::~Domain_polar_periodic_shell() {
89 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
90 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
91 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
92 fwrite_be (&
beta,
sizeof(
double), 1, fd) ;
93 fwrite_be (&
ome,
sizeof(
double), 1, fd) ;
94 fwrite_be (&
type_time,
sizeof(
int), 1, fd) ;
98 o <<
"Polar_periodic shell" << endl ;
99 o <<
"time goes to " <<
maxt << endl ;
101 o <<
"Omega = " <<
ome << endl ;
233 cerr <<
"Unknown boundary case in Domain_polar_periodic_shell::der_normal" << endl ;
241 for (
int i=0 ; i<3 ; i++)
242 assert (
coloc[i] != 0x0) ;
243 for (
int i=0 ; i<3 ; i++)
244 assert (
absol[i] == 0x0) ;
245 for (
int i=0 ; i<3 ; i++) {
247 absol[i]->allocate_conf() ;
255 while (index.
inc()) ;
262 for (
int i=0 ; i<2 ; i++)
263 assert (
coloc[i] != 0x0) ;
270 while (index.
inc()) ;
279 double rho_loc = xx(1) ;
280 double z_loc = xx(2) ;
281 double air_loc = sqrt (rho_loc*rho_loc + z_loc*z_loc) ;
283 bool res = ((air_loc <=
alpha+
beta+prec) && (air_loc >=
beta-
alpha-prec)) ?
true :
false ;
284 if ((xx(3)<0-prec) || (xx(3)>
maxt/
ome + prec))
293 assert (
is_in(abs)) ;
295 double rho_loc = fabs(abs(1)) ;
296 double z_loc = abs(2) ;
297 double air = sqrt(rho_loc*rho_loc+z_loc*z_loc) ;
302 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
305 num.
set(2) = atan(rho_loc/z_loc) ;
309 num.
set(2) = M_PI + num(2) ;
316 double coloc_leg(
int,
int) ;
323 for (
int i=0 ; i<
ndim ; i++)
335 for (
int i=0 ; i<
ndim ; i++)
345 cerr <<
"Unknown type of basis in Domain_polar_periodic_shell::do_coloc" << endl ;
379 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
381 index.
set(0) = j ; index.
set(1) = k ;
382 base.
bases_1d[0]->set(index) = CHEB ;
399 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
401 index.
set(0) = j ; index.
set(1) = k ;
402 base.
bases_1d[0]->set(index) = CHEB ;
417 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
419 index.
set(0) = j ; index.
set(1) = k ;
420 base.
bases_1d[0]->set(index) = LEG ;
438 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
440 index.
set(0) = j ; index.
set(1) = k ;
441 base.
bases_1d[0]->set(index) = LEG ;
470 base.
bases_1d[1]->set(k) = COS_EVEN ;
472 index.
set(0) = j ; index.
set(1) = k ;
473 base.
bases_1d[0]->set(index) = CHEB ;
488 base.
bases_1d[1]->set(k) = SIN_EVEN ;
490 index.
set(0) = j ; index.
set(1) = k ;
491 base.
bases_1d[0]->set(index) = CHEB ;
506 base.
bases_1d[1]->set(k) = SIN_ODD ;
508 index.
set(0) = j ; index.
set(1) = k ;
509 base.
bases_1d[0]->set(index) = CHEB ;
524 base.
bases_1d[1]->set(k) = COS_EVEN ;
526 index.
set(0) = j ; index.
set(1) = k ;
527 base.
bases_1d[0]->set(index) = LEG ;
542 base.
bases_1d[1]->set(k) = SIN_EVEN ;
544 index.
set(0) = j ; index.
set(1) = k ;
545 base.
bases_1d[0]->set(index) = LEG ;
560 base.
bases_1d[1]->set(k) = SIN_ODD ;
562 index.
set(0) = j ; index.
set(1) = k ;
563 base.
bases_1d[0]->set(index) = LEG ;
576 bool res_def = true ;
621 switch ((*a.
bases_1d[1])(index_1)) {
623 switch ((*b.
bases_1d[1])(index_1)) {
625 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
628 res.
bases_1d[1]->set(index_1) = COS_ODD ;
631 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
634 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
642 switch ((*b.
bases_1d[1])(index_1)) {
644 res.
bases_1d[1]->set(index_1) = COS_ODD ;
647 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
650 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
653 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
661 switch ((*b.
bases_1d[1])(index_1)) {
663 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
666 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
669 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
672 res.
bases_1d[1]->set(index_1) = COS_ODD ;
680 switch ((*b.
bases_1d[1])(index_1)) {
682 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
685 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
688 res.
bases_1d[1]->set(index_1) = COS_ODD ;
691 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
703 while (index_1.
inc()) ;
710 switch ((*a.
bases_1d[0])(index_0)) {
712 switch ((*b.
bases_1d[0])(index_0)) {
714 res.
bases_1d[0]->set(index_0) = CHEB ;
722 switch ((*b.
bases_1d[0])(index_0)) {
724 res.
bases_1d[0]->set(index_0) = LEG ;
736 while (index_0.
inc()) ;
740 for (
int dim=0 ; dim<a.
ndim ; dim++)
Class for storing the basis of decompositions of a field.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
void allocate(const Dim_array &nbr_coefs)
Allocates the various arrays, for a given number of coefficients.
bool def
true if the Base_spectral is defined and false otherwise.
int ndim
Number of dimensions.
Class for storing the dimensions of an array.
int get_ndim() const
Returns the number of dimensions.
void save(FILE *) const
Save function.
Class for a spherical shell with a symmetry in .
Domain_polar_periodic_shell(int num, int ttype, double rin, double rout, double ome, const Dim_array &nbr)
Standard constructor :
virtual void do_absol() const
Computes the absolute coordinates.
virtual void set_legendre_base_with_m(Base_spectral &, int m) const
Gives the stnadard base using Legendre polynomials.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
Term_eq * ome_term_eq
Pointer on the Term_eq version of the pulsation.
virtual void set_anti_legendre_base_with_m(Base_spectral &, int m) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void save(FILE *) const
Saving function.
int type_time
Gives the type of time periodicity.
virtual void set_anti_cheb_base_with_m(Base_spectral &, int m) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual void set_anti_legendre_base(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
double alpha
Relates the numerical radius to the physical one.
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
double beta
Relates the numerical radius to the physical one.
virtual void set_cheb_base_r_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the radial component of a vector.
virtual void set_cheb_base_with_m(Base_spectral &, int m) const
Gives the standard base using Chebyshev polynomials.
virtual void set_cheb_base_p_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
virtual void do_coloc()
Computes the colocation points.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
double maxt
Upper bound of which is or .
virtual void set_legendre_base_p_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual void set_cheb_base_t_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_legendre_base_r_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the radial component of a vector.
virtual void do_radius() const
Computes the generalized radius.
virtual void do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const
Computes the derivative with respect to the absolute Cartesian coordinates from the derivative with r...
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
virtual void set_legendre_base_t_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
Abstract class that implements the fonctionnalities common to all the type of domains.
virtual void del_deriv()
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
Val_domain * radius
The generalized radius.
Memory_mapped_array< Val_domain * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
int ndim
Number of dimensions.
int num_dom
Number of the current domain (used by the Space)
Dim_array nbr_coefs
Number of coefficients.
Dim_array nbr_points
Number of colocation points.
int type_base
Type of colocation point :
Memory_mapped_array< Array< double > * > coloc
Colocation points in each dimension (stored in ndim 1d- arrays)
virtual Val_domain div_x(const Val_domain &) const
Division by .
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
bool inc(int increm, int var=0)
Increments the position of the Index.
The class Point is used to store the coordinates of a point.
const int & get_ndim() const
Returns the number of dimensions.
double & set(int i)
Read/write of a coordinate.
This class is intended to describe the manage objects appearing in the equations.
void set_der_d(double)
Sets the double variation.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Val_domain mult_sin_theta() const
Multiplication by .
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Val_domain mult_cos_theta() const
Multiplication by .
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.