LORENE
sol_elliptic_only_zec.C
1/*
2 * Copyright (c) 2004 Philippe Grandclement
3 *
4 * This file is part of LORENE.
5 *
6 * LORENE is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * LORENE is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with LORENE; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21
22
23/*
24 * $Id: sol_elliptic_only_zec.C,v 1.5 2016/12/05 16:18:10 j_novak Exp $
25 * $Log: sol_elliptic_only_zec.C,v $
26 * Revision 1.5 2016/12/05 16:18:10 j_novak
27 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
28 *
29 * Revision 1.4 2014/10/13 08:53:30 j_novak
30 * Lorene classes and functions now belong to the namespace Lorene.
31 *
32 * Revision 1.3 2014/10/06 15:16:10 j_novak
33 * Modified #include directives to use c++ syntax.
34 *
35 * Revision 1.2 2004/08/24 09:14:44 p_grandclement
36 * Addition of some new operators, like Poisson in 2d... It now requieres the
37 * GSL library to work.
38 *
39 * Also, the way a variable change is stored by a Param_elliptic is changed and
40 * no longer uses Change_var but rather 2 Scalars. The codes using that feature
41 * will requiere some modification. (It should concern only the ones about monopoles)
42 *
43 * Revision 1.1 2004/06/22 08:49:58 p_grandclement
44 * Addition of everything needed for using the logarithmic mapping
45 *
46 *
47 * $Header $
48 *
49 */
50
51// Header C :
52#include <cstdlib>
53#include <cmath>
54
55// Headers Lorene :
56#include "tbl.h"
57#include "mtbl_cf.h"
58#include "map.h"
59#include "param_elliptic.h"
60
61
62 //----------------------------------------------
63 // Version Mtbl_cf
64 //----------------------------------------------
65
66
67
68namespace Lorene {
69Mtbl_cf elliptic_solver_only_zec (const Param_elliptic& ope_var, const Mtbl_cf& source, double val) {
70 // Verifications d'usage sur les zones
71 int nz = source.get_mg()->get_nzone() ;
72 assert (nz>1) ;
73 assert (source.get_mg()->get_type_r(nz-1) == UNSURR) ;
74
75 // donnees sur la zone
76 int nr, nt, np ;
77
78 //Rangement des valeurs intermediaires
79 Tbl *so ;
80 Tbl *sol_hom ;
81 Tbl *sol_part ;
82
83
84 // Rangement des solutions, avant raccordement
85 Mtbl_cf solution_part(source.get_mg(), source.base) ;
86 Mtbl_cf solution_hom_un(source.get_mg(), source.base) ;
87 Mtbl_cf solution_hom_deux(source.get_mg(), source.base) ;
88 Mtbl_cf resultat(source.get_mg(), source.base) ;
89
90 solution_part.annule_hard() ;
91 solution_hom_un.annule_hard() ;
92 solution_hom_deux.annule_hard() ;
93 resultat.annule_hard() ;
94
95 // Computation of the SP and SH's in the ZEC ...
96 int conte_start = 0 ;
97 for (int l=0 ; l<nz-1 ; l++) {
98 nt = source.get_mg()->get_nt(l) ;
99 np = source.get_mg()->get_np(l) ;
100 for (int k=0 ; k<np+1 ; k++)
101 for (int j=0 ; j<nt ; j++)
102 conte_start ++ ;
103 }
104 int conte = conte_start ;
105
106 int zone = nz-1 ;
107
108 nr = source.get_mg()->get_nr(zone) ;
109 nt = source.get_mg()->get_nt(zone) ;
110 np = source.get_mg()->get_np(zone) ;
111
112 for (int k=0 ; k<np+1 ; k++)
113 for (int j=0 ; j<nt ; j++) {
114
115 if (ope_var.operateurs[conte] != 0x0) {
116
117 // Calcul de la SH
118 sol_hom = new Tbl(ope_var.operateurs[conte]->get_solh()) ;
119
120 //Calcul de la SP
121 so = new Tbl(nr) ;
122 so->set_etat_qcq() ;
123 for (int i=0 ; i<nr ; i++)
124 so->set(i) = source(zone, k, j, i) ;
125
126 sol_part = new Tbl(ope_var.operateurs[conte]->get_solp(*so)) ;
127
128 // Rangement dans les tableaux globaux ;
129 for (int i=0 ; i<nr ; i++) {
130 solution_part.set(zone, k, j, i) = (*sol_part)(i) ;
131 if (sol_hom->get_ndim()==1)
132 solution_hom_un.set(zone, k, j, i) = (*sol_hom)(i) ;
133 else
134 {
135 solution_hom_un.set(zone, k, j, i) = (*sol_hom)(0,i) ;
136 solution_hom_deux.set(zone, k, j, i) = (*sol_hom)(1,i) ;
137 }
138 }
139
140 delete so ;
141 delete sol_hom ;
142 delete sol_part ;
143
144 }
145 conte ++ ;
146 }
147
148
149 //---------------------------------------------------------
150 // ON impose la bonne CL ... CASE ONLY SPHERICAL RIGHT NOW
151 //---------------------------------------------------------
152
153 // C'est pas simple toute cette sombre affaire...
154 // Que le cas meme nombre de points dans chaque domaines...
155
156 int start = conte_start ;
157 for (int k=0 ; k<1 ; k++)
158 for (int j=0 ; j<1 ; j++) {
159 if (ope_var.operateurs[start] != 0x0) {
160
161
162 // Valeurs en -1 :
163 double facteur = ((val-ope_var.F_minus(nz-1, k, j))/
164 ope_var.G_minus(nz-1) -
165 ope_var.operateurs[start]->val_sp_minus()) /
166 ope_var.operateurs[start]->val_sh_one_minus() ;
167
168 // Zec
169 nr = source.get_mg()->get_nr(nz-1) ;
170 for (int i=0 ; i<nr ; i++)
171 resultat.set(nz-1,k,j,i) = solution_part(nz-1,k,j,i) +
172 facteur*solution_hom_un(nz-1,k,j,i) ;
173 }
174 start ++ ;
175 }
176
177 return resultat;
178}
179
180}
int get_nzone() const
Returns the number of domains.
Definition grilles.h:465
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:196
const Mg3d * get_mg() const
Returns the Mg3d on which the Mtbl_cf is defined.
Definition mtbl_cf.h:463
This class contains the parameters needed to call the general elliptic solver.
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:67