-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
184 lines (132 loc) · 6.76 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
** Mesochronic Analysis Toolbox **
This is a Matlab toolbox intented to demonstrate the principles behind
2d mesochronic analyses for incompressible dynamical systems. The
toolbox has been tested with Matlab 2012b and newer. It will not run
correctly on Matlab 2011b and earlier.
I would appreciate your feedback sent to
Additionally, if you happen to publish results based on mesochronic
analysis using this code, please send me and
Igor Mezic [email protected]
an e-mail with a reference.
Written by
Marko Budisic,
Dept. of Mechanical Engineering, UC Santa Barbara
supported by ONR MURI N00014-11-1-0087
** Installation: **
On Matlab 2012b and newer, if faster execution is desired (highly
recommended), run
deploytool -build mcjacobian.prj
before using the code for the first time and wait until "Build
finished" message. This will convert mcjacobian.m to C-code and
compile it into mcjacobian_mat MEX. Function evaluateJ_ode.m detects
whether the MEX file exists and uses MEX or .mat file appropriately.
For compilation problems, please consult Matlab Coder (not Compiler!)
compatibility chart: http://www.mathworks.com/support/compilers
The code is written so it can be run in parallel on Matlab with
Parallel Toolbox licenses. To open several "workers" to compute code
in parallel, issue command
matlabpool open N
where N is the number of processing cores on your computer (laptops
typically have 1-4 nowadays). You can also omit 'N' altogether and
issue just
matlabpool open
to have Matlab autodetect the number of cores. Note that they
sometimes under-estimate the number of cores available. Setting N to
anything larger than number of cores may lead to slowdown of
performance. Here's an article by Cleve Moler on this issue, if you
want to know more:
http://www.mathworks.com/company/newsletters/articles/parallel-matlab-multiple-processors-and-multiple-cores.html
There is a well known case of a bug, appearing on Mac OS X with newer
versions of Java. You can see how it manifests and how to fix it on
http://www.mathworks.com/support/bugreports/919688
** Test (demo) system **
This is a simple planar, time-dependent flow, used as the first
example in Mezic, Loire, et al. Science (2010). The function
fourgyre.m was written with intention of being mimicked by other
researchers in their researcn, not as being the optimally written
harness for others to use.p
Demo: fourgyre.m
****
% open parallel jobs (in serial, the code takes a few minutes to run)
matlabpool open; %
% computes mesochronic analysis
% and store results in mcan_fourgyre_ode_fwdT_1.5_N_00900.mat
N = 30; % grid resolution
Ts = [0.5, 1, 1.5]; % three different integration times
direction = 1; % positive time arrow direction
R = fourgyre([], Ts, N, direction)
% visualize output for T=1
fourgyre(R, 1, N, direction)
****
The demonstration is a sample short-time run, just to evaluate that
the code runs validly and to familiarize the user with inputs and
output. Once you are comfortable with the structure, you could
a) replace the vector field vf_fourgyre passed in fourgyre.m to
meh_simulation.m with an alternative vector field. As a practice
field, the file vf_shaddengyre can be used.
b) Mimic the structure of fourgyre.m to produce your own code, e.g.,
replacing meh_simulation.m (which computes mesochronic Jacobians
data), with another, perhaps more precise, computational code, or even
experimental data, and just applying meh_analysis.m to that data.
*** File functionality ***
* Main files *
meh_simulation.m -- Simulation harness: this is the main file that
performs simulation of an arbitrary system specified as a function
handle and computes mesochronic Jacobian for a specific set of
initial conditions and integration times.
This is performed in parallel for initial conditions.
meh_analysis.m -- Analysis harness: this is the file that
runs mesochronic analysis on mesochronic Jacobians, e.g., those
computed by meh_simulation.
This is performed in parallel for initial conditions.
meh2d.m -- Analysis at a single point. Takes several Jacobians,
all corresponding to the same initial condition, but different
integration lengths, and computes their mesochronic analysis.
* Computational aides *
vf_fourgyre.m and vf_shaddengyre.m -- Two simple 2d incompressible
vector fields.
evaluateJ_ode.m -- Evaluates the mesochronic Jacobian at a given
state point and time of a flow specified by a function handle.
mcjacobian.m -- Computes a mesochronic Jacobian from evaluations of
instantaneous Jacobian along trajectory (run by evaluateJ_ode.m)
ftle.m -- Computes FTLE from mesochronic Jacobian (run by
meh2d).
jacobian_fd.m -- Computes instantaneous Jacobiaian using central
difference method on a vector field.
mindist.m -- Computes the smallest difference of elements of a
vector.
* Visualization aides *
mehcolor.m -- Creates a colormap for visualization of 2d mesochronic
classes using values of determinant.
diverging_map.m -- Creates a diverging colormap between 2 colors.
Written by Andy Stein based on Kenneth Moreland's (Sandia) paper:
http://www.sandia.gov/~kmorel/documents/ColorMaps/
doi:10.1007/978-3-642-10520-3_9
* Additional files *
mcjacobian.prj -- Matlab Coder Project file, used to compile
mcjacobian.m into a fast compiled code.
Copyright (c) 2013, Regents of the University of California All rights
reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of
the University of California, Santa Barbara nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission. THIS
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.