MAST
|
This example solves a cantilever rectangular plate with a uniformly distributed load on the top of the plate.
For direct solver, run with options: -ksp_type preonly -pc_type lu
Initialize libMesh library.
Create Mesh object on default MPI communicator and generate a 2D mesh of QUAD4 elements. We discretize with 12 elements in the x-direction (0.0 to 36.0 inches) and 40 elements in the y-direction (0.0 to 120.0 inches). 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.
if a finite radius is defined, change the mesh to a circular arc of specified radius
initialize the pointer to a node
For later reference, the boundary and subdomain ID's generated by the libMesh mesh generation are sketched below.
* y (#) Boundary ID * | (2) [#] Subdomain ID * 120.0 O-----O * | | x - right * | | y - up * (3) | [0] | (1) z - out of screen * | | * | | * 0.0 O-----O--x * (0) * 0.0 36.0 *
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 adds fixed displacement BCs. Here we use the side boundary ID numbering created by the libMesh generator to clamp the edge of the mesh along x=0.0. We apply the BC to all variables on each node in the subdomain ID 0, which clamps this edge.
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.
temperature_load.add(jac_scaling);
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.
Attach material to the card.
Initialize the 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.
output the solution to exo file.
write the header to the load.txt file
Solve the system
get the value of the node at the center of the plate for output
write the value to the load.txt file