Tuesday, 31 March 2009

To get:

Effect of flow on the acoustic resonances of an open-ended duct
J. Acoust. Soc. Am. Volume 58, Issue 4, pp. 788-793 (October 1975)
Issue Date: October 1975

Acoustic waves in ducts with sinusoidally perturbed walls and mean flow
Nayfeh, A. H.
Acoustical Society of America, Journal, vol. 57, May 1975, p. 1036-1039.

Title:
Standing acoustic waves in a low Mach number shear flow
Authors:
Wang, Meng; Kassoy, David R.

@ARTICLE{art:Yeh64,
author = "Y. Yeh and H. Z. Cummins",
title = "Localised flow measurements with an He-Ne laser spectrometer",
journal = "Applied Physics Letters",
year = "1964",
volume = "4",
pages = "176",
note = "I can't get this one online",
}

DIsplay elements / polar setup, PAFEC




Copy the Python code into an interpreter, execute it. Copy the output to a NODES
section. First the display, then, an uncoupled BE, over a circular region, raised slightly from
z=0.


c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c DISPLAY
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Python script for node generation.
c from math import *
c def n():
c r, o, n0 = 0.025, [0, 0, 2E-3], 100 # radius, origin, 0th node.
c for i in xrange(360 + 1):
c x = o[0] + r * cos(0.5 * i * 2 * pi / 360)
c y = o[1] + 0
c z = o[2] + r * sin(0.5 * i * 2 * pi / 360)
c print n0 + i, x, y, z
c print n0 + i + 1, o[0] + r / 2, o[1], o[2]
c print n0 + i + 2, o[0] + r / 2, o[1], o[2] + r / 2
c print n0 + i + 3, o[0] + 0 / 2, o[1], o[2] + r / 2
c print n0 + i + 4, o[0] - r / 2, o[1], o[2] + r / 2
c print n0 + i + 5, o[0] - r / 2, o[1], o[2]
c print n0 + i + 6, o[0], o[1], o[2]
c print

c for i in xrange(360 + 1):
c x = o[0] + 0
c y = o[1] + r * cos(0.5 * i * 2 * pi / 360)
c z = o[2] + r * sin(0.5 * i * 2 * pi / 360)
c print 400 + n0 + i, x, y, z
c print 400 + n0 + i + 1, o[0], o[1] + r / 2, o[2]
c print 400 + n0 + i + 2, o[0], o[1] + r / 2, o[2] + r / 2
c print 400 + n0 + i + 3, o[0], o[1] + 0 / 2, o[2] + r / 2
c print 400 + n0 + i + 4, o[0], o[1] - r / 2, o[2] + r / 2
c print 400 + n0 + i + 5, o[0], o[1] - r / 2, o[2]
c print 400 + n0 + i + 6, o[0], o[1], o[2]
c print

c for i in xrange(360 + 1):
c x = o[0] + r * cos(0.5 * i * 2 * pi / 360)
c y = o[1] + r * sin(0.5 * i * 2 * pi / 360)
c z = o[2] + 0
c print 800 + n0 + i, x, y, z
c print 800 + n0 + i + 1, o[0] + r / 2, o[1], o[2]
c print 800 + n0 + i + 2, o[0] + r / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 3, o[0] + 0 / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 4, o[0] - r / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 5, o[0] - r / 2, o[1], o[2]
c print 800 + n0 + i + 6, o[0], o[1], o[2]


PAFBLOCKS
BLOCK GROUP ELEMENT.TYPE PROP N1 N2 TOPO
1 1 24720 11 <'dm'> <'dm'> 462 190 461 100 0 0 145
2 1 24720 11 <'dm'> <'dm'> 280 190 463 462 235
3 1 24720 11 <'dm'> <'dm'> 370 280 464 463 325
4 1 24720 11 <'dm'> <'dm'> 370 464 460 465 0 415
5 1 24720 11 <'dm'> <'dm'> 463 462 466 461
6 1 24720 11 <'dm'> <'dm'> 464 463 465 466

7 2 24720 11 <'dm'> <'dm'> <462+400> <190+400> <461+400> <100+400> 0 0 <145+400>
8 2 24720 11 <'dm'> <'dm'> <280+400> <190+400> <463+400> <462+400> <235+400>
9 2 24720 11 <'dm'> <'dm'> <370+400> <280+400> <464+400> <463+400> <325+400>
10 2 24720 11 <'dm'> <'dm'> <370+400> <464+400> <460+400> <465+400> 0 <415+400>
11 2 24720 11 <'dm'> <'dm'> <463+400> <462+400> <466+400> <461+400>
12 2 24720 11 <'dm'> <'dm'> <464+400> <463+400> <465+400> <466+400>

c 13 3 24720 11 <'xm'> <'xm'> <462+800> <190+800> <461+800> <100+800> 0 0 <145+800>
c 14 3 24720 11 <'xm'> <'xm'> <280+800> <190+800> <463+800> <462+800> <235+800>
c 15 3 24720 11 <'xm'> <'xm'> <370+800> <280+800> <464+800> <463+800> <325+800>
c 16 3 24720 11 <'xm'> <'xm'> <370+800> <464+800> <460+800> <465+800> 0 <415+800>
c 17 3 24720 11 <'xm'> <'xm'> <463+800> <462+800> <466+800> <461+800>
c 18 3 24720 11 <'xm'> <'xm'> <464+800> <463+800> <465+800> <466+800>

c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c BE
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c r, z0 = 4.75E-3, 1E-3
c def n2():
c for i in xrange(17):
c print i+1, r * cos (i/16. * 2 * pi), r * sin (i/16. * 2 * pi), z0
c print 17, r/2, 0, z0
c print 18, r/2, r/2, z0
c print 19, 0, r/2, z0
c print 20, -r/2, r/2, z0
c print 21, -r/2, 0, z0
c print 22, -r/2, -r/2, z0
c print 23, 0, -r/2, z0
c print 24, r/2, -r/2, z0
c print 25, 0, 0, z0
c for i in xrange(31, 46 + 1):
c print i, r * cos ((i - 31) / 16. * 2 * pi), r * sin ((i - 31) / 16. * 2 * pi), 0



PAFBLOCKS
BOUNDARY.ELEMENT = 1000
GROUP ELEMENT.TYPE PROP N1 N2 TOPO
c top face
4 24620 11 <'xm'> <'xm'> 18 3 17 1 0 0 2
4 24620 11 <'xm'> <'xm'> 5 3 19 18 4
4 24620 11 <'xm'> <'xm'> 7 5 20 19 6
4 24620 11 <'xm'> <'xm'> 7 20 9 21 0 8
4 24620 11 <'xm'> <'xm'> 9 21 11 22 0 10
4 24620 11 <'xm'> <'xm'> 22 23 11 13 0 0 0 12
4 24620 11 <'xm'> <'xm'> 23 24 13 15 0 0 0 14
4 24620 11 <'xm'> <'xm'> 17 1 24 15 0 0 16
4 24620 11 <'xm'> <'xm'> 19 18 25 17
4 24620 11 <'xm'> <'xm'> 20 19 21 25
4 24620 11 <'xm'> <'xm'> 21 25 22 23
4 24620 11 <'xm'> <'xm'> 25 17 23 24
c side face
4 24620 11 <'xm'> 1 1 3 31 33 2 0 0 32
4 24620 11 <'xm'> 1 <1+1*2> <3+1*2> <31+1*2> <33+1*2> <2+1*2> 0 0 <32+1*2>
4 24620 11 <'xm'> 1 <1+2*2> <3+2*2> <31+2*2> <33+2*2> <2+2*2> 0 0 <32+2*2>
4 24620 11 <'xm'> 1 <1+3*2> <3+3*2> <31+3*2> <33+3*2> <2+3*2> 0 0 <32+3*2>
4 24620 11 <'xm'> 1 <1+4*2> <3+4*2> <31+4*2> <33+4*2> <2+4*2> 0 0 <32+4*2>
4 24620 11 <'xm'> 1 <1+5*2> <3+5*2> <31+5*2> <33+5*2> <2+5*2> 0 0 <32+5*2>
4 24620 11 <'xm'> 1 <1+6*2> <3+6*2> <31+6*2> <33+6*2> <2+6*2> 0 0 <32+6*2>
4 24620 11 <'xm'> 1 <1+7*2> 1 <31+7*2> 31 <2+7*2> 0 0 <32+7*2>






An alternative approach is to get PAFEC to generate the
nodes, and use triangles.



c polar extraction. Define three nodes, for arc definition. 1 node per dgree.
NODES
NODE AXIS X Y
300 3 0.018 0 c on axis.
345 3 0.018 45
390 3 0.018 90 c 90 degrees off axis
391 3 0.000 0 c on axis, 0 radius, for display elements.
ARC.NODES
LIST.OF.NODES.ON.ARC
300 301 302 303 304 305 306 307 308 309
* 310 311 312 313 314 315 316 317 318 319
* 320 321 322 323 324 325 326 327 328 329
* 330 331 332 333 334 335 336 337 338 339
* 340 341 342 343 344 345 346 347 348 349
* 350 351 352 353 354 355 356 357 358 359
* 360 361 362 363 364 365 366 367 368 369
* 370 371 372 373 374 375 376 377 378 379
* 380 381 382 383 384 385 386 387 388 389
* 390

c observation elements.
PAFBLOCKS
BLOCK TYPE GROUP ELEMENT PROP N1 N2 N3 TOPO
56 2 7 24710 13 15 15 15 391 300 390 0 345

Monday, 30 March 2009

translating nodes in PAFEC

Given a data file, with nodes defined:


a = file('ct1b.DAT')
b = a.readlines()
c = b[36:500] # only node entries
d = [i.strip('\n').split(' ') for i in c]
e = []
for i in d:
tmp = [float(j) for j in i]
e.append(tmp)
f = array(e)
f[:, 2] = f[:, 2] + 0.001 # apply offset
for i in f:
print str(i).strip('[]') # copy and paste.

Thursday, 26 March 2009

Formatting in this blog

Leading spaces tend to be lost. Add < p r e > to the start, and < / p r e > to the end, to preserve them.

Python scripts called from $

An example:


import sys
if __name__ == '__main__':
# Executed, only if called from command line.
args = sys.argv

if len(args) == 1:
print 'No argument specified. call as filename.py '
exit()
else:
print 'Argument(s) provided: ', args

Tuesday, 24 March 2009

PGFplots error bars.


\documentclass{article}
\usepackage{pgfplots}
%
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\begin{axis}
\addplot plot[error bars/.cd,
y dir=both, y explicit,
x dir=both, x explicit]
coordinates {
(0,0) +- (0.5, 0.1)
(1,1) +- (0.2, 0.3)
};
\end{axis}
\end{tikzpicture}

\end{document}

Building Engrid on Ubuntu Hardy

from https://sourceforge.net/mailarchive/forum.php?forum_name=engrid-users&max_rows=100&style=nested&viewmonth=200903&viewday=3

First, make sure you have the build dependencies:
/================
sudo apt-get install libvtk5 libvtk5-dev libvtk5-qt4 libvtk5-qt4-dev
libqt4-dev
================
/
Second, if you have qt3 dev files installed too, there might be a
conflict with qmake-qt3. So just run one of the following commands:
(I used the second command on my laptop. I'm not sure if the first one
works, but it should based on what I've read.)
/================
update-alternatives --install /usr/bin/qmake qmake "/usr/bin/qmake-qt4"
"50" --slave /usr/share/man/man1/qmake.1.gz qmake.1.gz
"/usr/share/man/man1/qmake-qt4.1.gz"
================
/or
/================
ln -sf /usr/bin/qmake-qt4 /usr/bin/qmake
================
/
To make sure the rest will work, check that /usr/bin/qmake is a link to
/usr/bin/qmake-qt4:
/================
[29][~]$ ls -l /usr/bin/qmake
lrwxrwxrwx 1 root root 18 Mar 3 12:04 /usr/bin/qmake -> /usr/bin/qmake-qt4
================
/
Check out the CVS:
/================
cvs -d:pserver:anonymous@en...:/cvsroot/engrid login
cvs -d:pserver:anonymous@en...:/cvsroot/engrid co src
cd src
================
/
Then you'll need to set up the environment before running qmake:
/================
export VTKLIBDIR=/usr/lib/
export VTKINCDIR=/usr/include/vtk-5.0/
export LD_LIBRARY_PATH=$VTKLIBDIR:$LD_LIBRARY_PATH
================
/I wrote a convenience script for this, which you can use instead if you
wish:
/================
source ./setup_paths.sh ubuntu
================
/
And finally, build netgen and engrid:
/================
./build-nglib.sh
qmake
make
================
/


Following an email from Oliver Gloth, I needed to re-compile. I did this,
as:
-----------------------
export VTKLIBDIR=/usr/lib/
export VTKINCDIR=/usr/include/vtk-5.0/
export LD_LIBRARY_PATH=$VTKLIBDIR:$LD_LIBRARY_PATH

and in ~/downloads/newengrid/src/

make clean
qmake
make