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 : #include "FauxPolycrystalVoronoi.h" 11 : #include "IndirectSort.h" 12 : #include "MooseRandom.h" 13 : #include "MooseMesh.h" 14 : #include "MooseVariable.h" 15 : #include "NonlinearSystemBase.h" 16 : #include "DelimitedFileReader.h" 17 : 18 : registerMooseObject("PhaseFieldApp", FauxPolycrystalVoronoi); 19 : 20 : InputParameters 21 38 : FauxPolycrystalVoronoi::validParams() 22 : { 23 38 : InputParameters params = PolycrystalVoronoi::validParams(); 24 38 : params.addClassDescription("Random Voronoi tessellation polycrystal when the number of order " 25 : "parameters equal to the number of grains"); 26 38 : return params; 27 0 : } 28 : 29 19 : FauxPolycrystalVoronoi::FauxPolycrystalVoronoi(const InputParameters & parameters) 30 19 : : PolycrystalVoronoi(parameters) 31 : { 32 19 : if (_grain_num != _op_num) 33 0 : paramError("op_num", "The number of order parameters has to equal to the number of grains"); 34 19 : } 35 : 36 : void 37 19 : FauxPolycrystalVoronoi::initialSetup() 38 : { 39 : /** 40 : * For polycrystal ICs we need to assume that each of the variables has the same periodicity. 41 : * Since BCs are handled elsewhere in the system, we'll have to check this case explicitly. 42 : */ 43 19 : if (_op_num < 1) 44 0 : mooseError("No coupled variables found"); 45 : 46 19 : const auto first_variable_value = _mesh.queryPeriodicDimensions(*_vars[0]); 47 76 : for (unsigned int i = 1; i < _vars.size(); ++i) 48 57 : if (_mesh.queryPeriodicDimensions(*_vars[i]) != first_variable_value) 49 0 : mooseError("Coupled polycrystal variables differ in periodicity"); 50 19 : } 51 : 52 : void 53 16 : FauxPolycrystalVoronoi::execute() 54 : { 55 16 : precomputeGrainStructure(); 56 16 : } 57 : 58 : void 59 16 : FauxPolycrystalVoronoi::finalize() 60 : { 61 : _grain_to_op.clear(); 62 : 63 80 : for (auto grain = decltype(_grain_num)(0); grain < _grain_num; grain++) 64 64 : _grain_to_op.emplace_hint(_grain_to_op.end(), grain, grain); 65 16 : }