KADATH
domain_polar_inner_adapted_ope.cpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "array.hpp"
21 #include "adapted_polar.hpp"
22 #include "val_domain.hpp"
23 #include "array_math.hpp"
24 #include "scalar.hpp"
25 #include "tensor_impl.hpp"
26 namespace Kadath {
27 int mult_cos_1d (int, Array<double>&) ;
28 int mult_sin_1d (int, Array<double>&) ;
29 int div_sin_1d (int, Array<double>&) ;
30 int div_cos_1d (int, Array<double>&) ;
31 int mult_x_1d (int, Array<double>&) ;
32 
34  if (so.check_if_zero())
35  return so ;
36  else {so.coef() ;
37  Val_domain res(this) ;
38 
39  res.base = so.base ;
40 
41  res.cf = new Array<double> (so.base.ope_1d(mult_cos_1d, 1, *so.cf, res.base)) ;
42  res.in_coef = true ;
43  return res ;}
44 }
45 
47  if (so.check_if_zero())
48  return so ;
49  else {so.coef() ;
50  Val_domain res(this) ;
51 
52  res.base= so.base ;
53 
54  res.cf = new Array<double> (so.base.ope_1d(mult_sin_1d, 1, *so.cf, res.base)) ;
55  res.in_coef = true ;
56  return res ;}
57 }
58 
60  if (so.check_if_zero())
61  return so ;
62  else {so.coef() ;
63  Val_domain res(this) ;
64 
65  res.base = so.base ;
66 
67  res.cf = new Array<double> (so.base.ope_1d(div_sin_1d, 1, *so.cf, res.base)) ;
68  res.in_coef = true ;
69  return res ;}
70 }
71 
72 
73 
75  if (so.check_if_zero())
76  return so ;
77  else {
78 
79  return (so.der_var(1) * 2. / (outer_radius - *inner_radius)) ;
80 
81  }
82 }
83 
85  if (so.check_if_zero())
86  return so ;
87  else {
88 
89  return (so/ get_radius()) ;
90 
91  }
92 }
93 
95  if (so.check_if_zero())
96  return so ;
97  else {
98 
99  return (so* get_radius()) ;
100 
101  }
102 }
103 
105  Val_domain derr (so.der_r()) ;
106  Val_domain dert (so.der_var(2)) ;
107  Val_domain res (derr.der_r() + div_r(2*derr + div_r(dert.der_var(2) + dert.mult_cos_theta().div_sin_theta()))) ;
108  if (m!=0)
109  res -= m * m * div_r(div_r(so.div_sin_theta().div_sin_theta())) ;
110  return res ;
111 }
112 
114  Val_domain derr (so.der_r()) ;
115  Val_domain dert (so.der_var(2)) ;
116  Val_domain res (derr.der_r() + div_r(derr + div_r(dert.der_var(2)))) ;
117  if (m!=0)
118  res -= m * m * div_r(div_r(so.div_sin_theta().div_sin_theta())) ;
119  return res ;
120 }
121 }
122 
Array< double > ope_1d(int(*function)(int, Array< double > &), int var, const Array< double > &so, Base_spectral &base) const
One-dimensional operator acting in the coefficient space.
Definition: ope_1d.cpp:26
virtual Val_domain laplacian(const Val_domain &, int) const
Computes the ordinary flat Laplacian for a scalar field with an harmonic index m.
virtual Val_domain div_sin_theta(const Val_domain &) const
Division by .
Val_domain * inner_radius
Pointer on the inner boundary , as a Val_domain.
virtual Val_domain der_r(const Val_domain &) const
Compute the radial derivative of a scalar field.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
virtual Val_domain laplacian2(const Val_domain &, int) const
Computes the ordinary flat 2dè- Laplacian for a scalar field with an harmonic index m.
virtual Val_domain mult_r(const Val_domain &) const
Multiplication by .
virtual Val_domain div_r(const Val_domain &) const
Division by .
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
Val_domain const & get_radius() const
Returns the generalized radius.
Definition: space.hpp:1465
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
Base_spectral base
Spectral basis of the field.
Definition: val_domain.hpp:72
bool check_if_zero() const
Check whether the logical state is zero or not.
Definition: val_domain.hpp:142
Val_domain der_r() const
Definition: val_domain.cpp:726
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
Definition: val_domain.hpp:77
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .
bool in_coef
Is the field known in the coefficient space ?
Definition: val_domain.hpp:79
void coef() const
Computes the coefficients.
Definition: val_domain.cpp:622
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
Definition: val_domain.cpp:670