20 #include "headcpp.hpp"
22 #include "utilities.hpp"
25 #include "system_of_eqs.hpp"
26 #include "name_tools.hpp"
28 double eta_lim_chi (
double chi,
double rext,
double a,
double eta_c) ;
29 double chi_lim_eta (
double chi,
double rext,
double a,
double chi_c) ;
31 double zerosec(
double (*f)(
double,
const Param&),
const Param& parf,
32 double x1,
double x2,
double precis,
int nitermax,
int& niter) ;
35 double func_ab (
double aa,
const Param& par) {
36 double r1 = par.get_double(0) ;
37 double r2 = par.get_double(1) ;
38 double d = par.get_double(2) ;
39 return (sqrt(aa*aa+r1*r1)+sqrt(aa*aa+r2*r2)-d) ;
51 res.
set(0) = nr ; res.
set(1) = nr ; res.
set(2) = nr-1 ;
53 res_bi.
set(0) = nr ; res_bi.
set(1) = nr ; res_bi.
set(2) = nr ;
62 double a_max = dist/2. ;
63 double precis = PRECISION ;
66 double aa = zerosec(func_ab, par_a, a_min, a_max, precis, nitermax, niter) ;
67 double eta_plus = asinh(aa/2/rbh2) ;
68 double eta_minus = -asinh(aa/2/rbh1) ;
70 double chi_c = 2*atan(aa/rbi) ;
71 double eta_c = log((1+rbi/aa)/(rbi/aa-1)) ;
72 double eta_lim = eta_c/2. ;
73 double chi_lim = chi_lim_eta (eta_lim, rbi, aa, chi_c) ;
77 center_minus.
set(1) = aa*cosh(eta_minus)/sinh(eta_minus) ;
83 center_plus.
set(1) = aa*cosh(eta_plus)/sinh(eta_plus) ;
115 fread_be (&
ndim,
sizeof(
int), 1, fd) ;
116 fread_be (&
type_base,
sizeof(
int), 1, fd) ;
163 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
164 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
171 return (
domains[1]->nbr_unknowns_from_adapted() +
domains[3]->nbr_unknowns_from_adapted()) ;
177 bool found_outer_1 = false ;
181 bool found_inner_1 = false ;
183 assert (found_outer_1 == found_inner_1) ;
194 bool found_outer_2 = false ;
198 bool found_inner_2 = false ;
200 assert (found_outer_2 == found_inner_2) ;
209 int old_conte = conte ;
240 for (
int i=0 ; i<sys->
nvar ; i++) {
241 for (
int n=0 ; n<sys->
var[i]->get_n_comp() ; n++) {
249 sys->
var[i]->cmp[n]->set_domain(0) = res(0) ;
250 sys->
var[i]->cmp[n]->set_domain(1) = res(1) ;
251 sys->
var[i]->cmp[n]->set_domain(2) = res(2) ;
252 sys->
var[i]->cmp[n]->set_domain(3) = res(3) ;
257 for (
int i=0 ; i<sys->
ncst ; i++)
259 for (
int n=0 ; n<sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)]->val_t->get_n_comp() ; n++) {
263 for (
int d=0 ; d<=3 ; d++)
273 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)]->val_t->cmp[n]->set_domain(0) = res(0) ;
274 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+1]->val_t->cmp[n]->set_domain(1) = res(1) ;
275 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+2]->val_t->cmp[n]->set_domain(2) = res(2) ;
276 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+3]->val_t->cmp[n]->set_domain(3) = res(3) ;
296 res.
set(1,0) = INNER_BC ;
298 res.
set(1,1) = INNER_BC ;
301 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
313 res.
set(1,0) = INNER_BC ;
315 res.
set(1,1) = INNER_BC ;
318 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
330 res.
set(1,0) = OUTER_BC ;
334 res.
set(1,0) = INNER_BC ;
337 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
349 res.
set(1,0) = OUTER_BC ;
353 res.
set(1,0) = INNER_BC ;
356 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
369 res.
set(1, 0) = INNER_BC ;
372 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
384 res.
set(1, 0) = OUTER_BC ;
388 res.
set(1, 0) = INNER_BC ;
391 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
403 res.
set(1,0) = OUTER_BC ;
407 res.
set(1,0) = INNER_BC ;
410 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
427 for (
int i=0 ; i<5 ; i++)
428 res.
set(1,i) = OUTER_BC ;
431 cerr <<
"Bad bound in Space_bbh::get_indices_matching_non_std" << endl ;
437 cerr <<
"Bad domain in Space_bbh::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-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 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_bbh(int ttype, double dist, double rbh1, double rbh2, double rbi, double rext, int nr)
Standard constructor
virtual ~Space_bbh()
Destructor.
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 Array< int > get_indices_matching_non_std(int dom, int bound) const
Gives the number of the other domains, touching a given boundary.
virtual int nbr_unknowns_from_variable_domains() const
Gives the number of unknowns coming from the variable shape of the domain.
virtual void save(FILE *) const
Saving function.
virtual void xx_to_ders_variable_domains(const Array< double > &, int &) const
Update the vairable domains from a set of values.
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...