/* * Solution of the l=0 part of the vector Poisson equation (only r-component) * */ /* * Copyright (c) 2007 Jerome Novak * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char pois_vect_r0_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/pois_vect_r0.C,v 1.2 2014/10/13 08:53:29 j_novak Exp $" ; /* * $Id: pois_vect_r0.C,v 1.2 2014/10/13 08:53:29 j_novak Exp $ * $Log: pois_vect_r0.C,v $ * Revision 1.2 2014/10/13 08:53:29 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.1 2007/01/23 17:08:46 j_novak * New function pois_vect_r0.C to solve the l=0 part of the vector Poisson * equation, which involves only the r-component. * * * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/pois_vect_r0.C,v 1.2 2014/10/13 08:53:29 j_novak Exp $ * */ // Lorene headers #include "metric.h" #include "proto.h" #include "diff.h" /* * This function solves for the l=0 component of * * d2 f 2 df 2f * ---- + - -- - -- = source * dr2 r dr r2 * * and returns the soluton f. * The input Scalar must have dzpuis = 4. */ namespace Lorene { Scalar pois_vect_r0(const Scalar& source) { const Map& map0 = source.get_mp() ; const Map_af* map1 = dynamic_cast(&map0) ; assert(map1 != 0x0) ; const Map_af& map = *map1 ; const Mg3d& mgrid = *map.get_mg() ; int nz = mgrid.get_nzone() ; Scalar resu(map) ; if (source.get_etat() == ETATZERO) { resu = 0 ; return resu ; } resu.annule_hard() ; resu.std_spectral_base_odd() ; resu.set_spectral_va().ylm() ; Mtbl_cf& sol_coef = (*resu.set_spectral_va().c_cf) ; const Base_val& base = source.get_spectral_base() ; assert(resu.get_spectral_base() == base) ; assert(source.check_dzpuis(4)) ; Mtbl_cf sol_part(mgrid, base) ; sol_part.annule_hard() ; Mtbl_cf sol_hom1(mgrid, base) ; sol_hom1.annule_hard() ; Mtbl_cf sol_hom2(mgrid, base) ; sol_hom2.annule_hard() ; { int lz = 0 ; int nr = mgrid.get_nr(lz) ; double alpha2 = map.get_alpha()[lz]*map.get_alpha()[lz] ; assert(mgrid.get_type_r(lz) == RARE) ; int base_r = R_CHEBI ; Matrice ope(nr,nr) ; ope.annule_hard() ; Diff_dsdx2 dx2(base_r, nr) ; const Matrice& mdx2 = dx2.get_matrice() ; Diff_sxdsdx sdx(base_r, nr) ; const Matrice& msdx = sdx.get_matrice() ; Diff_sx2 sx2(base_r, nr) ; const Matrice& ms2 = sx2.get_matrice() ; for (int lin=0; lin