tag:blogger.com,1999:blog-69209995608754699382024-02-21T23:57:37.115-08:00Spectral Element MethodA description of spectral and finite element method(s), theoretical, and implementation issues.Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-6920999560875469938.post-32372931705497406742013-11-21T23:57:00.001-08:002014-11-12T05:51:37.384-08:00How to control line spacing in bloggerThis is a very short post, I have been using a very interesting plugin for inserting code, and the a variety of languages are impressing. This is <a href="http://devhawk.net/2009/04/05/pygments-for-windows-live-writer/">Pygments for Windows Live Writer</a>. <br />
To my surprise I discovered the rather annoying (Enter –> double line spacing conversion) which is really an annoying convention adopted by blogger and for the new editor (what they call new look) the old setting –> Formatting –> No line breaks is absent.<br />
What I found that could solve this problem. Go to posts from the browser and pick any old post and choose options on the right hand side and choose the radio button Enter to line Breaks. That should eliminate all the extra spaces in the inserted code. <br />
As to whether it will be systematically applied to all the future posts I am not sure of it. But I kind of hope that it will persist, because it is really cumbersome to edit every post in the browser after posting it from the Windows Live Writer.<br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:a750890f-f753-4f75-a290-b63009084e24" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<span style="color: blue;"><br />
</span></div>
</div>
As a way to test if it will have double spacing or not? I have tried it and it does not work. Every time I will insert a code I have to edit it from the Browser.Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-38993714481744018532013-11-21T21:27:00.001-08:002013-11-21T23:31:50.109-08:00Python vs. Matlab<br />
<div align="justify">
<span style="font-size: small;">I was familiar with Python as an introduction language fro programming, I tried a couple of time a long time ago. The main impression that I had was that it is a bit slow although it still quite reasonable choice for prototyping specially it is free and platform independent. </span></div>
<div align="justify">
<span style="font-size: small;">I thought to revisit my old interest in Python, and here is an implementation of Julia sets that I fetched from a lecture on YouTube, one of many available that was delivered at scipy conferences. The problem is that I connot remember which one now that I watched.</span></div>
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:9288d6c6-fd1d-4e6e-bb1c-f33d8074ebfb" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<br />
<span style="color: green;"><b>import</b></span> <span style="color: blue;"><b>numpy</b></span> <span style="color: green;"><b>as</b></span> <span style="color: blue;"><b>np</b></span><br />
<span style="color: green;"><b>from</b></span> <span style="color: blue;"><b>time</b></span> <span style="color: green;"><b>import</b></span> time<br />
<br />
<span style="color: green;"><b>def</b></span> <span style="color: blue;">kernel</span>(z, c, lim, cutoff<span style="color: #666666;">=</span><span style="color: #666666;">1e6</span>):<br />
<span style="color: #ba2121;"><i>''' Computes the number, `n`, of iterations necessary such that<br /> |z_n| > `lim`, where `z_n = z_{n-1}**2 + c`.<br /> '''</i></span><br />
count <span style="color: #666666;">=</span> <span style="color: #666666;">0</span><br />
<span style="color: green;"><b>while</b></span> <span style="color: green;">abs</span>(z) <span style="color: #666666;"><</span> lim <span style="color: #aa22ff;"><b>and</b></span> count <span style="color: #666666;"><</span> cutoff:<br />
z <span style="color: #666666;">=</span> z <span style="color: #666666;">*</span> z <span style="color: #666666;">+</span> c<br />
count <span style="color: #666666;">+=</span> <span style="color: #666666;">1</span><br />
<span style="color: green;"><b>return</b></span> count<br />
<br />
<span style="color: green;"><b>def</b></span> <span style="color: blue;">compute_julia</span>(c, N, bound<span style="color: #666666;">=</span><span style="color: #666666;">2</span>, lim<span style="color: #666666;">=</span><span style="color: #666666;">1000.</span>, kernel<span style="color: #666666;">=</span>kernel):<br />
<span style="color: #ba2121;"><i>''' Pure Python calculation of the Julia set for a given `c`. </i></span><br />
<span style="color: #ba2121;"><i> No NumPy array operations are used.<br /> '''</i></span><br />
<br />
julia <span style="color: #666666;">=</span> np<span style="color: #666666;">.</span>empty((N, N), dtype<span style="color: #666666;">=</span>np<span style="color: #666666;">.</span>uint32)<br />
grid_x <span style="color: #666666;">=</span> np<span style="color: #666666;">.</span>linspace(<span style="color: #666666;">-</span>bound, bound, N)<br />
grid_y <span style="color: #666666;">=</span> grid_x <span style="color: #666666;">*</span> <span style="color: #666666;">1</span>j<br />
c <span style="color: #666666;">=</span> <span style="color: green;">complex</span>(c)<br />
t0 <span style="color: #666666;">=</span> time()<br />
<span style="color: green;"><b>for</b></span> i, x <span style="color: #aa22ff;"><b>in</b></span> <span style="color: green;">enumerate</span>(grid_x):<br />
<span style="color: green;"><b>for</b></span> j, y <span style="color: #aa22ff;"><b>in</b></span> <span style="color: green;">enumerate</span>(grid_y):<br />
julia[i,j] <span style="color: #666666;">=</span> kernel(x<span style="color: #666666;">+</span>y, c, lim)<br />
<span style="color: green;"><b>return</b></span> julia, time() <span style="color: #666666;">-</span> t0<br />
<br /></div>
</div>
<span style="font-size: small;">This two functions composed of the iterative kernel and the actual computation of the Julia set values on a grid composed of \(N X N \) grid. </span><br />
<span style="font-size: small;">The plotting part are as given below</span><br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:5489f26b-1a31-44d1-b87b-04c604f55998" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<br />
<span style="color: green;"><b>import</b></span> <span style="color: blue;"><b>pylab</b></span> <span style="color: green;"><b>as</b></span> <span style="color: blue;"><b>pl</b></span><br />
<span style="color: green;"><b>def</b></span> <span style="color: blue;">plot_julia</span>(kwargs, compute_julia):<br />
<span style="color: #ba2121;"><i>''' Given parameters dict in `kwargs` and a function to </i></span><i style="color: #ba2121;"> compute the Julia set (`compute_julia`), plots the </i><br />
<i style="color: #ba2121;"> resulting Julia </i><i style="color: #ba2121;">set with appropriately </i><i style="color: #ba2121;">labeled axes.</i><br />
<span style="color: #ba2121;"><i> '''</i></span><br />
kwargs <span style="color: #666666;">=</span> kwargs<span style="color: #666666;">.</span>copy()<br />
<span style="color: green;"><b>def</b></span> <span style="color: blue;">_plotter</span>(kwargs):<br />
bound <span style="color: #666666;">=</span> kwargs[<span style="color: #ba2121;">'bound'</span>]<br />
julia, time <span style="color: #666666;">=</span> compute_julia(<span style="color: #666666;">**</span>kwargs)<br />
<span style="color: green;"><b>print</b></span> <span style="color: #ba2121;">"execution time (s):"</span>, time<br />
julia <span style="color: #666666;">=</span> np<span style="color: #666666;">.</span>log(julia)<br />
pl<span style="color: #666666;">.</span>imshow(julia,<br />
interpolation<span style="color: #666666;">=</span><span style="color: #ba2121;">'nearest'</span>,<br />
extent<span style="color: #666666;">=</span>(<span style="color: #666666;">-</span>bound, bound)<span style="color: #666666;">*</span><span style="color: #666666;">2</span>)<br />
pl<span style="color: #666666;">.</span>colorbar()<br />
title <span style="color: #666666;">=</span> <span style="color: #ba2121;">r"Julia set for $C={0.real:5.3f}+{0.imag:5.3f}i$ $[{1}\times{1}]$"</span><br />
pl<span style="color: #666666;">.</span>title(title<span style="color: #666666;">.</span>format(kwargs[<span style="color: #ba2121;">'c'</span>], kwargs[<span style="color: #ba2121;">'N'</span>]))<br />
pl<span style="color: #666666;">.</span>xlabel(<span style="color: #ba2121;">"$Re(z)$"</span>)<br />
pl<span style="color: #666666;">.</span>ylabel(<span style="color: #ba2121;">"$Im(z)$"</span>)<br />
pl<span style="color: #666666;">.</span>figure(figsize<span style="color: #666666;">=</span>(<span style="color: #666666;">14</span>, <span style="color: #666666;">12</span>))<br />
<br />
cvals <span style="color: #666666;">=</span> [<span style="color: #666666;">0.285</span><span style="color: #666666;">+</span><span style="color: #666666;">0.01</span>j, <span style="color: #666666;">-</span><span style="color: #666666;">0.1</span><span style="color: #666666;">+</span><span style="color: #666666;">0.651</span>j, <span style="color: #666666;">-</span><span style="color: #666666;">0.4</span><span style="color: #666666;">+</span><span style="color: #666666;">0.6</span>j, <span style="color: #666666;">-</span><span style="color: #666666;">0.8</span><span style="color: #666666;">+</span><span style="color: #666666;">0.156</span>j]<br />
subplots <span style="color: #666666;">=</span> [<span style="color: #ba2121;">'221'</span>, <span style="color: #ba2121;">'222'</span>, <span style="color: #ba2121;">'223'</span>, <span style="color: #ba2121;">'224'</span> ]<br />
<br />
<span style="color: green;"><b>for</b></span> c, sp <span style="color: #aa22ff;"><b>in</b></span> <span style="color: green;">zip</span>(cvals, subplots):<br />
kwargs<span style="color: #666666;">.</span>update(c<span style="color: #666666;">=</span>c)<br />
pl<span style="color: #666666;">.</span>subplot(sp)<br />
_plotter(kwargs)<br />
pl<span style="color: #666666;">.</span>show()<br />
<br /></div>
</div>
<span style="font-size: small;">And here is the implementation</span><br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:c51fad04-b875-4592-912b-30f6b688d14d" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<br />
kwargs <span style="color: #666666;">=</span> <span style="color: green;">dict</span>(N<span style="color: #666666;">=</span><span style="color: #666666;">1000</span>, bound<span style="color: #666666;">=</span><span style="color: #666666;">1.5</span>)<br />
plot_julia(kwargs, compute_julia)<br />
<br /></div>
</div>
<span style="font-size: small;">and here is the output on my machine, </span><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0_qRddhw1sAeCSnOl8S7bqtCBC9UTVTQIgeYbL9P5R4bY_dhTaM9txW9cJgnGJ1hL4RNtMysjUE2wdmyrjZg5LTNEvQmsAamJs21txYwLcxiOw6wMHLWVYNROQYnGOu0XR9eABRNJ4LyU/s1600-h/Julia_sets_Python%25255B10%25255D.png"><img alt="Julia_sets_Python" height="330" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4zhyphenhypheni-5n1MmSDefId-4bocYtTa2Dvil3YyaQTPwHLsokI3qR6kzOlDQRpax9dGW2x8VK-SayUQizNty3VXX12dhT6X9Wn-_y4e3R_K48mAW2nmipEAylbbfimBsxrxsH5Y5_IoicQ3eQH/?imgmax=800" style="display: block; float: none; margin-left: auto; margin-right: auto;" title="Julia_sets_Python" width="592" /></a><br />
The execution times for the four figures was <br />
<pre>execution time (s): 37.7200000286
execution time (s): 97.0900001526
execution time (s): 44.8949999809
execution time (s): 72.1289999485</pre>
<pre><span style="font-size: small;">Somewhat slow !! </span></pre>
<pre><span style="font-size: small;">The matlab implementation of the same function are shorter and considerably faster.</span></pre>
<br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:b301604e-d16b-41ec-aeb3-b72fce66f765" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<span style="color: blue;">function</span> julia = compute_julia(N, bound, c)<br />
<br />
julia = uint32(zeros(N, N));<br />
grid_x = linspace(-bound, bound, N);<br />
grid_y = grid_x * 1j;<br />
<br />
<span style="color: blue;">for</span> j = 1:N<br />
<span style="color: blue;">for</span> i = 1:N<br />
julia(i,j) = kernel(grid_x(i)+grid_y(j), c);<br />
<span style="color: blue;">end</span><br />
<span style="color: blue;">end</span><br />
<span style="color: blue;">end</span><br />
<span style="color: blue;"><br />function</span> count = kernel(z, c)<br />
<br />
<span style="color: green;">%Computes the number, `n`, of iterations necessary such that</span><br />
<span style="color: green;">%|z_n| > `lim`, where `z_n = z_{n-1}**2 + c`.</span><br />
<br />
lim=1000;<br />
count = 0;<br />
cutoff=1e6;<br />
<span style="color: blue;">while</span> abs(z) < lim && count < cutoff<br />
z = z * z + c;<br />
count = count + 1;<br />
<span style="color: blue;">end</span><br />
<span style="color: blue;">end</span><br />
<br /></div>
</div>
And now for the actual computation with the same values as the ones used in the python code<br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:a063943a-21dc-46ec-a91a-2d9b4017eca7" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<br />
cvals = [0.285+0.01j, -0.1+0.651j, -0.4+0.6j, -0.8+0.156j];<br />
<span style="color: blue;">for</span> i = 1:4<br />
tic; julia = compute_julia(1000, 1.5, cvals(i)); toc<br />
subplot(2,2,i)<br />
image(julia)<br />
<span style="color: blue;">end</span><br />
<br /></div>
<br /></div>
<div align="justify">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzI_xrxh6EHBaeGeH5rs_9dbr7tkyxIEoM9t17SPMAn9YcSFGkHj6NOSgrzxc65NICuINlzN4vTmfmKtADgf4AxGUmMI7PXqsbQB1U20kbqYdVp45eTHDJ0boqF9iVxmICF4yjcYpIB0Us/s1600-h/Julia_sets_Matlab%25255B6%25255D.png"><img alt="Julia_sets_Matlab" height="457" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSg4ZMIfT5j7U4nKtxsr20Xf7-C7zaGKUG4oTmjyW-wZrik4LgYkTf1g4iKa9Ipwh1BCzqZVeDWZBf5mpe3mD5FSgDYPjEzOKtFTRqoGzrMaXSZeTfXpnsDnrvS7w_KSztCuEtCdQ7Nw_3/?imgmax=800" style="display: inline;" title="Julia_sets_Matlab" width="572" /></a></div>
<div align="justify">
<span style="font-size: small;">and here are the execution times</span></div>
<br />
Elapsed time is 7.515207 seconds.<br />
Elapsed time is 20.076634 seconds.<br />
Elapsed time is 8.709530 seconds.<br />
Elapsed time is 14.150072 seconds.<br />
<br />
<div align="justify">
<span style="font-size: small;">So, clearly the matlab is faster. But what if we used Cython with python and mex files with matlab? </span>The cython implementation is really one of the best automatic code generation tools ever. The ease with which the conversion is done is unsurpassed.</div>
<br />
<div align="justify">
<span style="font-size: small;">First and since I am using the Ipython –notebook we have to load the Cython magic</span></div>
<br />
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:cd5934f3-5a11-455a-8e67-e5f784a3bcca" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<span style="color: #666666;">%</span>load_ext cythonmagic</div>
</div>
<div class="wlWriterEditableSmartContent" id="scid:2EC9848E-067D-4e79-BAB7-06CA927DB962:673f44ea-f8c2-4ef6-a034-b3fda769db63" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<div style="font-family: consolas,lucida console,courier,monospace;">
<span style="color: #666666;"><br /></span>
<span style="color: #666666;">%%</span>cython<br />
<br />
<span style="color: green;"><b>from</b></span> <span style="color: blue;"><b>time</b></span> <span style="color: green;"><b>import</b></span> time<br />
<span style="color: green;"><b>import</b></span> <span style="color: blue;"><b>numpy</b></span> <span style="color: green;"><b>as</b></span> <span style="color: blue;"><b>np</b></span><br />
cimport cython<br />
cimport numpy <span style="color: green;"><b>as</b></span> cnp<br />
ctypedef double <span style="color: green;">complex</span> cpx_t<br />
ctypedef double real_t<br />
<br />
cdef inline real_t cabs_sq(cpx_t z) nogil:<br />
<span style="color: #ba2121;"><i>''' Helper inline function, computes the square of the abs. </i></span><br />
<span style="color: #ba2121;"><i> value of the complex number `z`.<br /> '''</i></span><br />
<span style="color: green;"><b>return</b></span> z<span style="color: #666666;">.</span>real <span style="color: #666666;">*</span> z<span style="color: #666666;">.</span>real <span style="color: #666666;">+</span> z<span style="color: #666666;">.</span>imag <span style="color: #666666;">*</span> z<span style="color: #666666;">.</span>imag<br />
<br />
cpdef unsigned <span style="color: green;">int</span> kernel(cpx_t z,<br />
cpx_t c,<br />
real_t lim,<br />
real_t cutoff<span style="color: #666666;">=</span><span style="color: #666666;">1e6</span>) nogil:<br />
<span style="color: #ba2121;"><i>''' Cython implementation of the kernel computation.<br /> This is implemented so that no</i></span><br />
<span style="color: #ba2121;"><i> C-API calls are made inside the function<br /> body. Even still, there is some overhead as compared </i></span><br />
<span style="color: #ba2121;"><i> with a pure C implementation.<br /> '''</i></span><br />
cdef unsigned <span style="color: green;">int</span> count <span style="color: #666666;">=</span> <span style="color: #666666;">0</span><br />
cdef real_t lim_sq <span style="color: #666666;">=</span> lim <span style="color: #666666;">*</span> lim<br />
<span style="color: green;"><b>while</b></span> cabs_sq(z) <span style="color: #666666;"><</span> lim_sq <span style="color: #aa22ff;"><b>and</b></span> count <span style="color: #666666;"><</span> cutoff:<br />
z <span style="color: #666666;">=</span> z <span style="color: #666666;">*</span> z <span style="color: #666666;">+</span> c<br />
count <span style="color: #666666;">+=</span> <span style="color: #666666;">1</span><br />
<span style="color: green;"><b>return</b></span> count<br />
<br />
<span style="color: #aa22ff;">@cython</span><span style="color: #666666;">.</span>boundscheck(<span style="color: green;">False</span>)<br />
<span style="color: #aa22ff;">@cython</span><span style="color: #666666;">.</span>wraparound(<span style="color: green;">False</span>)<br />
<br />
<span style="color: green;"><b>def</b></span> <span style="color: blue;">compute_julia_opt</span>(cpx_t c,<br />
unsigned <span style="color: green;">int</span> N,<br />
real_t bound<span style="color: #666666;">=</span><span style="color: #666666;">1.5</span>,<br />
real_t lim<span style="color: #666666;">=</span><span style="color: #666666;">1000.</span>):<br />
<span style="color: #ba2121;"><i>'''<br /> Cython `compute_julia()` implementation with Numpy array buffer<br /> declarations and appropriate compiler directives. The body of this<br /> function is nearly identical to the `compute_julia_no_opt()` </i></span><br />
<span style="color: #ba2121;"><i> function.<br /> '''</i></span><br />
cdef cnp<span style="color: #666666;">.</span>ndarray[cnp<span style="color: #666666;">.</span>uint32_t, ndim<span style="color: #666666;">=</span><span style="color: #666666;">2</span>, mode<span style="color: #666666;">=</span><span style="color: #ba2121;">'c'</span>] julia<br />
cdef cnp<span style="color: #666666;">.</span>ndarray[real_t, ndim<span style="color: #666666;">=</span><span style="color: #666666;">1</span>, mode<span style="color: #666666;">=</span><span style="color: #ba2121;">'c'</span>] grid<br />
cdef unsigned <span style="color: green;">int</span> i, j<br />
cdef real_t x, y<br />
<br />
julia <span style="color: #666666;">=</span> np<span style="color: #666666;">.</span>empty((N, N), dtype<span style="color: #666666;">=</span>np<span style="color: #666666;">.</span>uint32)<br />
grid <span style="color: #666666;">=</span> np<span style="color: #666666;">.</span>linspace(<span style="color: #666666;">-</span>bound, bound, N)<br />
t0 <span style="color: #666666;">=</span> time()<br />
<span style="color: green;"><b>for</b></span> i <span style="color: #aa22ff;"><b>in</b></span> <span style="color: green;">range</span>(N):<br />
x <span style="color: #666666;">=</span> grid[i]<br />
<span style="color: green;"><b>for</b></span> j <span style="color: #aa22ff;"><b>in</b></span> <span style="color: green;">range</span>(N):<br />
y <span style="color: #666666;">=</span> grid[j]<br />
julia[i,j] <span style="color: #666666;">=</span> kernel(x<span style="color: #666666;">+</span>y<span style="color: #666666;">*</span><span style="color: #666666;">1</span>j, c, lim)<br />
<span style="color: green;"><b>return</b></span> julia, time() <span style="color: #666666;">-</span> t0</div>
<br /></div>
<div align="justify">
<span style="font-size: small;">This only an alternative implementation of the of the compute Julia sets. No modification is made to the plotting function. The results of the execution time is !!!</span><br />
<span style="font-size: small;"><br /></span></div>
<pre>execution time (s): 0.107000112534
execution time (s): 0.279000043869
execution time (s): 0.123000144958
execution time (s): 0.197000026703</pre>
<pre>
</pre>
<span style="font-family: Arial; font-size: small;">Well that was fast, I used </span><a href="https://store.continuum.io/cshop/anaconda/"><span style="font-family: Arial; font-size: small;">anaconda python distribution</span></a><span style="font-family: Arial; font-size: small;">, with the MinGW package within it to compile the code with the accelerate module activated. </span><br />
<div align="justify">
<pre><span style="font-family: Arial; font-size: small;">Now for the comparison to be fair we need to use a similar acceleration trick, by transforming the matlab code into a mex file. This is done and the comparison of the execution times used by matlab mex function with VS 2012 as compiler is given below</span></pre>
<pre><span style="font-family: Arial; font-size: small;">
</span></pre>
</div>
<div align="justify">
<pre>Elapsed time is 0.828125000000000 seconds
Elapsed time is 2.140625000000000 seconds
Elapsed time is 0.953125000000000 seconds
Elapsed time is 1.484375000000000 seconds</pre>
</div>
<div align="justify">
<pre><span style="font-family: Arial; font-size: small;">
</span></pre>
<pre><span style="font-family: Arial; font-size: small;">So even when loading the mex file Cython is faster than matlab, and considering that I am still novice in both the mex files and python –cython conversions. I am sure there is still a huge room for improvement. But this is pretty impressive work by the python and cython community . I am considering seriously migrating completely to Python. </span></pre>
</div>
Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-52190322729935988552013-11-13T04:48:00.001-08:002013-11-21T23:30:27.833-08:00Blasius Equation: Some Explorations Part 4<h1 align="justify">
<span style="font-size: large;"><em>Boundary Layer Thickness</em></span></h1>
<div align="justify">
There is no sharp outer edge of the boundary layer. Rather it merges smoothly and gradually with the outer free stream. However, there are several rational ways of defining a boundary layer thickness, and we consider one of them here. The idea is determining where the horizontal velocity is nearly equal to the free stream velocity or a constant ratio of it. The thickness , is the y-value at which the u velocity is 0.90 of the free stream velocity. In order to find that value we have need to wrap the previous pieces of code into a single function which is listed below </div>
<hr />
<span style="font-family: Courier New;"><strong><span style="font-size: small;"><span style="color: blue;">function</span> [eta, fun] = BLThickness(x, <span style="color: #4bacc6;">lim</span>)<br /> <span style="color: blue;">function</span> B= BlasVal(y)<br /> options = odeset(<span style="color: #9b00d3;">'RelTol'</span>, 1e-10, <span style="color: #9b00d3;">'AbsTol'</span>, 1e-12);<br /> sol=ode45(@BlasiusFunc, [0,15], [0.0 0.0 1.0], options);<br /> alpha = sqrt(sol.y(2,end));<br /> f = (deval(sol, (y./alpha)));<br /> B = (f(2)./alpha^2)-<span style="color: #4bacc6;">lim</span>;<br /> <br /> <span style="color: blue;">function</span> df = BlasiusFunc(~,f)<br /> df = zeros(3,1);<br /> df(1) = f(2);<br /> df(2) = f(3);<br /> df(3) = -f(1)*f(3)/2;<br /> <span style="color: blue;">end</span><br /> <span style="color: blue;">end</span></span></strong></span><br />
<span style="font-family: Courier New;"><strong><span style="font-size: small;"><span style="color: blue;"><br /></span> [eta, fun]= fzero(@BlasVal, x);<br /><span style="color: blue;">end</span></span></strong></span><br />
<hr />
<div class="csharpcode">
So, in order to compute the value of the <span style="font-size: small;">\(\eta_{90}\) </span></div>
<div class="csharpcode">
<span style="font-size: small;"><span style="font-family: Courier New;"><strong>BLThickness(3, 0.9)</strong></span> </span> </div>
<div class="csharpcode">
This gives the value of that corresponds to<span style="font-size: small;"> \(\frac{u}{U_{\infty}}\)=0.90</span>. So the thickness of the boundary layer is given by: <span style="font-size: small;">\[\delta_{90} = \eta_{90} \delta = \eta_{90} \sqrt{\frac{\mu x}{U_{\infty}}} \]</span></div>
<blockquote>
</blockquote>
<br />
<br />
Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com2tag:blogger.com,1999:blog-6920999560875469938.post-53426747054118193212013-11-11T22:55:00.001-08:002013-11-13T05:22:57.110-08:00LaTeX in Blogs<p align="justify">Well I had tried several times to add math into the blog in a way that will be satisfying for the regular LaTeXian. As you can see from my previous posts that it is not very successful, I had to insert the symbols as images and the alignment is horrible, it may have worked with the equations but the inline math is absolutely ridiculous. So I came across this site of <a href="http://www.dessci.com/en/support/mathtype/works_with.asp#!target=blogger">mathtype</a>, which is a commercial software for typesetting math. And I found that the same info could be used without even having the software at all.</p> <ol> <li>From the left sidebar of the Dashboard, click <b>Layout</b>. <li>Beneath the Header section of Layout, click <b>Add a Gadget</b>. <li>Scroll down until you find the gadget labeled <b>HTML/JavaScript</b>, and click the <b>+</b> to the upper right of that gadget:<br><img border="0" src="http://www.dessci.com/en/products/mathtype/ww/post/targets/blogger/html_gadget.png" width="320" height="63"> <li>Give it whatever title you want (it won't show on the blog). <i>MathJax</i> seems like an appropriate title. <li>In the Content area, paste or type this code (it’s all 1 line; just let it wrap when it gets to the end):<pre><script type="text/javascript"<br /> src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"><br /></script></pre><br /><li>Click <b>Save</b>. <br /><li>When the Gadget window closes, you should be back on the <b>Layout</b> screen, so click the orange <b>Save Arrangement</b> button near the top. </li></ol><br /><p>Now having followed this steps, and since I am using Windows Live Writer it would be interesting to see how it will turn out. Which is this post all about. For <strong>Display</strong> style math<strong> </strong>you just use the <strong>\[ </strong>and <strong>\] </strong>enclosing whatever \(\LaTeX \) formula you want to add.\[\sqrt {{\alpha^2} + {\beta^2}} \] And here for the inline format \(\sqrt {{\alpha^2} + {\beta^2}} \) where the enclosing brackets are <strong>\(</strong> and<strong> \)</strong> . And now I have to see the result of posting directly from the windows Live writer this formulas and how it will appear. It seems that it works very well. </p> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com1tag:blogger.com,1999:blog-6920999560875469938.post-7605041091498123022013-05-26T22:59:00.001-07:002014-11-11T16:29:30.506-08:00Blasius Equation: Some Explorations Part 3<div align="justify">
<br /></div>
<div align="justify">
In the previous post we have solved a modified form of Blasius equation using matlab. But the free pramater that is used for the scaling are not detemined. Here we continue the exploration of solution of the Blasius Equation. The parameter \( \alpha \) does not appear in g formulation, and we can solve for numerically. After solving for g, we choose: </div>
<div align="justify">
\begin{equation}\alpha = \sqrt{g’(\infty)} \end{equation}</div>
<div align="justify">
Then \( f \) will satisfy the proper condition at infinity. With this choice of \(\alpha\), we obtain \( f \) as<br />
\begin{equation} f(\eta) = \frac{1}{\alpha} g\left( \frac{\eta}{\alpha} \right) \end{equation} In the numerical integration to get the solution was carried out to \( \eta \) = 15. As we see from the plot, this is more than we need. The velocity function levels off well before = 10.</div>
<div align="justify">
We can now determine \(\alpha \): </div>
<div align="justify" class="csharpcode">
<pre class="alt">>> alpha = sqrt(sol.y(2,end))</pre>
<pre class="alt">alpha = 1.444094587085306</pre>
</div>
<div align="justify" class="csharpcode">
Finally we map back to the original function f . Then we check the boundary condition and check for the boundary value of f.</div>
<div align="justify" class="csharpcode">
<pre class="alt">>> f = (deval(sol, ([0 13]./alpha)));</pre>
</div>
<div>
>> <span style="font-family: Courier New;">f(1,1)/alpha</span></div>
<br />
<div align="justify" class="csharpcode">
<pre class="alt">ans = 0</pre>
</div>
<h2>
<span style="color: #0b5394; font-family: Arial, Helvetica, sans-serif; font-size: large;">Fluid Velocity Components</span></h2>
<div align="justify">
The scaled horizontal velocity component is given by: \[ \frac{u}{U_{\infty}} = f’(\eta) \]</div>
<hr />
<span style="font-family: 'Courier New';">>> eta = linspace(0,6, 100);</span><br />
<div align="justify" class="csharpcode">
<pre>>> f = (deval(sol, (eta./alpha)));</pre>
</div>
<div>
<span style="font-family: Courier New;">>> plot(eta, f(2,:)./alpha^2, <span class="str"><span style="color: #9b00d3;">'r'</span></span>,<span class="str"><span style="color: #9b00d3;">'LineWidth'</span></span>, 2.5)</span></div>
<div align="justify" class="csharpcode">
<pre class="alt">>> xlabel(<span class="str"><span style="color: #9b00d3;">'\eta'</span></span>); ylabel(<span class="str"><span style="color: #9b00d3;">'u/U_\infty'</span></span>)</pre>
</div>
<div>
<span style="font-family: Courier New;">>> ylim([0 1.5])</span><br />
<hr />
<br /></div>
<div align="justify" class="csharpcode">
<pre class="alt"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTyvwx0N8_N2ciYRw8DQcDGLfo8Kr3QO2Tw8j5HSrYbaZw-m-Gb-s-YRjdayNiNuX9YUHWDAEbiJ9gD1c6kSiFJYaRbYKMSMQudKoWUDPPxzuL0dgdJA4sgGjUIDpcFZSBekLpQO14HUam/s1600-h/Vel_U.png"><img alt="Vel_U" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQCIY_9andGds53uoqKaRLfNTAtr4_u69gCOPSrcakPH6vJh1TP9JaOlzdH2rYyNXRC7NtTz2XYMJBonk6YgXD8s62re5MhHoWrTyUMYL2HkJyy3SIi3NYcNBWfAojljkpHB5-MMbSjvTJ/?imgmax=800" height="283" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="Vel_U" width="400" /></a></pre>
</div>
<br />
<div align="justify">
The vertical Component is given by: \[ v = \frac{1}{2} \sqrt{\frac{\mu U_{\infty}}{x}} y_F \] <br />
where \(y_F\) is defined as \[ y_F = \eta f’(\eta) – f(\eta) \]</div>
<br />
<div align="justify">
<span style="font-family: Courier New;">>> eta = linspace(0,10, 200);</span></div>
<div align="justify">
<span style="font-family: Courier New;">>> f = (deval(sol, (eta./alpha)));<br />>> plot(eta, eta.*f(2,:)./alpha^2-f(1,:)./alpha, <span class="str"><span style="color: #9b00d3;">'g'</span></span>,<span class="str"><span style="color: #9b00d3;">'LineWidth'</span></span>, 2.5)</span></div>
<div align="justify">
<span style="font-family: Courier New;">>> xlabel(<span class="str"><span style="color: #9b00d3;">'\eta'</span></span>); ylabel(<span class="str"><span style="color: #9b00d3;">'v_s'</span></span>)</span></div>
<div align="justify">
<span style="font-family: Courier New;">>> ylim([0 2])</span></div>
<br />
<div align="justify" class="csharpcode">
<pre class="alt"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc4UqGqtowGg3ChiT292gahk6zy_ZQUbzOUqXFqW8p4e47j6BnvkuU62whuw23Y-4_GwL5M9v98uXP_cW8sGJ026Ey0t8IHCMqW6NWKD5p9PmdcyZhOstz2Valj9v8Uu7LBXWHIJbTQysI/s1600-h/Vel_v.png"><img alt="Vel_v" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWV4dT6BGl9RlcoJzcTdTWC6jfwQH1oclK5jFZEhDo697snrOZaft9X9mxyZ8InAqTbmZvtG3FK-Qj1o1Zpn-rC3sb2QNGaQfKSQkFOJV98ZqlRpNbtxCGnd965RIBTNXTeo2VxZyT1tF1/?imgmax=800" height="284" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="Vel_v" width="400" /></a></pre>
</div>
<br />
<br />
<div align="justify">
We see indeed that there is a constant vertical velocity at the outer limit of the boundary layer. This is caused by the retardation in the boundary layer, which in turn deflects some of the oncoming fluid upward. At the outer edge of the boundary layer \[ v = \frac{1}{2} \sqrt{\frac{\mu U_{\infty}}{x}}c_{\infty} = \frac{U_{\infty}c_{\infty}}{2 \sqrt{Re_x}} \]</div>
<br />
<div align="justify">
In the next post I will explore the boundary layer thickness. </div>
<br />Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-67557413202994053082013-05-26T22:25:00.001-07:002013-05-27T00:28:54.268-07:00Blasius Equation: Some Explorations Part 2<h1 align="justify">
<span style="font-size: large;"><span style="font-weight: normal;"><em>Solution of Blasius Equation in Matlab</em></span></span></h1>
<div align="justify">
A direct attack on the Blasius equation requires some kind of iteration such as a shooting method, because it is a two-point boundary value problem. Fortunately, there is a reformulation of the problem that avoids an iteration. We begin this reformulation by introducing a new dependent variable : </div>
<blockquote>
<div align="justify">
<img alt="g(\eta ) = \alpha f(\alpha \eta )" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4zaiaacIcaqaaaaaaaaaWdbiabeE7aOjaacMcacqGH9aqpcqaHXoqycaWGMbGaaiikaiabeg7aHjabeE7aOjaacMcaaaa!423A!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=g%28%5Ceta%20%29%20%3D%20%5Calpha%20f%28%5Calpha%20%5Ceta%20%29" /></div>
</blockquote>
<div align="justify">
Where<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBWvRP1i-DW26sRd7WV9-P0e9P-vxHiN_3tj1V3QkZvUq1Dun0L6zufAKdTPznSeqVKMrui4pUS_XgtvpLntr-9U7O1cg7C42scBp-O_N2Rc-_GqbhNm4tL23PcmBA5qdG3ItGkeQUVRBN/s1600-h/image10.png"><img alt="image" height="11" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR1NId40v8lwQsgI6fFdAO420mS5wQ94jn5OCbi_HBl6e2G9L1CEOr3J27ToE_VbdVkAFrZOcOQCDvIYhQsmvJ4xie6ARA16rZRB5aI8OK1YfMduWAgLdK3tr2ojBq8qe7EDvjau4EZVpg/?imgmax=800" style="display: inline;" title="image" width="10" /></a> is a positive parameter to be determined. As one may show, the equation for g is then the same as that for f: </div>
<blockquote>
<img alt="g(0) = 0,\;g'(0) = 0,\;g''(0) = 1" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4zaiaacIcacaaIWaGaaiykaiabg2da9iaaicdacaGGSaGaaGjbVlqadEgagaqbaiaacIcacaaIWaGaaiykaiabg2da9iaaicdacaGGSaGaaGjbVlqadEgagaGbaiaacIcacaaIWaGaaiykaiabg2da9iaaigdaaaa!48C6!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=g%280%29%20%3D%200%2C%5C%3Bg%27%280%29%20%3D%200%2C%5C%3Bg%27%27%280%29%20%3D%201" /></blockquote>
From the conditions on f , we have g(0) = 0, and <br />
<br />
<img alt="g'(\eta ) = {\alpha ^2}f'(\alpha \eta ) \to {\alpha ^2}" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGabm4zayaafaGaaiikaabaaaaaaaaapeGaeq4TdGMaaiykaiabg2da9iabeg7aH9aadaahaaWcbeqaa8qacaaIYaaaaOWdaiqadAgagaqbaiaacIcapeGaeqySdeMaeq4TdGMaaiykaiabgkziUkabeg7aH9aadaahaaWcbeqaa8qacaaIYaaaaaaa!4818!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=g%27%28%5Ceta%20%29%20%3D%20%7B%5Calpha%20%5E2%7Df%27%28%5Calpha%20%5Ceta%20%29%20%5Cto%20%7B%5Calpha%20%5E2%7D" style="display: inline; float: left;" /><br />
<span style="font-family: Times New Roman; font-size: medium;"><br /></span>
<span style="font-family: Times New Roman; font-size: medium;">as</span><br />
<br />
<span style="font-family: Times New Roman; font-size: medium;"></span><img alt="\eta \to \infty " longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaaeaaaaaaaaa8qacqaH3oaAcqGHsgIRcqGHEisPaaa!3B20!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=%5Ceta%20%20%5Cto%20%5Cinfty%20" /> <br />
<br />
Instead of imposing the condition on g at infinity , we impose <br />
<br />
<img alt="g''(0) = 1." longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGabm4zayaagaGaaiikaiaaicdacaGGPaGaeyypa0JaaGymaiaac6caaaa!3B75!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=g%27%27%280%29%20%3D%201." /><br />
<br />
Then the problem for g is an initial value problem with initial conditions<br />
<img alt="g(0) = 0,\;g'(0) = 0,\;g''(0) = 1" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4zaiaacIcacaaIWaGaaiykaiabg2da9iaaicdacaGGSaGaaGjbVlqadEgagaqbaiaacIcacaaIWaGaaiykaiabg2da9iaaicdacaGGSaGaaGjbVlqadEgagaGbaiaacIcacaaIWaGaaiykaiabg2da9iaaigdaaaa!48C6!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=g%280%29%20%3D%200%2C%5C%3Bg%27%280%29%20%3D%200%2C%5C%3Bg%27%27%280%29%20%3D%201" /><br />
In order to carry out this integration numerically using matlab, we need to convert the 3<sup>rd</sup> order differential equation into a system of three 1st order equations. <br />
<blockquote>
<img alt="{y_1} = g,{y_2} = g',{y_3} = g''" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEamaaBaaaleaaqaaaaaaaaaWdbiaaigdaa8aabeaakiabg2da9iaadEgacaGGSaGaamyEamaaBaaaleaapeGaaGOmaaWdaeqaaOGaeyypa0Jabm4zayaafaGaaiilaiaadMhadaWgaaWcbaWdbiaaiodaa8aabeaakiabg2da9iqadEgagaGbaaaa!4381!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=%7By_1%7D%20%3D%20g%2C%7By_2%7D%20%3D%20g%27%2C%7By_3%7D%20%3D%20g%27%27" /></blockquote>
We have the following equivalent system of equations <br />
<blockquote>
<img alt="{y_1}^\prime = {y_2},\quad {y_2}^\prime = {y_3},\quad {y_3}^\prime = - 0.5{y_1}{y_3}" longdesc="MathType!MTEF!2!1!+-feaagGart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-xfr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEamaaBaaaleaaqaaaaaaaaaWdbiaaigdaa8aabeaakmaaCaaaleqabaGccWaGGBOmGikaaiabg2da9iaadMhadaWgaaWcbaWdbiaaikdaa8aabeaakiaacYcacaaMf8UaamyEamaaBaaaleaapeGaaGOmaaWdaeqaaOWaaWbaaSqabeaakiadacUHYaIOaaGaeyypa0JaamyEamaaBaaaleaapeGaaG4maaWdaeqaaOGaaiilaiaaywW7caWG5bWaaSbaaSqaa8qacaaIZaaapaqabaGcdaahaaWcbeqaaOGamai4gkdiIcaacqGH9aqpcqGHsislcaaIWaGaaiOlaiaaiwdacaWG5bWaaSbaaSqaa8qacaaIXaaapaqabaGccaWG5bWaaSbaaSqaa8qacaaIZaaapaqabaaaaa!5868!" src="http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=%7By_1%7D%5E%5Cprime%20%20%3D%20%7By_2%7D%2C%5Cquad%20%7By_2%7D%5E%5Cprime%20%20%3D%20%7By_3%7D%2C%5Cquad%20%7By_3%7D%5E%5Cprime%20%20%3D%20%20-%200.5%7By_1%7D%7By_3%7D" /></blockquote>
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 1: </span>>> blas =@(t,f) [f(2); f(3); -0.5*f(1)*f(3)];</pre>
<pre><span class="lnum"> 2: </span>>> options = odeset(<span class="str"><span style="color: #9b00d3;">'RelTol'</span></span>, 1e-10, <span class="str"><span style="color: #9b00d3;">'AbsTol'</span></span>, 1e-12);</pre>
<pre class="alt"><span class="lnum"> 3: </span>>> sol=ode45(blas, [0,15], [0.0 0.0 1.0], options);</pre>
<pre><span class="lnum"> 4: </span>>> plot(sol.x, sol.y(2,:), <span class="str"><span style="color: #9b00d3;">'LineWidth'</span></span>, 2.5)</pre>
<pre class="alt"><span class="lnum"> 5: </span>>> xlabel(<span class="str"><span style="color: #9b00d3;">'\eta'</span></span>); ylabel(<span class="str"><span style="color: #9b00d3;">'g(\eta)'</span></span>)</pre>
<pre><span class="lnum"> 6: </span>>> plot(sol.x, sol.y(2,:), <span class="str"><span style="color: #9b00d3;">'LineWidth'</span></span>, 2.5)</pre>
<pre class="alt"><span class="lnum"> 7: </span>>> xlabel(<span class="str"><span style="color: #9b00d3;">'\</span><span style="color: #9b00d3;">eta'</span></span>); ylabel(<span class="str"><span style="color: #9b00d3;">'g(\eta)'</span></span>)</pre>
</div>
<br />
<style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi34OQ89pQUAOQrvtKw7kGuIEDhJEYV1V0v5J8sEtncydAIuGISFRCLZj1NPt1iw68oYw4eztrr7cWPUPuqCcdmizt7z6vEQtCp_y47VTkjjxRbBGH496NMXWxcCgvLhpQ24fm2_mBOHkxM/s1600-h/blas.png"><img alt="blas" border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9l9WmiZfxCSe9EbapLDkvFDr7pYqnqAt1gro2f3UVw_C288-whyiv9OYD_SCpzjfXb8WrWUEilbCOK9GBauz74tIX0fuEUSRKWoOQZwqBC-kOkBCbhNtqlmA6gVf7DEl05Bm6KECxd0fD/?imgmax=800" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="blas" width="550" /></a><br />
<br />
<br />
<br />
<br />
<br />Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-90853723640519595622013-05-26T20:16:00.001-07:002013-05-26T20:16:44.159-07:00Blasius Equation: Some Explorations - Part 1<p> </p> <h1 align="justify"></h1> <h1 align="justify"><font size="5"><font style="font-weight: normal"><em>What is Blasius Equation:</em></font></font></h1> <p align="justify">Blasuis Equation describes the flow of a fluid over a flat plate.</p> <p align="justify">The x-y coordinate system is chosen so that x is along the plate, and y is perpendicular to the plate. The leading edge of the plate is at x = 0, y = 0. The velocity components - u in the x-direction and v in the y-direction -- are expressed in terms of a stream function (x,y): <blockquote> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKRvadaMiMlWN2K5LPyzvIz9XbUfGIM__RKO7iFsrpjSx1gLGom1AtRK7NVbOnmiCuyDOMP_PIC7WbPtDfjPow3bTcoqNJ-UFuDJzOaDbmW_7xrZwuyOPqNyoCCUGAXjaEvtMCsvwHL1hA/s1600-h/image%25255B2%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3mu7weEFmlXIH_VDLJIolpYemRm5O896gNVmXxDAPyFYYNA5jkY7uRiiIrJL8UGQRTCs2Uu_LvGXtOG1iP1Ctb2q_KaLeyxWb3C32sKcBML8bS1ab8bE9KEb_7iBcbzxzeElE8f1rSFzC/?imgmax=800" width="244" height="48"></a></p></blockquote> <p align="justify">The fundamental equation which determines y is the x-component of the momentum equation in the boundary layer approximation. For the flat plate there is no pressure gradient, and the boundary layer approximation to the x-momentum equation takes the form <blockquote> <p align="justify"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgacdHv62xOYTCm4ghmQB_kxgy6wAOe5k_MOqBEL6UI4o9XvY2O5cpuNq5v1er8KLbY294QsE6UgMd_yo95_eYess3Vr53OTumoYb-5VhamSkn16cXuabwXB4LrbOd0YPk0bnZF-Ky03Poy/s1600-h/image%25255B5%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOWlAnhJmPb1rKDc49n9DldCPetco4TdRRwNo2MdS5UusBXi8F4I1NJAGVlWIIDbRBfC4eK9rtXj8klTCi6Tv4jjKLDOGY4ZeTy3_Gzr8Jdi9dwpP9Eb9KFD8xmihYA5wNGmu2t2BPq1z7/?imgmax=800" width="244" height="48"></a></p></blockquote> <p align="justify">Where is the kinematic viscosity. By substituting the first eqaution into the second, we get for the partial differential equation <blockquote> <p align="justify"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjawAxY1wFv7PK10BaPTg6UuD1g7pGNPW65p9w0NVmnHS6Gro4-XwF7Jfj9imyjLeDfnpYbnFzCC9s7Cd4Xa_YPYULX89cREBKO0ey2LD6Ko02uDTyzvfTzxdkRTV2PjqwHYN_ZPRUaMU_s/s1600-h/image%25255B9%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv9a6g1B7AJjxMr12IDv2hgjQTVrljr0NJYtsALhSmC2kM8ODr7YFbNVScCeDkDw9mGLKgCbz7534dXsxymtbdLMT-29wX8Zbju6AaE9D9wRZbzaMGmFYE-Vv8ClRUlmRNooJeuhMLMg62/?imgmax=800" width="311" height="54"></a></p></blockquote> <p>At the wall (y = 0) both velocity components must vanish, and far away from the plate, the horizontal velocity must approach the given free stream velocity <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrmfi8T2RTTb6FxEQQFKsYMyXSiTepVPkgsB1lfVsljbiTg2bbDtSEoMiDW32u68DLVCocrNxS9LK60uxPT5L84zLz1dysuKkOWg8xaLVtAu7BcOeoabVYglNMCEfwyXlRYaiFruf1Oqe/s1600-h/image%25255B24%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjro5OLakZu4ZurMgWs9Ybd8iSa775bmmnomrueTzsex63bI3kZF2EeJ7hZXOpfEVvMOTHrJwvhLAeMtSzT-fTgmM7ur8Xuin8eJIVGzN3sEUtO-OfQd843iKeC9toC6Qk8B2aToTStw8VY/?imgmax=800" width="19" height="18"></a> . These conditions translate into the following conditions on <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtlT5r_vUmO3MyXpyJ8Dy9qmY7ISXVgjnvYUn5DkkFJFikW8AJHykgGHwhto94HWBSskewu7gURCLl2wKv29oKaT_DgCnpAEg9COpPz6H4eXdNJapRtxVzviC2ztKcT9novDwZ5NPsScVc/s1600-h/image%25255B23%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcD6olIi6G63hGc0yOAXYLaX74P6dHVURHz7pwB2AFo7X88bFDX4Y2Bctma0pIlxy9Bjx6jmFUEKTDWtrSn3mmUWPZJ0evhtPqpnd8xbXs-TBOJoVPYjWWvrvCR5-W_hCf_mbCR7mHIvfR/?imgmax=800" width="13" height="16"></a>: <blockquote> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS4eUbUmqmt3SE1799za9U05-ipmJ8txiySb-3ZE0tfl2t3lBlgFT3J37llGE35Sq_gbc_CJCkRGp22eMjl3utWlDCL0JOwMB2mcC9d2mKEO5T5pG9RL17IgyqKjJSbV-T1nbOPy1kK0KL/s1600-h/image%25255B28%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNlej1t_0ij6HxLvmz-pUgYbZ6yHce01W23vW9Zcp9T7nAReAu2rf81uRgm84VjbrkSkn9GOre0yNOge85irFOjO2QMHjLBLVGMfJPLa3iAsAKSmG9Ph3fP1_aUkg5K8qKHrr8Zzh4GwEc/?imgmax=800" width="517" height="45"></a></p></blockquote> <p>The absence of a length scale (the plate is semi-infinite in length) suggests a similarity solution, as originally used by Blasius. The solution has the form:</p> <blockquote> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJFbPieHeL_zoOE4Al8wjMAxgSkdOEJTGzyoRmJovA-0tVzPQI6eG4J194NJiNK7xFAY0BxtfO7vJTcbHvJo9OhbSCIbb0ILnrRV8V70ZX4VCFaCZ5FHriS6wCpehyowPA1AWhjjAvc0LS/s1600-h/image%25255B32%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8K1iTTVkVodsELsIdJmvT-3OOALwghQ4PgMSPUiurimKiEiJ56sE43NMa1eILgtOZk6pPaRy3QJDOab6CRbZXvocR0mo6O-zM52cP4-TVQiQwlECHOadmlqqffBljDt2qJF9e8E-I8dx0/?imgmax=800" width="567" height="44"></a></p></blockquote> <p>The scale<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7EEU4huNaTZ8kXot7v_EoAxYyJUcznkV8bZGahhxRz5Br5ksfIyjCtUylpgyPsDa3dhQrF-ob79lNtoWm1DyGb40ROkgxvgE22QIaSaFkZeTT1pcD3DG_VJCQH05TnEC-cjW2GCRs4AMv/s1600-h/image%25255B37%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc7mEoA8BAPb0qVvR0RmJMebIRJlYswY6qXDA1VQx1eFsE1dbXkahW85qNW2aZhz68rlQY_AntSwV7UvPAIK6kbSFMG3cDJthsD1O2WXe_WbWRkVhAN8mvkTFGn4q5kCVbFg-5bbPzPnvU/?imgmax=800" width="16" height="23"></a> is comparable with the boundary layer thickness. This substitution into the equation for <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1LHNY_VcdyUmwViW_tU8M0rg8Gg1E0F-SRrG305-9pBA8oP5_N3pvVjBH7VZoVAnG_nDjOwIo9uyznaYoUyFEEPKH8Z3p9YlNOmraRCeyCD5x9vQIvrHc57PSsige199LPkiNzNENoYa6/s1600-h/image%25255B41%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8qR5R4-v5YPUN6MsnDiuY2X6MuTiyhPG7wG0YydAUrsN-pNC3du8W0Dd9c4S-GgaCbBVU2glyEuuBdN2TyoQn-mjwTGp3exGbJB61CLbc2y7SqrYhAYnXNvyVJ8iXDj7P_dZp7NCRhhHQ/?imgmax=800" width="13" height="16"></a>leads to the following nonlinear ordinary differential equation for<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwPMFFbDp5TtblDQbmllphp0sw8_yLj-nn4iedC5pyp_VYhxt8L-IGA_M-YqsOzl1ryxlRlzucw4D6pwW2orYJGhMK6inAINpZhOFbfkIkre9YUsNQo0c4hePI4uQW8YUTi3u3_NG-Fo25/s1600-h/image%25255B49%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuCOZ6745yGE5N3xI25dXPABfDrrvYsRERno405hM8XjmEspaAHmWpRMaOU2Vh33uDVWl4j0RSBmtmObTxW6zjfjUm8ftMfVRQz4czrkeo6fhEcvZ4vx072ajjCbY4DcQpIrhwjmpjyUS8/?imgmax=800" width="35" height="32"></a> : <blockquote> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSuU2CSxsYHDxGhxjy335_y_KGr30rMuV-qQ8YIkwG21-9nJcN_tv9ce21N-BPpkrHHYnuc4lxD4rYYeSZ96vpwYdasuPuKLMN5tDbFSlk7L9xYcZnslkSBLVXbHL3K1VD6JCZGYfqz7Fk/s1600-h/image%25255B53%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx14xGsKrqjM1paIZvdcY4IMTzpoLRDNHk-SEpT60tfhyDD0QN1PovzUfCAP1CaX9ZYriP0B4UaoTZeyoYT3oa1qPvxjTqBelxe2-HyqDy5wXZKFqZVAJyBC1PNhTSS2G4cQSxMGN5Dfht/?imgmax=800" width="573" height="40"></a></p></blockquote> <p>This equation is called the Blasius equation. We will solve it numerically in the next part. Once f is known, the velocity components may be computed as <blockquote> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEJKtvMEpodurnCw5eSNt1IcOBndfXtfIauHNeuSqwmpYQa69jD3ncjmI0Evrwnay9o2Mqvib25-Cn_DAERkksuxUlv8wZyTVRrVUJ9TxqKmANK3XXys2Q3aemZ93ymM96uFw3c2eM7cSF/s1600-h/image%25255B57%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6dxaMpWWzHqethnz7ki4hF7lsn5XNnNMnqPBW7YxjkTujd1Nw0zDxSivsIfkomZ48t0F3D2wCQBgbF8rhBNTUB9aWlKS8ZJMKIRCZfSoga6009ulcGu9V1qOFWNWBQ_wmfByTQqGSDOAf/?imgmax=800" width="580" height="54"></a></p></blockquote> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-12706008512313900542012-04-10T08:27:00.001-07:002012-04-10T08:27:25.791-07:00Very good freeware editor for ANSYS APDL<p> </p> <p align="justify">I was trying to find an APDL freeware editor, with auto-completion feature. After a while of searching, I found a very good one that is based on the freeware PSpad editor. you can find it in the following location:</p> <p><a href="http://www.2doworld.com/software/ansys-editor-10.html">http://www.2doworld.com/software/ansys-editor-10.html</a> </p> <p align="justify">It supports 1500 ANSYS command lines for user. Each text editor supports instant command help for APDL commands by locating the cursor on the line containing the command of interest. I failed to make the context help command work with new ANSYS help system based on java, which is not mentioned in the site, probably they developed the editor for the old help system. But you still can activate the auto-completion by CTRL+SPACE it will give you a short description for the command. It is portable, standalone application. </p> <p align="justify"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeWMjJMC62Z56KiL_y1zvgI82m8YA1rBTfVFa8IHotmu4ZduLKm5V0loxsAeIvtrt_ZAYGuKGXFSxjz8fcPcXBOjozktn1vnFBRzn2Tf74qWAoaDr42xmgrG8XS6CJRx_kAeqSirajxJhyphenhyphen/s1600-h/Untitled%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Untitled" border="0" alt="Untitled" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3ld7nw8MCpcgm0y8pSpwzT9uLI23YXuCCWYZ9FXLPPOBa7nA2bvOi5W9qanrWVfs8otry0Fdi4KE_pV-hFpvD8NPYasCG1TGIG3adEsefESFaFhnACrtJFcwKw5pj8DPV8HTYziBuTfNG/?imgmax=800" width="635" height="674"></a></p> <p>Another interesting aspect of the above mentioned site is the available tutorials for ANSYS products. Check it out it is informative.</p> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com2tag:blogger.com,1999:blog-6920999560875469938.post-34424966298831653502011-12-14T07:51:00.001-08:002013-08-26T08:35:18.937-07:00Older presentation about the spectral element method<br />
<div align="justify">
This is an older presentation that was delivered at <strong><a href="http://spie.org/x12228.xml" target="_blank">SPIE</a> Smart Structures/NDE 2010 </strong>conference about the spectral element method. In order to see the animation you have to download the pdf file. It is rather detailed about the specifics of the multi-physics coupling. </div>
<a href="http://www.scribd.com/doc/75555460/SPIE-2010-Spectral-Element-Presentation" style="-x-system-font: none; display: block; font-size-adjust: none; font-stretch: normal; font: 14px helvetica,arial,sans-serif; margin: 12px auto 6px; text-decoration: underline;" title="View SPIE 2010 Spectral Element Presentation on Scribd">SPIE 2010 Spectral Element Presentation</a> <br />
<iframe class="scribd_iframe_embed" data-aspect-ratio="1.33115468409586" data-auto-height="true" frameborder="0" height="600" id="doc_11614" scrolling="no" src="http://www.scribd.com/embeds/75555460/content?start_page=1&view_mode=slideshow&access_key=key-1kmjuxomr04rfw0wc42x" width="100%"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script>Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-87770497729327902112011-12-13T09:03:00.001-08:002013-08-26T08:24:26.936-07:00ANSYS Tutorial For Lamb Waves Modeling<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dc7ef477-cea2-487d-8a92-becae982e572" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Technorati Tags: <a href="http://technorati.com/tags/ANSYS" rel="tag">ANSYS</a>,<a href="http://technorati.com/tags/Finite+Element+Method" rel="tag">Finite Element Method</a>,<a href="http://technorati.com/tags/Lamb+Waves" rel="tag">Lamb Waves</a></div>
<div align="justify">
I have made a tutorial for the same course for simulating Lamb waves propagation as an exercise for the general considerations that I have posted earlier. I hope it makes things clearer. You can download it from:</div>
<div align="justify">
<br /></div>
<div align="justify">
https://dl.dropboxusercontent.com/u/50597292/Ansys_Tut.pdf</div>
<div align="justify">
<br /></div>
<div align="justify">
The same steps could be applied to any other FEM software. </div>
Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com1tag:blogger.com,1999:blog-6920999560875469938.post-69776246971734846152011-12-13T07:03:00.000-08:002011-12-13T07:06:11.351-08:00Consideration when modeling guided waves<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a53b5921-e2ca-4530-a66d-bf114a0e9a81" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Science" rel="tag">Science</a>,<a href="http://technorati.com/tags/Spectral+Element" rel="tag">Spectral Element</a>,<a href="http://technorati.com/tags/Wave+Propagation" rel="tag">Wave Propagation</a>,<a href="http://technorati.com/tags/Guided+Waves" rel="tag">Guided Waves</a></div> <p align="justify">There are several consideration to be taken into account when modeling guided waves, in fact any wave propagation phenomena will require a similar consideration. Those considerations and a fairly simple background are summarized in the following presentation.</p> <a style="margin: 12px auto 6px; display: block; font: 14px helvetica,arial,sans-serif; text-decoration: underline; font-size-adjust: none; font-stretch: normal; -x-system-font: none" title="View 07 Modelisation_ondes on Scribd" href="http://www.scribd.com/doc/75569600/07-Modelisation-ondes?secret_password=pvwd26lrc2it3k5owap">07 Modelisation_ondes</a> <p><iframe id="doc_34031" class="scribd_iframe_embed" height="600" src="http://www.scribd.com/embeds/75569600/content?start_page=1&view_mode=slideshow&access_key=key-21024cgt6nyn1ijysfqp&secret_password=pvwd26lrc2it3k5owap" frameborder="0" width="100%" scrolling="no" data-aspect-ratio="1.33333333333333" data-auto-height="true"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script></p> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-9354296295747255352011-12-13T03:38:00.001-08:002011-12-13T08:16:29.160-08:00A presentation about the Spectral Element Method<p>This is a modified version of a presentation I have given in <a href="http://www.cansmart.com/workshop2011.htm" target="_blank">CANSMART 2011 workshop</a>></p> <p><a style="margin: 12px auto 6px; display: block; font: 14px helvetica,arial,sans-serif; text-decoration: underline; font-size-adjust: none; font-stretch: normal; -x-system-font: none" title="View Spectral Element Fast Solver for Piezoelectric Structures on Scribd" href="http://www.scribd.com/doc/75553248/Spectral-Element-Fast-Solver-for-Piezoelectric-Structures?secret_password=y9vkaix7fxd249nxm4f">Spectral Element Fast Solver for Piezoelectric Structures</a><iframe id="doc_2065" class="scribd_iframe_embed" height="600" src="http://www.scribd.com/embeds/75553248/content?start_page=1&view_mode=slideshow&access_key=key-2acw0k7tr8p530hu6380&secret_password=y9vkaix7fxd249nxm4f" frameborder="0" width="100%" scrolling="no" data-auto-height="true" data-aspect-ratio="1.33115468409586"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script></p> <p>And here is the paper</p> <p><a style="margin: 12px auto 6px; display: block; font: 14px helvetica,arial,sans-serif; text-decoration: underline; font-size-adjust: none; font-stretch: normal; -x-system-font: none" title="View 2011-RamyPaper_PM on Scribd" href="http://www.scribd.com/doc/75553036/2011-RamyPaper-PM?secret_password=213ncqeuadd9c9oj1gd9">2011-RamyPaper_PM</a> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:08b46763-7ecb-4030-ab82-b063321ad1a4" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/Spectral+Element" rel="tag">Spectral Element</a>,<a href="http://technorati.com/tags/Wave+Propagation" rel="tag">Wave Propagation</a>,<a href="http://technorati.com/tags/Numerical+Simualtion" rel="tag">Numerical Simualtion</a>,<a href="http://technorati.com/tags/Lamb+Waves" rel="tag">Lamb Waves</a>,<a href="http://technorati.com/tags/Guided+Waves" rel="tag">Guided Waves</a></div> <iframe id="doc_57660" class="scribd_iframe_embed" height="600" src="http://www.scribd.com/embeds/75553036/content?start_page=1&view_mode=list&access_key=key-1mfhqls6ehg13efmhwts&secret_password=213ncqeuadd9c9oj1gd9" frameborder="0" width="100%" scrolling="no" data-auto-height="true" data-aspect-ratio="0.772727272727273"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script></p> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0tag:blogger.com,1999:blog-6920999560875469938.post-49405780971414829672011-11-19T12:22:00.001-08:002011-11-19T12:22:16.281-08:00Is Object Oriented Programming the best Programming Paradigm for Number Crunching Applications? (1-4)<p align="justify">Undoubtedly there is an almost worldwide belief as well as acceptance of the huge benefits of the Object Oriented Programming Paradigm. For example in my field -Finite Element Methods (FEM)- there is a plethora of publications about the object oriented frameworks and planning for an OO FEM software. </p> <p align="justify">The main focus of this series, will be to test the claims as well as real needs for full OO features in a number crunching application. So, I well first explain what I understand as OO paradigm in the context of computational science, with a specific focus on the FEM. Then I would like to examine the motivations usually introduced for the need for OO in FEM. Finally, another extremely important feature is the effect of adapting such an approach on the computational performance.   </p> <p align="justify">First, OOP main objectives are to minimize the maintenance and modification costs of a code. Another aspect is the data hiding (encapsulation) which is really a very important aspect for delivering software components to other users or coworkers. So, as much as we are concerned this mainly benefits a collaboration project between different programmers. Another result is the ability to have unified interfaces between different objects and methods. So, if you want to change or add new behaviour to an object you would need only to add a single part that is responsible for that method, and as long as the interface remain intact no one of the users of the code need to worry about the implementation issues of the procedure.</p> <p align="justify">But that is not all, a very important facet of using OO paradigm, is the reusability of the code. Typically there is already established algorithms and implementations already checked for correctness. Yes, I am aware of the fact that this is not unique to the OO Paradigm. But when combined with the data encapsulations and polymorphism it becomes a very powerful way of thinking about the overall design of the application with less concern about how the different pieces fit together, and how they perform.</p> Ramy Elkadyhttp://www.blogger.com/profile/11581388164727230010noreply@blogger.com0