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 <array> 13 : #include "PolycrystalUserObjectBase.h" 14 : #include "DelimitedFileReader.h" 15 : 16 : // Forward Declarations 17 : 18 : /** 19 : * PolycrystalCircles creates a polycrystal made up of circles. 20 : * The locations and radii of the circles are given either 21 : * through a user input or by reading a .txt file. 22 : * The file is expected to have a one-line header labeling the 23 : * colums 'x y z r'. 24 : **/ 25 : 26 : class PolycrystalCircles : public PolycrystalUserObjectBase 27 : { 28 : public: 29 : static InputParameters validParams(); 30 : 31 : PolycrystalCircles(const InputParameters & parameters); 32 : 33 : // Required functions from PolycrystalUserObjectBase 34 : virtual void precomputeGrainStructure() override; 35 : virtual void getGrainsBasedOnPoint(const Point & point, 36 : std::vector<unsigned int> & grains) const override; 37 : virtual Real getVariableValue(unsigned int op_index, const Point & p) const override; 38 12 : virtual unsigned int getNumGrains() const override { return _grain_num; } 39 : 40 : protected: 41 : enum COLS 42 : { 43 : X, 44 : Y, 45 : Z, 46 : R 47 : }; // Names of columns in text file. 48 : /// Whether to use columns or spheres in 3D geometries 49 : const bool _columnar_3D; 50 : 51 : /// Interfacial width 52 : const Real _int_width; 53 : 54 : /// Number of crystal grains to create 55 : unsigned int _grain_num; 56 : 57 : /// x,y,z coordinates of circle centers 58 : std::vector<Point> _centerpoints; 59 : 60 : /// Radius for each circular grain created 61 : std::vector<Real> _radii; 62 : 63 : Real computeDiffuseInterface(const Point & p, const unsigned int & i) const; 64 : };