1 #------------------------------------------------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 #-------------------------------------------------------------------------------
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 # Creates an .eps graph of OpenFOAM results vs analytical solution
29 # for a simple harmonic motion dynamicMesh case
31 #------------------------------------------------------------------------------
43 zeta = c/(2.0*m*omega)
45 phi = atan((sqrt(1.0 - zeta**2))/zeta)
48 pos(A, t, omega, phi, zeta) = A*exp(-zeta*omega*t)*sin(sqrt(1-zeta**2)*omega*t + phi)
49 vel(A, t, omega, phi, zeta) = \
50 A*exp(-zeta*omega*t)*\
52 sqrt(1-zeta**2)*omega*cos(sqrt(1-zeta**2)*omega*t + phi) \
53 - zeta*omega*sin(sqrt(1-zeta**2)*omega*t + phi) \
67 set terminal postscript eps color enhanced solid
71 "t_vs_cm" u 1:($2 - 0.6) w l t "Simulation, centre of mass relative to start", \
72 pos(A, x, omega, phi, zeta) w l t "Analytical solution, centre of mass", \
73 "t_vs_lv" u 1:2 w l axes x1y2 t "Simulation, vertical velocity", \
74 vel(A, x, omega, phi, zeta) w l axes x1y2 t "Analytical solution, vertical velocity"
76 #------------------------------------------------------------------------------