https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LevelSetOlssonVortex.C
Go to the documentation of this file.
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
11
13
16{
17 MooseEnum rtype("instantaneous=0 cosine=1", "instantaneous");
18
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
36RealVectorValue
37LevelSetOlssonVortex::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}
const Real p
registerMooseObject("LevelSetApp", LevelSetOlssonVortex)
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Defines a vortex velocity field in the x-y plane.
const MooseEnum & _reverse_type
Type of reverse (instantaneous or smooth)
static InputParameters validParams()
LevelSetOlssonVortex(const InputParameters &parameters)
RealVectorValue vectorValue(Real t, const Point &p) const override
const Real & _reverse_time
Total time for the velocity field to complete reverse.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...