Skip to content

Commit

Permalink
Demonstrate contains point
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Oct 28, 2022
1 parent 5b19836 commit e535795
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
26 changes: 26 additions & 0 deletions framework/include/auxkernels/ContainsPointAux.h
@@ -0,0 +1,26 @@
//* 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

// MOOSE includes
#include "AuxKernel.h"

class ContainsPointAux : public AuxKernel
{
public:
static InputParameters validParams();

ContainsPointAux(const InputParameters & parameters);

protected:
virtual Real computeValue() override;

const Point _point;
};
35 changes: 35 additions & 0 deletions framework/src/auxkernels/ContainsPointAux.C
@@ -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

// MOOSE includes
#include "ContainsPointAux.h"
#include "MooseMesh.h"

registerMooseObject("MooseApp", ContainsPointAux);

InputParameters
ContainsPointAux::validParams()
{
InputParameters params = AuxKernel::validParams();
params.addRequiredParam<Point>("point", "The point we're checking containment of");
return params;
}

ContainsPointAux::ContainsPointAux(const InputParameters & parameters)
: AuxKernel(parameters), _point(getParam<Point>("point"))
{
if (isNodal())
paramError("variable", "This AuxKernel only supports Elemental fields");
}

Real
ContainsPointAux::computeValue()
{
return _current_elem->contains_point(_point);
}
10 changes: 10 additions & 0 deletions modules/tensor_mechanics/child.i
Expand Up @@ -41,6 +41,16 @@ gamma = 0.5
[]
initial_condition = 1.0
[]
[contains_point]
order = CONSTANT
family = MONOMIAL
[AuxKernel]
type = ContainsPointAux
point = '.104 .356 0'
execute_on = 'initial timestep_end'
use_displaced_mesh = true
[]
[]
[]

[Modules/TensorMechanics/DynamicMaster]
Expand Down

0 comments on commit e535795

Please sign in to comment.