Skip to content

Commit

Permalink
Tests for ADBCs (idaholab#13260)
Browse files Browse the repository at this point in the history
  • Loading branch information
tophmatthews committed Apr 18, 2019
1 parent 24d3a9d commit ffb6990
Show file tree
Hide file tree
Showing 19 changed files with 1,414 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# This simulation models the mechanics solution for a hollow sphere under
# pressure, applied on the outer surfaces, using 1D spherical symmetry
# assumpitions. The inner radius of the sphere, r = 4mm, is pinned to prevent
# rigid body movement of the sphere.
#
# From Bower (Applied Mechanics of Solids, 2008, available online at
# solidmechanics.org/text/Chapter4_1/Chapter4_1.htm), and applying the outer
# pressure and pinned displacement boundary conditions set in this simulation,
# the radial displacement is given by:
#
# u(r) = \frac{P(1 + v)(1 - 2v)b^3}{E(b^3(1 + v) + 2a^3(1-2v))} * (\frac{a^3}{r^2} - r)
#
# where P is the applied pressure, b is the outer radius, a is the inner radius,
# v is Poisson's ration, E is Young's Modulus, and r is the radial position.
#
# The radial stress is given by:
#
# S(r) = \frac{Pb^3}{b^3(1 + v) + 2a^3(1 - 2v)} * (\frac{2a^3}{r^3}(2v - 1) - (1 + v))
#
# The test assumes an inner radius of 4mm, and outer radius of 9 mm,
# zero displacement at r = 4mm, and an applied outer pressure of 2MPa.
# The radial stress is largest in the inner most element and, at an assumed
# mid element coordinate of 4.5mm, is equal to -2.545MPa.
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 4
xmax = 9
nx = 5
[]

[GlobalParams]
displacements = 'disp_r'
[]

[Problem]
coord_type = RSPHERICAL
[]

[Modules/TensorMechanics/Master]
[./all]
strain = FINITE
add_variables = true
use_automatic_differentiation = true
[../]
[]

[AuxVariables]
[./stress_rr]
order = CONSTANT
family = MONOMIAL
[../]
[]

[Postprocessors]
[./stress_rr]
type = ElementAverageValue
variable = stress_rr
[../]
[]

[AuxKernels]
[./stress_rr]
type = RankTwoAux
rank_two_tensor = stress
index_i = 0
index_j = 0
variable = stress_rr
execute_on = timestep_end
[../]
[]

[BCs]
[./innerDisp]
type = PresetBC
boundary = left
variable = disp_r
value = 0.0
[../]
[./outerPressure]
type = ADPressure
boundary = right
variable = disp_r
component = 0
factor = 2
[../]
[]

[Materials]
[./Elasticity_tensor]
type = ComputeIsotropicElasticityTensor
poissons_ratio = 0.345
youngs_modulus = 1e4
[../]
[./stress]
type = ADComputeFiniteStrainElasticStress
[../]
[]

[Preconditioning]
[./smp]
type = SMP
full = true
[../]
[]

[Executioner]
type = Transient
solve_type = PJFNK
line_search = none


# controls for linear iterations
l_max_its = 100
l_tol = 1e-8

# controls for nonlinear iterations
nl_max_its = 15
nl_rel_tol = 1e-10
nl_abs_tol = 1e-5

# time control
start_time = 0.0
dt = 0.25
dtmin = 0.0001
end_time = 1.0
[]

[Outputs]
exodus = true
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# This simulation models the mechanics solution for a solid sphere under
# pressure, applied on the outer surfaces, using 1D spherical symmetry
# assumpitions. The inner center of the sphere, r = 0, is pinned to prevent
# movement of the sphere.
#
# From Bower (Applied Mechanics of Solids, 2008, available online at
# solidmechanics.org/text/Chapter4_1/Chapter4_1.htm), and applying the outer
# pressure and pinned displacement boundary conditions set in this simulation,
# the radial displacement is given by:
#
# u(r) = \frac{- P * (1 - 2 * v) * r}{E}
#
# where P is the applied pressure, v is Poisson's ration, E is Young's Modulus,
# and r is the radial position.
#
# The test assumes a radius of 4, zero displacement at r = 0mm, and an applied
# outer pressure of 1MPa. Under these conditions in a solid sphere, the radial
# stress is constant and has a value of -1 MPa.
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = 4
nx = 4
[]

[GlobalParams]
displacements = 'disp_r'
[]

[Problem]
coord_type = RSPHERICAL
[]

[Modules/TensorMechanics/Master]
[./all]
strain = SMALL
add_variables = true
save_in = residual_r
use_automatic_differentiation = true
[../]
[]

[AuxVariables]
[./stress_rr]
order = CONSTANT
family = MONOMIAL
[../]
[./residual_r]
[../]
[]

[Postprocessors]
[./stress_rr]
type = ElementAverageValue
variable = stress_rr
[../]
[./residual_r]
type = NodalSum
variable = residual_r
boundary = right
[../]
[]

[AuxKernels]
[./stress_rr]
type = RankTwoAux
rank_two_tensor = stress
index_i = 0
index_j = 0
variable = stress_rr
execute_on = timestep_end
[../]
[]

[BCs]
[./innerDisp]
type = PresetBC
boundary = left
variable = disp_r
value = 0.0
[../]
[./outerPressure]
type = ADPressure
boundary = right
variable = disp_r
component = 0
factor = 1
[../]
[]

[Materials]
[./Elasticity_tensor]
type = ComputeIsotropicElasticityTensor
poissons_ratio = 0.345
youngs_modulus = 1e4
[../]
[./stress]
[../]
[]

[Preconditioning]
[./smp]
type = SMP
full = true
[../]
[]

[Executioner]
type = Transient
solve_type = PJFNK
line_search = none

# controls for linear iterations
l_max_its = 100
l_tol = 1e-8

# controls for nonlinear iterations
nl_max_its = 15
nl_rel_tol = 1e-10
nl_abs_tol = 1e-5

# time control
start_time = 0.0
dt = 0.25
dtmin = 0.0001
end_time = 1.0
[]

[Outputs]
exodus = true
[]
71 changes: 71 additions & 0 deletions modules/tensor_mechanics/test/tests/1D_spherical/tests
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,75 @@
design = 'source/Materials/ComputeRSphericalFStrain.md source/Materials/stress/ComputeFiniteStrainElasticStress.md syntax/Modules/TensorMechanics/Master/index.md'
requirement = 'The ComputeRSphericalFiniteStrain class, called through the TensorMechanicsMaster action, shall find the finite incremental strain displacement of a thick walled hollow isotropic elastic sphere under an applied load using a 1D spherical symmetric fomulation with incremental finite strain assumptions.'
[../]

[./ad-smallStrain_1DSphere]
type = Exodiff
input = 'ad-smallStrain_1DSphere.i'
exodiff = 'ad-smallStrain_1DSphere_out.e'
compiler = 'CLANG GCC'
cli_args = 'Modules/TensorMechanics/Master/all/incremental=false
Materials/stress/type=ADComputeLinearElasticStress'
issues = '#6256 #7555'
design = 'source/Materials/ComputeRSphericalSmallStrain.md source/Materials/stress/ComputeLinearElasticStress.md syntax/Modules/TensorMechanics/Master/index.md'
requirement = 'The ComputeRSphericalSmallStrain class, called through the TensorMechanicsMaster action, shall compute the total linearized solution for the displacement of a solid isotropic elastic sphere with a pressure applied to the outer surface using a 1D spherical symmetric formulation with total small strain assumptions.'
[../]
[./ad-smallStrain_1DSphere_incremental]
type = Exodiff
input = 'ad-smallStrain_1DSphere.i'
exodiff = 'ad-smallStrain_1DSphere_out.e'
compiler = 'CLANG GCC'
cli_args = 'Modules/TensorMechanics/Master/all/incremental=true
Materials/stress/type=ADComputeFiniteStrainElasticStress'
prereq = 'ad-smallStrain_1DSphere'
issues = '#6256 #7555'
design = 'source/Materials/ComputeRSphericalIncrementalStrain.md source/Materials/stress/ComputeFiniteStrainElasticStress.md syntax/Modules/TensorMechanics/Master/index.md'
requirement = 'The ComputeRSphericalIncrementalStrain class, called through the TensorMechanicsMaster action, shall find the linearized incremental strain displacement of a solid isotropic elastic sphere with a pressure applied to the outer surface using a 1D spherical symmetric formulation with incremental small strain assumptions.'
[../]
[./ad-finiteStrain_1DSphere_hollow]
type = Exodiff
input = 'ad-finiteStrain_1DSphere_hollow.i'
exodiff = 'ad-finiteStrain_1DSphere_hollow_out.e'
compiler = 'CLANG GCC'
issues = '#6256 #7555'
design = 'source/Materials/ComputeRSphericalFStrain.md source/Materials/stress/ComputeFiniteStrainElasticStress.md syntax/Modules/TensorMechanics/Master/index.md'
requirement = 'The ComputeRSphericalFiniteStrain class, called through the TensorMechanicsMaster action, shall find the finite incremental strain displacement of a thick walled hollow isotropic elastic sphere under an applied load using a 1D spherical symmetric fomulation with incremental finite strain assumptions.'
[../]

[./ad-smallStrain_1DSphere-jac]
type = 'PetscJacobianTester'
input = 'ad-smallStrain_1DSphere.i'
run_sim = 'True'
ratio_tol = 1e-8
difference_tol = 1e-8
petsc_version = '>=3.9.4'
cli_args = 'Modules/TensorMechanics/Master/all/incremental=false
Materials/stress/type=ADComputeLinearElasticStress'
issues = '#12650'
design = 'jacobian_definitions.md'
requirement = 'The Jacobian for the AD small strain elasticity problem with Pressure BC in spherical coordinates shall be perfect'
[../]
[./ad-smallStrain_1DSphere_incremental-jac]
type = 'PetscJacobianTester'
input = 'ad-smallStrain_1DSphere.i'
run_sim = 'True'
ratio_tol = 1e-8
difference_tol = 1e-8
petsc_version = '>=3.9.4'
cli_args = 'Modules/TensorMechanics/Master/all/incremental=true
Materials/stress/type=ADComputeFiniteStrainElasticStress'
issues = '#12650'
design = 'jacobian_definitions.md'
requirement = 'The Jacobian for the AD small incremental strain elasticity problem with Pressure BC in spherical coordinates shall be perfect'
[../]
[./ad-finiteStrain_1DSphere_hollow-jac]
type = 'PetscJacobianTester'
input = 'ad-finiteStrain_1DSphere_hollow.i'
run_sim = 'True'
ratio_tol = 1e-8
difference_tol = 1e-8
petsc_version = '>=3.9.4'
issues = '#12650'
design = 'jacobian_definitions.md'
requirement = 'The Jacobian for the AD small incremental strain elasticity problem with Pressure BC in spherical coordinates shall be perfect'
[../]
[]
Loading

0 comments on commit ffb6990

Please sign in to comment.