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.
Refactor PolyatomicRecoil to accomodate DPAUserObject (idaholab#410)
- Loading branch information
Sebastian Schunert
committed
Dec 27, 2019
1 parent
cb47a43
commit 7d52267
Showing
13 changed files
with
171 additions
and
105 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
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
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
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,42 @@ | ||
/**********************************************************************/ | ||
/* 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 ParkinCoulterBase; | ||
class PolyatomicDisplacementFunction; | ||
class PolyatomicDamageEnergyFunction; | ||
class PolyatomicDisplacementDerivativeFunction; | ||
|
||
template <> | ||
InputParameters validParams<ParkinCoulterBase>(); | ||
|
||
class ParkinCoulterBase : public GeneralUserObject | ||
{ | ||
public: | ||
ParkinCoulterBase(const InputParameters & parameters); | ||
void initialize() override {} | ||
|
||
protected: | ||
/// recomputes the Polyatomic damage functions | ||
void computeDamageFunctions(); | ||
|
||
std::vector<unsigned int> _atomic_numbers; | ||
std::vector<Real> _mass_numbers; | ||
std::vector<std::vector<Real>> _Ecap; | ||
|
||
std::vector<MyTRIM_NS::Element> _poly_mat; | ||
|
||
std::unique_ptr<PolyatomicDisplacementFunctionBase> _padf; | ||
std::unique_ptr<PolyatomicDisplacementDerivativeFunction> _padf_derivative; | ||
}; | ||
|
||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/**********************************************************************/ | ||
/* 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 "ParkinCoulterBase.h" | ||
#include "PolyatomicDisplacementFunction.h" | ||
#include "PolyatomicDamageEnergyFunction.h" | ||
#include "PolyatomicDisplacementDerivativeFunction.h" | ||
#include "MooseMesh.h" | ||
|
||
// mytrim includes | ||
#include <mytrim/element.h> | ||
|
||
template <> | ||
InputParameters | ||
validParams<ParkinCoulterBase>() | ||
{ | ||
InputParameters params = validParams<GeneralUserObject>(); | ||
params.addRequiredParam<std::vector<unsigned int>>("Z", "Atomic numbers"); | ||
params.addRequiredParam<std::vector<Real>>("A", "Mass numbers"); | ||
params.addRequiredParam<std::vector<Real>>("number_fraction", "Number fractions"); | ||
params.addRequiredParam<std::vector<Real>>("displacement_thresholds", "Dispacement thresholds"); | ||
params.addParam<std::vector<Real>>("lattice_binding_energies", "Lattice binding energies"); | ||
params.addParam<std::vector<std::vector<Real>>>( | ||
"Ecap", "Capture energy Ecap_ij of species i being trapped in j site"); | ||
params.addRangeCheckedParam<Real>("uniform_energy_spacing_threshold", | ||
10, | ||
"uniform_energy_spacing_threshold >= 0", | ||
"Threshold below which energy points are spaced uniformly."); | ||
params.addRangeCheckedParam<Real>("uniform_energy_spacing", | ||
0.25, | ||
"uniform_energy_spacing > 0", | ||
"Uniform energy spacing below the threshold"); | ||
params.addRequiredRangeCheckedParam<Real>( | ||
"logarithmic_energy_spacing", | ||
"logarithmic_energy_spacing > 1", | ||
"Spacing of the energy points En in log space energy_spacing = E_{n+1} / En"); | ||
params.addRequiredRangeCheckedParam<Real>( | ||
"Emax", "Emax > 0", "Maximum desired energy to which displacement functions are computed"); | ||
|
||
// this should only be run once | ||
params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_BEGIN; | ||
params.suppressParameter<ExecFlagEnum>("execute_on"); | ||
return params; | ||
} | ||
|
||
ParkinCoulterBase::ParkinCoulterBase(const InputParameters & parameters) | ||
: GeneralUserObject(parameters), | ||
_atomic_numbers(getParam<std::vector<unsigned int>>("Z")), | ||
_mass_numbers(getParam<std::vector<Real>>("A")) | ||
{ | ||
_Ecap = {{}}; | ||
if (isParamValid("Ecap")) | ||
_Ecap = getParam<std::vector<std::vector<Real>>>("Ecap"); | ||
|
||
std::vector<Real> N = getParam<std::vector<Real>>("number_fraction"); | ||
std::vector<Real> threshold = getParam<std::vector<Real>>("displacement_thresholds"); | ||
std::vector<Real> bind; | ||
if (isParamValid("lattice_binding_energies")) | ||
bind = getParam<std::vector<Real>>("lattice_binding_energies"); | ||
else | ||
bind.assign(_atomic_numbers.size(), 0.0); | ||
|
||
if (_atomic_numbers.size() != _mass_numbers.size() || _atomic_numbers.size() != N.size() || | ||
_atomic_numbers.size() != threshold.size() || _atomic_numbers.size() != bind.size()) | ||
mooseError("Size mismatch for at least one parameter array. Z, A, number_fraction, " | ||
"displacement_thresholds and lattice_binding_energies" | ||
"must all have the same length."); | ||
|
||
for (unsigned int j = 0; j < _atomic_numbers.size(); ++j) | ||
{ | ||
MyTRIM_NS::Element element; | ||
element._Z = _atomic_numbers[j]; | ||
element._m = _mass_numbers[j]; | ||
element._t = N[j]; | ||
element._Edisp = threshold[j]; | ||
element._Elbind = bind[j]; | ||
_poly_mat.push_back(element); | ||
} | ||
|
||
if (getParam<Real>("Emax") < getParam<Real>("uniform_energy_spacing_threshold")) | ||
mooseError("Emax must be larger than uniform_energy_spacing_threshold."); | ||
} | ||
|
||
void | ||
ParkinCoulterBase::computeDamageFunctions() | ||
{ | ||
Real energy = _padf->minEnergy(); | ||
Real Emax = getParam<Real>("Emax"); | ||
Real threshold = getParam<Real>("uniform_energy_spacing_threshold"); | ||
Real dE = getParam<Real>("uniform_energy_spacing"); | ||
Real logdE = getParam<Real>("logarithmic_energy_spacing"); | ||
|
||
for (;;) // while (energy <= Emax) | ||
{ | ||
energy = energy < threshold ? energy + dE : energy * logdE; | ||
if (energy > Emax) | ||
{ | ||
_padf->advanceDisplacements(Emax); | ||
break; | ||
} | ||
|
||
// increment displacements for value of energy | ||
_padf->advanceDisplacements(energy); | ||
} | ||
|
||
if (_padf_derivative) | ||
for (unsigned int n = 1; n < _padf->nEnergySteps(); ++n) | ||
_padf_derivative->advanceDisplacements(_padf->energyPoint(n)); | ||
} | ||
|
||
#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
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