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/tensor_mechanics/tutorials/introduction/step03.html
#
[GlobalParams]
displacements = 'disp_x disp_y'
[]
[Mesh]
[generated]
type = GeneratedMeshGenerator
dim = 2
nx = 40
ny = 20
xmax = 2
ymax = 1
[]
# assign two subdomains
[block1]
type = SubdomainBoundingBoxGenerator
input = generated
block_id = 1
bottom_left = '0 0 0'
top_right = '1 1 0'
[]
[block2]
type = SubdomainBoundingBoxGenerator
input = block1
block_id = 2
bottom_left = '1 0 0'
top_right = '2 1 0'
[]
[]
[Modules/TensorMechanics/Master]
[all]
add_variables = true
[]
[]
[BCs]
[bottom_x]
type = DirichletBC
variable = disp_x
boundary = bottom
value = 0
[]
[bottom_y]
type = DirichletBC
variable = disp_y
boundary = bottom
value = 0
[]
[Pressure]
[top]
boundary = top
function = 1e7*t
[]
[]
[]
[Materials]
[elasticity1]
type = ComputeIsotropicElasticityTensor
youngs_modulus = 1e9
poissons_ratio = 0.3
block = 1
[]
[elasticity2]
type = ComputeIsotropicElasticityTensor
youngs_modulus = 5e8
poissons_ratio = 0.3
block = 2
[]
[stress]
type = ComputeLinearElasticStress
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
end_time = 5
dt = 1
[]
[Outputs]
exodus = true
[]
(moose/modules/tensor_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 on 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 totrue
(this can be disabled by setting "auto_preconditioning" tofalse
).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 master action makes this particularly easy.
Try and add output for the vonMises stress in the simulation domain. Take a look at the "generate_output" parameter...
Sidebar: Thermal expansion
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.