Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Learning Programming for Structural Engineering 12

Status
Not open for further replies.

MegaStructures

Structural
Sep 26, 2019
366
I have recently become very interested in matrix structural analysis and finite element analysis and I have been creating my own "program" using excel. Of course I have quickly noticed that the basic operations available within excel without using VBA is somewhat limited and I cannot make the quality of the program I want. So naturally I have began learning VBA and in my journey around the internet learning VBA I have seen other recommendations for more powerful languages such as Python, Matlab, Fortran etc..

During this whole process I have been thinking a lot about the usefulness of coding in structural engineering and thought that it might be a fun conversation to have to see what other structural engineers have taught themselves to code, how useful they have found it, and what language might be the most helpful. So I would love to hear others opinions on the topic of coding for a structural engineer!

“Any idiot can build a bridge that stands, but it takes an engineer to build a bridge that barely stands.”
 
Replies continue below

Recommended for you

@Mohanlal - Got it thanks.

Yes MathCAD / SMath are more WYSIWYG math programs. Although I see it being somewhat similar to Matlab. Basically the format is:
Enter input values
Do some work (some of which is shown some can be hidden)
Output results - includes graphs, checks, etc.

I believe I have seen python use in this sense to a degree and maybe Octave could be similar. I've always wanted to invest more time into more a more 'robust' programming language with the ultimate goal of making solid GUI's for the different programs, but as you've said, time...

EIT
 
@RFreund

You may be able to achieve what you are looking for on Mathematica, with greater ease compared to other languages.

I only use it in my initial stages of development to check the solutions for complex equations and the feasibility of a proposed concept that I am developing.

You can basically create a CDF file, which is essentially a PDF with the mathematical knowledge of what you have coded, it will allow you to change values using slide bars and recalculate solutions. I think it would also change graphs and so forth in real time.

What is nice is that you can have a layout with full text and images like a word document and the code is locked so no one can tamper with it...

 
@Celt83,

Finite element modelling is not the same as coming up with a closed-form piece-wise solution, there are too many moving pieces to just say it's the same thing.

Small number of nodes introduces error through inadequate discretisation of uniform loads, not through "lower accuracy" of resolving the elements themselves. The elements are always accurately resolved because their stiffness matrices are based on closed-form solutions. It's the loads that end up being wrong.



 
Captain_slow,

You don't need to discretize a uniform load nor a beam element though all you need are the fixed end reactions.

The closed for solution is of a specific bar/beam element not the structure as a whole. The stiffness method specifically solves for the joint actions under the equilibrium and compatibility constraints imposed by the supports and members. Once you have the joint actions you can directly solve for the forces at the joints. With the joint forces using superposition you can then look at each element individually as a single span beam with applied end forces and displacements and using the closed form solutions for the beam elements determine the max and min internal actions without needing to subdivide the element. There are cases where subdivision is more efficient/required as Mohanlal0488 pointed out.

My Personal Open Source Structural Applications:

Open Source Structural GitHub Group:
 
@ Celt83,

Let's double down and make sure we are not talking about different things.

Say you have a UDL load on a beam. How would you say the process of resolving it using FEA goes?

What I am saying is that step 1 is to discretise the UDL load into a series of point loads applied at beam nodes. Are you saying that there is no need to discretise the UDL load and that it can be just directly applied to the beam element?
 
captain_slow said:
Say you have a UDL load on a beam. How would you say the process of resolving it using FEA goes?

For a single span beam I wouldn't use FEA, if your talking a continuous beam first find the fixed end reactions and combine them at the joints then the general formula becomes {F}-{F,fixed}=[K]{D}

captain_slow said:
Are you saying that there is no need to discretise the UDL load and that it can be just directly applied to the beam element?

Yes, for beam elements there are closed form solutions for the internal actions.

My Personal Open Source Structural Applications:

Open Source Structural GitHub Group:
 
For the FEM toolbox I developed, the UDL is taken as is, and the end conditions between nodes are calculated as if the element is fixed. The end conditions are then used to develop the lead vector. Obviously this formulation requires some changes when allowing releases at beam ends.



 
@Celt83,

OK I think I know what we are talking here then.

Yes I agree that there is a heap of closed-form solutions out there that can be used to solve a lot of this stuff. I am sure we all have our spreadsheets with several implementations of these things.

I am talking more from the angle of building a general-purpose FEA program - the program first determines where the hard nodes are, then it discretises the continuum (whether it be a beam, plate, or a brick elements), then it discretises any continuous conditions (such as loads, restraints, etc), and then it goes about assembling/solving/post-processing.
 
I have done some quite simple (but useful) spreadsheets which I occasionally use in design, but I have never attempted anything involving a stiffness matrix analysis, although I have always wondered how matrix analysis can be handled in a spreadsheet. How does one go about doing a full stiffness analysis of any structure in a spreadsheet?
I hope I am not going off in a tangent, but would anyone like to comment on this.
 
@civeng80

You could do it on excel with some help of vba, there are some built in matrix manipulation tools also. But it goes back to the earlier comments, why would you want to do it on excel? It's a crappy tool for the task. I would use excel just as an interface to develop text files for connectivity and element data that can be printed to a txt file and read by a superior language.

My approach using excel would be to have a worksheet that allows one to enter node coordinates and elements which can be read by various vba routines that do the complexities involved.
 
Personally I think one of the best ever was MS Visual Basic 6, from which sprang VBA. And VB6 does not not have to sit inside an Excel can and it is relatively easy to interface the two if required. MS mutated it into into VB.Net and deprecated it so MS could enslave us with 99% unwanted web apps baggage. But MS knows that plain old VB6 is still a great general purpose language, because even after having been deprecated to near non-existence, they still refuse to release the source code. They can't take the risk of it being updated by others and kicking them in the "ask". Even after all that and and being nearly 30 yrs old, VB6 is still is the 20th most popular programing language in the coding world. MS, release the source code! Use it, or set it free!

Reality used to affect the way we thought. Now we somehow believe that what we think affects reality.
 
"For my work and personal FEA programming purposes I use Octave which is basically the same as Matlab just a freeware version"

I use Octave also. Matlab is too expensive unless one really needs it. Octave is very similar for most tasks.

The downside to Octave is that it is different enough from Matlab that Matlab examples are often not helpful, and the number of Octave examples is very limited. For example, formatting figures is completely different and there's little help online. You just have to play with it -- sometimes for a long time -- to figure out how to do something simple.
 
Spreadsheet has a function for solving the determinant of a matrix. Have used it before to solve simple problems.
 
Sorry. I see that now.

Reality used to affect the way we thought. Now we somehow believe that what we think affects reality.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor