forked from idaholab/magpie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastian Schunert
committed
Feb 11, 2019
1 parent
d45bb58
commit 4f97f56
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
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 */ | ||
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ | ||
/* */ | ||
/* Copyright 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/**********************************************************************/ | ||
|
||
#ifndef MDGRANULARPOROSITYAUX_H | ||
#define MDGRANULARPOROSITYAUX_H | ||
|
||
#include "AuxKernel.h" | ||
|
||
// forward declarations | ||
class MDRunBase; | ||
class MDGranularPorosityAux; | ||
|
||
template <> | ||
InputParameters validParams<MDGranularPorosityAux>(); | ||
|
||
class MDGranularPorosityAux : public AuxKernel | ||
{ | ||
public: | ||
MDGranularPorosityAux(const InputParameters & params); | ||
virtual ~MDGranularPorosityAux() {} | ||
|
||
virtual Real computeValue(); | ||
|
||
protected: | ||
/// referene to the MDRunBase user object | ||
const MDRunBase & _md_uo; | ||
|
||
const bool _compute_packing; | ||
|
||
/// property value that is computed only on qp = 0 | ||
Real _packing_fraction; | ||
}; | ||
|
||
#endif // MDGRANULARPOROSITYAUXx_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,61 @@ | ||
/**********************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ | ||
/* */ | ||
/* Copyright 2017 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/**********************************************************************/ | ||
|
||
#include "MDGranularPorosityAux.h" | ||
#include "MDRunBase.h" | ||
|
||
registerMooseObject("MagpieApp", MDGranularPorosityAux); | ||
|
||
template <> | ||
InputParameters | ||
validParams<MDGranularPorosityAux>() | ||
{ | ||
InputParameters params = validParams<AuxKernel>(); | ||
params.addRequiredParam<UserObjectName>("user_object", "Name of MD runner UserObject"); | ||
params.addParam<bool>("compute_packing_fraction", false, "Whether to compute porosity or packing fraction."); | ||
params.addClassDescription( | ||
"Computes porosity or packing fraction (1 - porosity) and injects it into and aux variable."); | ||
return params; | ||
} | ||
|
||
MDGranularPorosityAux::MDGranularPorosityAux(const InputParameters & parameters) | ||
: AuxKernel(parameters), | ||
_md_uo(getUserObject<MDRunBase>("user_object")), | ||
_compute_packing(getParam<bool>("compute_packing_fraction")) | ||
{ | ||
// ensure MD particles are granular | ||
if (!_md_uo.isGranular()) | ||
mooseError("user_object stores non-granular particles."); | ||
|
||
// ensure variable is elemental | ||
if (isNodal()) | ||
mooseError("MDGranularPorosityAux only permits elemental variables."); | ||
} | ||
|
||
Real | ||
MDGranularPorosityAux::computeValue() | ||
{ | ||
if (_qp == 0) | ||
{ | ||
_packing_fraction = 0.0; | ||
|
||
// get the overlapping MD particles | ||
std::vector<std::pair<unsigned int, Real>> gran_vol; | ||
_md_uo.granularElementVolumes(_current_elem->unique_id(), gran_vol); | ||
|
||
// add the overlapping volumes | ||
for (auto & p : gran_vol) | ||
_packing_fraction += p.second; | ||
|
||
// divide by element volume | ||
_packing_fraction /= _current_elem->volume(); | ||
} | ||
if (_compute_packing) | ||
return _packing_fraction; | ||
return 1 - _packing_fraction; | ||
} |
Binary file not shown.