www.mooseframework.org
LevelSetOlssonVortex.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "LevelSetOlssonVortex.h"
11 
13 
16 {
17  MooseEnum rtype("instantaneous=0 cosine=1", "instantaneous");
18 
20  params.addClassDescription(
21  "A function for creating vortex velocity fields for level set equation benchmark problems.");
22  params.addParam<MooseEnum>(
23  "reverse_type", rtype, "The time of reversal to enforce (instantaneous or cosine).");
24  params.addParam<Real>("reverse_time", 2, "Total time for complete vortex reversal.");
25  return params;
26 }
27 
29  : Function(parameters),
30  _reverse_time(getParam<Real>("reverse_time")),
31  _reverse_type(getParam<MooseEnum>("reverse_type")),
32  _pi(libMesh::pi)
33 {
34 }
35 
37 LevelSetOlssonVortex::vectorValue(Real t, const Point & p) const
38 {
39  // Compute the velocity field
40  RealVectorValue output;
41  output(0) = std::sin(_pi * p(0)) * std::sin(_pi * p(0)) * std::sin(2 * _pi * p(1));
42  output(1) = -std::sin(_pi * p(1)) * std::sin(_pi * p(1)) * std::sin(2 * _pi * p(0));
43 
44  // Compute the coefficient used to reverse the flow
45  Real reverse_coefficient = 1.0;
46  if (_reverse_type == 0 && t > _reverse_time / 2.)
47  reverse_coefficient = -1.0;
48  else if (_reverse_type == 1)
49  reverse_coefficient = std::cos(_pi * t / _reverse_time);
50  return reverse_coefficient * output;
51 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const MooseEnum & _reverse_type
Type of reverse (instantaneous or smooth)
registerMooseObject("LevelSetApp", LevelSetOlssonVortex)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
RealVectorValue vectorValue(Real t, const Point &p) const override
LevelSetOlssonVortex(const InputParameters &parameters)
const Real & _reverse_time
Total time for the velocity field to complete reverse.
Defines a vortex velocity field in the x-y plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
const Real pi