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 "AddFunctionAction.h" 13 : #include "CommonChemicalCompositionAction.h" 14 : 15 : /** 16 : * The ChemicalCompositionAction sets up user objects, aux kernels, and aux variables 17 : * for a thermochemistry calculation using Thermochimica. 18 : */ 19 : class ChemicalCompositionAction : public Action 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : ChemicalCompositionAction(const InputParameters & params); 24 : 25 242 : const std::vector<unsigned int> & elementIDs() const { return _element_ids; } 26 : 27 242 : const std::vector<std::string> & phases() const { return _phases; } 28 : const std::vector<std::string> & elementPotentials() const 29 : { 30 242 : return _tokenized_element_potentials; 31 : } 32 : 33 : const std::vector<std::pair<std::string, std::string>> & speciesPhasePairs() const 34 : { 35 242 : return _tokenized_species; 36 : } 37 : 38 : const std::vector<std::pair<std::string, std::string>> & vaporPhasePairs() const 39 : { 40 242 : return _tokenized_vapor_species; 41 : } 42 : 43 : const std::vector<std::pair<std::string, std::string>> & phaseElementPairs() const 44 : { 45 242 : return _tokenized_phase_elements; 46 : } 47 : 48 : virtual void act(); 49 : 50 : protected: 51 : void readCSV(); 52 : 53 : /// Element names 54 : std::vector<std::string> _elements; 55 : 56 : /// Initial conditions for each element: [element name] => initial condition value 57 : std::map<std::string, Real> _initial_conditions; 58 : 59 : /// List of phases tracked by Thermochimica 60 : std::vector<std::string> _phases; 61 : 62 : /// Atomic numbers of the selected elements 63 : std::vector<unsigned int> _element_ids; 64 : 65 : /// Tokenized versions of the output variables to avoid redoing tokenization 66 : std::vector<std::pair<std::string, std::string>> _tokenized_species; 67 : std::vector<std::string> _tokenized_element_potentials; 68 : std::vector<std::pair<std::string, std::string>> _tokenized_vapor_species; 69 : std::vector<std::pair<std::string, std::string>> _tokenized_phase_elements; 70 : };