Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/PDE/ConfigureCompFlow.cpp 4 : : \copyright 2012-2015 J. Bakosi, 5 : : 2016-2018 Los Alamos National Security, LLC., 6 : : 2019-2021 Triad National Security, LLC. 7 : : All rights reserved. See the LICENSE file for details. 8 : : \brief Register and compile configuration for compressible flow PDE 9 : : \details Register and compile configuration for compressible flow PDE. 10 : : */ 11 : : // ***************************************************************************** 12 : : 13 : : #include <set> 14 : : #include <map> 15 : : #include <vector> 16 : : #include <string> 17 : : #include <limits> 18 : : 19 : : #include <brigand/algorithms/for_each.hpp> 20 : : 21 : : #include "Tags.hpp" 22 : : #include "CartesianProduct.hpp" 23 : : #include "PDEFactory.hpp" 24 : : #include "Inciter/Options/PDE.hpp" 25 : : #include "ContainerUtil.hpp" 26 : : #include "ConfigureCompFlow.hpp" 27 : : #include "CompFlow/Physics/CG.hpp" 28 : : #include "CompFlow/Physics/DG.hpp" 29 : : #include "CompFlow/CGCompFlow.hpp" 30 : : #include "CompFlow/DGCompFlow.hpp" 31 : : #include "CompFlow/Problem.hpp" 32 : : 33 : : namespace inciter { 34 : : 35 : : void 36 : 2301 : registerCompFlow( CGFactory& cf, 37 : : DGFactory& df, 38 : : std::set< ctr::PDEType >& cgt, 39 : : std::set< ctr::PDEType >& dgt ) 40 : : // ***************************************************************************** 41 : : // Register compressible flow PDE into PDE factory 42 : : //! \param[in,out] cf Continuous Galerkin PDE factory to register to 43 : : //! \param[in,out] df Discontinuous Galerkin PDE factory to register to 44 : : //! \param[in,out] cgt Counters for equation types registered into CG factory 45 : : //! \param[in,out] dgt Counters for equation types registered into DG factory 46 : : // ***************************************************************************** 47 : : { 48 : : // Construct vector of vectors for all possible policies 49 : : using CGCompFlowPolicies = 50 : : tk::cartesian_product< cg::CompFlowPhysics, CompFlowProblems >; 51 : : // Register PDEs for all combinations of policies 52 : : brigand::for_each< CGCompFlowPolicies >( 53 [ + - ]: 2301 : registerCG< cg::CompFlow >( cf, cgt, ctr::PDEType::COMPFLOW ) ); 54 : : 55 : : // Construct vector of vectors for all possible policies 56 : : using DGCompFlowPolicies = 57 : : tk::cartesian_product< dg::CompFlowPhysics, CompFlowProblems >; 58 : : // Register PDEs for all combinations of policies 59 : : brigand::for_each< DGCompFlowPolicies >( 60 [ + - ]: 2301 : registerDG< dg::CompFlow >( df, dgt, ctr::PDEType::COMPFLOW ) ); 61 : 2301 : } 62 : : 63 : : std::vector< std::pair< std::string, std::string > > 64 : 62 : infoCompFlow( std::map< ctr::PDEType, tk::ncomp_t >& cnt ) 65 : : // ***************************************************************************** 66 : : // Return information on the compressible flow system of PDEs 67 : : //! \param[inout] cnt std::map of counters for all PDE types 68 : : //! \return vector of string pairs describing the PDE configuration 69 : : // ***************************************************************************** 70 : : { 71 : : using eq = tag::compflow; 72 : : using tk::parameter; 73 : : using tk::parameters; 74 : : 75 [ + - ]: 62 : auto c = ++cnt[ ctr::PDEType::COMPFLOW ]; // count eqs 76 : 62 : --c; // used to index vectors starting with 0 77 : : 78 : 62 : std::vector< std::pair< std::string, std::string > > nfo; 79 : : 80 [ + - ][ + - ]: 62 : nfo.emplace_back( ctr::PDE().name( ctr::PDEType::COMPFLOW ), "" ); [ + - ] 81 : : 82 [ + - ]: 124 : nfo.emplace_back( "physics", ctr::Physics().name( 83 [ + - ][ + - ]: 62 : g_inputdeck.get< eq, tag::physics >() ) ); 84 : : 85 [ + - ]: 124 : nfo.emplace_back( "problem", ctr::Problem().name( 86 [ + - ][ + - ]: 62 : g_inputdeck.get< eq, tag::problem >() ) ); 87 : : 88 : 62 : auto ncomp = g_inputdeck.get< tag::ncomp >(); 89 [ + - ][ + - ]: 62 : nfo.emplace_back( "number of components", parameter( ncomp ) ); 90 : : 91 : 62 : const auto scheme = g_inputdeck.get< tag::scheme >(); 92 [ + + ][ + + ]: 62 : if (scheme != ctr::SchemeType::ALECG && scheme != ctr::SchemeType::OversetFE) 93 [ + - ]: 64 : nfo.emplace_back( "flux", ctr::Flux().name( 94 [ + - ][ + - ]: 32 : g_inputdeck.get< tag::flux >() ) ); 95 : : 96 : : // ICs 97 : : 98 : 62 : const auto& ic = g_inputdeck.get< tag::ic >(); 99 : : 100 : 62 : const auto& icbox = ic.get< tag::box >(); 101 [ + + ]: 62 : if (!icbox.empty()) { 102 : 2 : std::size_t bcnt = 0; 103 [ + + ]: 5 : for (const auto& b : icbox) { // for all boxes configured for this eq 104 : : std::vector< tk::real > box 105 : 3 : { b.get< tag::xmin >(), b.get< tag::xmax >(), 106 : 9 : b.get< tag::ymin >(), b.get< tag::ymax >(), 107 [ + - ]: 6 : b.get< tag::zmin >(), b.get< tag::zmax >() }; 108 : : 109 [ + - ][ + - ]: 6 : std::string boxname = "IC box " + parameter(bcnt); 110 [ + - ][ + - ]: 3 : nfo.emplace_back( boxname, parameters( box ) ); 111 : : 112 [ + - ]: 6 : nfo.emplace_back( boxname + " orientation", 113 [ + - ][ + - ]: 9 : parameters(b.get< tag::orientation >()) ); 114 : : 115 : 3 : const auto& initiate = b.get< tag::initiate >(); 116 [ + - ]: 3 : auto opt = ctr::Initiate(); 117 [ + - ][ + - ]: 3 : nfo.emplace_back( boxname + ' ' + opt.group(), opt.name(initiate) ); [ + - ][ + - ] 118 : : 119 : 3 : ++bcnt; 120 : : } 121 : : } 122 : : 123 : 62 : const auto& icblock = ic.get< tag::meshblock >(); 124 [ - + ]: 62 : for (const auto& b : icblock) { // for all blocks configured for eq 125 : : std::string blockname = "IC mesh block " + 126 [ - - ][ - - ]: 0 : parameter(b.get< tag::blockid >()); 127 : : 128 : 0 : const auto& initiate = b.get< tag::initiate >(); 129 [ - - ]: 0 : auto opt = ctr::Initiate(); 130 [ - - ][ - - ]: 0 : nfo.emplace_back( blockname + ' ' + opt.group(), opt.name(initiate) ); [ - - ][ - - ] 131 : : } 132 : : 133 : : // BCs 134 : : 135 : 62 : const auto& bc = g_inputdeck.get< tag::bc >(); 136 [ + + ]: 125 : for (const auto& ib : bc) { 137 : 63 : const auto& fs = ib.get< tag::farfield >(); 138 [ + + ]: 63 : if (!fs.empty()) 139 [ + - ][ + - ]: 8 : nfo.emplace_back( "Farfield BC sideset(s)", parameters( fs ) ); 140 : : 141 : 63 : const auto& sym = ib.get< tag::symmetry >(); 142 [ + + ]: 63 : if (!sym.empty()) 143 [ + - ][ + - ]: 31 : nfo.emplace_back( "Symmetry BC sideset(s)", parameters( sym ) ); 144 : : 145 : 63 : const auto& dir = ib.get< tag::dirichlet >(); 146 [ + + ]: 63 : if (!dir.empty()) 147 [ + - ][ + - ]: 34 : nfo.emplace_back( "Dirichlet BC sideset(s)", parameters( dir ) ); 148 : : 149 : 63 : const auto& timedep = ib.get< tag::timedep >(); 150 [ + + ]: 63 : if (!timedep.empty()) { 151 [ + + ]: 4 : for (const auto& bndry : timedep) { 152 : : nfo.emplace_back( "Time dependent BC sideset(s)", 153 [ + - ][ + - ]: 2 : parameters(bndry.get< tag::sideset >()) ); 154 : : } 155 : : } 156 : : } 157 : : 158 : 124 : return nfo; 159 : : } 160 : : 161 : : } // inciter::