Skip to content

Commit

Permalink
Implement dpa userobject; inherit from NeutronDamageInterface to allo…
Browse files Browse the repository at this point in the history
…w different damage functions to be plugged in (idaholab#410)
  • Loading branch information
Sebastian Schunert committed Mar 3, 2020
1 parent 48c841a commit ce02d5f
Show file tree
Hide file tree
Showing 12 changed files with 938 additions and 31 deletions.
34 changes: 34 additions & 0 deletions include/postprocessors/DPAPostprocessor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/

#ifdef GSL_ENABLED

#pragma once

#include "GeneralPostprocessor.h"

// forward declarations
class DPAPostprocessor;
class DPAUserObjectBase;

template <>
InputParameters validParams<DPAPostprocessor>();

class DPAPostprocessor : public GeneralPostprocessor
{
public:
DPAPostprocessor(const InputParameters & parameters);
virtual void execute() override {}
virtual void initialize() override {}
virtual Real getValue() override;

protected:
const DPAUserObjectBase & _damage_object;
};

#endif
101 changes: 101 additions & 0 deletions include/userobjects/DPAUserObjectBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/
#ifdef GSL_ENABLED

#pragma once

#include "GeneralUserObject.h"

class DPAUserObjectBase;

template <>
InputParameters validParams<DPAUserObjectBase>();

class DPAUserObjectBase : public GeneralUserObject
{
public:
DPAUserObjectBase(const InputParameters & parameters);

///@{ get the
Real getDPA() const { return _dpa; }
Real getPartialDPA(unsigned int Z, Real A) const;
///@}

void initialize() override {}

protected:
void prepare();
bool changed() const;
std::vector<unsigned int> getAtomicNumbers() const;
std::vector<Real> getMassNumbers() const;
std::vector<Real> getNumberFractions() const;
Real getMaxEnergy() const;

/// accumulated dpa
void accumulateDamage();

/// a helper function that sets _ns and checks consistency of A, Z, N
void initAZNHelper();

/// a helper function that computes the neutron damage efficiency
Real
neutronDamageEfficiency(unsigned int i, unsigned int j, unsigned int g, unsigned int x) const;

/// a virtual function computing the integral damage function
virtual Real integralDamageFunction(Real T, unsigned int i, unsigned int j) const = 0;

/// callback that is executed when composition changed and damage functions must be recomputed
virtual void onCompositionChanged() = 0;

/// a helper that assigns a unique string to a Z, A pair
std::string zaidHelper(unsigned int Z, Real A) const;

/// tolerance for recomputing the displacement function
Real _tol = 1e-10;

/// the computed dose rates
Real _dpa = 0;

/// the computed dose rate by species; this is a map because presence of (Z,A) can change dynamically
std::map<std::string, Real> _partial_dpa;

/// is damage accumulated during a transient or computed for steady state
bool _is_transient_irradiation;

/// irradiation_time used when dpa is estimated from steady-state calculations
Real _irradiation_time;

/// the neutron reaction types considered for computing dpa
MultiMooseEnum _neutron_reaction_types;

/// number of reaction types creating radiation damage
unsigned int _nr;

///@{ data used for computing dpa value
std::vector<Real> _atomic_numbers;
std::vector<Real> _mass_numbers;
std::vector<Real> _number_densities;
std::vector<Real> _energy_group_boundaries;
std::vector<Real> _scalar_flux;
std::vector<std::vector<std::vector<Real>>> _cross_sections;
///@}

/// Q values for each reaction type and isotope
std::vector<std::vector<Real>> _q_values;

///@{ the "old" versions of the data; used for determining if disp function update is required
std::vector<Real> _atomic_numbers_old;
std::vector<Real> _mass_numbers_old;
std::vector<Real> _number_densities_old;
///@}

/// number of neutron energy groups
unsigned int _ng;
};

#endif // GSL_ENABLED
44 changes: 44 additions & 0 deletions include/userobjects/FunctionDPAUserObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/

#ifdef GSL_ENABLED

#pragma once

#include "DPAUserObjectBase.h"
#include "LinearInterpolation.h"

class FunctionDPAUserObject;

template <>
InputParameters validParams<FunctionDPAUserObject>();

class FunctionDPAUserObject : public DPAUserObjectBase
{
public:
FunctionDPAUserObject(const InputParameters & parameters);
void finalize() override;
void execute() override;
void initialSetup() override;
void initialize() override {}

protected:
virtual Real integralDamageFunction(Real T, unsigned int i, unsigned int j) const override;
virtual void onCompositionChanged() override;

/// the maximum energy step size used for interpolation and integration of integral damage function
Real _max_delta_E;

/// the damage functions are provided by MOOSE functions
std::vector<std::vector<const Function *>> _damage_functions;

/// stores the integral damage functions computed from input as LinearInterpolation objects
std::vector<std::vector<LinearInterpolation>> _integral_damage_functions;
};

#endif
38 changes: 38 additions & 0 deletions include/userobjects/ParkinCoulterDPAUserObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/
#ifdef GSL_ENABLED

#pragma once

#include "DPAUserObjectBase.h"
#include "ParkinCoulterInterface.h"

class ParkinCoulterDPAUserObject;

template <>
InputParameters validParams<ParkinCoulterDPAUserObject>();

class ParkinCoulterDPAUserObject : public DPAUserObjectBase, public ParkinCoulterInterface
{
public:
ParkinCoulterDPAUserObject(const InputParameters & parameters);
void finalize() override;
void execute() override;
void initialSetup() override;

protected:
virtual void initDamageFunctions() override;
virtual std::vector<unsigned int> atomicNumbers() const override;
virtual std::vector<Real> massNumbers() const override;
virtual std::vector<Real> numberFractions() const override;
virtual Real maxEnergy() const override { return getMaxEnergy(); }
virtual Real integralDamageFunction(Real T, unsigned int i, unsigned int j) const override;
virtual void onCompositionChanged() override;
};

#endif // GSL_ENABLED
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
// mytrim includes
#include <mytrim/element.h>

class ParkinCoulterBase;
class ParkinCoulterInterface;
class PolyatomicDisplacementFunction;
class PolyatomicDamageEnergyFunction;
class PolyatomicDisplacementDerivativeFunction;

template <>
InputParameters validParams<ParkinCoulterBase>();
InputParameters validParams<ParkinCoulterInterface>();

class ParkinCoulterBase : public GeneralUserObject
class ParkinCoulterInterface
{
public:
ParkinCoulterBase(const InputParameters & parameters);
void initialize() override {}
ParkinCoulterInterface(const MooseObject * moose_object);
static InputParameters validParams();

protected:
/// recomputes the Polyatomic damage functions
Expand All @@ -50,6 +50,12 @@ class ParkinCoulterBase : public GeneralUserObject
/// computes the polymat object that is used to create PolyatomicDisplacementFunctions
std::vector<MyTRIM_NS::Element> polyMat() const;

/// the MooseObject that inherits from this interface
const MooseObject * _moose_obj;

/// convenience reference to InputParameters from MooseObject
const InputParameters & _pars;

std::vector<std::vector<Real>> _Ecap;

std::unique_ptr<PolyatomicDisplacementFunctionBase> _padf;
Expand Down
8 changes: 4 additions & 4 deletions include/userobjects/PolyatomicRecoil.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

#pragma once

#include "ParkinCoulterBase.h"
#include "GeneralUserObject.h"
#include "ParkinCoulterInterface.h"

class PolyatomicRecoil;

class PolyatomicRecoil : public ParkinCoulterBase
class PolyatomicRecoil : public GeneralUserObject, public ParkinCoulterInterface
{
public:
static InputParameters validParams();

PolyatomicRecoil(const InputParameters & parameters);
void finalize() override;
void execute() override;
void initialize() override {}

protected:
virtual void initDamageFunctions() override;
Expand Down
37 changes: 37 additions & 0 deletions src/postprocessors/DPAPostprocessor.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/

#ifdef GSL_ENABLED

#include "DPAPostprocessor.h"
#include "DPAUserObjectBase.h"

registerMooseObject("MagpieApp", DPAPostprocessor);

template <>
InputParameters
validParams<DPAPostprocessor>()
{
InputParameters params = validParams<GeneralPostprocessor>();
params.addRequiredParam<UserObjectName>("dpa_object", "The neutronics damage object.");
params.addClassDescription("Retrieves the value of the dpa from a DPAUserObjectBase.");
return params;
}

DPAPostprocessor::DPAPostprocessor(const InputParameters & params)
: GeneralPostprocessor(params), _damage_object(getUserObject<DPAUserObjectBase>("dpa_object"))
{
}

Real
DPAPostprocessor::getValue()
{
return _damage_object.getDPA();
}

#endif
Loading

0 comments on commit ce02d5f

Please sign in to comment.