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) ;
36 double func_ab (
double aa,
const Param& par) {
37 double r1 = par.get_double(0) ;
38 double r2 = par.get_double(1) ;
39 double d = par.get_double(2) ;
40 return (sqrt(aa*aa+r1*r1)+sqrt(aa*aa+r2*r2)-d) ;
52 res.
set(0) = nr ; res.
set(1) = nr ; res.
set(2) = nr-1 ;
54 res_bi.
set(0) = nr ; res_bi.
set(1) = nr ; res_bi.
set(2) = nr ;
63 double a_max = dist/2. ;
64 double precis = PRECISION ;
67 double aa = zerosec(func_ab, par_a, a_min, a_max, precis, nitermax, niter) ;
68 double eta_plus = asinh(aa/2/rbh2) ;
69 double eta_minus = -asinh(aa/2/rbh1) ;
71 double chi_c = 2*atan(aa/rext) ;
72 double eta_c = log((1+rext/aa)/(rext/aa-1)) ;
73 double eta_lim = eta_c/2. ;
74 double chi_lim = chi_lim_eta (eta_lim, rext, aa, chi_c) ;
78 center_minus.
set(1) = aa*cosh(eta_minus)/sinh(eta_minus) ;
85 center_plus.
set(1) = aa*cosh(eta_plus)/sinh(eta_plus) ;
118 fread_be (&
ndim,
sizeof(
int), 1, fd) ;
119 fread_be (&
type_base,
sizeof(
int), 1, fd) ;
168 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
169 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
176 return (
domains[2]->nbr_unknowns_from_adapted() +
domains[5]->nbr_unknowns_from_adapted()) ;
182 bool found_outer_1 = false ;
186 bool found_inner_1 = false ;
188 assert (found_outer_1 == found_inner_1) ;
199 bool found_outer_2 = false ;
203 bool found_inner_2 = false ;
205 assert (found_outer_2 == found_inner_2) ;
214 int old_conte = conte ;
245 for (
int i=0 ; i<sys->
nvar ; i++) {
246 for (
int n=0 ; n<sys->
var[i]->get_n_comp() ; n++) {
254 sys->
var[i]->cmp[n]->set_domain(1) = res(1) ;
255 sys->
var[i]->cmp[n]->set_domain(2) = res(2) ;
256 sys->
var[i]->cmp[n]->set_domain(4) = res(4) ;
257 sys->
var[i]->cmp[n]->set_domain(5) = res(5) ;
262 for (
int i=0 ; i<sys->
ncst ; i++)
264 for (
int n=0 ; n<sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)]->val_t->get_n_comp() ; n++) {
268 for (
int d=1 ; d<=5 ; d++)
279 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+1]->val_t->cmp[n]->set_domain(1) = res(1) ;
280 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+2]->val_t->cmp[n]->set_domain(2) = res(2) ;
281 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+4]->val_t->cmp[n]->set_domain(4) = res(4) ;
282 sys->
cst[i*(sys->
dom_max-sys->
dom_min+1)+5]->val_t->cmp[n]->set_domain(5) = res(5) ;
302 res.
set(1,0) = INNER_BC ;
304 res.
set(1,1) = INNER_BC ;
307 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ;
319 res.
set(1,0) = INNER_BC ;
321 res.
set(1,1) = INNER_BC ;
324 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ; abort() ;
335 res.
set(1,0) = OUTER_BC ;
339 res.
set(1,0) = INNER_BC ;
342 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ; abort() ;
353 res.
set(1,0) = OUTER_BC ;
357 res.
set(1,0) = INNER_BC ;
360 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ; abort() ;
372 res.
set(1, 0) = INNER_BC ;
375 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ; abort() ;
386 res.
set(1, 0) = OUTER_BC ;
390 res.
set(1, 0) = INNER_BC ;
393 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ; abort() ;
404 res.
set(1,0) = OUTER_BC ;
408 res.
set(1,0) = INNER_BC ;
411 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ;
428 for (
int i=0 ; i<5 ; i++)
429 res.
set(1,i) = OUTER_BC ;
432 cerr <<
"Bad bound in Space_bin_bh::get_indices_matching_non_std" << endl ;
438 cerr <<
"Bad domain in Space_bin_bh::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 .
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-like domain, having 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 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 ~Space_bin_bh()
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.
virtual int nbr_unknowns_from_variable_domains() const
Gives the number of unknowns coming from the variable shape of the 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_bin_bh(int ttype, double dist, double rbh1, double rbh2, double rext, int nr)
Standard constructor
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...