/* * Method for vector Poisson equation inverting eqs. for V^r and eta as a block * (with a boundary condition on the excised sphere). * * (see file vector.h for documentation). * */ /* * Copyright (c) 2005 Jerome Novak * Francois Limousin * Jose Luis Jaramillo * * 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 vector_poisson_boundary_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_poisson_boundary.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $" ; /* * $Id: vector_poisson_boundary.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $ * $Log: vector_poisson_boundary.C,v $ * Revision 1.3 2014/10/13 08:53:45 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.2 2014/10/06 15:13:21 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.1 2005/06/09 08:00:09 f_limousin * Implement a new function sol_elliptic_boundary() and * Vector::poisson_boundary(...) which solve the vectorial poisson * equation (method 6) with an inner boundary condition. * * * $Header: /cvsroot/Lorene/C++/Source/Tensor/vector_poisson_boundary.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $ * */ // C headers #include #include #include // Lorene headers #include "metric.h" #include "diff.h" #include "param_elliptic.h" #include "proto.h" #include "utilitaires.h" namespace Lorene { void Vector::poisson_boundary(double lam, const Mtbl_cf& bound_vr, const Mtbl_cf& bound_eta, const Mtbl_cf& bound_mu, int num_front, double fact_dir, double fact_neu, Vector& resu) const { const Map_af* mpaff = dynamic_cast(mp) ; #ifndef NDEBUG for (int i=0; i<3; i++) assert(cmp[i]->check_dzpuis(4)) ; // All this has a meaning only for spherical components: const Base_vect_spher* bvs = dynamic_cast(triad) ; assert(bvs != 0x0) ; //## ... and affine mapping, for the moment! assert( mpaff != 0x0) ; #endif if (fabs(lam + 1.) < 1.e-8) { cout << "Not implemented yet !!" << endl ; abort() ; /* const Metric_flat& mets = mp->flat_met_spher() ; Vector_divfree sou(*mp, *triad, mets) ; for (int i=1; i<=3; i++) sou.set(i) = *cmp[i-1] ; resu = sou.poisson() ; return ; */ } // Some working objects //--------------------- const Mg3d& mg = *mpaff->get_mg() ; int nz = mg.get_nzone() ; int nzm1 = nz - 1; assert(mg.get_type_r(nzm1) == UNSURR) ; Scalar S_r = *cmp[0] ; if (S_r.get_etat() == ETATZERO) S_r.annule_hard() ; Scalar S_eta = eta() ; if (S_eta.get_etat() == ETATZERO) S_eta.annule_hard() ; S_r.set_spectral_va().ylm() ; S_eta.set_spectral_va().ylm() ; const Base_val& base = S_eta.get_spectral_va().base ; Mtbl_cf sol_part_eta(mg, base) ; sol_part_eta.annule_hard() ; Mtbl_cf sol_part_vr(mg, base) ; sol_part_vr.annule_hard() ; Mtbl_cf solution_hom_un(mg, base) ; solution_hom_un.annule_hard() ; Mtbl_cf solution_hom_deux(mg, base) ; solution_hom_deux.annule_hard() ; Mtbl_cf solution_hom_trois(mg, base) ; solution_hom_trois.annule_hard() ; Mtbl_cf solution_hom_quatre(mg, base) ; solution_hom_quatre.annule_hard() ; // The l_0 component is solved independently // Understand this step //------------------------------------------ Scalar sou_l0 = (*cmp[0]) / (1. + lam) ; Param_elliptic param_l0(sou_l0) ; for (int l=0; lget_alpha()[zone] ; beta = mpaff->get_beta()[zone] ; ech = beta / alpha ; assert (nr > 5) ; assert(nt == mg.get_nt(zone)) ; assert(np == mg.get_np(zone)) ; // Loop on l and m //---------------- for (int k=0 ; kget_alpha()[nzm1] ; assert (nr > 4) ; int nr0 = nr - 2 ; //two degrees of freedom less because of division by u^2 // Loop on l and m //---------------- for (int k=0 ; kget_alpha()[num_front+1] ; double echelle = mpaff->get_beta()[num_front+1]/alpha ; // Conditions on eta (configuration space) //value and derivative of (x+echelle)^(l-1) at -1 systeme.set(ligne, colonne) = pow(echelle-1., double(l_q-1)) ; // value and derivative of 1/(x+echelle) ^(l+2) at -1 systeme.set(ligne, colonne+1) = 1/pow(echelle-1., double(l_q+2)) ; //value and derivative of (x+echelle)^(l+1) at -1 systeme.set(ligne, colonne+2) = f3_eta*pow(echelle-1., double(l_q+1)) ; // value and derivative of 1/(x+echelle) ^l at -1 systeme.set(ligne, colonne+3) = f4_eta/pow(echelle-1., double(l_q)) ; for (int i=0 ; iget_alpha()[zone] ; echelle = mpaff->get_beta()[zone]/alpha ; ligne -= 3 ; //value of (x+echelle)^(l-1) at -1 systeme.set(ligne, colonne) = -pow(echelle-1., double(l_q-1)) ; // value of 1/(x+echelle) ^(l+2) at -1 systeme.set(ligne, colonne+1) = -1/pow(echelle-1., double(l_q+2)) ; //value of (x+echelle)^(l+1) at -1 systeme.set(ligne, colonne+2) = -f3_eta*pow(echelle-1., double(l_q+1)); // value of 1/(x+echelle) ^l at -1 systeme.set(ligne, colonne+3) = -f4_eta/pow(echelle-1., double(l_q)) ; for (int i=0 ; iget_alpha()[nzm1] ; ligne -= 3 ; //value of (x-1)^(l+2) at -1 : systeme.set(ligne, colonne) = -pow(-2, double(l_q+2)) ; //value of (x-1)^l at -1 : systeme.set(ligne, colonne+1) = -f4_eta*pow(-2, double(l_q)) ; for (int i=0 ; i 2) systeme.set_band(5,5) ; else systeme.set_band(1,1) ; systeme.set_lu() ; Tbl facteurs(systeme.inverse(sec_membre)) ; int conte = 0 ; // everything is put to the right place, the same combination of hom. // solutions (with some l or -(l+1) factors) must be used for V^r //------------------------------------------------------------------- for (int zone=1 ; zone we fill // all the zones extending the values at the boundary before calling to poisson_angu. Scalar temp_vt (*mp) ; Scalar temp_vp (*mp) ; temp_vt.annule_hard() ; temp_vp.annule_hard() ; int nz = mp->get_mg()->get_nzone() ; for (int l=0; lget_mg()->get_nt(l); j++) for (int k=0; kget_mg()->get_np(l); k++) { temp_vt.set_grid_point(l, k, j, 0) = bound_vt(1, k, j, 0) ; temp_vp.set_grid_point(l, k, j, 0) = bound_vp(1, k, j, 0) ; } temp_vt.set_spectral_va().set_base(bound_vt.base) ; // We set the basis temp_vp.set_spectral_va().set_base(bound_vp.base) ; cout << "temp_vp" << endl << norme(temp_vp) << endl ; //Source for eta Scalar source_eta(*mp) ; Scalar vtstant (temp_vt) ; vtstant.div_tant() ; source_eta = temp_vt.dsdt() + vtstant + temp_vp.stdsdp() ; //Source for mu Scalar source_mu(*mp) ; Scalar vpstant (temp_vp) ; vpstant.div_tant() ; source_mu = temp_vp.dsdt() + vpstant - temp_vt.stdsdp() ; //There was a wrong sign here Scalar temp_mu (source_mu.poisson_angu()) ; Scalar temp_eta (source_eta.poisson_angu()) ; // Boundary condition for mu Valeur limit_mu ((*mp).get_mg()->get_angu() ) ; int nnp = (*mp).get_mg()->get_np(1) ; int nnt = (*mp).get_mg()->get_nt(1) ; limit_mu= 1 ; for (int k=0 ; kget_angu() ) ; limit_eta = 1 ; for (int k=0 ; kcheck_dzpuis(4)) ; if (cmp[i]->get_etat() != ETATZERO || bound_vr.get_etat() != ETATZERO || bound_vt.get_etat() != ETATZERO || bound_vp.get_etat() != ETATZERO) nullite = false ; } Vector resu(*mp, CON, triad) ; if (nullite) resu.set_etat_zero() ; else poisson_boundary(lam, lim_vr, lim_eta, lim_mu, num_front, fact_dir, fact_neu, resu) ; return resu ; } }