LP2R 1.0
Linear Polydisperse Polymer Rheology
LP2R.h
Go to the documentation of this file.
1#ifndef _LinLin_H_
2#define _LinLin_H_
3#include <iostream>
4#include <fstream>
5#include <sstream>
6#include <vector>
7#include <string>
8#include <cmath>
9#include <algorithm>
10
20class C_LPoly{
21public:
22C_LPoly()=default;
23C_LPoly(const double M, const double W, const double M_e) :
24 mass(M), wt(W), Z_chain(M/M_e), t_FRouse(Z_chain*Z_chain) {}
25
26double mass=0.0;
27double wt=0.0;
28double Z_chain=0.0;
29double z=0.0;
31bool alive=true;
32bool relax_free_Rouse=false;
34bool rept_set=false;
35double tau_d_0=1.0e22;
36double Z_rept=0.0;
37double rept_wt=0.0;
38int p_max=0;
39int p_next=0;
41double t_FRouse;
42 };
43
44
53class InvSqSum{ // sum(1/p^2)
54double psum[500];
55public:
56 InvSqSum(){
57 psum[0]=0.0; psum[1]=1.0;
58 for(int i=2; i<500; i++){psum[i]=psum[i-1]+1.0/((double) (i*i));}
59 }
60 double intg_psum(int n1, int n2){
61 double n1d=((double) n1); double n2d=((double) n2);
62 double n1dsq=n1d*n1d; double n2dsq=n2d*n2d;
63 double val=1.0/n1d - 1.0/n2d + 0.50*(1.0/n1dsq + 1.0/n2dsq);
64 val+=(1.0/(n1d*n1dsq) - 1.0/(n2d*n2dsq))/6.0;
65 return val;
66 }
67 double operator()(int Z){
68 if(Z < 500){return psum[Z];}
69 else{ return psum[499]+intg_psum(500,Z);}
70 }
71 double operator()(int Z1, int Z2){
72 double s1, s2;
73 if(Z1 <= 500){s1=psum[Z1-1];}
74 else{s1=psum[499]+intg_psum(500,Z1-1);}
75 if(Z2 < 500){s2=psum[Z2];}
76 else{s2=psum[499]+intg_psum(500,Z2);}
77 return s2-s1;
78 }
79
80 };
81
82#include "./LP2R_NS.h"
83#include "./routines.h"
84
85
86#endif
global namespaces
Definition: LP2R.h:20
double mass
Definition: LP2R.h:26
bool relax_free_Rouse
Definition: LP2R.h:32
int p_max
Definition: LP2R.h:38
double Z_rept
Definition: LP2R.h:36
int p_next
Definition: LP2R.h:39
double Z_chain
Definition: LP2R.h:28
double rept_wt
Definition: LP2R.h:37
double z
Definition: LP2R.h:29
double tau_d_0
Definition: LP2R.h:35
double wt
Definition: LP2R.h:27
bool alive
Definition: LP2R.h:31
double t_FRouse
Definition: LP2R.h:41
bool rept_set
Definition: LP2R.h:34
Class to hold and retrieve partial sums of the form 1/p^2 .
Definition: LP2R.h:53