20 #include "headcpp.hpp"
22 #include "utilities.hpp"
25 #include "tensor_impl.hpp"
26 #include "system_of_eqs.hpp"
27 #include "name_tools.hpp"
29 double eta_lim_chi (
double chi,
double rext,
double a,
double eta_c) ;
30 double chi_lim_eta (
double chi,
double rext,
double a,
double chi_c) ;
32 double zerosec(
double (*f)(
double,
const Param&),
const Param& parf,
33 double x1,
double x2,
double precis,
int nitermax,
int& niter) ;
37 double func_abns (
double aa,
const Param& par) {
38 double r1 = par.get_double(0) ;
39 double r2 = par.get_double(1) ;
40 double d = par.get_double(2) ;
41 return (sqrt(aa*aa+r1*r1)+sqrt(aa*aa+r2*r2)-d) ;
45 double rinstar2,
double rstar2,
double routstar2,
double rext,
int nr) {
55 res.
set(0) = nr ; res.
set(1) = nr ; res.
set(2) = nr-1 ;
57 res_bi.
set(0) = nr ; res_bi.
set(1) = nr ; res_bi.
set(2) = nr ;
66 double a_max = dist/2. ;
67 double precis = PRECISION ;
70 double aa = zerosec(func_abns, par_a, a_min, a_max, precis, nitermax, niter) ;
71 double eta_plus = asinh(aa/routstar2) ;
72 double eta_minus = -asinh(aa/routstar1) ;
74 double chi_c = 2*atan(aa/rext) ;
75 double eta_c = log((1+rext/aa)/(rext/aa-1)) ;
76 double eta_lim = eta_c/2. ;
77 double chi_lim = chi_lim_eta (eta_lim, rext, aa, chi_c) ;
81 center_minus.
set(1) = aa*cosh(eta_minus)/sinh(eta_minus) ;
88 center_plus.
set(1) = aa*cosh(eta_plus)/sinh(eta_plus) ;
119 double rinstar2,
double rstar2,
double routstar2,
double rext,
double rshell,
int nr) {
129 res.
set(0) = nr ; res.
set(1) = nr ; res.
set(2) = nr-1 ;
131 res_bi.
set(0) = nr ; res_bi.
set(1) = nr ; res_bi.
set(2) = nr ;
140 double a_max = dist/2. ;
141 double precis = PRECISION ;
144 double aa = zerosec(func_abns, par_a, a_min, a_max, precis, nitermax, niter) ;
145 double eta_plus = asinh(aa/routstar2) ;
146 double eta_minus = -asinh(aa/routstar1) ;
148 double chi_c = 2*atan(aa/rext) ;
149 double eta_c = log((1+rext/aa)/(rext/aa-1)) ;
150 double eta_lim = eta_c/2. ;
151 double chi_lim = chi_lim_eta (eta_lim, rext, aa, chi_c) ;
155 center_minus.
set(1) = aa*cosh(eta_minus)/sinh(eta_minus) ;
162 center_plus.
set(1) = aa*cosh(eta_plus)/sinh(eta_plus) ;
197 fread_be (&
ndim,
sizeof(
int), 1, fd) ;
198 fread_be (&
type_base,
sizeof(
int), 1, fd) ;
220 for (
int i=0 ; i<
nshells ; i++)
254 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
255 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
262 return (
domains[1]->nbr_unknowns_from_adapted() +
domains[4]->nbr_unknowns_from_adapted()) ;
268 bool found_outer_1 = false ;
272 bool found_inner_1 = false ;
274 assert (found_outer_1 == found_inner_1) ;
285 bool found_outer_2 = false ;
289 bool found_inner_2 = false ;
291 assert (found_outer_2 == found_inner_2) ;
301 int old_conte = conte ;
333 for (
int i=0 ; i<sys->
nvar ; i++) {
334 for (
int n=0 ; n<sys->
var[i]->get_n_comp() ; n++) {
342 sys->
var[i]->cmp[n]->set_domain(1) = res(1) ;
343 sys->
var[i]->cmp[n]->set_domain(2) = res(2) ;
344 sys->
var[i]->cmp[n]->set_domain(4) = res(4) ;
345 sys->
var[i]->cmp[n]->set_domain(5) = res(5) ;
350 for (
int i=0 ; i<sys->
ncst ; i++)
352 for (
int n=0 ; n<sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)]->val_t->get_n_comp() ; n++) {
356 for (
int d=1 ; d<=5 ; d++)
367 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+1]->val_t->cmp[n]->set_domain(1) = res(1) ;
368 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+2]->val_t->cmp[n]->set_domain(2) = res(2) ;
369 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+4]->val_t->cmp[n]->set_domain(4) = res(4) ;
370 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+5]->val_t->cmp[n]->set_domain(5) = res(5) ;
389 res.
set(1,0) = INNER_BC ;
391 res.
set(1,1) = INNER_BC ;
394 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ;
406 res.
set(1,0) = INNER_BC ;
408 res.
set(1,1) = INNER_BC ;
411 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ; abort() ;
422 res.
set(1,0) = OUTER_BC ;
426 res.
set(1,0) = INNER_BC ;
429 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ; abort() ;
440 res.
set(1,0) = OUTER_BC ;
444 res.
set(1,0) = INNER_BC ;
447 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ; abort() ;
459 res.
set(1, 0) = INNER_BC ;
462 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ; abort() ;
473 res.
set(1, 0) = OUTER_BC ;
477 res.
set(1, 0) = INNER_BC ;
480 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ; abort() ;
491 res.
set(1,0) = OUTER_BC ;
495 res.
set(1,0) = INNER_BC ;
498 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ;
515 for (
int i=0 ; i<5 ; i++)
516 res.
set(1,i) = OUTER_BC ;
519 cerr <<
"Bad bound in Space_bin_ns::get_indices_matching_non_std" << endl ;
525 cerr <<
"Bad domain in Space_bispheric::get_indices_matching_non_std" << endl ;
reference set(const Index &pos)
Read/write of an element.
Class for storing the dimensions of an array.
int & set(int i)
Read/write of the size of a given dimension.
Class for bispherical coordinates with a symmetry with respect to the plane .
Class for bispherical coordinates with a symmetry with respect to the plane .
Class for bispherical coordinates with a symmetry with respect to the plane .
Class for a spherical compactified domain and a symmetry with respect to the plane .
Class for a spherical domain containing the origin and a symmetry with respect to the plane .
Class for a spherical-like domain, having a symmetry with respect to the plane .
void update() const
Updates all the quantities that depend on the inner radius (like the normal vectors).
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
virtual void vars_to_terms() const
The Term_eq describing the variable shape of the Domain are updated.
Class for a spherical-like domain, having a symmetry with respect to the plane .
void update() const
Updates all the quantities that depend on the inner radius (like the normal vectors).
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
virtual void vars_to_terms() const
The Term_eq describing the variable shape of the Domain are updated.
Class for a spherical shell and a symmetry with respect to the plane .
Abstract class that implements the fonctionnalities common to all the type of domains.
virtual void xx_to_ders_from_adapted(const Array< double > &xx, int &conte) const
Affects the derivative part of variable a Domain from a set of values.
virtual void affecte_coef(int &conte, int cc, bool &found) const
The variation of the functions describing the shape of the Domain are affected from the unknowns of t...
virtual void update_variable(const Val_domain &shape, const Scalar &oldval, Scalar &newval) const
Update the value of a scalar, after the shape of the Domain has been changed by the system.
virtual void xx_to_vars_from_adapted(Val_domain &shape, const Array< double > &xx, int &conte) const
Computes the new boundary of a Domain from a set of values.
virtual void update_mapping(const Val_domain &shape)
Updates the variables parts of the Domain.
virtual void update_constante(const Val_domain &shape, const Scalar &oldval, Scalar &newval) const
Update the value of a scalar, after the shape of the Domain has been changed by the system.
void add_double(double x, int position=0)
Adds the the address of a new double to the list.
The class Point is used to store the coordinates of a point.
double & set(int i)
Read/write of a coordinate.
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.
virtual void save(FILE *) const
Saving function.
virtual int nbr_unknowns_from_variable_domains() const
Gives the number of unknowns coming from the variable shape of the domain.
virtual void xx_to_ders_variable_domains(const Array< double > &, int &) const
Update the vairable domains from a set of values.
virtual void xx_to_vars_variable_domains(System_of_eqs *, const Array< double > &, int &) const
Update the variables of a system, from the variation of the shape of the domains.
virtual void affecte_coef_to_variable_domains(int &, int, Array< int > &) const
The variation of the functions describing the shape of the Domain are affected from the unknowns of t...
Space_bin_ns(int ttype, double dist, double rinstar1, double rstar1, double routstar1, double rinstar2, double rstar2, double routstar2, double rext, int nr)
Standard constructor ; stars are initial spherical.
int nshells
Number of outer shells.
virtual ~Space_bin_ns()
Destructor.
virtual Array< int > get_indices_matching_non_std(int dom, int bound) const
Gives the number of the other domains, touching a given boundary.
int type_base
Type of basis used (i.e. using either Chebyshev or Legendre polynomials).
int ndim
Number of dimensions (should be the same for all the Domains).
Domain ** domains
Pointers on the various Domains.
int nbr_domains
Number od Domains.
Class used to describe and solve a system of equations.
MMPtr_array< Tensor > var
Pointer on the unknown fields.
MMPtr_array< Term_eq > cst
Pointers on the Term_eq coming from the constants passed by the user.
int dom_max
Highest domain number.
int ncst
Number of constants passed by the user.
int dom_min
Smallest domain number.
int nvar
Number of unknown fields.
Class for storing the basis of decompositions of a field and its values on both the configuration and...