Parallel Finite Element - General geometry Ewald-like Method
Part of Continuum-particle Simulation Suite under MICCOM
fix_base.h
Go to the documentation of this file.
1 // Parallel Finite Element-General Geometry Ewald-like Method.
2 // Copyright (C) 2015-2016 Xujun Zhao, Jiyuan Li, Xikai Jiang
3 
4 // This code is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 
10 // This code is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 
15 
16 // You should have received a copy of the GNU General Public
17 // License along with this code; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 #pragma once
21 
22 #include <stdio.h>
23 #include <cmath>
24 
25 #include "libmesh/reference_counted_object.h"
26 
27 
28 
29 namespace libMesh
30 {
31 
32  /*
33  * This is a base class to define the force field of immersed structures.
34  * Users can define their own force field via derived classes!
35  *
36  */
37 
38 class FixBase
39 {
40 public:
41  // Constructor
42  FixBase();
43 
44 
45  // Destructor
46  ~FixBase();
47 
48 
49  // 0. define parameters of the force field
50  // *** This is illegal in C++ (see Practical C++ programming 2nd ed P215)
51  const Real PI = libMesh::pi; //3.1415926;
52  const Real tol = 1E-3;
53 
54 
55  /* --------------------------------------------------------------
56  * The following forces are computed according to the PRL paper:
57  * DNA dynamics in a microchannel, R.M. Jendrejack et al. (2003)
58  * See its Ref. [38], [39], [40] therein, and
59  * Doyle&Underhill (2005) HandBook of Material modeling
60  -------------------------------------------------------------- */
61 
62 
63  /*
64  * Compute the spring force between the bead i and j, the direction is from i to j
65  * WLS: Worm-like springs model. ( vector R_ij = Rj - Ri )
66  * f_ij = c1*[ (1-|R_ij|/Ls)^(-2) -1 + 4*|R_ij|/Ls ] * R_ij/|R_ij|
67  *
68  * Originally, c1 = kB*T/(2bk), and Ls = q0 = N_ks*bk
69  * If force is normalized by bead radius a, we have
70  * c1 = a/(2bk), and c2 = q0/a = Nks*bk/a
71  */
72  Point spring_force_wls(const Point& R_ij, // direction vector
73  const Real& c1, // constant 1
74  const Real& Ls) const; // constant 2
75 
76 
77  /*
78  * Compute the force on the bead i, whose direction is from i to j
79  * FENE: finitely extensible nonlinear elastic spring model. ( vector R_ij = Rj - Ri )
80  * |R_ij|/Ls
81  * f_ij = c1*[ ------------------- ] * R_ij/|R_ij|
82  * 1 - ( |R_ij|/Ls )^2
83  *
84  * Originally, c1 = 3*kB*T/(bk), and Ls = q0
85  * If force is normalized by bead radius a, we have
86  * c1 = 3a/bk, and c2 = q0/a = Nks*bk/a
87  */
88  Point spring_force_fene(const Point& R_ij, // direction vector
89  const Real& c1, // constant 1:
90  const Real& Ls) const; // constant 2:
91 
92 
93 
94  /*
95  * Compute the force on the bead i, whose direction is from i to j
96  * Underhill-Doyle(UD): spring model. ( vector R_ij = Rj - Ri )
97  *
98  * f_ij = [ a1*(1-r2)^-2 + a2*(1-r2)^-1 + a3 + a4*(1-r2) ] * R_ij/|R_ij|
99  * where
100  * r2 = (|R_ij|/Ls)^2
101  * a1 ~ a4 can be found in Kounovsky-Shafer et al. Macromolecules(2013) 46 p.8356
102  * c1 input is chi = 1/Nks,
103  * Ls is q0 (max spring extension) or normalized q0 = q0/a = Nks*bk/a
104  */
105  Point spring_force_ud(const Point& R_ij, // direction vector
106  const Real& c1, // constant 1:
107  const Real& Ls) const; // constant 2:
108 
109 
110  /*
111  * Compute the force on the bead i, whose direction is from i to j
112  * LHS: Linear Hookean Spring
113  *
114  * f_ij = k0*( |R_ij| - l0 ) * R_ij/|R_ij|
115  */
116  Point spring_force_lhs(const Point& R_ij, // direction vector
117  const Real& l0, // equilibrium distance
118  const Real& k0) const; // spring constant
119 
120 
121 
122  /*
123  * Compute the force on the bead i, whose direction is from i to j
124  * Dimensionless form:
125  * potential: u_gaussian = 1/2 * c1 * exp( -c2*|r_ij|^2 )
126  * where r_ij is dimensionless : r_ij = R_ij / a and r_ij = rj - ri
127  * where c1 > 0, c2 > 0
128  * force : f_ij = -du_gaussian/dr_ij = -c1*c2* exp( -c2*|r_ij|^2 ) * r_ij
129  * there is a negative sign before the force because r_ij = r_j - r_i, which has
130  * an opposite direction as f_ij
131  */
132  Point gaussian_force(const Point& r_ij, // direction vector
133  const Real& c1, // constant 1: coefficient
134  const Real& c2) const; // constant 2: exp coef
135 
136  /*
137  * Compute the force acting on bead i
138  * Dimensionless form:
139  * potential: u_lj = 4 * epsilon *[(sigma / |r_ij|)^12 - (sigma / |r_ij|)^6]
140  // f_ij = -24 * epsilon * (2*(sigma/|r_ij|)^12 - (sigma/|r_ij|)^6 ) * r_ij / |r_ij|^2
141  * where r_ij (vector) is dimensionless : r_ij = R_ij / a and r_ij = rj - ri
142  * sigma is dimensionless : sigma = SIGMA / a
143  * epsilon is dimensionless : epsilon = EPSILON / kBT
144  * @ http://www.physics.buffalo.edu/phy516/jan28.pdf
145  */
146  Point lj_force(const Point& r_ij, // direction vector
147  const Real& epsilon, // energy coefficient
148  const Real& sigma) const; // distance coefficient
149 
150  /*
151  * Compute the force acting on bead i
152  * Dimensionless form
153  * potential uij = 1/2 * k * (|r_ij| - |r0|)^2
154  * force fij = k (|r_ij| - r0) * r_ij / |r_ij|
155  * where r_ij (vector) is dimensionless: r_ij = R_ij / a and r_ij = rj - ri
156  * there is no minus sign before fij because r_ij = rj - ri
157  * r0 is equilibrim distance
158  * k is dimensionless: k = K /kBT
159  * @ Edmond Chow and Jeffrey Skolnick (2015), www.pnas.org/cgi/doi/10.1073/pnas.1514757112
160  */
161  Point harmonic_force(const Point& r_ij, // direction vector
162  const Real& k, // equilibrium distance
163  const Real& r0) const; // energy coefficient
164 
165 
166  /*
167  * Compute the force on the bead i, whose direction is from i to j
168  * Particle-wall repulsive force
169  * potential: Uw = -c0/3 *dwall * ( 1 - y/dwall ), where y is the distance to a wall
170  * force : f_i = -dUw/dy = -c0*( 1 - y/dwall )^2 * r_ij.unit(), where c0 > 0 and r_ij = rj - ri
171  * Jendrejack, R. M., Schwartz, D. C., Graham, M. D., & de Pablo, J. J. (2003). Effect of confinement on DNA dynamics in microfluidic devices. The Journal of Chemical Physics, 119(2), 1165–10. http://doi.org/10.1063/1.1575200
172  */
173  Point polymer_wall_empirical_force(const Point& r_ij, // vector from particle to wall (or particle i to particle j, r_j-r_i)
174  const Real& c0, // constant 1:
175  const Real& d0) const; // constant 2:
176 
177 
178 
179  /*
180  * Compute the friction force between two moving beads using a Coulombic law.
181  * Ref:
182  * Londono-Hurtado et al. J Reinforced Plastic&Composites 30(9) 781-790(2011)
183  */
184  Point friction_force(const Point& bead_1, // position of bead 1
185  const Point& bead_2, // position of bead 2
186  const std::vector<Real>& v1, // velocity of bead 1
187  const std::vector<Real>& v2, // velocity of bead 2
188  const std::vector<Real>& fxv_12, // excluded vol force
189  const Real& Hf, // friction coef
190  const Real& dmin) const; // minimum distance
191 
192 
193 
194 
195  /*
196  * This virtual function needs to be defined by the user in the derived class.
197  */
198 // static void reinit_force_field() = 0;
199 
200 
201 
202 
203 
204 }; // end of class
205 
206 
207 } // end of namespace
208 
209 
Point spring_force_wls(const Point &R_ij, const Real &c1, const Real &Ls) const
Definition: fix_base.C:61
Point gaussian_force(const Point &r_ij, const Real &c1, const Real &c2) const
Definition: fix_base.C:160
~FixBase()
Definition: fix_base.C:53
Definition: brownian_system.h:58
FixBase()
Definition: fix_base.C:37
const Real PI
Definition: fix_base.h:51
Point spring_force_fene(const Point &R_ij, const Real &c1, const Real &Ls) const
Definition: fix_base.C:84
Point polymer_wall_empirical_force(const Point &r_ij, const Real &c0, const Real &d0) const
Definition: fix_base.C:208
Point spring_force_lhs(const Point &R_ij, const Real &l0, const Real &k0) const
Definition: fix_base.C:136
const Real tol
Definition: fix_base.h:52
Point lj_force(const Point &r_ij, const Real &epsilon, const Real &sigma) const
Definition: fix_base.C:176
Point friction_force(const Point &bead_1, const Point &bead_2, const std::vector< Real > &v1, const std::vector< Real > &v2, const std::vector< Real > &fxv_12, const Real &Hf, const Real &dmin) const
Definition: fix_base.C:230
Definition: fix_base.h:38
Point harmonic_force(const Point &r_ij, const Real &k, const Real &r0) const
Definition: fix_base.C:195
Point spring_force_ud(const Point &R_ij, const Real &c1, const Real &Ls) const
Definition: fix_base.C:106