Skip to content
Permalink
Browse files

Merge pull request #13503 from snschune/coupled_var_neumann_13502

Add CoupledVarNeumannBC
  • Loading branch information...
permcody committed Jun 3, 2019
2 parents 80d0d97 + ae16fef commit 51d07de50f60b700cf52a97736f024b05c0261b3
@@ -0,0 +1,19 @@
# CoupledVarNeumannBC

!syntax description /BCs/CoupledVarNeumannBC

## Description

`CoupledVarNeumannBC` is a generalization of the `NeumannBC`. Instead of
coupling a single real value through the `value` parameter, a coupled variable
is provided for the `v` parameter.

## Example Input Syntax

!listing test/tests/bcs/coupled_var_neumann/coupled_var_neumann.i start=[./right] end=[../] include-end=true

!syntax parameters /BCs/CoupledVarNeumannBC

!syntax inputs /BCs/CoupledVarNeumannBC

!syntax children /BCs/CoupledVarNeumannBC
@@ -0,0 +1,33 @@
//* 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 "IntegratedBC.h"

class CoupledVarNeumannBC;

template <>
InputParameters validParams<CoupledVarNeumannBC>();

/**
* Implements a Neumann BC where grad(u)=_coupled_var on the boundary.
* Uses the term produced from integrating the diffusion operator by parts.
*/
class CoupledVarNeumannBC : public IntegratedBC
{
public:
CoupledVarNeumannBC(const InputParameters & parameters);

protected:
virtual Real computeQpResidual() override;

/// Variable providing the value of grad(u) on the boundary.
const VariableValue & _coupled_var;
};
@@ -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

#include "CoupledVarNeumannBC.h"

registerMooseObject("MooseApp", CoupledVarNeumannBC);

template <>
InputParameters
validParams<CoupledVarNeumannBC>()
{
InputParameters params = validParams<IntegratedBC>();
params.addRequiredCoupledVar("v", "Coupled variable setting the gradient on the boundary.");
params.addClassDescription("Imposes the integrated boundary condition "
"$\\frac{\\partial u}{\\partial n}=v$, "
"where $v$ is a variable.");
return params;
}

CoupledVarNeumannBC::CoupledVarNeumannBC(const InputParameters & parameters)
: IntegratedBC(parameters), _coupled_var(coupledValue("v"))
{
}

Real
CoupledVarNeumannBC::computeQpResidual()
{
return -_test[_i][_qp] * _coupled_var[_qp];
}
@@ -0,0 +1,68 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]

[Variables]
[./u]
order = FIRST
family = LAGRANGE
[../]
[]

[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]

[AuxVariables]
[./coupled_bc_var]
[../]
[]

[ICs]
[./coupled_bc_var]
type = FunctionIC
variable = coupled_bc_var
function = set_coupled_bc_var
[../]
[]

[Functions]
[./set_coupled_bc_var]
type = ParsedFunction
value = 'y - 0.5'
[../]
[]

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[../]

[./right]
type = CoupledVarNeumannBC
variable = u
boundary = 1
v = coupled_bc_var
[../]
[]

[Executioner]
type = Steady
[]

[Outputs]
exodus = true
[]
Binary file not shown.
@@ -0,0 +1,10 @@
[Tests]
issues = '#13502'
design = 'bcs/CoupledVarNeumannBC.md'
[./test]
type = 'Exodiff'
input = 'coupled_var_neumann.i'
exodiff = 'coupled_var_neumann_out.e'
requirement = "MOOSE shall support coupled Neumann type boundary conditions."
[../]
[]

0 comments on commit 51d07de

Please sign in to comment.
You can’t perform that action at this time.