Skip to content

Commit

Permalink
Add analytical function test and fixup bug in ElectrostaticContactCon…
Browse files Browse the repository at this point in the history
…dition (idaholab#31)
  • Loading branch information
cticenhour committed May 16, 2022
1 parent 199d304 commit 77f37e3
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ ElectrostaticContactCondition::computeQpResidual(Moose::DGResidualType type)
switch (type)
{
case Moose::Element:
res = 0.5 *
(_conductivity_secondary[_qp] * _grad_neighbor_value[_qp] * _normals[_qp] -
contact_conductance * (_neighbor_value[_qp] - _u[_qp])) *
_test[_i][_qp];
res = -contact_conductance * (_neighbor_value[_qp] - _u[_qp]) * _test[_i][_qp];
break;

case Moose::Neighbor:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Regression test for ElectrostaticContactCondition with analytic solution
#
# dim = 1D
# X = [0,2]
# Interface at X = 1
#
# stainless_steel graphite
# +------------------+------------------+
#
# Left BC: Potential = 1
# Right BC: Potential = 0
# Center Interface: ElectrostaticContactCondition
#

[Mesh]
[./line]
type = GeneratedMeshGenerator
dim = 1
nx = 4
xmax = 2
[../]
[./break]
type = SubdomainBoundingBoxGenerator
input = line
block_id = 1
block_name = 'graphite'
bottom_left = '1 0 0'
top_right = '2 0 0'
[../]
[./block_name]
type = RenameBlockGenerator
input = break
old_block_id = 0
new_block_name = 'stainless_steel'
[../]
[./interface]
type = SideSetsBetweenSubdomainsGenerator
input = block_name
primary_block = 'stainless_steel'
paired_block = 'graphite'
new_boundary = 'ssg_interface'
[../]
[]

[Variables]
[./potential_graphite]
block = graphite
[../]
[./potential_stainless_steel]
block = stainless_steel
[../]
[]

[AuxVariables]
[./analytic_potential_stainless_steel]
block = stainless_steel
[../]
[./analytic_potential_graphite]
block = graphite
[../]
[]

[Kernels]
[./electric_graphite]
type = ConductivityLaplacian
variable = potential_graphite
conductivity_coefficient = electrical_conductivity
block = graphite
[../]
[./electric_stainless_steel]
type = ConductivityLaplacian
variable = potential_stainless_steel
conductivity_coefficient = electrical_conductivity
block = stainless_steel
[../]
[]

[AuxKernels]
[./analytic_function_aux_stainless_steel]
type = FunctionAux
function = potential_fxn_stainless_steel
variable = analytic_potential_stainless_steel
block = stainless_steel
[../]
[./analytic_function_aux_graphite]
type = FunctionAux
function = potential_fxn_graphite
variable = analytic_potential_graphite
block = graphite
[../]
[]

[BCs]
[./elec_left]
type = ADDirichletBC
variable = potential_stainless_steel
boundary = left
value = 1
[../]
[./elec_right]
type = ADDirichletBC
variable = potential_graphite
boundary = right
value = 0
[../]
[]

[InterfaceKernels]
[./electric_contact_conductance_ssg]
type = ElectrostaticContactCondition
variable = potential_stainless_steel
neighbor_var = potential_graphite
boundary = ssg_interface
mean_hardness = mean_hardness
mechanical_pressure = 3000
[../]
[]

[Materials]
#graphite (at 300 K)
[./sigma_graphite]
type = ADGenericConstantMaterial
prop_names = electrical_conductivity
prop_values = 73069.2
temperature = temperature_graphite
block = graphite
[../]

#stainless_steel (at 300 K)
[./sigma_stainless_steel]
type = ADGenericConstantMaterial
prop_names = electrical_conductivity
prop_values = 1.41867e6
temperature = temperature_stainless_steel
block = stainless_steel
[../]

# harmonic mean of graphite and stainless steel hardness
[./mean_hardness]
type = ADGenericConstantMaterial
prop_names = mean_hardness
prop_values = 2.4797e9
[../]
[]

[Functions]
[./potential_fxn_stainless_steel]
type = ElectricalContactTestFunc
domain = stainless_steel
[../]
[./potential_fxn_graphite]
type = ElectricalContactTestFunc
domain = graphite
[../]
[]

[Postprocessors]
[./error_stainless_steel]
type = ElementL2Error
variable = potential_stainless_steel
function = potential_fxn_stainless_steel
block = stainless_steel
[../]
[./error_graphite]
type = ElementL2Error
variable = potential_graphite
function = potential_fxn_graphite
block = graphite
[../]
[]


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

[Executioner]
type = Steady
solve_type = NEWTON
automatic_scaling = true
[]

[Outputs]
csv = true
perf_graph = true
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
time,error_graphite,error_stainless_steel
0,0,0
1,1.7691842306039e-07,9.1122582866556e-09
5 changes: 5 additions & 0 deletions modules/electromagnetics/test/tests/interfacekernels/tests
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@
difference_tol = 2e-8 #default = 1e-8, first evaluation is 1.15647e-8
prereq = electrostatic_contact_conductance_calculated
[../]
[./electrostatic_contact_analytic_solution_test]
type = CSVDiff
input = 'analytic_solution_test.i'
csvdiff = 'analytic_solution_test_out.csv'
[../]
[]

0 comments on commit 77f37e3

Please sign in to comment.