forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in base class for helping to create AuxKernels that use group sol…
…ution values. Add example objects and tests. closes idaholab#10
- Loading branch information
Showing
13 changed files
with
411 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
modules/ray_tracing/include/auxkernels/AverageGroupValueAux.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef AVERAGEGROUPVALUEAUX_H | ||
#define AVERAGEGROUPVALUEAUX_H | ||
|
||
#include "AuxKernel.h" | ||
|
||
// Local Includes | ||
#include "GroupValueAuxBase.h" | ||
|
||
// Forward Declarations | ||
class AverageGroupValueAux; | ||
|
||
template <> | ||
InputParameters validParams<AverageGroupValueAux>(); | ||
|
||
class AverageGroupValueAux : public GroupValueAuxBase | ||
{ | ||
public: | ||
AverageGroupValueAux(const InputParameters & parameters); | ||
|
||
virtual ~AverageGroupValueAux() {} | ||
|
||
protected: | ||
virtual Real computeValue(); | ||
}; | ||
|
||
#endif // AVERAGEGROUPVALUEAUX_H |
53 changes: 53 additions & 0 deletions
53
modules/ray_tracing/include/auxkernels/GroupValueAuxBase.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef GROUPVALUEAUXBASE_H | ||
#define GROUPVALUEAUXBASE_H | ||
|
||
#include "AuxKernel.h" | ||
|
||
// Local Includes | ||
#include "RayProblem.h" | ||
|
||
// Forward Declarations | ||
class GroupValueAuxBase; | ||
|
||
template <> | ||
InputParameters validParams<GroupValueAuxBase>(); | ||
|
||
class GroupValueAuxBase : public AuxKernel | ||
{ | ||
public: | ||
GroupValueAuxBase(const InputParameters & parameters); | ||
|
||
virtual ~GroupValueAuxBase() {} | ||
|
||
protected: | ||
/// The RAY Problem | ||
RayProblem & _ray_problem; | ||
|
||
/// The RAY System | ||
RaySystem & _ray_sys; | ||
|
||
/// Number of energy groups in the problem | ||
unsigned int _num_groups; | ||
|
||
/// Offest into the vectors | ||
dof_id_type & _current_offset; | ||
|
||
/// READ only! The current group values | ||
PetscScalar *& _group_values; | ||
}; | ||
|
||
#endif // GROUPVALUEAUXBASE_H |
72 changes: 72 additions & 0 deletions
72
modules/ray_tracing/include/ray_kernels/ConstantGroupValues.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef CONSTANTGROUPVALUES_H | ||
#define CONSTANTGROUPVALUES_H | ||
|
||
// Local Includes | ||
#include "Ray.h" | ||
#include "RayKernel.h" | ||
|
||
class ConstantGroupValues; | ||
|
||
template <> | ||
InputParameters validParams<ConstantGroupValues>(); | ||
|
||
class ConstantGroupValues : public RayKernel | ||
{ | ||
public: | ||
ConstantGroupValues(const InputParameters & params); | ||
virtual ~ConstantGroupValues(); | ||
|
||
virtual void initialSetup() {} | ||
virtual void timestepSetup() {} | ||
|
||
/** | ||
* Called at the beginning of a new Ray trace | ||
* | ||
* Useful for caching data! | ||
*/ | ||
virtual void rayStart() {} | ||
|
||
/** | ||
* Called on each Segment | ||
* @param start The beginning of the segment | ||
* @param end The end of the segment | ||
* @param ends_in_elem Whether or not the Ray ends _within_ the current element. Note: this is | ||
* NOT true if the Ray hits a physical boundary on one side of the element. It is _only_ true if | ||
* the Ray truly ends _within_ the element. | ||
*/ | ||
virtual void onSegment(const Elem * /*elem*/, | ||
const Point & /*start*/, | ||
const Point & /*end*/, | ||
bool /*ends_in_elem*/); | ||
|
||
/** | ||
* Set the current Ray that's being worked on | ||
*/ | ||
virtual void setRay(const std::shared_ptr<Ray> & ray); | ||
|
||
protected: | ||
/// Number of groups in the problem | ||
unsigned int _num_groups; | ||
|
||
/// Values to use for each group | ||
const std::vector<Real> & _input_group_values; | ||
|
||
/// Pointer to the beginning of the Ray's data | ||
Real * _ray_data; | ||
}; | ||
|
||
#endif /* CONSTANTGROUPVALUES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#include "AverageGroupValueAux.h" | ||
|
||
template <> | ||
InputParameters | ||
validParams<AverageGroupValueAux>() | ||
{ | ||
InputParameters params = validParams<GroupValueAuxBase>(); | ||
return params; | ||
} | ||
|
||
AverageGroupValueAux::AverageGroupValueAux(const InputParameters & parameters) | ||
: GroupValueAuxBase(parameters) | ||
{ | ||
} | ||
|
||
Real | ||
AverageGroupValueAux::computeValue() | ||
{ | ||
Real total = 0; | ||
|
||
for (unsigned int g = 0; g < _num_groups; g++) | ||
total += _group_values[_current_offset + g]; | ||
|
||
return total / static_cast<Real>(_num_groups); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#include "GroupValueAuxBase.h" | ||
|
||
template <> | ||
InputParameters | ||
validParams<GroupValueAuxBase>() | ||
{ | ||
InputParameters params = validParams<AuxKernel>(); | ||
return params; | ||
} | ||
|
||
GroupValueAuxBase::GroupValueAuxBase(const InputParameters & parameters) | ||
: AuxKernel(parameters), | ||
_ray_problem(dynamic_cast<RayProblem &>(*parameters.get<FEProblem *>("_fe_problem"))), | ||
_ray_sys(_ray_problem.raySystem()), | ||
_num_groups(_ray_problem.numGroups()), | ||
_current_offset(_ray_sys.currentOffset(_tid)), | ||
_group_values(_ray_sys.currentGroupSolutionValues()) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#include "ConstantGroupValues.h" | ||
|
||
// Local Includes | ||
#include "RayProblem.h" | ||
#include "RaySystem.h" | ||
|
||
// MOOSE Includes | ||
#include "MooseMesh.h" | ||
|
||
template <> | ||
InputParameters | ||
validParams<ConstantGroupValues>() | ||
{ | ||
InputParameters params = validParams<RayKernel>(); | ||
|
||
params.addRequiredParam<std::vector<Real>>("group_values", "The value for each group"); | ||
|
||
return params; | ||
} | ||
|
||
ConstantGroupValues::ConstantGroupValues(const InputParameters & params) | ||
: RayKernel(params), | ||
_num_groups(_ray_problem.numGroups()), | ||
_input_group_values(getParam<std::vector<Real>>("group_values")) | ||
{ | ||
if (_num_groups != _input_group_values.size()) | ||
mooseError("group_values size does not match num_groups! In ", name()); | ||
} | ||
|
||
ConstantGroupValues::~ConstantGroupValues() {} | ||
|
||
void | ||
ConstantGroupValues::onSegment(const Elem * /*elem*/, | ||
const Point & /* start */, | ||
const Point & /* end */, | ||
bool /* ends_in_elem */) | ||
{ | ||
for (unsigned int g = 0; g < _num_groups; g++) | ||
_group_solution_values[_current_offset + g] = _input_group_values[g]; | ||
} | ||
|
||
void | ||
ConstantGroupValues::setRay(const std::shared_ptr<Ray> & ray) | ||
{ | ||
RayKernel::setRay(ray); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.