Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "InterfaceDiffusionFluxMatch.h" 11 : 12 : registerMooseObject("PhaseFieldApp", InterfaceDiffusionFluxMatch); 13 : 14 : InputParameters 15 23 : InterfaceDiffusionFluxMatch::validParams() 16 : { 17 23 : InputParameters params = InterfaceDiffusionBase::validParams(); 18 23 : params.addClassDescription( 19 : "Enforce flux continuity between two different variables across a subdomain boundary"); 20 23 : return params; 21 0 : } 22 : 23 12 : InterfaceDiffusionFluxMatch::InterfaceDiffusionFluxMatch(const InputParameters & parameters) 24 12 : : InterfaceDiffusionBase(parameters) 25 : { 26 12 : } 27 : 28 : Real 29 251360 : InterfaceDiffusionFluxMatch::computeQpResidual(Moose::DGResidualType type) 30 : { 31 : // equal gradients means difference is zero 32 : Real res = 33 251360 : _D * _grad_u[_qp] * _normals[_qp] - _D_neighbor * _grad_neighbor_value[_qp] * _normals[_qp]; 34 : 35 251360 : switch (type) 36 : { 37 125680 : case Moose::Element: 38 125680 : return res * _test[_i][_qp]; 39 : 40 125680 : case Moose::Neighbor: 41 125680 : return res * _test_neighbor[_i][_qp]; 42 : } 43 : 44 0 : mooseError("Internal error."); 45 : } 46 : 47 : Real 48 78080 : InterfaceDiffusionFluxMatch::computeQpJacobian(Moose::DGJacobianType type) 49 : { 50 78080 : switch (type) 51 : { 52 39040 : case Moose::ElementElement: 53 39040 : return _D * _grad_phi[_j][_qp] * _normals[_qp] * _test[_i][_qp]; 54 : 55 39040 : case Moose::NeighborNeighbor: 56 39040 : return -_D_neighbor * _grad_phi_neighbor[_j][_qp] * _normals[_qp] * _test_neighbor[_i][_qp]; 57 : 58 0 : case Moose::ElementNeighbor: 59 0 : return -_D_neighbor * _grad_phi_neighbor[_j][_qp] * _normals[_qp] * _test[_i][_qp]; 60 : 61 0 : case Moose::NeighborElement: 62 0 : return _D * _grad_phi[_j][_qp] * _normals[_qp] * _test_neighbor[_i][_qp]; 63 : } 64 0 : mooseError("Internal error."); 65 : }