Exemplo n.º 1
0
void Model::calForcesHelper(int i, int j, Eigen::Vector3d &F) {
    double dist;
    Eigen::Vector3d r;

    dist = 0.0;
    F.fill(0);
    r = particles[j]->r - particles[i]->r;
    dist = r.norm();
            
    if (dist < 2.0) {
        std::cerr << "overlap " << i << "\t" << j << "\t"<< this->timeCounter << "dist: " << dist << "\t" << this->timeCounter <<std::endl;
#ifdef OPENMP
        std::cerr << "report from thread: " << omp_get_thread_num() << std::endl;
        std::cerr << "number of threads: " << omp_get_num_threads() << std::endl; 
#endif
        dist = 2.06;
    }
    if (dist < cutoff) {
        // the unit of force is kg m s^-2
        // kappa here is kappa*a a non-dimensional number
        
        double Fpp = -4.0/3.0*
        Os_pressure*M_PI*(-3.0/4.0*pow(combinedSize,2.0)+3.0*dist*dist/16.0*radius_nm*radius_nm);
        Fpp = -Bpp * Kappa * exp(-Kappa*(dist-2.0));
//        Fpp += -9e-13 * exp(-kappa* (dist - 2.0));
        F = Fpp*r/dist;
    }
}
void Model_cell::calForcesHelper(int i, int j, Eigen::Vector3d &F, Eigen::Vector3d &inhib) {
    double dist;
    Eigen::Vector3d r;

    dist = 0.0;
    F.fill(0);
    inhib.fill(0);
    r = particles[j]->r - particles[i]->r;
    dist = r.norm();
    double Fpp;

    if (dist < D0 && dist >= 1) {
        Fpp = V_a * (dist - 1) / (D0 - 1);
        F = Fpp * r / dist;
    } else if (dist < 1) {
        Fpp = -V_r * (1 - dist);
        F = Fpp * r / dist;
    } 

    if (dist < D0) {
        inhib = -r / dist *exp(-(dist-1.0));
    }
}