ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/hydrodynamics/AnalyticalModel.cpp
Revision: 2752
Committed: Tue May 16 02:06:37 2006 UTC (18 years, 3 months ago) by gezelter
File size: 5280 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 tim 2634 /*
2     * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3     *
4     * The University of Notre Dame grants you ("Licensee") a
5     * non-exclusive, royalty free, license to use, modify and
6     * redistribute this software in source and binary code form, provided
7     * that the following conditions are met:
8     *
9     * 1. Acknowledgement of the program authors must be made in any
10     * publication of scientific results based in part on use of the
11     * program. An acceptable form of acknowledgement is citation of
12     * the article in which the program was described (Matthew
13     * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14     * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15     * Parallel Simulation Engine for Molecular Dynamics,"
16     * J. Comput. Chem. 26, pp. 252-271 (2005))
17     *
18     * 2. Redistributions of source code must retain the above copyright
19     * notice, this list of conditions and the following disclaimer.
20     *
21     * 3. Redistributions in binary form must reproduce the above copyright
22     * notice, this list of conditions and the following disclaimer in the
23     * documentation and/or other materials provided with the
24     * distribution.
25     *
26     * This software is provided "AS IS," without a warranty of any
27     * kind. All express or implied conditions, representations and
28     * warranties, including any implied warranty of merchantability,
29     * fitness for a particular purpose or non-infringement, are hereby
30     * excluded. The University of Notre Dame and its licensors shall not
31     * be liable for any damages suffered by licensee as a result of
32     * using, modifying or distributing the software or its
33     * derivatives. In no event will the University of Notre Dame or its
34     * licensors be liable for any lost revenue, profit or data, or for
35     * direct, indirect, special, consequential, incidental or punitive
36     * damages, however caused and regardless of the theory of liability,
37     * arising out of the use of or inability to use software, even if the
38     * University of Notre Dame has been advised of the possibility of
39     * such damages.
40     */
41 gezelter 2752 #include "hydrodynamics/AnalyticalModel.hpp"
42     #include "hydrodynamics/Sphere.hpp"
43     #include "hydrodynamics/Ellipsoid.hpp"
44     #include "hydrodynamics/CompositeShape.hpp"
45 tim 2634 #include "math/LU.hpp"
46     namespace oopse {
47 gezelter 2752
48     bool AnalyticalModel::calcHydroProps(Sphere* sphere, double viscosity, double temperature) {
49    
50     double radius = sphere->getRadius();
51 tim 2634 HydroProps props;
52     props.center =V3Zero;
53     double Xitt = 6.0 * NumericConstant::PI * viscosity * radius;
54     double Xirr = 8.0 * NumericConstant::PI * viscosity * radius * radius * radius;
55     props.Xi(0, 0) = Xitt;
56     props.Xi(1, 1) = Xitt;
57     props.Xi(2, 2) = Xitt;
58     props.Xi(3, 3) = Xirr;
59     props.Xi(4, 4) = Xirr;
60     props.Xi(5, 5) = Xirr;
61    
62     const double convertConstant = 6.023; //convert poise.angstrom to amu/fs
63     props.Xi *= convertConstant;
64     Mat6x6d XiCopy = props.Xi;
65     invertMatrix(XiCopy, props.D);
66     double kt = OOPSEConstant::kB * temperature;
67     props.D *= kt;
68     props.Xi *= OOPSEConstant::kb * temperature;
69 gezelter 2752
70 tim 2634 setCR(props);
71     setCD(props);
72    
73 gezelter 2752 return true;
74 tim 2634 }
75    
76 gezelter 2752 /**
77     * Reference:
78     * (2) F. Perrin , J. Phys. Radium, [7] 5, 497-511, 1934
79     * (3) F. Perrin, J. Phys. Radium, [7] 7, 1-11, 1936
80     */
81     bool AnalyticalModel::calcHydroProps(Ellipsoid* ellipsoid, double viscosity, double temperature) {
82    
83 tim 2644 double rMajor = ellipsoid->getRMajor();
84     double rMinor = ellipsoid->getRMinor();
85 gezelter 2752
86 tim 2644 double a = rMinor;
87     double b = rMajor;
88     double a2 = a * a;
89     double b2 = b* b;
90    
91     double p = a /b;
92     double S;
93     if (p > 1.0) { //prolate
94 gezelter 2752 S = 2.0/sqrt(a2 - b2) * log((a + sqrt(a2-b2))/b);
95 tim 2646 } else { //oblate
96 gezelter 2752 S = 2.0/sqrt(b2 - a2) * atan(sqrt(b2-a2)/a);
97 tim 2634 }
98 gezelter 2752
99 tim 2644 double P = 1.0/(a2 - b2) * (S - 2.0/a);
100     double Q = 0.5/(a2-b2) * (2.0*a/b2 - S);
101 gezelter 2752
102 tim 2644 double transMinor = 16.0 * NumericConstant::PI * viscosity * (a2 - b2) /((2.0*a2-b2)*S -2.0*a);
103     double transMajor = 32.0 * NumericConstant::PI * viscosity * (a2 - b2) /((2.0*a2-3.0*b2)*S +2.0*a);
104     double rotMinor = 32.0/3.0 * NumericConstant::PI * viscosity *(a2 - b2) * b2 /(2.0*a -b2*S);
105     double rotMajor = 32.0/3.0 * NumericConstant::PI * viscosity *(a2*a2 - b2*b2)/((2.0*a2-b2)*S-2.0*a);
106    
107 gezelter 2752
108 tim 2634 HydroProps props;
109 gezelter 2752
110 tim 2644 props.Xi(0,0) = transMajor;
111     props.Xi(1,1) = transMajor;
112     props.Xi(2,2) = transMinor;
113     props.Xi(3,3) = rotMajor;
114     props.Xi(4,4) = rotMajor;
115     props.Xi(5,5) = rotMinor;
116 tim 2634
117     const double convertConstant = 6.023; //convert poise.angstrom to amu/fs
118     props.Xi *= convertConstant;
119    
120     Mat6x6d XiCopy = props.Xi;
121     invertMatrix(XiCopy, props.D);
122     double kt = OOPSEConstant::kB * temperature;
123     props.D *= kt;
124 tim 2644 props.Xi *= OOPSEConstant::kb * temperature;
125    
126 tim 2634 setCR(props);
127     setCD(props);
128 gezelter 2752
129 tim 2634 return true;
130 gezelter 2752 }
131    
132     bool AnalyticalModel::calcHydroProps(CompositeShape* compositeShape, double viscosity, double temperature) {
133 tim 2634 return false;
134 gezelter 2752 }
135    
136     void AnalyticalModel::writeBeads(std::ostream& os) {
137 tim 2665 os << "1\n";
138     os << "Generated by Hydro\n";
139     Vector3d pos = sd_->getPos();
140     os << sd_->getType() << "\t" << pos[0] << "\t" << pos[1] << "\t" << pos[2] << std::endl;
141 gezelter 2752 }
142 tim 2665 }