[SciPy-user] Use of Scipy in a students final year mechanical engineering project.
peter.row at gmail.com
Tue Aug 8 08:08:31 CDT 2006
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.
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!
> 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
> > of comments.
> > I'm a former prof. of ChE (retired). When I started out (a long time
> > industrial plants were built in several stages: beaker, bucket, barrel,
> > (maybe more), final plant. You would start with bench-scale experiments
> > the laboratory, and work through progressively larger "pilot plants"
> > you were confident that you understood the process well enough to commit
> > 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
> > simulated in detail before being tried "in silicon."
> > In spite of this, most engineers never learn to program at any level
> > 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,
> > outrageously expensive. (Scilab, as an example, is free, similar to
> > in basic capabilities, works under both Windows and Linux, and is
> > 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"
> > language, which can handle VERY large programs with "grace and beauty,"
> > 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
> > ... 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
> > Python, perhaps this will help.
> > (As I re-read what I've written, I guess I could have just said,
> > .. 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
> > mailing list instead. I'm trying to see if scipy could fit into a final
> > 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
> > project.
> > Because my course is not centered around coding, I think I'd be more
> > 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
> > while searching for an idea for a project that I could do in python,
> > staying within the scope of mechanical engineering and my course. I'm
> > no closer to an idea, so I thought I'd write to you to see if you had
> > 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
> > 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
> > 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
> SciPy-user mailing list
> SciPy-user at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user