[SciPy-user] Use of Scipy in a students final year mechanical engineering project.
Peter Row
peter.row at gmail.com
Tue Aug 8 08:08:31 CDT 2006
Why scipy:
Say you have a inner loop like:
X = X + F * dt
In either Matlab or scipy, it will probably work as:
temp1 = F * dt
temp2 = X + tempF
X = temp2
Which is slower than nessesary, because you have to assign those great hunks
of memory to temp1 and temp2.
If you use weave.inline (after doing a rapid prototype in pure python -
because debugging segfaults when you make a mess of your indicies is never
fun, or easy), you can get rid of the big temporary arrays.
You can also do this in Matlab (using CXX), but you could simply plead that
it is easier for you to do using inline.
This is a pretty trivial example. There is no limit to the number of
intensive operations that you can't find a good vectorized function for.
Speaking of which, have you seen the "vectorize" command in scipy? It seems
a little slow (next to inline), but it sure beats running an inner loop in
pure Matlab or python.
Good luck,
Peter
On 8/8/06, William Hunter <willemjagter at gmail.com> wrote:
>
> Another thought(s). Something you're likely to come across if you end
> up in the mechanical design field, is the use of codes...
>
> Why don't you write a program that can calculate the dimensions of a
> pressure vessel, according to ASME, for example? Or a gear design
> program which will output the 3D gear? A program to design offshore
> containers to DNV's CN 2.7-1?
>
> Go look at some of the add-ins available for programs like SolidWorks
> and Solid Edge, you might find some ideas here too.
>
> For programs like these the user (probably yourself one day) would
> typically want an intuitive UI, some form of customisation, be it by
> editing a text file with material spec's or a file specifying pipe
> and/or flange dimensions, and DEFINITELY output in the form of a CAD
> file (I would say DXF/IGES for 2D and StL/XML/VRML for 3D. You can
> attempt Parasolid, ACIS or STEP, but these are not as simple as StL
> and last mentioned is in wide use by the rapid prototyping industry).
> One would possibly also want to view (matplotlib) the pressure vessel
> before saving it as a DXF file for instance. Maybe add an option to
> enter "Company and Project Details" when saving the file as a DXF...
> There's a lot of options!
>
> Regards,
> William
>
> On 07/08/06, John Hassler <hasslerjc at adelphia.net> wrote:
> >
> > You've gotten a lot of very good responses already. I'd just make a
> couple
> > of comments.
> >
> > I'm a former prof. of ChE (retired). When I started out (a long time
> ago),
> > industrial plants were built in several stages: beaker, bucket, barrel,
> > (maybe more), final plant. You would start with bench-scale experiments
> in
> > the laboratory, and work through progressively larger "pilot plants"
> until
> > you were confident that you understood the process well enough to commit
> to
> > building the full-scale plant. Now, design is done through computer
> > modeling and simulation, and pilot plants are rarely, if ever,
> used. The
> > same is true in all fields of engineering. For example, computer chips
> are
> > simulated in detail before being tried "in silicon."
> >
> > In spite of this, most engineers never learn to program at any level
> beyond
> > the most basic. I'm not familiar with your field, but in ChE, there are
> > "black box" programs (Aspen, ChemCad) which will do very sophisticated
> > modeling, without requiring much knowledge on the part of the
> operator. I
> > think this is unfortunate ... but then, I'm old fashioned.
> >
> > I'm a visiting prof. here at VaTech. The engineering college has
> > standardized on Matlab. I don't like it much, for two reasons. First,
> it's
> > outrageously expensive. (Scilab, as an example, is free, similar to
> Matlab
> > in basic capabilities, works under both Windows and Linux, and is
> certainly
> > sufficient for any but the most demanding computational
> problems.) Second,
> > Matlab makes it difficult to write well-structured programs of any
> > appreciable size. Python-Scipy, on the other hand, is a "real"
> programming
> > language, which can handle VERY large programs with "grace and beauty,"
> and
> > can do small programs with convenience. The "immediate" calculational
> > abilities (IDLE) are more convenient than those of Matlab, since you can
> > define functions "on the fly" ... Matlab requires "m-files" for
> functions
> > ... and I've used Python plus Numeric to solve some reasonably large FEM
> > examples in acceptable times.
> >
> > So if you needed any more encouragement to look into a modeling problem
> with
> > Python, perhaps this will help.
> >
> > (As I re-read what I've written, I guess I could have just said,
> "Computing
> > .. important. Python... good." Professors are long winded ..... )
> >
> > john
> >
> >
> >
> > Stephen Kelly wrote:
> >
> >
> > Hi,
> >
> > I sent this email to Eric Jones, but he recommended that I send it to
> this
> > mailing list instead. I'm trying to see if scipy could fit into a final
> year
> > project for my mechanical engineering course.
> >
> > I am a student of mechanical engineering in UCD Dublin , and part of my
> > course involves doing a final year project. We do very little
> programming in
> > my course, but as coding and python in particular is something that
> > interests me, I'd like to have some involvement in python in my final
> year
> > project.
> >
> > Because my course is not centered around coding, I think I'd be more
> likely
> > to be able to do a project on applying a python application like scipy
> to a
> > problem, or using python as glue in a scripting applicatin. I found
> scipy
> > while searching for an idea for a project that I could do in python,
> while
> > staying within the scope of mechanical engineering and my course. I'm
> still
> > no closer to an idea, so I thought I'd write to you to see if you had
> any
> > ideas of what I might be able to do as a mechanical engineer with
> > python/scipy.
> >
> > Something that I think might be plausible might be a simulation or
> > computational analysis of some kind, but I would probably need to
> justify
> > using python for whatever I do rather than MatLab, which is the industry
> > standard, and the program that my lecturers are already familiar with. I
> > have never used MatLab myself, so I'm not sure what it offers.
> >
> > I would appreciate any thoughts you might have on this. I emailed one of
> my
> > lecturers already, who asked me for more specific details and to give
> > thought to the type of project I would like to do.
> >
> > Kind Regards,
> >
> > Stephen Kelly
> > ________________________________
> >
> > _______________________________________________ SciPy-user
> > mailing list SciPy-user at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> >
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> >
> >
> >
>
>
> --
> Regards,
> WH
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20060808/f9beae70/attachment-0001.html
More information about the SciPy-user
mailing list