KADATH
spheric_periodic_add_eq.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 "headcpp.hpp"
21 #include "spheric_periodic.hpp"
22 #include "system_of_eqs.hpp"
23 #include "name_tools.hpp"
24 namespace Kadath {
25 void Space_spheric_periodic::add_outer_bc (System_of_eqs& sys, const char* name, int nused, Array<int>** pused) {
26  sys.add_eq_bc (sys.get_dom_max(), OUTER_BC, name, nused, pused) ;
27 }
28 
29 void Space_spheric_periodic::add_eq (System_of_eqs& sys, const char* name, int nused, Array<int>** pused) {
30 
31  // Nucleus
32  for (int dd=sys.get_dom_min() ; dd<=sys.get_dom_max() ; dd++)
33  if (dd==0)
34  sys.add_eq_order (dd, 1, name, nused, pused) ;
35  else
36  sys.add_eq_order (dd, 2, name, nused, pused) ;
37 }
38 
39 void Space_spheric_periodic::add_eq_full (System_of_eqs& sys, const char* name, int nused, Array<int>** pused) {
40  for (int dd=sys.get_dom_min() ; dd<=sys.get_dom_max() ; dd++)
41  sys.add_eq_order (dd, 0, name, nused, pused) ;
42 }
43 
44 void Space_spheric_periodic::add_matching (System_of_eqs& sys, const char* name, int nused, Array<int>** pused) {
45  for (int dd=sys.get_dom_min() ; dd<sys.get_dom_max() ; dd++)
46  sys.add_eq_matching (dd, OUTER_BC, name, nused, pused) ;
47 }
48 
49 void Space_spheric_periodic::add_eq (System_of_eqs& sys, const char* eq, const char* rac, const char* rac_der, int nused, Array<int>** pused) {
50  for (int dd=sys.get_dom_min() ; dd<sys.get_dom_max(); dd++) {
51  if (dd==0)
52  sys.add_eq_order (dd, 1, eq, nused, pused) ;
53  else
54  sys.add_eq_order (dd, 2, eq, nused, pused) ;
55  sys.add_eq_matching (dd, OUTER_BC, rac, nused, pused) ;
56  sys.add_eq_matching (dd, OUTER_BC, rac_der, nused, pused) ;
57  }
58  sys.add_eq_order (sys.get_dom_max(), 2, eq, nused, pused) ;
59 }
60 
61 void Space_spheric_periodic::add_eq_inverted (System_of_eqs& sys, const char* eq, const char* rac, const char* rac_der, int nused, Array<int>** pused) {
62  for (int dd=sys.get_dom_min() ; dd<sys.get_dom_max(); dd++) {
63  sys.add_eq_order (dd, 2, eq, nused, pused) ;
64  sys.add_eq_matching (dd, OUTER_BC, rac, nused, pused) ;
65  sys.add_eq_matching (dd, OUTER_BC, rac_der, nused, pused) ;
66  }
67  if (sys.get_dom_max()==nbr_domains-1)
68  sys.add_eq_order (sys.get_dom_max(), 1, eq, nused, pused) ;
69  else
70  sys.add_eq_order (sys.get_dom_max(), 2, eq, nused, pused) ;
71 }
72 
73 void Space_spheric_periodic::add_eq_ori (System_of_eqs& sys, const char* name) {
74 
75  Index pos (domains[0]->get_nbr_points()) ;
76  char auxi[LMAX] ;
77  trim_spaces (auxi, name) ;
78  sys.add_eq_val (0, auxi, pos) ;
79 }}
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
void add_eq_ori(System_of_eqs &syst, const char *eq)
Adds an equation being the value of some field at the origin.
void add_matching(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Adds a matching condition, at all the interface present in a given system.
void add_eq_inverted(System_of_eqs &syst, const char *eq, const char *rac, const char *rac_der, int nused=-1, Array< int > **pused=0x0)
Adds a bulk equation and two matching conditions (from outer domains to inner ones)
void add_eq_full(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Adds a bulk equation in all the domains of a given system (equation is assumed to be 0th order)
void add_eq(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Adds a bulk equation in all the domains of a given system (equation is assumed to be second order)
void add_outer_bc(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Sets a boundary condition at the outer radius of the compactified domain.
Domain ** domains
Pointers on the various Domains.
Definition: space.hpp:1368
int nbr_domains
Number od Domains.
Definition: space.hpp:1365
Class used to describe and solve a system of equations.
virtual void add_eq_order(int dom, int order, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation to be solved inside a domain (of arbitrary order).
Definition: add_eq.cpp:56
virtual void add_eq_matching(int dom, int bb, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation describing a matching condition between two domains (standard setting)
Definition: add_eq.cpp:198
virtual void add_eq_bc(int dom, int bb, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation describing a boundary condition.
Definition: add_eq.cpp:168
virtual void add_eq_val(int dom, const char *eq, const Index &pos)
Addition of an equation saying that the value of a field must be zero at one collocation point.
Definition: add_eq.cpp:462
int get_dom_max() const
Returns the highest index of the domains.
int get_dom_min() const
Returns the smallest index of the domains.