Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "ElementUserObject.h" 13 : 14 : /** 15 : * This UserObject manages the insertion and expiration of nuclei in the simulation 16 : * domain it manages a list of nuclei with their insertion times and their center 17 : * positions. A DiscreteNucleationMap is needed to enable the DiscreteNucleation 18 : * material to look up if a nucleus is present at a given element/qp. 19 : * This class can take a variable nucleus radius. 20 : */ 21 : class DiscreteNucleationInserterBase : public ElementUserObject 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : DiscreteNucleationInserterBase(const InputParameters & parameters); 27 : 28 : /// A nucleus has an expiration time, a location, and a size. 29 : // using NucleusLocation = std::tuple<Real, Point, Real>; 30 : struct NucleusLocation 31 : { 32 : Real time; 33 : Point center; 34 : Real radius; 35 : }; 36 : 37 : /// Every MPI task should keep a full list of nuclei (in case they cross domains with their finite radii) 38 : using NucleusList = std::vector<NucleusLocation>; 39 : 40 : // counter pair to track insertions and deletion in the current timestep 41 : using NucleusChanges = std::pair<unsigned int, unsigned int>; 42 : 43 1203 : virtual bool isMapUpdateRequired() const { return _update_required; } 44 264 : virtual const NucleusList & getNucleusList() const { return _global_nucleus_list; } 45 179 : virtual const NucleusChanges & getInsertionsAndDeletions() const { return _changes_made; } 46 : 47 : virtual const Real & getRate() const = 0; 48 : 49 : protected: 50 : /// the global list of all nuclei over all processors 51 : NucleusList & _global_nucleus_list; 52 : 53 : /// count the number of nucleus insertions and deletions 54 : NucleusChanges _changes_made; 55 : 56 : /// is a map update required 57 : bool _update_required; 58 : }; 59 : 60 : // Used for Restart 61 : template <> 62 : void dataStore(std::ostream & stream, 63 : DiscreteNucleationInserterBase::NucleusLocation & nl, 64 : void * context); 65 : template <> 66 : void dataLoad(std::istream & stream, 67 : DiscreteNucleationInserterBase::NucleusLocation & nl, 68 : void * context);