diff --git a/framework/include/interfacekernels/InterfaceDiffusionTest.h b/framework/include/interfacekernels/InterfaceDiffusionTest.h new file mode 100644 index 000000000000..5d6736ab79b6 --- /dev/null +++ b/framework/include/interfacekernels/InterfaceDiffusionTest.h @@ -0,0 +1,35 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#pragma once + +#include "InterfaceKernel.h" + +/** + * DG kernel for interfacing diffusion between two variables on adjacent blocks + */ +class InterfaceDiffusionTest : public InterfaceKernel +{ +public: + static InputParameters validParams(); + + InterfaceDiffusionTest(const InputParameters & parameters); + +protected: + virtual Real computeQpResidual(Moose::DGResidualType type) override; + virtual Real computeQpJacobian(Moose::DGJacobianType type) override; + + const MaterialProperty & _D; + const MaterialProperty & _D_neighbor; + + // dislocation velocities + // slip direction and normal element + const MaterialProperty> & _slip_direction_edge; + const MaterialProperty> & _slip_plane_normalboth; +}; \ No newline at end of file diff --git a/framework/src/interfacekernels/InterfaceDiffusionTest.C b/framework/src/interfacekernels/InterfaceDiffusionTest.C new file mode 100644 index 000000000000..aacb6a5daf06 --- /dev/null +++ b/framework/src/interfacekernels/InterfaceDiffusionTest.C @@ -0,0 +1,76 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "InterfaceDiffusionTest.h" + +registerMooseObject("MooseApp", InterfaceDiffusionTest); + +InputParameters +InterfaceDiffusionTest::validParams() +{ + InputParameters params = InterfaceKernel::validParams(); + params.addParam("D", "D", "The diffusion coefficient."); + params.addParam( + "D_neighbor", "D_neighbor", "The neighboring diffusion coefficient."); + params.addClassDescription( + "The kernel is utilized to establish flux equivalence on an interface for variables."); + return params; +} + +InterfaceDiffusionTest::InterfaceDiffusionTest(const InputParameters & parameters) + : InterfaceKernel(parameters), + _D(getMaterialProperty("D")), + _D_neighbor(getNeighborMaterialProperty("D_neighbor")), + _slip_direction_edge(getMaterialProperty>("slip_direction_edge")), + _slip_plane_normalboth( + getMaterialProperty>("slip_plane_normalboth")) +{ +} + +Real +InterfaceDiffusionTest::computeQpResidual(Moose::DGResidualType type) +{ + Real r = 0; + + switch (type) + { + case Moose::Element: + r = _test[_i][_qp] * -_D_neighbor[_qp] * _grad_neighbor_value[_qp] * _normals[_qp]; + break; + + case Moose::Neighbor: + r = _test_neighbor[_i][_qp] * _D[_qp] * _grad_u[_qp] * _normals[_qp]; + break; + } + + return r; +} + +Real +InterfaceDiffusionTest::computeQpJacobian(Moose::DGJacobianType type) +{ + Real jac = 0; + + switch (type) + { + case Moose::ElementElement: + case Moose::NeighborNeighbor: + break; + + case Moose::NeighborElement: + jac = _test_neighbor[_i][_qp] * _D[_qp] * _grad_phi[_j][_qp] * _normals[_qp]; + break; + + case Moose::ElementNeighbor: + jac = _test[_i][_qp] * -_D_neighbor[_qp] * _grad_phi_neighbor[_j][_qp] * _normals[_qp]; + break; + } + + return jac; +} \ No newline at end of file diff --git a/framework/src/meshmodifiers/SidesetAroundSubdomainUpdater.C b/framework/src/meshmodifiers/SidesetAroundSubdomainUpdater.C index a34f346e0301..9f16c32312dd 100644 --- a/framework/src/meshmodifiers/SidesetAroundSubdomainUpdater.C +++ b/framework/src/meshmodifiers/SidesetAroundSubdomainUpdater.C @@ -159,10 +159,16 @@ SidesetAroundSubdomainUpdater::finalize() { for (const auto & [elem_id, side] : sent_data) { - _boundary_info.remove_side(mesh.elem_ptr(elem_id), side, _boundary_id); + // delete boundaries using parents + auto elem_ptr = mesh.elem_ptr(elem_id)->level() > 0 ? mesh.elem_ptr(elem_id)->parent() + : mesh.elem_ptr(elem_id); + _boundary_info.remove_side(elem_ptr, side, _boundary_id); if (_displaced_boundary_info) - _displaced_boundary_info->remove_side( - displaced_mesh->elem_ptr(elem_id), side, _boundary_id); + _displaced_boundary_info->remove_side((displaced_mesh->elem_ptr(elem_id)->level() > 0) + ? displaced_mesh->elem_ptr(elem_id)->parent() + : displaced_mesh->elem_ptr(elem_id), + side, + _boundary_id); } };