**Next:**Allocation of the fields

**Up:**CalculiX CrunchiX USER'S MANUAL

**Previous:**User-defined output

**Contents**

# Program structure.

CalculiX CrunchiX is a mixture of FORTRAN77 (with elements from FORTRAN90) and C. C is primarily used for automatic allocation and reallocation purposes. FORTRAN is the first language I learned and I must admit that I'm still a FORTRAN addict. I use C where necessary, I avoid it where possible. Another option would have been to code everything in FORTRAN90, however, to this date there is no good FREE FORTRAN90 compiler. Roughly speaking, the main routine and some of the routines called by main are in C, the others are in FORTRAN. This means that no C routine is called by a FORTRAN routine, a FORTRAN routine may be called by a C routine or a FORTRAN routine. There are NO commons in the code. All data transfer is through arguments of subroutine calls. All arguments are transferred by address, not value (there may be one or two exceptions on this rule in the code).

The main subroutine of CalculiX is ccx_2.5.c. It consists roughly of the following parts:

- Allocation of the fields

- Reading the step input data (including the prestep data for the first step)
- Determining the matrix structure
- Filling and solving the set of equations, storing the results.

**Subsections**

- Allocation of the fields

- Reading the step input data
- SPC's
- Homogeneous linear equations
- Concentrated loads
- Facial distributed loads
- Mechanical body loads
- Sets
- Material description

- Expansion of the one-dimensional and two-dimensional elements
- Cataloguing the elements belonging to a given node
- Calculating the normals in the nodes
- Expanding the 1D and 2D elements
- Connecting 1D and 2D elements to 3D elements
- Applying the SPC's to the expanded structure
- Applying the MPC's to the expanded structure
- Applying temperatures and temperature gradients
- Applying concentrated forces to the expanded structure

- Contact
- Determining the matrix structure
- Matching the SPC's
- De-cascading the MPC's
- Renumbering the nodes to decrease the profile
- Determining the matrix structure.

- Filling and solving the set of equations, storing the results
- Linear static analysis
- Nonlinear calculations
- Frequency calculations
- Buckling calculations
- Modal dynamic calculations
- Steady state dynamics calculations

- Major routines

- Aerodynamic and hydraulic networks
- The variables and the equations
- Determining the basic characteristics of the network
- Initializing the unknowns
- Calculating the residual and setting up the equation system
- Convergence criteria

- Three-Dimensional Navier-Stokes Calculations
- Topological information
- Determining the structure of the system matrices
- Initial calculations
- The left hand sides of the equation systems
- Determining the time increment
- Determining the loading
- Step 1: determining
- Step 2: determining the pressure/density correction
- Step 3: determining the second momentum correction
- Step 4: determining the energy correction
- Step 5: determining the turbulence corrections
- Updating the conservative variables
- Smoothing the conservative variables for gases
- Application of temperature BC's and convergence check
- Three-dimensional interpolation

- List of variables and their meaning

**Next:**Allocation of the fields

**Up:**CalculiX CrunchiX USER'S MANUAL

**Previous:**User-defined output

**Contents**guido dhondt 2012-10-06