Calculix FEA Beam Part 3: Writing an Input File for the CCX Solver

In this installment of the Calculix beam tutorial focus will shift from pre-processing in cgx to definition of an input file which will be processed by the ccx solver.  The input file describes the finite element problem as an ordered set of commands with parameters.  This article will examine the composition of an input file for a cantilever beam problem.

Open SciTE and create a new file named beam.inp.  This document should be located with the files from the previous articles.   Add the following code from the image below to the newly created file.  Source highlighting is activated when the file is saved with an extension recognized by SciTE.

This input file defines a cantilever beam with a linear elastic material model, mesh, distributed load, and fixed left end as described in the previous article.  Lets examine the construction, lines 1 thru 9 compose the model and material definition segment.  This lays the foundation for the next segment which consists of one or many loading steps.  This is located at lines 10 thru 18.  Within the step, loading is applied and optionally the results are written to a file for post-processing.  These are the two primary segments of an input file, model and step.  The material part is considered to be a sub-segment of the model definition.  Most commands are segment specific, however, some are interchangeable.

The first two lines of the input file declare a *HEADING where the user can write comments and notes on the following line.  Using this command is different than adding a comment.  A ccx comment can be used to add notes and clarity by using **.  Any text following the double asterisk is considered to be commentary and ignored by the solver.  Comments can be used on their own line or after a command.  In contrast, the *HEADING command is used to specify a line of text that will be reproduced at the top of the output file.

The next command, *INCLUDE, inserts the contents of the file named beam.msh into the input file.  Think of the *INCLUDE command as being analogous to copy and paste.  The contents of the specified file are pasted into the input file at the location where the command was used.  In this case the beam.msh contents are included.  This is the previously exported list of node and element definitions which define the mesh structure.  The beam.msh file is self contained because it has the ccx *NODE and *ELEMENT commands within it.  Also, note that the file is referenced by a relative path and it must be located in the same directory as the input file.  An absolute path can be specified for the included file if it is not located in the working directory.

Next a geometric boundary condition is applied using the *BOUNDARY command and the contents of the fixed_123.bou are included as the parameters. In contrast to the mesh, this file is not self contained and must be accompanied by a command preceding the inclusion.  The result ensures displacement at these nodes will be zero in the x, y, and z directions.

On lines 6 thru 9 the material model is defined.  This is a special segment where the commands are grouped together in order depending on material model.  It starts with the *MATERIAL command and assigns it a name, EL, short for elastic.  The next command, *ELASTIC, defines EL as isotropic linear elastic with two characteristics, the elastic modulus and Poisson’s ratio.  In this case the elastic modulus is 30 x 10^6 psi and Poisson’s ratio is 0.3.  These values are representative of steel with a system of units measured in pound force, inches, lbf*s^2/in, and seconds.  The solver just crunches numbers, the user must make sure a consistent set of units is used.  Examples of consistent units are shown in the table below.

Next we move along to the the *SOLID SECTION definition which assigns the elastic material EL to the element set Ebeam.  This command is used to assign a material to 3D, plain stress, plain strain, and axisymmetric element sets. The second line of this command defines the thickness when not using 3D elements.  In this case the set of 3D elements in Ebeam will now be treated as linear elastic elements with the properties as defined.

Examples of Consistent Sets of Units
Force = Mass * Length / Time2
English Engineering English w/Inches British Gravitational Metric / SI Metric w/mm
Length ft in ft m mm
Mass lbm lbf*s2/in slug kg N*s2/mm
Force lbf lbf lbf N N
Time s s s s s

This table is provided for reference when working with a consistent set of units.  Additional information for other characteristics like specific heat, conductivity, film coefficient, and dynamic viscosity are covered in the units portion of the user manual.

At this point the model and material has been defined.  It is now ready for a loading step.  In this example only one step is used, however, more than one step can be used if necessary.  The start and stop of a step are indicated by the *STEP and *END STEP commands.  In this step the loading is applied using the *STATIC method.  This indicates the force will be slowly applied in a quasi-static sense.  This will neglect the mass inertia of the structure.

Next a distributed load is applied to the tip of the beam.  The included file was previously defined and applies a load of 10 pounds to element 751’s top face.  Finally the *NODE FILE and *EL FILE commands are used to output the desired results to an .frb file.  The output fields are flagged by single characters on the second line.  For example U requests the output of the nodal displacements. The S flag from *EL FILE is used to output the Cauchy (true) stress extrapolated to the nodal points.  In addition there are two other commands which are similar, *NODE PRINT and *EL PRINT. These commands are used to print the results to a .dat text file.  When using these commands the Cauchy stress is provided at the integration points of the element.  If the file is intended to be post-processed by cgx it is necessary to choose output as an .frb file. This is accomplished by using the *NODE FILE and *EL FILE commands.

With the beam.inp file open in SciTE choose Tools->Solve or use the keyboard shortcut Ctrl+F10 to process this file with ccx.  This will solve the finite element model as defined and output the requested files.

The output of the ccx program will appear in the SciTE output window.  It provides detailed diagnostics information.  At the bottom it finishes the job and exits with code 0.  This successful indication means a solution was found and the results have been written to disk.  The ccx output should look like the following image.  Progress can be monitored by watching the output as ccx attempts to find a convergent solution or steps through a number of loading conditions.



In this case a file named beam.frb has been created in the working directory with the results. This file can be post-processed in cgx by using the SciTE menu item Tools->Post Process or using the keyboard shortcut Shift-F10.  Using the cgx menu system click on Datasets -> 2 STRESS   1.000000 and then use the menu system again to click on Datasets -> Entity -> Mises. This will display the Von Mises stress distribution for the solution at step 1.  It should look like the following image.

The next article in this installment will cover using cgx to post process the beam in greater detail.  There are several handy tools available to visualize the results.  A couple examples include displaying the deformed shape and plotting nodal values.

Thanks for reading!
-Ty Beede

About mechanicalguy

My name is Ty Beede and I'm a mechanical engineer currently working in the aerospace sector. My interests include computational structural analysis, metal fabrication, building and modifying Jeeps for extreme off-roading, and design/fabrication of bicycles for on and off road use. I enjoy working hard and my passion in life is building and learning new skills related to mechanical, computer, and electrical engineering.
This entry was posted in Calculix FEA Tutorials. Bookmark the permalink.

Leave a comment