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.
Implement dpa userobject; inherit from NeutronDamageInterface to allo…
…w different damage functions to be plugged in (idaholab#410)
- Loading branch information
Sebastian Schunert
committed
Mar 3, 2020
1 parent
48c841a
commit ce02d5f
Showing
12 changed files
with
938 additions
and
31 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,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 |
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,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 |
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,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 |
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,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 |
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,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 |
Oops, something went wrong.