From 4d02241503922dafa79c0b4346a83e8d170e59e1 Mon Sep 17 00:00:00 2001 From: Daniel Schwen Date: Mon, 20 Jan 2020 13:01:02 -0700 Subject: [PATCH] Add variable shim for FFT (#401) --- include/variables/MooseFFTVariable.h | 153 +++++++++++++++++++++++++++ src/variables/MooseFFTVariable.C | 20 ++++ 2 files changed, 173 insertions(+) create mode 100644 include/variables/MooseFFTVariable.h create mode 100644 src/variables/MooseFFTVariable.C diff --git a/include/variables/MooseFFTVariable.h b/include/variables/MooseFFTVariable.h new file mode 100644 index 00000000..8107c32b --- /dev/null +++ b/include/variables/MooseFFTVariable.h @@ -0,0 +1,153 @@ +/**********************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ +/* */ +/* Copyright 2017 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/**********************************************************************/ + +#pragma once + +#include "MooseVariable.h" + +class MooseFFTVariable : public MooseVariable +{ +public: + static InputParameters validParams(); + + MooseFFTVariable(const InputParameters & parameters); + + virtual bool isNodal() const { return false; } + + /** + * Clear out the dof indices. We do this in case this variable is not going to be prepared at + * all... + */ + virtual void clearDofIndices() {} + + /** + * Prepare the elemental degrees of freedom + */ + virtual void prepare() {} + + /** + * Prepare the neighbor element degrees of freedom + */ + virtual void prepareNeighbor() { mooseError("Neighbor FFT variables are not supported yet."); } + + /** + * Prepare a lower dimensional element's degrees of freedom + */ + virtual void prepareLowerD() + { + mooseError("Lower dimensional FFT variables are not supported yet."); + } + + virtual void prepareAux() {} + + virtual void reinitNode() {} + virtual void reinitAux() {} + virtual void reinitAuxNeighbor() { mooseError("Neighbor FFT variables are not supported yet."); } + + virtual void reinitNodes(const std::vector &) + { + mooseError("Nodal FFT variables are not supported."); + } + virtual void reinitNodesNeighbor(const std::vector & nodes) + { + mooseError("Nodal FFT variables are not supported."); + } + + /** + * Field type of this variable + */ + virtual Moose::VarFieldType fieldType() const { return Moose::VarFieldType::VAR_FIELD_STANDARD; } + + /** + * @returns true if this is a vector-valued element, false otherwise. + */ + virtual bool isVector() const { return false; }; + + /** + * Is this variable defined at nodes + * @return true if it the variable is defined at nodes, otherwise false + */ + virtual bool isNodalDefined() const { return false; } + + virtual const dof_id_type & nodalDofIndex() const + { + mooseError("Nodal FFT variables are not supported."); + } + + virtual const dof_id_type & nodalDofIndexNeighbor() const + { + mooseError("Nodal FFT variables are not supported."); + } + + /** + * Current element this variable is evaluated at + */ + virtual const Elem * const & currentElem() const + { + mooseError("Current element access not supported."); + } + + /** + * The subdomains the variable is active on + */ + virtual const std::set & activeSubdomains() const { return _all_subdomains; } + /** + * Is the variable active on the subdomain? + * @param subdomain The subdomain id in question + * @return true if active on subdomain, false otherwise + */ + virtual bool activeOnSubdomain(SubdomainID subdomain) const { return true; } + + /** + * Prepare the initial condition + */ + virtual void prepareIC() {} + + /** + * Compute values at interior quadrature points + */ + virtual void computeElemValues() + { // meat! + } + + /** + * Compute values at facial quadrature points + */ + virtual void computeElemValuesFace() {} + /** + * Compute values at facial quadrature points for the neighbor + */ + virtual void computeNeighborValuesFace() {} + /** + * Compute values at quadrature points for the neighbor + */ + virtual void computeNeighborValues() {} + /** + * compute values at quadrature points on the lower dimensional element + */ + virtual void computeLowerDValues() {} + /** + * Compute nodal values of this variable in the neighbor + */ + virtual void computeNodalNeighborValues() {} + /** + * Compute nodal values of this variable + */ + virtual void computeNodalValues() {} + + virtual void getDofIndices(const Elem * elem, std::vector & dof_indices) const {} + + virtual unsigned int numberOfDofsNeighbor() { return 0; } + + virtual void insert(NumericVector & residual) {} + virtual void add(NumericVector & residual) {} + +protected: + std::vector _no_dofs; + std::set _all_subdomains; +}; diff --git a/src/variables/MooseFFTVariable.C b/src/variables/MooseFFTVariable.C new file mode 100644 index 00000000..eedf1db4 --- /dev/null +++ b/src/variables/MooseFFTVariable.C @@ -0,0 +1,20 @@ +/**********************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ +/* */ +/* Copyright 2017 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/**********************************************************************/ + +#include + +InputParameters +MooseFFTVariable::validParams() +{ + InputParameters params = MooseVariableFEBase::validParams(); + return params; +} + +MooseFFTVariable::MooseFFTVariable(const InputParameters & parameters) : MooseVariable(parameters) +{ +}