MAST
|
This example solves an axial bar extension problem.
Initialize libMesh library.
Create Mesh object on default MPI communicator and generate a line mesh (5 elements, 10 units long). Note that in libMesh, all meshes are parallel by default in the sense that the equations on the mesh are solved in parallel by PETSc. A "ReplicatedMesh" is one where all MPI processes have the full mesh in memory, as compared to a "DistributedMesh" where the mesh is "chunked" up and distributed across processes, each having their own piece.
Create EquationSystems object, which is a container for multiple systems of equations that are defined on a given mesh.
Add system of type MAST::NonlinearSystem (which wraps libMesh::NonlinearImplicitSystem) to the EquationSystems container. We name the system "structural" and also get a reference to the system so we can easily reference it later.
Create a finite element type for the system. Here we use first order Lagrangian-type finite elements.
Initialize the system to the correct set of variables for a structural analysis. In libMesh this is analogous to adding variables (each with specific finite element type/order to the system for a particular system of equations.
Initialize a new structural discipline using equation_systems.
Create and add boundary conditions to the structural system. A Dirichlet BC fixes the left end of the bar. This definition uses the numbering created by the libMesh mesh generation function.
Initialize the equation system since we now know the size of our system matrices (based on mesh, element type, variables in the structural_system) as well as the setup of dirichlet boundary conditions. This initialization process is basically a pre-processing step to preallocate storage and spread it across processors.
Create parameters.
Create ConstantFieldFunctions used to spread parameters throughout the model.
Initialize load. TODO - Switch this to a concentrated/point load on the right end of the bar.
Create the material property card ("card" is NASTRAN lingo) and the relevant parameters to it. An isotropic material needs elastic modulus (E) and Poisson ratio (nu) to describe its behavior.
Create the section property card. Attach all property values.
Specify a section orientation point and add it to the section.
Attach material to the card.
Initialize the section and specify the subdomain in the mesh that it applies to.
Create nonlinear assembly object and set the discipline and structural_system. Create reference to system.
Zero the solution before solving.
Solve the system and print displacement degrees-of-freedom to screen.