bool parserCls::term2(void) { bool s1 = term3();if(s1==false) return false ; EtokenType et1=getTokenType();tokenContainCls t1 ; if((et1==ExEq)||(et1==Ne)||(et1==Ge)||(et1==Le)|| (et1==Gt)||(et1==Lt)||(et1==Eq) ) { t1=getCurToken();getToken();bool s2 = term3(); if(s2==false) return false ; addOperator(t1);et1 = getTokenType(); } return s1 ; }
const Real GreensFunction2DAbs::p_int_theta_first(const Real r, const Real theta, const Real t) const { const Real r_0(this->getr0()); const Real a(this->geta()); const Real minusDt(-1e0 * this->getD() * t); const Integer num_term_use(100); const Real threshold(CUTOFF); Real sum(0e0); Real term(0e0); Real term1(0e0); Real term2(0e0); Real term3(0e0); Real a_alpha_n(0e0); Real alpha_n(0e0); Real J0_r_alpha_n(0e0); Real J0_r0_alpha_n(0e0); Real J1_a_alpha_n(0e0); Integer n(1); for(; n < num_term_use; ++n) { a_alpha_n = gsl_sf_bessel_zero_J0(n); alpha_n = a_alpha_n / a; J0_r_alpha_n = gsl_sf_bessel_J0(r * alpha_n); J0_r0_alpha_n = gsl_sf_bessel_J0(r_0 * alpha_n); J1_a_alpha_n = gsl_sf_bessel_J1(a_alpha_n); term1 = std::exp(alpha_n * alpha_n * minusDt); term2 = J0_r_alpha_n * J0_r0_alpha_n; term3 = J1_a_alpha_n * J1_a_alpha_n; term = term1 * term2 / term3; sum += term; // std::cout << "sum " << sum << ", term" << term << std::endl; if(fabs(term/sum) < threshold) { // std::cout << "normal exit. n = " << n << " first term" << std::endl; break; } } if(n == num_term_use) std::cout << "warning: use term over num_term_use" << std::endl; // return (sum / (M_PI * a * a)); return (theta * sum / (M_PI * a * a)); }
const Real GreensFunction2DAbs::p_int_r(const Real r, const Real t) const { //speed of convergence is too slow if(r == 0e0) return 0e0; const Real r_0(this->getr0()); const Real a(this->geta()); const Real Dt(this->getD() * t); const Integer num_term_use(100); const Real threshold(CUTOFF); Real sum(0e0); Real term(0e0); Real term1(0e0); Real term2(0e0); Real term3(0e0); Real a_alpha_n(0e0); Real alpha_n(0e0); Real J0_r0_alpha_n(0e0); Real J1_r_alpha_n(0e0); Real J1_a_alpha_n(0e0); Integer n(1); for(; n < num_term_use; ++n) { a_alpha_n = gsl_sf_bessel_zero_J0(n); alpha_n = a_alpha_n / a; J0_r0_alpha_n = gsl_sf_bessel_J0(r_0 * alpha_n); J1_r_alpha_n = gsl_sf_bessel_J1(r * alpha_n); J1_a_alpha_n = gsl_sf_bessel_J1(a_alpha_n); term1 = std::exp(-1e0 * alpha_n * alpha_n * Dt); term2 = r * J1_r_alpha_n * J0_r0_alpha_n; term3 = (alpha_n * J1_a_alpha_n * J1_a_alpha_n); term = term1 * term2 / term3; sum += term; // std::cout << "sum " << sum << ", term" << term << std::endl; if(fabs(term/sum) < threshold) { // std::cout << "normal exit. " << n << std::endl; break; } } if(n == num_term_use) std::cout << "warning: use term over num_term_use" << std::endl; return (2e0 * sum / (a*a)); }