Skip to content
Permalink
Browse files

Merge pull request #13313 from aeslaughter/VectorFunctionIC-13309

Create VectorFunctionIC
  • Loading branch information...
lindsayad committed Apr 29, 2019
2 parents 951f407 + cba4f1d commit 206c4edee2b8faa4c874507646eb8d2a33c9b0ac
Showing with 612 additions and 213 deletions.
  1. +9 −9 ...ork/doc/content/source/bcs/{ADLagrangeVecFunctionDirichletBC.md → ADVectorFunctionDirichletBC.md}
  2. +7 −7 framework/doc/content/source/bcs/{LagrangeVecDirichletBC.md → VectorDirichletBC.md}
  3. +8 −8 framework/doc/content/source/bcs/{LagrangeVecFunctionDirichletBC.md → VectorFunctionDirichletBC.md}
  4. +16 −0 framework/doc/content/source/ics/VectorFunctionIC.md
  5. +32 −0 framework/include/base/Registry.h
  6. +10 −8 framework/include/bcs/{ADLagrangeVecFunctionDirichletBC.h → ADVectorFunctionDirichletBC.h}
  7. +4 −5 framework/include/bcs/{LagrangeVecDirichletBC.h → VectorDirichletBC.h}
  8. +10 −8 framework/include/bcs/{LagrangeVecFunctionDirichletBC.h → VectorFunctionDirichletBC.h}
  9. +51 −0 framework/include/ics/VectorFunctionIC.h
  10. +4 −1 framework/include/kernels/VectorBodyForce.h
  11. +0 −43 framework/src/bcs/ADLagrangeVecFunctionDirichletBC.C
  12. +77 −0 framework/src/bcs/ADVectorFunctionDirichletBC.C
  13. +0 −45 framework/src/bcs/LagrangeVecFunctionDirichletBC.C
  14. +9 −5 framework/src/bcs/{LagrangeVecDirichletBC.C → VectorDirichletBC.C}
  15. +77 −0 framework/src/bcs/VectorFunctionDirichletBC.C
  16. +58 −0 framework/src/ics/VectorFunctionIC.C
  17. +19 −5 framework/src/kernels/VectorBodyForce.C
  18. +3 −3 modules/navier_stokes/test/tests/ins/lid_driven/ad_lid_driven.i
  19. +3 −3 modules/navier_stokes/test/tests/ins/lid_driven/ad_lid_driven_stabilized.i
  20. +4 −3 test/include/bcs/VectorCurlPenaltyDirichletBC.h
  21. +33 −9 test/src/bcs/VectorCurlPenaltyDirichletBC.C
  22. +3 −3 test/tests/bcs/ad_bcs/tests
  23. +3 −3 test/tests/bcs/ad_bcs/vector_ad_bc.i
  24. BIN test/tests/ics/vector_function_ic/gold/vector_function_ic_comp_out.e
  25. BIN test/tests/ics/vector_function_ic/gold/vector_function_ic_out.e
  26. +37 −0 test/tests/ics/vector_function_ic/tests
  27. +37 −0 test/tests/ics/vector_function_ic/vector_function_ic.i
  28. +35 −0 test/tests/ics/vector_function_ic/vector_function_ic_comp.i
  29. +6 −6 test/tests/kernels/ad_vector_couple/ad_grad_vector_couple.i
  30. +6 −6 test/tests/kernels/ad_vector_couple/ad_vector_couple.i
  31. +3 −3 test/tests/kernels/vector_fe/ad_lagrange_vec.i
  32. +2 −2 test/tests/kernels/vector_fe/coupled_scalar_vector.i
  33. +16 −16 test/tests/kernels/vector_fe/coupled_vector_gradient.i
  34. +4 −4 test/tests/kernels/vector_fe/lagrange_vec.i
  35. +2 −2 test/tests/kernels/vector_fe/lagrange_vec_1d.i
  36. +22 −4 test/tests/kernels/vector_fe/tests
  37. +2 −2 test/tests/kernels/vector_fe/vector_kernel.i
@@ -1,10 +1,10 @@
# ADLagrangeVecFunctionDirichletBC
# ADVectorFunctionDirichletBC

!syntax description /BCs/ADLagrangeVecFunctionDirichletBC
!syntax description /BCs/ADVectorFunctionDirichletBC

## Description

`ADLagrangeVecFunctionDirichletBC` is the extension of [`FunctionDirichletBC`](bcs/DirichletBC) to
`ADVectorFunctionDirichletBC` is the extension of [`FunctionDirichletBC`](bcs/DirichletBC) to
Lagrange vector variables and is used for
imposing so-called "essential" boundary conditions on systems of
partial differential equations (PDEs). Such boundary conditions force
@@ -21,17 +21,17 @@ class is appropriate to use for PDEs of the form

where $\Omega \subset \mathbb{R}^n$ is the domain, and $\partial
\Omega = \partial \Omega_D \cup \partial \Omega_N$ is its boundary. In
this case, a `LagrangeVecFunctionDirichletBC` object is used to impose the condition (2)
this case, a `VectorFunctionDirichletBC` object is used to impose the condition (2)
on the subset of the boundary denoted by $\partial \Omega_D$. In this case,
$\vec{g}$ is supplied through the `Function` parameters `x_exact_soln`, `y_exact_soln`, and
`z_exact_soln`. If any of those parameters are not supplied by the user, they
$\vec{g}$ is supplied through the `Function` parameters `function_x`, `function_y`, and
`function_z`. If any of those parameters are not supplied by the user, they
take a default value of $0$. The user must define one
or more sidesets corresponding to the boundary subset $\partial \Omega_D$.

Note that this BC computes its Jacobian using automatic differentiation

!syntax parameters /BCs/ADLagrangeVecFunctionDirichletBC
!syntax parameters /BCs/ADVectorFunctionDirichletBC

!syntax inputs /BCs/ADLagrangeVecFunctionDirichletBC
!syntax inputs /BCs/ADVectorFunctionDirichletBC

!syntax children /BCs/ADLagrangeVecFunctionDirichletBC
!syntax children /BCs/ADVectorFunctionDirichletBC
@@ -1,10 +1,10 @@
# LagrangeVecDirichletBC
# VectorDirichletBC

!syntax description /BCs/LagrangeVecDirichletBC
!syntax description /BCs/VectorDirichletBC

## Description

`LagrangeVecDirichletBC` is the extension of [`DirichletBC`](bcs/DirichletBC) to
`VectorDirichletBC` is the extension of [`DirichletBC`](bcs/DirichletBC) to
Lagrange vector variables and is used for
imposing so-called "essential" boundary conditions on systems of
partial differential equations (PDEs). Such boundary conditions force
@@ -21,13 +21,13 @@ class is appropriate to use for PDEs of the form

where $\Omega \subset \mathbb{R}^n$ is the domain, and $\partial
\Omega = \partial \Omega_D \cup \partial \Omega_N$ is its boundary. In
this case, a `LagrangeVecDirichletBC` object is used to impose the condition (2)
this case, a `VectorDirichletBC` object is used to impose the condition (2)
on the subset of the boundary denoted by $\partial \Omega_D$. In this case, the
`values` correspond to the constant components of $\vec{g}$, and the user must define one
or more sidesets corresponding to the boundary subset $\partial \Omega_D$.

!syntax parameters /BCs/LagrangeVecDirichletBC
!syntax parameters /BCs/VectorDirichletBC

!syntax inputs /BCs/LagrangeVecDirichletBC
!syntax inputs /BCs/VectorDirichletBC

!syntax children /BCs/LagrangeVecDirichletBC
!syntax children /BCs/VectorDirichletBC
@@ -1,10 +1,10 @@
# LagrangeVecFunctionDirichletBC
# VectorFunctionDirichletBC

!syntax description /BCs/LagrangeVecFunctionDirichletBC
!syntax description /BCs/VectorFunctionDirichletBC

## Description

`LagrangeVecFunctionDirichletBC` is a generalization of [`LagrangeVecDirichletBC`](/LagrangeVecDirichletBC.md) which
`VectorFunctionDirichletBC` is a generalization of [`VectorDirichletBC`](/VectorDirichletBC.md) which
imposes possibly temporally- and spatially-dependent values for the Lagrange
vector components through
MOOSE [`Function`](/Functions/index.md) objects on degrees of freedom
@@ -21,16 +21,16 @@ PDE of the form

where $\Omega \subset \mathbb{R}^n$ is the domain, and $\partial
\Omega = \partial \Omega_D \cup \partial \Omega_N$ is its boundary.
A `LagrangeVecFunctionDirichletBC` object can be used to impose the
A `VectorFunctionDirichletBC` object can be used to impose the
condition (2) if the function is well-defined for $\vec{x} \in
\partial \Omega_D$. In this case, the `x_exact_soln`, `y_exact_soln`, and `z_exact_soln` parameters correspond to a
\partial \Omega_D$. In this case, the `function_x`, `function_y`, and `function_z` parameters correspond to a
set of MOOSE `Function` objects which represent the mathematical function
$\vec{g(t,\vec{x})}$, and the user must define one or more sidesets
corresponding to the boundary subset $\partial \Omega_D$ via the
`boundary` parameter.

!syntax parameters /BCs/LagrangeVecFunctionDirichletBC
!syntax parameters /BCs/VectorFunctionDirichletBC

!syntax inputs /BCs/LagrangeVecFunctionDirichletBC
!syntax inputs /BCs/VectorFunctionDirichletBC

!syntax children /BCs/LagrangeVecFunctionDirichletBC
!syntax children /BCs/VectorFunctionDirichletBC
@@ -0,0 +1,16 @@
# VectorFunctionIC

The VectorFunctionIC allows the components of a vector variable to be defined using a
[Function](syntax/Functions/index.md) object. This function supplied requires that the
`vectorValue` method of the supplied function be defined, since this is used to populate the
vector variable.

!syntax description /ICs/VectorFunctionIC

!syntax parameters /ICs/VectorFunctionIC

!syntax inputs /ICs/VectorFunctionIC

!syntax children /ICs/VectorFunctionIC

!bibtex bibliography
@@ -112,6 +112,7 @@
/// add a deprecated MooseObject orig_class to the registry that has been replaced by another
/// object new_class with the same API. time is the time the object became/becomes deprecated in
/// "mm/dd/yyyy hh:mm" format.
/// A call to registerMooseObject is still required for the new class
#define registerMooseObjectRenamed(app, orig_class, time, new_class) \
static char combineNames(dummyvar_for_registering_obj_##orig_class, __LINE__) = \
Registry::add<new_class>({app, \
@@ -127,6 +128,37 @@
#new_class, \
false})

/// Add AD MooseObjects (e.g. both residual and jacobian objects) to the registry with the given app name/label. classname is the (unquoted)
/// c++ class template. Each class template should only be registered once.
/// A call to registerADMooseObject is still required for the new class
#define registerADMooseObjectRenamed(app, origtemplatename, time, templatename) \
static char combineNames(dummyvar_for_registering_obj_##origtemplatename##_residual, __LINE__) = \
Registry::add<templatename<RESIDUAL>>({app, \
#templatename "<RESIDUAL>", \
#origtemplatename "<RESIDUAL>", \
#origtemplatename "<RESIDUAL>", \
nullptr, \
nullptr, \
nullptr, \
__FILE__, \
__LINE__, \
time, \
#templatename "<RESIDUAL>", \
true}); \
static char combineNames(dummyvar_for_registering_obj_##origtemplatename##_jacobian, __LINE__) = \
Registry::add<templatename<JACOBIAN>>({app, \
#templatename "<JACOBIAN>", \
#origtemplatename "<JACOBIAN>", \
#origtemplatename "<JACOBIAN>", \
nullptr, \
nullptr, \
nullptr, \
__FILE__, \
__LINE__, \
time, \
#templatename "<JACOBIAN>", \
true})

struct RegistryEntry;
class Factory;
class ActionFactory;
@@ -12,34 +12,36 @@
#include "ADNodalBC.h"

template <ComputeStage>
class ADLagrangeVecFunctionDirichletBC;
class ADVectorFunctionDirichletBC;

declareADValidParams(ADLagrangeVecFunctionDirichletBC);
declareADValidParams(ADVectorFunctionDirichletBC);

/**
* Boundary condition of a Dirichlet type
*
* Sets the values of a LAGRANGE_VEC variable at nodes to values specified by functions
*/
template <ComputeStage compute_stage>
class ADLagrangeVecFunctionDirichletBC : public ADVectorNodalBC<compute_stage>
class ADVectorFunctionDirichletBC : public ADVectorNodalBC<compute_stage>
{
public:
ADLagrangeVecFunctionDirichletBC(const InputParameters & parameters);
ADVectorFunctionDirichletBC(const InputParameters & parameters);

protected:
virtual ADRealVectorValue computeQpResidual() override;

/// Optional vectorValue function
Function * _function;

/// x component function
Function & _exact_x;
Function & _function_x;
/// y component function
Function & _exact_y;
Function & _function_y;
/// z component function
Function & _exact_z;
Function & _function_z;

/// The value for this BC
RealVectorValue _values;

usingVectorNodalBCMembers;
};

@@ -11,25 +11,24 @@

#include "VectorNodalBC.h"

class LagrangeVecDirichletBC;
class VectorDirichletBC;

template <>
InputParameters validParams<LagrangeVecDirichletBC>();
InputParameters validParams<VectorDirichletBC>();

/**
* Boundary condition of a Dirichlet type
*
* Sets the value in the node
*/
class LagrangeVecDirichletBC : public VectorNodalBC
class VectorDirichletBC : public VectorNodalBC
{
public:
LagrangeVecDirichletBC(const InputParameters & parameters);
VectorDirichletBC(const InputParameters & parameters);

protected:
virtual RealVectorValue computeQpResidual() override;

/// The value for this BC
const RealVectorValue & _values;
};

@@ -11,32 +11,34 @@

#include "VectorNodalBC.h"

class LagrangeVecFunctionDirichletBC;
class VectorFunctionDirichletBC;

template <>
InputParameters validParams<LagrangeVecFunctionDirichletBC>();
InputParameters validParams<VectorFunctionDirichletBC>();

/**
* Boundary condition of a Dirichlet type
*
* Sets the values of a LAGRANGE_VEC variable at nodes to values specified by functions
*/
class LagrangeVecFunctionDirichletBC : public VectorNodalBC
class VectorFunctionDirichletBC : public VectorNodalBC
{
public:
LagrangeVecFunctionDirichletBC(const InputParameters & parameters);
VectorFunctionDirichletBC(const InputParameters & parameters);

protected:
virtual RealVectorValue computeQpResidual() override;

/// Optional vectorValue function
Function * _function;

/// x component function
Function & _exact_x;
Function & _function_x;
/// y component function
Function & _exact_y;
Function & _function_y;
/// z component function
Function & _exact_z;
Function & _function_z;

/// The value for this BC
RealVectorValue _values;
};

@@ -0,0 +1,51 @@
//* 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

#ifndef VECTORFUNCTIONIC_H
#define VECTORFUNCTIONIC_H

#include "VectorInitialCondition.h"
#include "Function.h"

// System includes
#include <string>

// Forward Declarations
class VectorFunctionIC;
class InputParameters;

namespace libMesh
{
class Point;
}

template <>
InputParameters validParams<VectorFunctionIC>();

/**
* IC that calls vectorValue method of a Function object.
*/
class VectorFunctionIC : public VectorInitialCondition
{
public:
VectorFunctionIC(const InputParameters & parameters);

virtual RealVectorValue value(const Point & p) override;

protected:
/// Optional vectorValue function
Function * _function;

/// Optional component function value
Function & _function_x;
Function & _function_y;
Function & _function_z;
};

#endif
@@ -34,7 +34,10 @@ class VectorBodyForce : public VectorKernel
/// Scale factor
const Real & _scale;

/// Optional function value
/// Optional vectorValue function
Function * _function;

/// Optional component function value
Function & _function_x;
Function & _function_y;
Function & _function_z;

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 206c4ed

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