OpenMD
3.2
Molecular Dynamics in the Open
Toggle main menu visibility
Loading...
Searching...
No Matches
VelocityField.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2004-present, The University of Notre Dame. All rights
3
* reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
*
11
* 2. Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
* POSSIBILITY OF SUCH DAMAGE.
30
*
31
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32
* research, please cite the following paper when you publish your work:
33
*
34
* [1] Drisko et al., J. Open Source Softw. 9, 7004 (2024).
35
*
36
* Good starting points for code and simulation methodology are:
37
*
38
* [2] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
39
* [3] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
40
* [4] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
41
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
42
* [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
43
* [7] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
44
* [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
45
* [9] Drisko & Gezelter, J. Chem. Theory Comput. 20, 4986-4997 (2024).
46
*/
47
48
/*! \file perturbations/VelocityField.hpp
49
\brief Linear (homogeneous) ambient velocity field, queried at a location
50
*/
51
52
#ifndef PERTURBATIONS_VELOCITYFIELD_HPP
53
#define PERTURBATIONS_VELOCITYFIELD_HPP
54
55
#include "
brains/SimInfo.hpp
"
56
#include "
math/SquareMatrix3.hpp
"
57
#include "
math/Vector3.hpp
"
58
#include "perturbations/VelocityFieldParameters.hpp"
59
60
namespace
OpenMD
{
61
62
//! A linear (homogeneous) ambient velocity field, v(r) = v0 + K . r
63
/*! Built from a velocityField{ ... } block. The velocity gradient
64
\f$ K_{ij} = \partial v_i / \partial r_j \f$ is assembled from an
65
optional constant-stress (rate-of-strain) part and an optional
66
constant-vorticity part:
67
68
\f$ \mathsf{K} = \mathsf{E} + \mathsf{W}, \qquad
69
\mathsf{E} = \mathrm{sym}(\mathsf{K}), \quad
70
\mathsf{W} = \mathrm{antisym}(\mathsf{K}). \f$
71
72
Unlike the electric-field gradient in UniformGradient (which Laplace's
73
equation forces to be symmetric and traceless), K carries an
74
independent antisymmetric part. Because E is built traceless and W is
75
antisymmetric, this decomposed field is divergence-free by
76
construction (incompressible, \f$\nabla\cdot\mathbf{v}=0\f$).
77
78
This is a passive object: it is queried by the (Langevin /
79
hydrodynamic) integrator rather than registered as a ForceModifier.
80
Accessors expose the quantities the mobility coupling consumes: the
81
ambient velocity (leading drag), the rate of strain (stresslet), and
82
the vorticity / co-rotation rate (rotational coupling). Since the
83
flow is linear, \f$\nabla^2\mathbf{v}=0\f$ and the a^2/6 Faxen term
84
vanishes identically.
85
86
The velocity field can be applied by specifying one of these blocks in the
87
omd file:
88
89
\code{.unparsed}
90
91
// pure planar/uniaxial extension along x
92
velocityField {
93
useVelocityField = true;
94
strainRate = 1.0e-3; // fs^-1
95
strainDirection1 = (1, 0, 0);
96
strainDirection2 = (1, 0, 0);
97
}
98
99
// rigid rotation about z (vorticity only)
100
velocityField {
101
useVelocityField = true;
102
vorticity = (0, 0, 2.0e-3); // fs^-1
103
}
104
105
// background velocity field
106
velocityField {
107
useVelocityField = true;
108
backgroundVelocity = (0, 0, 1.0e-4); // Angstrom fs^-1
109
}
110
111
// simple shear v_x = gammaDot * y (equal strain + vorticity)
112
velocityField {
113
useVelocityField = true;
114
strainRate = 1.0e-3;
115
strainDirection1 = (1, 0, 0);
116
strainDirection2 = (0, 1, 0);
117
vorticity = (0, 0, -1.0e-3);
118
}
119
\endcode
120
121
This last block is important: simple shear is not a pure strain
122
or pure vorticity state — it's \f$ K_{xy} = \f$ split as \f$
123
E_{xy} = \dot{\gamma} / 2 \f$ plus \f$ \omega = -\dot{\gamma}
124
\f$, which is why both strain and vorticity appear.
125
*/
126
class
VelocityField {
127
public
:
128
explicit
VelocityField(
SimInfo
* info);
129
130
//! true when a valid velocityField{} block was supplied
131
bool
isActive
()
const
{
return
doVelocityField_; }
132
133
//! ambient velocity at position r: v0 + K . r
134
Vector3d
getVelocity
(
const
Vector3d& r)
const
{
return
v0_ + K_ * r; }
135
136
//! constant velocity gradient, K_ij = d v_i / d r_j
137
const
Mat3x3d&
getVelocityGradient
()
const
{
return
K_; }
138
139
//! rate-of-strain tensor E = sym(K) (the constant-stress part)
140
const
Mat3x3d&
getRateOfStrain
()
const
{
return
E_; }
141
142
//! spin tensor W = antisym(K)
143
const
Mat3x3d&
getSpin
()
const
{
return
W_; }
144
145
//! vorticity vector, omega = curl v (the constant-vorticity part)
146
const
Vector3d&
getVorticity
()
const
{
return
omega_; }
147
148
//! angular velocity an immersed sphere co-rotates with, omega / 2
149
Vector3d
getAngularVelocity
()
const
{
return
0.5 * omega_; }
150
151
//! uniform background velocity v0
152
const
Vector3d&
getBackgroundVelocity
()
const
{
return
v0_; }
153
154
private
:
155
void
initialize();
156
157
SimInfo
* info_;
158
Perturbations::VelocityFieldParameters
* vfParams_;
159
160
bool
initialized_ {
false
};
161
bool
doVelocityField_ {
false
};
162
163
Vector3d v0_ {V3Zero};
// uniform background velocity
164
Mat3x3d K_ {};
// velocity gradient
165
Mat3x3d E_ {};
// sym(K), rate of strain
166
Mat3x3d W_ {};
// antisym(K), spin
167
Vector3d omega_ {V3Zero};
// vorticity = curl v
168
};
169
}
// namespace OpenMD
170
171
#endif
// PERTURBATIONS_VELOCITYFIELD_HPP
SimInfo.hpp
SquareMatrix3.hpp
Vector3.hpp
OpenMD::Perturbations::VelocityFieldParameters
Parsed contents of the velocityField{ ... } block.
Definition
VelocityFieldParameters.hpp:81
OpenMD::SimInfo
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition
SimInfo.hpp:96
OpenMD::VelocityField::getSpin
const Mat3x3d & getSpin() const
spin tensor W = antisym(K)
Definition
VelocityField.hpp:143
OpenMD::VelocityField::getVelocityGradient
const Mat3x3d & getVelocityGradient() const
constant velocity gradient, K_ij = d v_i / d r_j
Definition
VelocityField.hpp:137
OpenMD::VelocityField::getAngularVelocity
Vector3d getAngularVelocity() const
angular velocity an immersed sphere co-rotates with, omega / 2
Definition
VelocityField.hpp:149
OpenMD::VelocityField::isActive
bool isActive() const
true when a valid velocityField{} block was supplied
Definition
VelocityField.hpp:131
OpenMD::VelocityField::getRateOfStrain
const Mat3x3d & getRateOfStrain() const
rate-of-strain tensor E = sym(K) (the constant-stress part)
Definition
VelocityField.hpp:140
OpenMD::VelocityField::getBackgroundVelocity
const Vector3d & getBackgroundVelocity() const
uniform background velocity v0
Definition
VelocityField.hpp:152
OpenMD::VelocityField::getVelocity
Vector3d getVelocity(const Vector3d &r) const
ambient velocity at position r: v0 + K . r
Definition
VelocityField.hpp:134
OpenMD::VelocityField::getVorticity
const Vector3d & getVorticity() const
vorticity vector, omega = curl v (the constant-vorticity part)
Definition
VelocityField.hpp:146
OpenMD
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Definition
ActionCorrFunc.cpp:63
perturbations
VelocityField.hpp
Generated on
for OpenMD by
1.17.0