Step 3 - Subdomains and subdomain-specific properties

In this step we'll be setting up two subdomains (regions of our sample) with differing material properties.

#
# Added subdomains and subdomain-specific properties
# https://mooseframework.inl.gov/modules/solid_mechanics/tutorials/introduction/step03.html
#

[GlobalParams<<<{"href": "../../../../syntax/GlobalParams/index.html"}>>>]
  displacements = 'disp_x disp_y'
[]

[Mesh<<<{"href": "../../../../syntax/Mesh/index.html"}>>>]
  [generated]
    type = GeneratedMeshGenerator<<<{"description": "Create a line, square, or cube mesh with uniformly spaced or biased elements.", "href": "../../../../source/meshgenerators/GeneratedMeshGenerator.html"}>>>
    dim<<<{"description": "The dimension of the mesh to be generated"}>>> = 2
    nx<<<{"description": "Number of elements in the X direction"}>>> = 40
    ny<<<{"description": "Number of elements in the Y direction"}>>> = 20
    xmax<<<{"description": "Upper X Coordinate of the generated mesh"}>>> = 2
    ymax<<<{"description": "Upper Y Coordinate of the generated mesh"}>>> = 1
  []

  # assign two subdomains
  [block1]
    type = SubdomainBoundingBoxGenerator<<<{"description": "Changes the subdomain ID of elements either (XOR) inside or outside the specified box to the specified ID.", "href": "../../../../source/meshgenerators/SubdomainBoundingBoxGenerator.html"}>>>
    input<<<{"description": "The mesh we want to modify"}>>> = generated
    block_id<<<{"description": "Subdomain id to set for inside/outside the bounding box"}>>> = 1
    bottom_left<<<{"description": "The bottom left point (in x,y,z with spaces in-between)."}>>> = '0 0 0'
    top_right<<<{"description": "The bottom left point (in x,y,z with spaces in-between)."}>>> = '1 1 0'
  []
  [block2]
    type = SubdomainBoundingBoxGenerator<<<{"description": "Changes the subdomain ID of elements either (XOR) inside or outside the specified box to the specified ID.", "href": "../../../../source/meshgenerators/SubdomainBoundingBoxGenerator.html"}>>>
    input<<<{"description": "The mesh we want to modify"}>>> = block1
    block_id<<<{"description": "Subdomain id to set for inside/outside the bounding box"}>>> = 2
    bottom_left<<<{"description": "The bottom left point (in x,y,z with spaces in-between)."}>>> = '1 0 0'
    top_right<<<{"description": "The bottom left point (in x,y,z with spaces in-between)."}>>> = '2 1 0'
  []
[]

[Physics<<<{"href": "../../../../syntax/Physics/index.html"}>>>/SolidMechanics<<<{"href": "../../../../syntax/Physics/SolidMechanics/index.html"}>>>/QuasiStatic<<<{"href": "../../../../syntax/Physics/SolidMechanics/QuasiStatic/index.html"}>>>]
  [all]
    add_variables<<<{"description": "Add the displacement variables"}>>> = true
  []
[]

[BCs<<<{"href": "../../../../syntax/BCs/index.html"}>>>]
  [bottom_x]
    type = DirichletBC<<<{"description": "Imposes the essential boundary condition $u=g$, where $g$ is a constant, controllable value.", "href": "../../../../source/bcs/DirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = disp_x
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = bottom
    value<<<{"description": "Value of the BC"}>>> = 0
  []
  [bottom_y]
    type = DirichletBC<<<{"description": "Imposes the essential boundary condition $u=g$, where $g$ is a constant, controllable value.", "href": "../../../../source/bcs/DirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = disp_y
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = bottom
    value<<<{"description": "Value of the BC"}>>> = 0
  []
  [Pressure<<<{"href": "../../../../syntax/BCs/Pressure/index.html"}>>>]
    [top]
      boundary<<<{"description": "The list of boundary IDs from the mesh where the pressure will be applied"}>>> = top
      function<<<{"description": "The function that describes the pressure"}>>> = 1e7*t
    []
  []
[]

[Materials<<<{"href": "../../../../syntax/Materials/index.html"}>>>]
  [elasticity1]
    type = ComputeIsotropicElasticityTensor<<<{"description": "Compute a constant isotropic elasticity tensor.", "href": "../../../../source/materials/ComputeIsotropicElasticityTensor.html"}>>>
    youngs_modulus<<<{"description": "Young's modulus of the material."}>>> = 1e9
    poissons_ratio<<<{"description": "Poisson's ratio for the material."}>>> = 0.3
    block<<<{"description": "The list of blocks (ids or names) that this object will be applied"}>>> = 1
  []
  [elasticity2]
    type = ComputeIsotropicElasticityTensor<<<{"description": "Compute a constant isotropic elasticity tensor.", "href": "../../../../source/materials/ComputeIsotropicElasticityTensor.html"}>>>
    youngs_modulus<<<{"description": "Young's modulus of the material."}>>> = 5e8
    poissons_ratio<<<{"description": "Poisson's ratio for the material."}>>> = 0.3
    block<<<{"description": "The list of blocks (ids or names) that this object will be applied"}>>> = 2
  []
  [stress]
    type = ComputeLinearElasticStress<<<{"description": "Compute stress using elasticity for small strains", "href": "../../../../source/materials/ComputeLinearElasticStress.html"}>>>
  []
[]

[Executioner<<<{"href": "../../../../syntax/Executioner/index.html"}>>>]
  type = Transient
  solve_type = NEWTON
  petsc_options_iname = '-pc_type'
  petsc_options_value = 'lu'
  end_time = 5
  dt = 1
[]

[Outputs<<<{"href": "../../../../syntax/Outputs/index.html"}>>>]
  exodus<<<{"description": "Output the results using the default settings for Exodus output."}>>> = true
[]
(moose/modules/solid_mechanics/tutorials/introduction/mech_step03.i)

Input file

Mesh

Note that we refine the mesh a bit to better capture the discontinuity we're introducing below.

The block1 and block2 subblocks are part of a chain of mesh generators, linked by their input parameters. Each of the SubdomainBoundingBoxGenerator adds a subdomain definition to the current mesh. Here we define two subdomains, one for the left half of the domain and one for the right.

Materials

We now define two elasticity tensors in this problem, one on the left half (block = 1) and one on the right half (block = 2), referring to the subdomain IDs we assigned using the mesh generators above.

Note how the stiffness of the right hand side is only half that of the left hand side.

Executioner

We make a few changes in the Executioner block here, and you should try playing with some of the settings later on.

  • We select NEWTON as our "solve_type". This is a good (fast) option whenever we have a complete Jacobian for the system. It should give us 1-2 linear iterations for every non-linear iteration. Note that for NEWTON solves MOOSE automatically sets up an SMP with the "full" option set to true (this can be disabled by setting "auto_preconditioning" to false).

  • We use LU decomposition to solve the linear problem, this preconditioner is very effective on a small problem like this. (For a more scalable preconditioner for large problems take a look at HYPRE.)

Questions

Visualizing strain

So far we've only looked at the deformation of the mesh. MOOSE can visualize a host of mechanical quantities, and the quasi-static physics makes this particularly easy.

Try and add output for the vonMises stress in the simulation domain. Take a look at the "generate_output" parameter...

Click here for the answer.

In addition to externally applied loading deformation can be induced by internal changes of a material. One common effect is the thermal expansion (or contraction) under temperature changes.

Click here for the sidebar on thermal expansion.

Once you've answered the questions and run this example we will move on to Step 4 and setup a cantilever problem that prepares us for contact.