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)); }
int CycLiqCP3D::recvSelf (int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) { // recv the vector object from the channel which defines material param and state static Vector data(20+9*3); if (theChannel.recvVector(this->getDbTag(), commitTag, data) < 0) { opserr << "CycLiqCP::recvSelf - failed to recv vector from channel\n"; return -1; } // set the material parameters and state variables int cnt = 0; this->setTag(data(cnt++)); G0 = data(cnt++); kappa = data(cnt++); h = data(cnt++); Mfc = data(cnt++); dre1 = data(cnt++); Mdc = data(cnt++); dre2 = data(cnt++); rdr = data(cnt++); eta = data(cnt++); dir = data(cnt++); ein = data(cnt++); rho = data(cnt++); epsvir_n = data(cnt++); epsvre_n = data(cnt++); gammamono = data(cnt++); epsvc_n = data(cnt++); etam = data(cnt++); epsvc0 = data(cnt++); p0 = data(cnt++); for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { strain_n(i,j) = data(cnt+9); alpha_n(i,j) = data(cnt+9*2); stress_n(i,j) = data(cnt+9*3); } } return 0; }
const Real GreensFunction2DAbs::p_survival(const Real t) const { // when t == 0.0, return value become eventually 1.0, // but the speed of convergence is too slow. if(t == 0.0) return 1.0; 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 term1(0e0); Real term2(0e0); Real term(0e0); Real a_alpha_n(0e0); Real 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_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(-1e0 * alpha_n * alpha_n * Dt) * J0_r0_alpha_n; term2 = alpha_n * J1_a_alpha_n; term = term1 / term2; 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); }
// From Kobbelt sqrt(3)-Subdivision, eqns 7 and 8, solving for pinf void point_inf(size_t p, struct Mesh_Info *mesh, ON_3dPointArray *p_a) { size_t n = mesh->point_valence[p]; std::multimap<size_t, size_t>::iterator p_it; std::pair<std::multimap<size_t, size_t>::iterator, std::multimap<size_t, size_t>::iterator> range; range = mesh->point_neighbors.equal_range(p); ON_3dPoint psum = ON_3dPoint(0, 0, 0); for (p_it = range.first; p_it != range.second; p_it++) { psum = psum + *mesh->points_p0.At((int)(*p_it).second); } fastf_t alpha = alpha_n(n); // // 3 an 1 // [pinf = ---------- * psum + -------- * p0] // 3 an n + n 3 an + 1 // ON_3dPoint pinf = (3*alpha/((3*alpha+1)*n))*psum + 1/(3*alpha+1) * *mesh->points_p0.At((int)p); p_a->Append(pinf); }
double tau_n(const double V_tilde) { return 1./(alpha_n(V_tilde)+beta_n(V_tilde)); }
double n_inf(const double V_tilde) { return alpha_n(V_tilde)/(alpha_n(V_tilde)+beta_n(V_tilde)); }
static inline double tau_n(double V) { return 1.0 / (alpha_n(V) + beta_n(V)); }
static inline double n_inf(double V) { return alpha_n(V) / (alpha_n(V) + beta_n(V)); }
double FS_neuron::n_integrate(double dt) { double n_0 = alpha_n() / (alpha_n() + beta_n()); double tau_n = 1 / (alpha_n() + beta_n()); return n_0 -(n_0 - n)*exp(-dt/tau_n); }