20 #include "headcpp.hpp"
21 #include "spheric_periodic.hpp"
22 #include "term_eq.hpp"
24 #include "tensor_impl.hpp"
26 #include "array_math.hpp"
28 void coef_1d (
int, Array<double>&) ;
46 cerr <<
"Unknown case in Domain_spheric_periodic_shell::fitwaves" << endl ;
54 double lambda2 = factor - expo*expo*
ome*
ome ;
55 double cor = 2*expo*expo*
ome*
ome - 1 ;
60 res = AA/exp(-sqrt(lambda2)*rmax)*pow(rmax,
double(dim-1)/2.) ;
62 res = AA/cos(sqrt(-lambda2)*rmax+masse/sqrt(-lambda2)*cor*log(rmax)+phase)* pow(rmax,
double(dim-1)/2.) ;
72 cerr <<
"Domain_spheric_periodic_shell::fitwaves_nonflat only defined with respect to tensors" << endl ;
77 cerr <<
"Domain_spheric_periodic_shell::fitwaves_nonflat only defined with respect to scalars" << endl ;
92 int baset = (*so.
get_val_t()()(dom).get_base().bases_1d[1])(0) ;
104 cerr <<
"Unknown case in Domain_spheric_periodic_shell::fitwaves" << endl ;
121 for (
int nn=0 ; nn<max ; nn++) {
138 cerr <<
"Unknown case in Domain_spheric_periodic_shell::fitwaves" << endl ;
141 double lambda2 = factor - expo*expo*
ome*
ome ;
142 double cor = 2*expo*expo*
ome*
ome - 1 ;
146 double la = sqrt(fabs(lambda2)) ;
147 double arg = (lambda2>0) ? la*rmax : la*rmax+masse_val*cor*log(rmax)/la+phases(nn) ;
148 double shval = (lambda2>0) ? exp(-arg)/rmax : cos(arg)/rmax ;
149 double dshval = (lambda2>0) ? -la*exp(-arg)/rmax - exp(-arg)/rmax/rmax : -sin(arg)/rmax*(la+masse_val*cor/la/rmax) - cos(arg)/rmax/rmax ;
152 double shder = (lambda2>0) ? 0 : -sin(arg)/rmax*log(rmax)/la*cor*masse_der ;
153 sh =
new Term_eq (dom, shval, shder) ;
154 double dshder = (lambda2>0) ? 0 : (-cos(arg)/rmax*(la+masse_val*cor/la/rmax)*cor*log(rmax)/la + sin(arg)/rmax/rmax*(cor*log(rmax)/la-cor/la))*masse_der ;
155 dsh =
new Term_eq (dom, dshval, dshder) ;
158 sh =
new Term_eq (dom, shval) ;
159 dsh =
new Term_eq (dom, dshval) ;
170 ff =
new Term_eq (dom, ffval, ffder) ;
171 dff =
new Term_eq (dom, dffval, dffder) ;
174 ff =
new Term_eq (dom, ffval) ;
175 dff =
new Term_eq (dom, dffval) ;
178 Term_eq auxi (rmax*rmax*((*sh)*(*dff)-(*dsh)*(*ff))) ;
193 if (so.
get_val_t()()(dom).check_if_zero()) {
200 if (so.
get_der_t()()(dom).check_if_zero()) {
215 return Term_eq (dom, res, der) ;
Bases_container bases_1d
Arrays containing the various basis of decomposition.
double give_harmonique_nonflat(const Val_domain &so, double mass, int nn, double phase, int dim, double fact) const
Computes the coefficient of a given outgoing wave harmonique inside some field, at the outer boundary...
double alpha
Relates the numerical to the physical radii.
Term_eq fitwaves_nonflat(const Term_eq &so, const Term_eq &field, const Array< double > &phases, int dim, double factor) const
Fit some field with homogenous solutions of the wave equation (Term_eq version).
double ome
Relates the numerical time to the physical one.
double beta
Relates the numerical to the physical radii.
virtual double val_boundary(int, const Val_domain &, const Index &) const
Computes the value of a field at a boundary.
virtual Val_domain mult_r(const Val_domain &) const
Multiplication by .
Dim_array nbr_coefs
Number of coefficients.
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
void set_start()
Sets the position to zero in all dimensions.
bool inc(int increm, int var=0)
Increments the position of the Index.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
int get_valence() const
Returns the valence.
This class is intended to describe the manage objects appearing in the equations.
int get_type_data() const
const Tensor * get_p_der_t() const
Tensor const & get_val_t() const
Tensor const & get_der_t() const
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Base_spectral base
Spectral basis of the field.
double & set_coef(const Index &pos)
Read/write the value of the field in the coefficient space.
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
void coef() const
Computes the coefficients.
Base_spectral & set_base()
Sets the basis of decomposition.