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 15 : InterfaceDiffusionFluxMatch::validParams() 16 : { 17 15 : InputParameters params = InterfaceDiffusionBase::validParams(); 18 15 : params.addClassDescription( 19 : "Enforce flux continuity between two different variables across a subdomain boundary"); 20 15 : return params; 21 0 : } 22 : 23 8 : InterfaceDiffusionFluxMatch::InterfaceDiffusionFluxMatch(const InputParameters & parameters) 24 8 : : InterfaceDiffusionBase(parameters) 25 : { 26 8 : } 27 : 28 : Real 29 207680 : InterfaceDiffusionFluxMatch::computeQpResidual(Moose::DGResidualType type) 30 : { 31 : // equal gradients means difference is zero 32 : Real res = 33 207680 : _D * _grad_u[_qp] * _normals[_qp] - _D_neighbor * _grad_neighbor_value[_qp] * _normals[_qp]; 34 : 35 207680 : switch (type) 36 : { 37 103840 : case Moose::Element: 38 103840 : return res * _test[_i][_qp]; 39 : 40 103840 : case Moose::Neighbor: 41 103840 : return res * _test_neighbor[_i][_qp]; 42 : } 43 : 44 0 : mooseError("Internal error."); 45 : } 46 : 47 : Real 48 65280 : InterfaceDiffusionFluxMatch::computeQpJacobian(Moose::DGJacobianType type) 49 : { 50 65280 : switch (type) 51 : { 52 32640 : case Moose::ElementElement: 53 32640 : return _D * _grad_phi[_j][_qp] * _normals[_qp] * _test[_i][_qp]; 54 : 55 32640 : case Moose::NeighborNeighbor: 56 32640 : 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 : }