diff --git a/docs/source/theory/codeAbstractions.rst b/docs/source/theory/codeAbstractions.rst index aa69da022..3c75e8a9b 100644 --- a/docs/source/theory/codeAbstractions.rst +++ b/docs/source/theory/codeAbstractions.rst @@ -259,11 +259,12 @@ elemental, nodal, face and edge of desired size. const int numStates = realm_.number_of_states(); // declare it - density_ = &(metaData_.declare_field(stk::topology::NODE_RANK, - "density", numStates)); + density_ + = &(metaData_.declare_field(stk::topology::NODE_RANK, + "density", numStates)); // put it on this part - stk::mesh::put_field_on_mesh(*density_, *part, nullptr); + stk::mesh::put_field(*density_, *part); } :math:`\bullet` edge field registration: @@ -276,11 +277,9 @@ elemental, nodal, face and edge of desired size. { const int nDim = metaData_.spatial_dimension(); edgeAreaVec_ - = &(metaData_.declare_field(stk::topology::EDGE_RANK, - "edge_area_vector")); - stk::mesh::put_field_on_mesh(*edgeAreaVec_, *part, nDim, nullptr); - stk::io::set_field_output_type(*edgeAreaVec_, - stk::io::FieldOutputType::VECTOR_3D); + = &(metaData_.declare_field(stk::topology::EDGE_RANK, + "edge_area_vector")); + stk::mesh::put_field(*edgeAreaVec_, *part, nDim); } :math:`\bullet` side/face field registration: @@ -298,10 +297,9 @@ elemental, nodal, face and edge of desired size. stk::topology::rank_t sideRank = static_cast(metaData_.side_rank()); GenericFieldType *wallFrictionVelocityBip - = &(metaData_.declare_field + = &(metaData_.declare_field (sideRank, "wall_friction_velocity_bip")); - stk::mesh::put_field_on_mesh(*wallFrictionVelocityBip, *part, numIp, - nullptr); + stk::mesh::put_field(*wallFrictionVelocityBip, *part, numIp); } } @@ -319,21 +317,23 @@ addition to the field template type, .. code-block:: c++ VectorFieldType *velocityRTM - = metaData_.get_field(stk::topology::NODE_RANK, "velocity"); + = metaData_.get_field(stk::topology::NODE_RANK, + "velocity"); ScalarFieldType *density - = metaData_.get_field(stk::topology::NODE_RANK, "density");} + = metaData_.get_field(stk::topology::NODE_RANK, + "density");} VectorFieldType *edgeAreaVec - = metaData_.get_field(stk::topology::EDGE_RANK, - "edge_area_vector"); + = metaData_.get_field(stk::topology::EDGE_RANK, + "edge_area_vector"); - GenericFieldType *massFlowRate - = metaData_.get_field(stk::topology::ELEMENT_RANK, - "mass_flow_rate_scs"); + GenericFieldType *massFlowRate + = metaData_.get_field(stk::topology::ELEMENT_RANK, + "mass_flow_rate_scs"); GenericFieldType *wallFrictionVelocityBip_ - = metaData_.get_field(metaData_.side_rank(), - "wall_friction_velocity_bip"); + = metaData_.get_field(metaData_.side_rank(), + "wall_friction_velocity_bip"); State ~~~~~ @@ -346,7 +346,8 @@ extracted, .. code-block:: c++ ScalarFieldType *density - = metaData_.get_field(stk::topology::NODE_RANK, "density"); + = metaData_.get_field(stk::topology::NODE_RANK, + "density"); densityNm1_ = &(density->field_of_state(stk::mesh::StateNM1)); densityN_ = &(density->field_of_state(stk::mesh::StateN)); densityNp1_ = &(density->field_of_state(stk::mesh::StateNP1)); diff --git a/include/FieldDefinitions.h b/include/FieldDefinitions.h index aba827f36..45f2e1f1e 100644 --- a/include/FieldDefinitions.h +++ b/include/FieldDefinitions.h @@ -15,33 +15,30 @@ namespace sierra { namespace nalu { -enum class FieldLayout { SCALAR, VECTOR, TENSOR, ARRAY }; - -template +template struct FieldDefinition { - using DataType = T; + using FieldType = T; const stk::topology::rank_t rank; const int num_states{1}; const int num_components{1}; - const FieldLayout layout{Layout}; }; -using FieldDefScalar = FieldDefinition; -using FieldDefVector = FieldDefinition; -using FieldDefTensor = FieldDefinition; -using FieldDefGeneric = FieldDefinition; -using FieldDefGenericInt = FieldDefinition; -using FieldDefTpetraId = FieldDefinition; -using FieldDefLocalId = FieldDefinition; -using FieldDefGlobalId = FieldDefinition; -using FieldDefHypreId = FieldDefinition; -using FieldDefScalarInt = FieldDefinition; +using FieldDefScalar = FieldDefinition; +using FieldDefVector = FieldDefinition; +using FieldDefTensor = FieldDefinition; +using FieldDefGeneric = FieldDefinition; +using FieldDefGenericInt = FieldDefinition; +using FieldDefTpetraId = FieldDefinition; +using FieldDefLocalId = FieldDefinition; +using FieldDefGlobalId = FieldDefinition; +using FieldDefHypreId = FieldDefinition; +using FieldDefScalarInt = FieldDefinition; // Type redundancy can occur between HypreId and ScalarInt // which will break std::variant using FieldDefTypes = std::conditional< - std::is_same_v, + std::is_same_v, std::variant< FieldDefScalar, FieldDefVector, @@ -64,22 +61,29 @@ using FieldDefTypes = std::conditional< FieldDefScalarInt, FieldDefHypreId>>::type; -// Trouble! using FieldPointerTypes = std::conditional< - std::is_same_v, + std::is_same_v, std::variant< - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*>, + ScalarFieldType*, + VectorFieldType*, + TensorFieldType*, + GenericFieldType*, + GenericIntFieldType*, + TpetIDFieldType*, + LocalIdFieldType*, + GlobalIdFieldType*, + ScalarIntFieldType*>, std::variant< - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*, - stk::mesh::Field*>>::type; + ScalarFieldType*, + VectorFieldType*, + TensorFieldType*, + GenericFieldType*, + GenericIntFieldType*, + TpetIDFieldType*, + LocalIdFieldType*, + GlobalIdFieldType*, + ScalarIntFieldType*, + HypreIDFieldType*>>::type; } // namespace nalu } // namespace sierra diff --git a/include/FieldManager.h b/include/FieldManager.h index e612ec099..d8727524e 100644 --- a/include/FieldManager.h +++ b/include/FieldManager.h @@ -57,7 +57,7 @@ class FieldManager /// ScalarFieldType* and so on. /// template - stk::mesh::Field* register_field( + T* register_field( const std::string& name, const stk::mesh::PartVector& parts, const void* init_val = nullptr, @@ -86,7 +86,7 @@ class FieldManager stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) { register_field(name, parts, numStates, numComponents, init_val); - return get_field_ptr(name, state); + return get_field_ptr(name, state); } // Return a field by the given name and of type T, the template parameter. @@ -94,7 +94,7 @@ class FieldManager // specified by the template parameter: ScalarFieldType, VectorFieldType, // ScalarIntFieldType, GlobalIdFieldType,.... template - stk::mesh::Field* get_field_ptr( + T* get_field_ptr( const std::string& name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { @@ -102,10 +102,12 @@ class FieldManager FieldRegistry::query(numDimensions_, numStates_, name); FieldPointerTypes pointerSet = std::visit( [&](auto def) -> FieldPointerTypes { - return &meta_.get_field(def.rank, name)->field_of_state(state); + return &meta_ + .get_field(def.rank, name) + ->field_of_state(state); }, fieldDef); - return std::get*>(pointerSet); + return std::get(pointerSet); } /// Register a field with the option to override default parameters that @@ -137,7 +139,9 @@ class FieldManager FieldRegistry::query(numDimensions_, numStates_, name); const stk::mesh::FieldBase& stkField = std::visit( [&](auto def) -> stk::mesh::FieldBase& { - return meta_.get_field(def.rank, name)->field_of_state(state); + return meta_ + .get_field(def.rank, name) + ->field_of_state(state); }, fieldDef); stk::mesh::NgpField& tmp = stk::mesh::get_updated_ngp_field(stkField); @@ -150,16 +154,16 @@ class FieldManager std::string name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { - return MakeSmartField().template operator()( + return MakeSmartField().template operator()( get_ngp_field_ptr(name, state)); } template - SmartField, tags::LEGACY, ACCESS> get_legacy_smart_field( + SmartField get_legacy_smart_field( std::string name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { - return MakeSmartField().template operator()( + return MakeSmartField().template operator()( get_field_ptr(name, state)); } }; diff --git a/include/FieldTypeDef.h b/include/FieldTypeDef.h index f13818fb1..9b436ae11 100644 --- a/include/FieldTypeDef.h +++ b/include/FieldTypeDef.h @@ -11,6 +11,7 @@ #define FieldTypeDef_h #include +#include #include #include @@ -26,38 +27,43 @@ namespace sierra { namespace nalu { -using ScalarFieldType = stk::mesh::Field; -using GlobalIdFieldType = stk::mesh::Field; -using ScalarIntFieldType = stk::mesh::Field; -using NGPDoubleFieldType = stk::mesh::NgpField; -using NGPGlobalIdFieldType = stk::mesh::NgpField; -using NGPScalarIntFieldType = stk::mesh::NgpField; +// define scalar field typedef +typedef stk::mesh::Field ScalarFieldType; +typedef stk::mesh::Field GlobalIdFieldType; +typedef stk::mesh::Field ScalarIntFieldType; +typedef stk::mesh::NgpField NGPDoubleFieldType; +typedef stk::mesh::NgpField NGPGlobalIdFieldType; +typedef stk::mesh::NgpField NGPScalarIntFieldType; -using VectorFieldType = stk::mesh::Field; -using TensorFieldType = stk::mesh::Field; +// define vector field typedef; however, what is the value of Cartesian? +typedef stk::mesh::Field VectorFieldType; +typedef stk::mesh::Field TensorFieldType; -using GenericFieldType = stk::mesh::Field; +// define generic +typedef stk::mesh::Field GenericFieldType; -using GenericIntFieldType = stk::mesh::Field; +typedef stk::mesh::Field GenericIntFieldType; -using LocalId = unsigned; -using LocalIdFieldType = stk::mesh::Field; +// field type for local ids +typedef unsigned LocalId; +typedef stk::mesh::Field LocalIdFieldType; +// Hypre Integer types #ifdef NALU_USES_HYPRE -using HypreIntType = HYPRE_Int; +typedef HYPRE_Int HypreIntType; #else -using HypreIntType = int; +typedef int HypreIntType; #endif #ifdef NALU_USES_TRILINOS_SOLVERS -using TpetIdType = Tpetra::Details::DefaultTypes::global_ordinal_type; +typedef stk::mesh::Field + TpetIDFieldType; #else -using TpetIdType = int64_t; +typedef stk::mesh::Field TpetIDFieldType; #endif -using TpetIDFieldType = stk::mesh::Field; -using HypreIDFieldType = stk::mesh::Field; -using NGPHypreIDFieldType = stk::mesh::NgpField; +typedef stk::mesh::Field HypreIDFieldType; +typedef stk::mesh::NgpField NGPHypreIDFieldType; } // namespace nalu } // namespace sierra diff --git a/include/MatrixFreeHeatCondEquationSystem.h b/include/MatrixFreeHeatCondEquationSystem.h index 1df84b120..d92fdcd21 100644 --- a/include/MatrixFreeHeatCondEquationSystem.h +++ b/include/MatrixFreeHeatCondEquationSystem.h @@ -16,6 +16,7 @@ #include "Kokkos_Array.hpp" #include "stk_mesh/base/Ngp.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "Realm.h" diff --git a/include/ProjectedNodalGradientEquationSystem.h b/include/ProjectedNodalGradientEquationSystem.h index 1748c6729..e728b7001 100644 --- a/include/ProjectedNodalGradientEquationSystem.h +++ b/include/ProjectedNodalGradientEquationSystem.h @@ -16,6 +16,7 @@ #include #include +#include namespace stk { struct topology; diff --git a/include/SmartField.h b/include/SmartField.h index 937d9ea62..a21252c37 100644 --- a/include/SmartField.h +++ b/include/SmartField.h @@ -401,10 +401,9 @@ struct MakeSmartField { // use pointer since that is the common access type for stk::mesh::Field template - SmartField, LEGACY, ACCESS> - operator()(stk::mesh::Field* field) + SmartField operator()(T* field) { - return SmartField, LEGACY, ACCESS>(*field); + return SmartField(*field); } }; diff --git a/include/aero/actuator/ActuatorGenericSearchFunctor.h b/include/aero/actuator/ActuatorGenericSearchFunctor.h index c1941d606..dd68cace8 100644 --- a/include/aero/actuator/ActuatorGenericSearchFunctor.h +++ b/include/aero/actuator/ActuatorGenericSearchFunctor.h @@ -35,12 +35,15 @@ struct GenericLoopOverCoarseSearchResults ActuatorBulk& actBulk, stk::mesh::BulkData& stkBulk) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "coordinates")), - actuatorSource_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "actuator_source")), - dualNodalVolume_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "dual_nodal_volume")), + coordinates_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "coordinates")), + actuatorSource_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "actuator_source")), + dualNodalVolume_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "dual_nodal_volume")), innerLoopFunctor_(actBulk) { actBulk_.coarseSearchElemIds_.sync_host(); @@ -55,12 +58,15 @@ struct GenericLoopOverCoarseSearchResults functor innerLoopFunctor) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "coordinates")), - actuatorSource_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "actuator_source")), - dualNodalVolume_(stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "dual_nodal_volume")), + coordinates_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "coordinates")), + actuatorSource_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "actuator_source")), + dualNodalVolume_( + stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "dual_nodal_volume")), innerLoopFunctor_(innerLoopFunctor) { actBulk_.coarseSearchElemIds_.sync_host(); @@ -95,7 +101,7 @@ struct GenericLoopOverCoarseSearchResults for (unsigned i = 0; i < numNodes; i++) { const double* coords = - stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); + (double*)stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); for (int j = 0; j < 3; j++) { elemCoords(i, j) = coords[j]; } @@ -108,9 +114,12 @@ struct GenericLoopOverCoarseSearchResults for (int nIp = 0; nIp < numIp; nIp++) { const int nodeIndex = ipNodeMap[nIp]; stk::mesh::Entity node = elem_nod_rels[nodeIndex]; - const double* nodeCoords = stk::mesh::field_data(*coordinates_, node); - const double dual_vol = *stk::mesh::field_data(*dualNodalVolume_, node); - double* sourceTerm = stk::mesh::field_data(*actuatorSource_, node); + const double* nodeCoords = + (double*)stk::mesh::field_data(*coordinates_, node); + const double dual_vol = + *(double*)stk::mesh::field_data(*dualNodalVolume_, node); + double* sourceTerm = + (double*)stk::mesh::field_data(*actuatorSource_, node); // anything else that is required should be stashed on the functor // during functor construction i.e. ActuatorBulk, flags, ActuatorMeta, diff --git a/include/aero/fsi/FSIturbine.h b/include/aero/fsi/FSIturbine.h index 473ace420..c4b0feaa4 100644 --- a/include/aero/fsi/FSIturbine.h +++ b/include/aero/fsi/FSIturbine.h @@ -16,6 +16,7 @@ #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Field.hpp" #include "FieldTypeDef.h" #include @@ -52,10 +53,10 @@ struct DeflectionRampingParams // TODO(psakiev) find a better place for this // ********************************************************************** //! convenience function for generating a vs::Vector from a stk::field -template +template inline vs::VectorT vector_from_field( - const stk::mesh::Field& field, const stk::mesh::Entity& node) + const stk::mesh::Field& field, const stk::mesh::Entity& node) { // debug only check for optimization assert(field.max_size(stk::topology::NODE_RANK) == 3); @@ -66,10 +67,12 @@ vector_from_field( //! convenience function for putting vector computations back onto the //! stk::fields -template +template inline void vector_to_field( - vs::VectorT vec, stk::mesh::Field& field, const stk::mesh::Entity& node) + vs::VectorT vec, + stk::mesh::Field& field, + const stk::mesh::Entity& node) { // debug only check for optimization assert(field.max_size(stk::topology::NODE_RANK) == 3); diff --git a/include/element_promotion/PromoteElement.h b/include/element_promotion/PromoteElement.h index 2f3b8faa1..5a92bd0ce 100644 --- a/include/element_promotion/PromoteElement.h +++ b/include/element_promotion/PromoteElement.h @@ -10,8 +10,8 @@ #define PromoteElement_h #include +#include #include -#include #include @@ -30,6 +30,7 @@ namespace mesh { class BulkData; } } // namespace stk +typedef stk::mesh::Field VectorFieldType; namespace sierra { namespace nalu { diff --git a/include/element_promotion/PromoteElementImpl.h b/include/element_promotion/PromoteElementImpl.h index 496095ced..cb75d55ac 100644 --- a/include/element_promotion/PromoteElementImpl.h +++ b/include/element_promotion/PromoteElementImpl.h @@ -12,13 +12,13 @@ #include #include +#include #include #include #include #include -#include namespace stk { namespace mesh { @@ -60,6 +60,7 @@ namespace nalu { struct ElementDescription; } } // namespace sierra +typedef stk::mesh::Field VectorFieldType; namespace sierra { namespace nalu { diff --git a/include/element_promotion/PromotedElementIO.h b/include/element_promotion/PromotedElementIO.h index d0aad823c..3d802ac31 100644 --- a/include/element_promotion/PromotedElementIO.h +++ b/include/element_promotion/PromotedElementIO.h @@ -10,13 +10,13 @@ #ifndef PromotedElementIO_h #define PromotedElementIO_h +#include #include #include #include #include #include -#include #include #include @@ -39,6 +39,11 @@ struct ElementDescription; } // namespace nalu } // namespace sierra +// field types +typedef stk::mesh::Field ScalarFieldType; +typedef stk::mesh::Field GenericFieldType; +typedef stk::mesh::Field VectorFieldType; + namespace stk { namespace mesh { class BulkData; diff --git a/include/mesh_motion/FrameBase.h b/include/mesh_motion/FrameBase.h index fb785bb47..8b43b5e6b 100644 --- a/include/mesh_motion/FrameBase.h +++ b/include/mesh_motion/FrameBase.h @@ -4,6 +4,7 @@ #include "NgpMotion.h" // stk base header files +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/MetaData.hpp" diff --git a/include/ngp_algorithms/NodalGradAlgDriver.h b/include/ngp_algorithms/NodalGradAlgDriver.h index e29d409a6..6d0d52028 100644 --- a/include/ngp_algorithms/NodalGradAlgDriver.h +++ b/include/ngp_algorithms/NodalGradAlgDriver.h @@ -26,7 +26,7 @@ class NodalGradAlgDriver : public NgpAlgDriver "Invalid field type provided to NodalGradAlgDriver"); public: - NodalGradAlgDriver(Realm&, const std::string&, const std::string&); + NodalGradAlgDriver(Realm&, const std::string&); virtual ~NodalGradAlgDriver() = default; @@ -38,7 +38,6 @@ class NodalGradAlgDriver : public NgpAlgDriver private: //! Field that is synchronized pre/post updates - const std::string phiName_; const std::string gradPhiName_; }; diff --git a/include/ngp_algorithms/NodalGradBndryElemAlg.h b/include/ngp_algorithms/NodalGradBndryElemAlg.h index eb5bcb14d..d696a89c4 100644 --- a/include/ngp_algorithms/NodalGradBndryElemAlg.h +++ b/include/ngp_algorithms/NodalGradBndryElemAlg.h @@ -13,8 +13,7 @@ #include "Algorithm.h" #include "ElemDataRequests.h" #include "FieldTypeDef.h" -#include "ngp_utils/NgpScratchData.h" -#include "ngp_algorithms/ViewHelper.h" + #include "stk_mesh/base/Types.hpp" namespace sierra { @@ -22,17 +21,21 @@ namespace nalu { class MasterElement; -using NodalGradBndryElemSimdDataType = - sierra::nalu::nalu_ngp::ElemSimdData; - -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> +template class NodalGradBndryElemAlg : public Algorithm { + static_assert( + ((std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value)), + "Improper field types passed to nodal gradient calculator"); + public: + using DblType = double; + NodalGradBndryElemAlg( Realm&, stk::mesh::Part*, @@ -51,34 +54,25 @@ class NodalGradBndryElemAlg : public Algorithm unsigned gradPhi_{stk::mesh::InvalidOrdinal}; unsigned dualNodalVol_{stk::mesh::InvalidOrdinal}; unsigned exposedAreaVec_{stk::mesh::InvalidOrdinal}; - int phiSize_{0}; - int gradPhiSize_{0}; const bool useShifted_{false}; MasterElement* meFC_{nullptr}; + + static constexpr int NumComp = + std::is_same::value ? 1 : AlgTraits::nDim_; }; template -using ScalarNodalGradBndryElemAlg = NodalGradBndryElemAlg< - AlgTraits, - ScalarFieldType, - VectorFieldType, - nalu_ngp::ScalarViewHelper>; +using ScalarNodalGradBndryElemAlg = + NodalGradBndryElemAlg; template -using VectorNodalGradBndryElemAlg = NodalGradBndryElemAlg< - AlgTraits, - VectorFieldType, - GenericFieldType, - nalu_ngp::VectorViewHelper>; - +using VectorNodalGradBndryElemAlg = + NodalGradBndryElemAlg; template -using TensorNodalGradBndryElemAlg = NodalGradBndryElemAlg< - AlgTraits, - VectorFieldType, - TensorFieldType, - nalu_ngp::VectorViewHelper>; +using TensorNodalGradBndryElemAlg = + NodalGradBndryElemAlg; } // namespace nalu } // namespace sierra diff --git a/include/ngp_algorithms/NodalGradEdgeAlg.h b/include/ngp_algorithms/NodalGradEdgeAlg.h index da92d00bc..46771b49f 100644 --- a/include/ngp_algorithms/NodalGradEdgeAlg.h +++ b/include/ngp_algorithms/NodalGradEdgeAlg.h @@ -21,6 +21,15 @@ namespace nalu { template class NodalGradEdgeAlg : public Algorithm { + static_assert( + ((std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value)), + "Improper field types passed to nodal gradient calculator"); + public: using DblType = double; diff --git a/include/ngp_algorithms/NodalGradElemAlg.h b/include/ngp_algorithms/NodalGradElemAlg.h index 5f0588f26..4ac340409 100644 --- a/include/ngp_algorithms/NodalGradElemAlg.h +++ b/include/ngp_algorithms/NodalGradElemAlg.h @@ -13,8 +13,7 @@ #include "Algorithm.h" #include "ElemDataRequests.h" #include "FieldTypeDef.h" -#include "ngp_utils/NgpScratchData.h" -#include "ngp_algorithms/ViewHelper.h" + #include "stk_mesh/base/Types.hpp" namespace sierra { @@ -22,17 +21,21 @@ namespace nalu { class MasterElement; -using NodalGradElemSimdDataType = - sierra::nalu::nalu_ngp::ElemSimdData; - -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> +template class NodalGradElemAlg : public Algorithm { + static_assert( + ((std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value) || + (std::is_same::value && + std::is_same::value)), + "Improper field types passed to nodal gradient calculator"); + public: + using DblType = double; + NodalGradElemAlg( Realm&, stk::mesh::Part*, @@ -50,34 +53,27 @@ class NodalGradElemAlg : public Algorithm unsigned phi_{stk::mesh::InvalidOrdinal}; unsigned gradPhi_{stk::mesh::InvalidOrdinal}; unsigned dualNodalVol_{stk::mesh::InvalidOrdinal}; - int phiSize_{0}; - int gradPhiSize_{0}; const bool useShifted_{false}; MasterElement* meSCS_{nullptr}; + + static constexpr int NDimMax = 3; + + static constexpr int NumComp = + std::is_same::value ? 1 : AlgTraits::nDim_; }; template -using ScalarNodalGradElemAlg = NodalGradElemAlg< - AlgTraits, - ScalarFieldType, - VectorFieldType, - nalu_ngp::ScalarViewHelper>; +using ScalarNodalGradElemAlg = + NodalGradElemAlg; template -using VectorNodalGradElemAlg = NodalGradElemAlg< - AlgTraits, - VectorFieldType, - GenericFieldType, - nalu_ngp::VectorViewHelper>; - +using VectorNodalGradElemAlg = + NodalGradElemAlg; template -using TensorNodalGradElemAlg = NodalGradElemAlg< - AlgTraits, - VectorFieldType, - TensorFieldType, - nalu_ngp::VectorViewHelper>; +using TensorNodalGradElemAlg = + NodalGradElemAlg; } // namespace nalu } // namespace sierra diff --git a/include/ngp_algorithms/ViewHelper.h b/include/ngp_algorithms/ViewHelper.h index c7fc73c1b..b683a2186 100644 --- a/include/ngp_algorithms/ViewHelper.h +++ b/include/ngp_algorithms/ViewHelper.h @@ -20,10 +20,12 @@ namespace nalu { namespace nalu_ngp { -template -struct ScalarViewHelper +template +struct ViewHelper; + +template +struct ViewHelper { - using SimdDataType = ElemSimdDataType; using ViewDataType = SharedMemView; using ScratchViewsType = ScratchViews< @@ -32,13 +34,13 @@ struct ScalarViewHelper typename ElemSimdDataType::ShmemType>; KOKKOS_INLINE_FUNCTION - ScalarViewHelper(ScratchViewsType& scrView, unsigned phiID) + ViewHelper(ScratchViewsType& scrView, unsigned phiID) : v_phi_(scrView.get_scratch_view_1D(phiID)) { } KOKKOS_DEFAULTED_FUNCTION - ~ScalarViewHelper() = default; + ~ViewHelper() = default; KOKKOS_INLINE_FUNCTION DoubleType operator()(int ni, int) const { return v_phi_(ni); } @@ -46,10 +48,9 @@ struct ScalarViewHelper const ViewDataType& v_phi_; }; -template -struct VectorViewHelper +template +struct ViewHelper { - using SimdDataType = ElemSimdDataType; using ViewDataType = SharedMemView; using ScratchViewsType = ScratchViews< @@ -58,13 +59,13 @@ struct VectorViewHelper typename ElemSimdDataType::ShmemType>; KOKKOS_INLINE_FUNCTION - VectorViewHelper(ScratchViewsType& scrView, unsigned phiID) + ViewHelper(ScratchViewsType& scrView, unsigned phiID) : v_phi_(scrView.get_scratch_view_2D(phiID)) { } KOKKOS_DEFAULTED_FUNCTION - ~VectorViewHelper() = default; + ~ViewHelper() = default; KOKKOS_INLINE_FUNCTION DoubleType operator()(int ni, int ic) const { return v_phi_(ni, ic); } diff --git a/include/ngp_utils/NgpFieldBLAS.h b/include/ngp_utils/NgpFieldBLAS.h index 577bbd140..e76bbeae3 100644 --- a/include/ngp_utils/NgpFieldBLAS.h +++ b/include/ngp_utils/NgpFieldBLAS.h @@ -137,13 +137,13 @@ field_axpby( template inline void -scalar_field_axpby( +field_axpby( const MeshInfoType& meshInfo, const stk::mesh::Selector& sel, const double alpha, - const stk::mesh::FieldBase& xField, + const ScalarFieldType& xField, const double beta, - stk::mesh::FieldBase& yField, + ScalarFieldType& yField, const stk::topology::rank_t rank = stk::topology::NODE_RANK) { constexpr unsigned nComp = 1; @@ -152,7 +152,7 @@ scalar_field_axpby( template inline void -vector_field_axpby( +field_axpby( const MeshInfoType& meshInfo, const stk::mesh::Selector& sel, const double alpha, diff --git a/include/overset/TiogaBlock.h b/include/overset/TiogaBlock.h index 324ba9369..b3467858c 100644 --- a/include/overset/TiogaBlock.h +++ b/include/overset/TiogaBlock.h @@ -5,12 +5,12 @@ #include #include #include +#include #include "overset/TiogaOptions.h" #include "overset/OversetFieldData.h" #include "overset/OversetNGP.h" #include "yaml-cpp/yaml.h" -#include "FieldTypeDef.h" #include #include @@ -22,6 +22,10 @@ class tioga; namespace tioga_nalu { +typedef stk::mesh::Field VectorFieldType; +typedef stk::mesh::Field ScalarFieldType; +typedef stk::mesh::Field ScalarIntFieldType; + /** Data representing an unstructured mesh block */ struct NgpTiogaBlock diff --git a/include/overset/TiogaSTKIface.h b/include/overset/TiogaSTKIface.h index 86a60050b..f851063ee 100644 --- a/include/overset/TiogaSTKIface.h +++ b/include/overset/TiogaSTKIface.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "overset/TiogaOptions.h" #include "overset/OversetFieldData.h" diff --git a/include/utils/StkHelpers.h b/include/utils/StkHelpers.h index 394c20f7a..e200d70ea 100644 --- a/include/utils/StkHelpers.h +++ b/include/utils/StkHelpers.h @@ -99,11 +99,6 @@ get_node_field( *meta.get_field(stk::topology::NODE_RANK, name)->field_state(state)); } -// Can replace this function with field.max_extent(0) when -// using new-enough Trilinos. -// -unsigned max_extent(const stk::mesh::FieldBase& field, unsigned dimension); - } // namespace nalu } // namespace sierra diff --git a/include/xfer/FromMesh.h b/include/xfer/FromMesh.h index 40ed7ba93..3035170c2 100644 --- a/include/xfer/FromMesh.h +++ b/include/xfer/FromMesh.h @@ -129,7 +129,7 @@ class FromMesh : fromMetaData_(fromMetaData), fromBulkData_(fromBulkData), fromRealm_(fromRealm), - fromcoordinates_(fromMetaData.get_field( + fromcoordinates_(fromMetaData.get_field( stk::topology::NODE_RANK, coordinates_name)), fromPartVec_(fromPartVec), fromFieldVec_(get_fields(fromMetaData, VarPairName)), diff --git a/include/xfer/LocalVolumeSearch.h b/include/xfer/LocalVolumeSearch.h index 0f8d0a9a0..90eb09e70 100644 --- a/include/xfer/LocalVolumeSearch.h +++ b/include/xfer/LocalVolumeSearch.h @@ -11,6 +11,7 @@ #define LOCAL_VOLUME_SEARCH_H #include "stk_mesh/base/Field.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_search/BoundingBox.hpp" #include "stk_search/IdentProc.hpp" @@ -55,13 +56,13 @@ void local_field_interpolation( const stk::mesh::BulkData& bulk, const stk::mesh::Selector& active, const std::vector>& points, - const stk::mesh::Field& coord_field, - const stk::mesh::Field& field_nm1, - const stk::mesh::Field& field, + const stk::mesh::Field& coord_field, + const stk::mesh::Field& field_nm1, + const stk::mesh::Field& field, double dtratio, LocalVolumeSearchData& data); } // namespace nalu } // namespace sierra -#endif +#endif \ No newline at end of file diff --git a/include/xfer/ToMesh.h b/include/xfer/ToMesh.h index 07e8929ad..1e72ab998 100644 --- a/include/xfer/ToMesh.h +++ b/include/xfer/ToMesh.h @@ -125,7 +125,7 @@ class ToMesh : toMetaData_(toMetaData), toBulkData_(toBulkData), toRealm_(toRealm), - tocoordinates_(toMetaData.get_field( + tocoordinates_(toMetaData.get_field( stk::topology::NODE_RANK, coordinates_name)), toPartVec_(toPartVec), toFieldVec_(get_fields(toMetaData, VarPairName)), diff --git a/src/AMSAlgDriver.C b/src/AMSAlgDriver.C index f8f79e0a7..f407d11a5 100644 --- a/src/AMSAlgDriver.C +++ b/src/AMSAlgDriver.C @@ -21,7 +21,6 @@ #include #include #include -#include // stk_mesh/base/fem #include @@ -72,63 +71,58 @@ AMSAlgDriver::register_nodal_fields(const stk::mesh::PartVector& part_vec) const int numStates = 2; // Nodal fields - beta_ = &(meta.declare_field(stk::topology::NODE_RANK, "k_ratio")); + beta_ = + &(meta.declare_field(stk::topology::NODE_RANK, "k_ratio")); stk::mesh::put_field_on_mesh(*beta_, selector, nullptr); - avgVelocity_ = &(meta.declare_field( + avgVelocity_ = &(meta.declare_field( stk::topology::NODE_RANK, "average_velocity", numStates)); stk::mesh::put_field_on_mesh(*avgVelocity_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *avgVelocity_, stk::io::FieldOutputType::VECTOR_3D); realm_.augment_restart_variable_list("average_velocity"); if ( realm_.solutionOptions_->meshMotion_ || realm_.solutionOptions_->externalMeshDeformation_) { - avgVelocityRTM_ = &(meta.declare_field( + avgVelocityRTM_ = &(meta.declare_field( stk::topology::NODE_RANK, "average_velocity_rtm")); stk::mesh::put_field_on_mesh(*avgVelocityRTM_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *avgVelocityRTM_, stk::io::FieldOutputType::VECTOR_3D); } - avgProduction_ = &(meta.declare_field( + avgProduction_ = &(meta.declare_field( stk::topology::NODE_RANK, "average_production", numStates)); stk::mesh::put_field_on_mesh(*avgProduction_, selector, nullptr); realm_.augment_restart_variable_list("average_production"); - avgDudx_ = &(meta.declare_field( + avgDudx_ = &(meta.declare_field( stk::topology::NODE_RANK, "average_dudx", numStates)); stk::mesh::put_field_on_mesh(*avgDudx_, selector, nDim * nDim, nullptr); realm_.augment_restart_variable_list("average_dudx"); - avgTkeResolved_ = &(meta.declare_field( + avgTkeResolved_ = &(meta.declare_field( stk::topology::NODE_RANK, "average_tke_resolved", numStates)); stk::mesh::put_field_on_mesh(*avgTkeResolved_, selector, nullptr); realm_.augment_restart_variable_list("average_tke_resolved"); - avgTime_ = - &(meta.declare_field(stk::topology::NODE_RANK, "rans_time_scale")); + avgTime_ = &(meta.declare_field( + stk::topology::NODE_RANK, "rans_time_scale")); stk::mesh::put_field_on_mesh(*avgTime_, selector, nullptr); - metric_ = - &(meta.declare_field(stk::topology::NODE_RANK, "metric_tensor")); + metric_ = &(meta.declare_field( + stk::topology::NODE_RANK, "metric_tensor")); stk::mesh::put_field_on_mesh(*metric_, selector, nDim * nDim, nullptr); - resAdequacy_ = &(meta.declare_field( + resAdequacy_ = &(meta.declare_field( stk::topology::NODE_RANK, "resolution_adequacy_parameter")); stk::mesh::put_field_on_mesh(*resAdequacy_, selector, nullptr); - avgResAdequacy_ = &(meta.declare_field( + avgResAdequacy_ = &(meta.declare_field( stk::topology::NODE_RANK, "avg_res_adequacy_parameter", numStates)); stk::mesh::put_field_on_mesh(*avgResAdequacy_, selector, nullptr); realm_.augment_restart_variable_list("avg_res_adequacy_parameter"); - forcingComp_ = &(meta.declare_field( + forcingComp_ = &(meta.declare_field( stk::topology::NODE_RANK, "forcing_components", numStates)); stk::mesh::put_field_on_mesh(*forcingComp_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *forcingComp_, stk::io::FieldOutputType::VECTOR_3D); } void @@ -138,7 +132,7 @@ AMSAlgDriver::register_edge_fields(const stk::mesh::PartVector& part_vec) stk::mesh::MetaData& meta = realm_.meta_data(); NaluEnv::self().naluOutputP0() << "Edge Mdot average added in AMS " << std::endl; - avgMdot_ = &(meta.declare_field( + avgMdot_ = &(meta.declare_field( stk::topology::EDGE_RANK, "average_mass_flow_rate")); stk::mesh::put_field_on_mesh(*avgMdot_, selector, nullptr); realm_.augment_restart_variable_list("average_mass_flow_rate"); @@ -329,8 +323,8 @@ AMSAlgDriver::post_iter_work() ngpForcingComp.sync_to_host(); - VectorFieldType* forcingComp = - meta.get_field(stk::topology::NODE_RANK, "forcing_components"); + VectorFieldType* forcingComp = meta.get_field( + stk::topology::NODE_RANK, "forcing_components"); stk::mesh::copy_owned_to_shared(bulk, {forcingComp}); if (realm_.hasPeriodic_) { diff --git a/src/AssembleContinuityNonConformalSolverAlgorithm.C b/src/AssembleContinuityNonConformalSolverAlgorithm.C index 80a5ca7b3..41d417a38 100644 --- a/src/AssembleContinuityNonConformalSolverAlgorithm.C +++ b/src/AssembleContinuityNonConformalSolverAlgorithm.C @@ -63,22 +63,24 @@ AssembleContinuityNonConformalSolverAlgorithm:: // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); if (meshMotion_) { meshMotionFac_ = 1.0; - meshVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "mesh_velocity"); + meshVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "mesh_velocity"); } else { meshMotionFac_ = 0.0; - meshVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + meshVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "velocity"); } - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(pressure_); @@ -195,8 +197,8 @@ AssembleContinuityNonConformalSolverAlgorithm::execute() // deal with state ScalarFieldType& pressureNp1 = pressure_->field_of_state(stk::mesh::StateNP1); - ScalarFieldType* Udiag = - meta_data.get_field(stk::topology::NODE_RANK, "momentum_diag"); + ScalarFieldType* Udiag = meta_data.get_field( + stk::topology::NODE_RANK, "momentum_diag"); // parallel communicate ghosted entities if (NULL != realm_.nonConformalManager_->nonConformalGhosting_) diff --git a/src/AssembleMomentumEdgeABLTopBC.C b/src/AssembleMomentumEdgeABLTopBC.C index fe77dde09..d79cca999 100644 --- a/src/AssembleMomentumEdgeABLTopBC.C +++ b/src/AssembleMomentumEdgeABLTopBC.C @@ -71,9 +71,10 @@ AssembleMomentumEdgeABLTopBC::AssembleMomentumEdgeABLTopBC( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - bcVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "cont_velocity_bc"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + bcVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "cont_velocity_bc"); } AssembleMomentumEdgeABLTopBC::~AssembleMomentumEdgeABLTopBC() @@ -240,8 +241,8 @@ AssembleMomentumEdgeABLTopBC::initialize() const int nprocs = bulk_data.parallel_size(); const int myrank = bulk_data.parallel_rank(); - VectorFieldType* coordinates = - meta_data.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coordinates = meta_data.get_field( + stk::topology::NODE_RANK, "coordinates"); nx = imax_ - 1; ny = jmax_ - 1; diff --git a/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C b/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C index 8d45ede2f..99ad0f7c5 100644 --- a/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C +++ b/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C @@ -50,17 +50,19 @@ AssembleMomentumEdgeWallFunctionSolverAlgorithm:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - bcVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "wall_velocity_bc"); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + bcVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "wall_velocity_bc"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); viscosity_ = - meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - wallFrictionVelocityBip_ = meta_data.get_field( + meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + wallFrictionVelocityBip_ = meta_data.get_field( meta_data.side_rank(), "wall_friction_velocity_bip"); - wallNormalDistanceBip_ = meta_data.get_field( + wallNormalDistanceBip_ = meta_data.get_field( meta_data.side_rank(), "wall_normal_distance_bip"); } diff --git a/src/AssembleMomentumNonConformalSolverAlgorithm.C b/src/AssembleMomentumNonConformalSolverAlgorithm.C index 029802a11..7954fcbe9 100644 --- a/src/AssembleMomentumNonConformalSolverAlgorithm.C +++ b/src/AssembleMomentumNonConformalSolverAlgorithm.C @@ -59,12 +59,12 @@ AssembleMomentumNonConformalSolverAlgorithm:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - ncMassFlowRate_ = - meta_data.get_field(meta_data.side_rank(), "nc_mass_flow_rate"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + ncMassFlowRate_ = meta_data.get_field( + meta_data.side_rank(), "nc_mass_flow_rate"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(&(velocity_->field_of_state(stk::mesh::StateNP1))); diff --git a/src/AssembleNodalGradNonConformalAlgorithm.C b/src/AssembleNodalGradNonConformalAlgorithm.C index e26a41ab8..ba5e11173 100644 --- a/src/AssembleNodalGradNonConformalAlgorithm.C +++ b/src/AssembleNodalGradNonConformalAlgorithm.C @@ -51,10 +51,10 @@ AssembleNodalGradNonConformalAlgorithm::AssembleNodalGradNonConformalAlgorithm( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(scalarQ_); diff --git a/src/AssembleNodalGradUNonConformalAlgorithm.C b/src/AssembleNodalGradUNonConformalAlgorithm.C index 9a8bbab99..043881d9d 100644 --- a/src/AssembleNodalGradUNonConformalAlgorithm.C +++ b/src/AssembleNodalGradUNonConformalAlgorithm.C @@ -52,10 +52,10 @@ AssembleNodalGradUNonConformalAlgorithm:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(vectorQ_); diff --git a/src/AssemblePNGBoundarySolverAlgorithm.C b/src/AssemblePNGBoundarySolverAlgorithm.C index 428d66c95..fe3fbd8e7 100644 --- a/src/AssemblePNGBoundarySolverAlgorithm.C +++ b/src/AssemblePNGBoundarySolverAlgorithm.C @@ -48,10 +48,10 @@ AssemblePNGBoundarySolverAlgorithm::AssemblePNGBoundarySolverAlgorithm( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - scalarQ_ = - meta_data.get_field(stk::topology::NODE_RANK, independentDofName); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); + scalarQ_ = meta_data.get_field( + stk::topology::NODE_RANK, independentDofName); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); } //-------------------------------------------------------------------------- diff --git a/src/AssemblePNGElemSolverAlgorithm.C b/src/AssemblePNGElemSolverAlgorithm.C index 191815538..29fe245ff 100644 --- a/src/AssemblePNGElemSolverAlgorithm.C +++ b/src/AssemblePNGElemSolverAlgorithm.C @@ -49,10 +49,11 @@ AssemblePNGElemSolverAlgorithm::AssemblePNGElemSolverAlgorithm( { // save off data stk::mesh::MetaData& meta_data = realm_.meta_data(); - scalarQ_ = - meta_data.get_field(stk::topology::NODE_RANK, independentDofName); - dqdx_ = meta_data.get_field(stk::topology::NODE_RANK, dofName); - coordinates_ = meta_data.get_field( + scalarQ_ = meta_data.get_field( + stk::topology::NODE_RANK, independentDofName); + dqdx_ = + meta_data.get_field(stk::topology::NODE_RANK, dofName); + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); } diff --git a/src/AssemblePNGNonConformalSolverAlgorithm.C b/src/AssemblePNGNonConformalSolverAlgorithm.C index 8d326548e..f7a8cdbb0 100644 --- a/src/AssemblePNGNonConformalSolverAlgorithm.C +++ b/src/AssemblePNGNonConformalSolverAlgorithm.C @@ -53,13 +53,14 @@ AssemblePNGNonConformalSolverAlgorithm::AssemblePNGNonConformalSolverAlgorithm( { // save off data stk::mesh::MetaData& meta_data = realm_.meta_data(); - scalarQ_ = - meta_data.get_field(stk::topology::NODE_RANK, independentDofName); - Gjq_ = meta_data.get_field(stk::topology::NODE_RANK, dofName); - coordinates_ = meta_data.get_field( + scalarQ_ = meta_data.get_field( + stk::topology::NODE_RANK, independentDofName); + Gjq_ = + meta_data.get_field(stk::topology::NODE_RANK, dofName); + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(scalarQ_); diff --git a/src/AssembleScalarEigenEdgeSolverAlgorithm.C b/src/AssembleScalarEigenEdgeSolverAlgorithm.C index 00321b85f..318ec745d 100644 --- a/src/AssembleScalarEigenEdgeSolverAlgorithm.C +++ b/src/AssembleScalarEigenEdgeSolverAlgorithm.C @@ -73,24 +73,27 @@ AssembleScalarEigenEdgeSolverAlgorithm::AssembleScalarEigenEdgeSolverAlgorithm( // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); if (meshMotion_) - velocityRTM_ = - meta_data.get_field(stk::topology::NODE_RANK, "velocity_rtm"); + velocityRTM_ = meta_data.get_field( + stk::topology::NODE_RANK, "velocity_rtm"); else - velocityRTM_ = - meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - coordinates_ = meta_data.get_field( + velocityRTM_ = meta_data.get_field( + stk::topology::NODE_RANK, "velocity"); + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - massFlowRate_ = - meta_data.get_field(stk::topology::EDGE_RANK, "mass_flow_rate"); - edgeAreaVec_ = - meta_data.get_field(stk::topology::EDGE_RANK, "edge_area_vector"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + massFlowRate_ = meta_data.get_field( + stk::topology::EDGE_RANK, "mass_flow_rate"); + edgeAreaVec_ = meta_data.get_field( + stk::topology::EDGE_RANK, "edge_area_vector"); // EXTRA GGDH - turbKe_ = - meta_data.get_field(stk::topology::NODE_RANK, "turbulent_ke"); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - dudx_ = meta_data.get_field(stk::topology::NODE_RANK, "dudx"); + turbKe_ = meta_data.get_field( + stk::topology::NODE_RANK, "turbulent_ke"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + dudx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dudx"); // create the peclet blending function pecletFunction_ = eqSystem->create_peclet_function(scalarQ_->name()); diff --git a/src/AssembleScalarNonConformalSolverAlgorithm.C b/src/AssembleScalarNonConformalSolverAlgorithm.C index f970044ce..119b60cfa 100644 --- a/src/AssembleScalarNonConformalSolverAlgorithm.C +++ b/src/AssembleScalarNonConformalSolverAlgorithm.C @@ -59,12 +59,12 @@ AssembleScalarNonConformalSolverAlgorithm:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - ncMassFlowRate_ = - meta_data.get_field(meta_data.side_rank(), "nc_mass_flow_rate"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + ncMassFlowRate_ = meta_data.get_field( + meta_data.side_rank(), "nc_mass_flow_rate"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(&(scalarQ_->field_of_state(stk::mesh::StateNP1))); diff --git a/src/AssembleWallDistNonConformalAlgorithm.C b/src/AssembleWallDistNonConformalAlgorithm.C index 35b113009..4a324bc65 100644 --- a/src/AssembleWallDistNonConformalAlgorithm.C +++ b/src/AssembleWallDistNonConformalAlgorithm.C @@ -31,10 +31,10 @@ AssembleWallDistNonConformalAlgorithm::AssembleWallDistNonConformalAlgorithm( { auto& meta = realm.meta_data(); - coordinates_ = meta.get_field( + coordinates_ = meta.get_field( stk::topology::NODE_RANK, realm.get_coordinates_name()); exposedAreaVec_ = - meta.get_field(meta.side_rank(), "exposed_area_vector"); + meta.get_field(meta.side_rank(), "exposed_area_vector"); ghostFieldVec_.push_back(coordinates_); } diff --git a/src/AssembleWallHeatTransferAlgorithmDriver.C b/src/AssembleWallHeatTransferAlgorithmDriver.C index e711167b4..49413126b 100644 --- a/src/AssembleWallHeatTransferAlgorithmDriver.C +++ b/src/AssembleWallHeatTransferAlgorithmDriver.C @@ -47,18 +47,18 @@ AssembleWallHeatTransferAlgorithmDriver:: { // register the fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - assembledWallArea_ = meta_data.get_field( + assembledWallArea_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_wall_area_ht"); - referenceTemperature_ = meta_data.get_field( + referenceTemperature_ = meta_data.get_field( stk::topology::NODE_RANK, "reference_temperature"); - heatTransferCoefficient_ = meta_data.get_field( + heatTransferCoefficient_ = meta_data.get_field( stk::topology::NODE_RANK, "heat_transfer_coefficient"); - normalHeatFlux_ = - meta_data.get_field(stk::topology::NODE_RANK, "normal_heat_flux"); - robinCouplingParameter_ = meta_data.get_field( + normalHeatFlux_ = meta_data.get_field( + stk::topology::NODE_RANK, "normal_heat_flux"); + robinCouplingParameter_ = meta_data.get_field( stk::topology::NODE_RANK, "robin_coupling_parameter"); - temperature_ = - meta_data.get_field(stk::topology::NODE_RANK, "temperature"); + temperature_ = meta_data.get_field( + stk::topology::NODE_RANK, "temperature"); } //-------------------------------------------------------------------------- diff --git a/src/AuxFunctionAlgorithm.C b/src/AuxFunctionAlgorithm.C index bf34b2fb4..c40fd05c4 100644 --- a/src/AuxFunctionAlgorithm.C +++ b/src/AuxFunctionAlgorithm.C @@ -53,7 +53,7 @@ AuxFunctionAlgorithm::execute() const unsigned nDim = meta_data.spatial_dimension(); const double time = realm_.get_current_time(); - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); auxFunction_->setup(time); diff --git a/src/ChienKEpsilonEquationSystem.C b/src/ChienKEpsilonEquationSystem.C index 8506e79d7..4012aef95 100644 --- a/src/ChienKEpsilonEquationSystem.C +++ b/src/ChienKEpsilonEquationSystem.C @@ -121,18 +121,18 @@ ChienKEpsilonEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // re-register tke and tdr for convenience - tke_ = &(meta_data.declare_field( + tke_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_ke", numStates)); stk::mesh::put_field_on_mesh(*tke_, selector, nullptr); - tdr_ = &(meta_data.declare_field( + tdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "total_dissipation_rate", numStates)); stk::mesh::put_field_on_mesh(*tdr_, selector, nullptr); // SST parameters that everyone needs - minDistanceToWall_ = &(meta_data.declare_field( + minDistanceToWall_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")); stk::mesh::put_field_on_mesh(*minDistanceToWall_, selector, nullptr); - dplus_ = &(meta_data.declare_field( + dplus_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "dplus_wall_function")); stk::mesh::put_field_on_mesh(*dplus_, selector, nullptr); @@ -167,14 +167,14 @@ ChienKEpsilonEquationSystem::register_wall_bc( wallBcPart_.push_back(part); auto& meta = realm_.meta_data(); - auto& assembledWallArea = meta.declare_field( + auto& assembledWallArea = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_area_wf"); stk::mesh::put_field_on_mesh(assembledWallArea, *part, nullptr); - auto& assembledWallNormDist = meta.declare_field( + auto& assembledWallNormDist = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance"); stk::mesh::put_field_on_mesh(assembledWallNormDist, *part, nullptr); - auto& wallNormDistBip = - meta.declare_field(meta.side_rank(), "wall_normal_distance_bip"); + auto& wallNormDistBip = meta.declare_field( + meta.side_rank(), "wall_normal_distance_bip"); auto* meFC = MasterElementRepo::get_surface_master_element_on_host(partTopo); const int numScsBip = meFC->num_integration_points(); stk::mesh::put_field_on_mesh(wallNormDistBip, *part, numScsBip, nullptr); @@ -265,8 +265,10 @@ ChienKEpsilonEquationSystem::post_external_data_transfer_work() auto interior_sel = owned_and_shared & stk::mesh::selectField(*tdr_); clip_ke(ngpMesh, interior_sel, tkeNp1, tdrNp1); - auto tdrBCField = meta.get_field(stk::topology::NODE_RANK, "tdr_bc"); - auto tkeBCField = meta.get_field(stk::topology::NODE_RANK, "tke_bc"); + auto tdrBCField = + meta.get_field(stk::topology::NODE_RANK, "tdr_bc"); + auto tkeBCField = + meta.get_field(stk::topology::NODE_RANK, "tke_bc"); if (tdrBCField != nullptr) { ThrowRequire(tkeBCField); auto bc_sel = owned_and_shared & stk::mesh::selectField(*tdrBCField); @@ -297,8 +299,8 @@ ChienKEpsilonEquationSystem::update_and_clip() const auto& eTmp = fieldMgr.get_field(tdrEqSys_->eTmp_->mesh_meta_data_ordinal()); - auto* turbViscosity = - meta.get_field(stk::topology::NODE_RANK, "turbulent_viscosity"); + auto* turbViscosity = meta.get_field( + stk::topology::NODE_RANK, "turbulent_viscosity"); const stk::mesh::Selector sel = (meta.locally_owned_part() | meta.globally_shared_part()) & diff --git a/src/ComputeHeatTransferEdgeWallAlgorithm.C b/src/ComputeHeatTransferEdgeWallAlgorithm.C index b2e61bc17..ec1f429fc 100644 --- a/src/ComputeHeatTransferEdgeWallAlgorithm.C +++ b/src/ComputeHeatTransferEdgeWallAlgorithm.C @@ -56,27 +56,29 @@ ComputeHeatTransferEdgeWallAlgorithm::ComputeHeatTransferEdgeWallAlgorithm( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - temperature_ = - meta_data.get_field(stk::topology::NODE_RANK, "temperature"); - dhdx_ = meta_data.get_field(stk::topology::NODE_RANK, "dhdx"); - coordinates_ = meta_data.get_field( + temperature_ = meta_data.get_field( + stk::topology::NODE_RANK, "temperature"); + dhdx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dhdx"); + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - thermalCond_ = meta_data.get_field( + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + thermalCond_ = meta_data.get_field( stk::topology::NODE_RANK, "thermal_conductivity"); - specificHeat_ = - meta_data.get_field(stk::topology::NODE_RANK, "specific_heat"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - assembledWallArea_ = meta_data.get_field( + specificHeat_ = meta_data.get_field( + stk::topology::NODE_RANK, "specific_heat"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + assembledWallArea_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_wall_area_ht"); - referenceTemperature_ = meta_data.get_field( + referenceTemperature_ = meta_data.get_field( stk::topology::NODE_RANK, "reference_temperature"); - heatTransferCoefficient_ = meta_data.get_field( + heatTransferCoefficient_ = meta_data.get_field( stk::topology::NODE_RANK, "heat_transfer_coefficient"); - normalHeatFlux_ = - meta_data.get_field(stk::topology::NODE_RANK, "normal_heat_flux"); - robinCouplingParameter_ = meta_data.get_field( + normalHeatFlux_ = meta_data.get_field( + stk::topology::NODE_RANK, "normal_heat_flux"); + robinCouplingParameter_ = meta_data.get_field( stk::topology::NODE_RANK, "robin_coupling_parameter"); } diff --git a/src/ComputeMdotNonConformalAlgorithm.C b/src/ComputeMdotNonConformalAlgorithm.C index c09ceedfa..b5d8396f0 100644 --- a/src/ComputeMdotNonConformalAlgorithm.C +++ b/src/ComputeMdotNonConformalAlgorithm.C @@ -58,24 +58,26 @@ ComputeMdotNonConformalAlgorithm::ComputeMdotNonConformalAlgorithm( // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); if (meshMotion_) { meshMotionFac_ = 1.0; - meshVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "mesh_velocity"); + meshVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "mesh_velocity"); } else { meshMotionFac_ = 0.0; - meshVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + meshVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "velocity"); } - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - ncMassFlowRate_ = - meta_data.get_field(meta_data.side_rank(), "nc_mass_flow_rate"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + ncMassFlowRate_ = meta_data.get_field( + meta_data.side_rank(), "nc_mass_flow_rate"); // what do we need ghosted for this alg to work? ghostFieldVec_.push_back(pressure_); @@ -167,8 +169,8 @@ ComputeMdotNonConformalAlgorithm::execute() // deal with state ScalarFieldType& pressureNp1 = pressure_->field_of_state(stk::mesh::StateNP1); - ScalarFieldType* Udiag = - meta_data.get_field(stk::topology::NODE_RANK, "momentum_diag"); + ScalarFieldType* Udiag = meta_data.get_field( + stk::topology::NODE_RANK, "momentum_diag"); // parallel communicate ghosted entities if (NULL != realm_.nonConformalManager_->nonConformalGhosting_) diff --git a/src/ComputeSSTMaxLengthScaleElemAlgorithm.C b/src/ComputeSSTMaxLengthScaleElemAlgorithm.C index 5534d0fbe..e1710e8b7 100644 --- a/src/ComputeSSTMaxLengthScaleElemAlgorithm.C +++ b/src/ComputeSSTMaxLengthScaleElemAlgorithm.C @@ -45,9 +45,9 @@ ComputeSSTMaxLengthScaleElemAlgorithm::ComputeSSTMaxLengthScaleElemAlgorithm( { // save off data stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - maxLengthScale_ = meta_data.get_field( + maxLengthScale_ = meta_data.get_field( stk::topology::NODE_RANK, "sst_max_length_scale"); } diff --git a/src/ComputeWallFrictionVelocityAlgorithm.C b/src/ComputeWallFrictionVelocityAlgorithm.C index f089acf6d..078daa325 100644 --- a/src/ComputeWallFrictionVelocityAlgorithm.C +++ b/src/ComputeWallFrictionVelocityAlgorithm.C @@ -66,28 +66,30 @@ ComputeWallFrictionVelocityAlgorithm::ComputeWallFrictionVelocityAlgorithm( // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); if (RANSAblBcApproach_) { - bcVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "velocity_bc"); + bcVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "velocity_bc"); } else { - bcVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "wall_velocity_bc"); + bcVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "wall_velocity_bc"); } - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); viscosity_ = - meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - wallFrictionVelocityBip_ = meta_data.get_field( + meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + wallFrictionVelocityBip_ = meta_data.get_field( meta_data.side_rank(), "wall_friction_velocity_bip"); - wallNormalDistanceBip_ = meta_data.get_field( + wallNormalDistanceBip_ = meta_data.get_field( meta_data.side_rank(), "wall_normal_distance_bip"); - assembledWallArea_ = meta_data.get_field( + assembledWallArea_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_wall_area_wf"); - assembledWallNormalDistance_ = meta_data.get_field( + assembledWallNormalDistance_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance"); } diff --git a/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C b/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C index dceaf5df3..ceb8589c0 100644 --- a/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C +++ b/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C @@ -42,11 +42,12 @@ ContinuityLowSpeedCompressibleNodeSuppAlg:: // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); ScalarFieldType* density = - meta_data.get_field(stk::topology::NODE_RANK, "density"); + meta_data.get_field(stk::topology::NODE_RANK, "density"); densityNp1_ = &(density->field_of_state(stk::mesh::StateNP1)); - pressure_ = meta_data.get_field(stk::topology::NODE_RANK, "pressure"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + pressure_ = + meta_data.get_field(stk::topology::NODE_RANK, "pressure"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/DataProbePostProcessing.C b/src/DataProbePostProcessing.C index 747ef74eb..f46a93e4d 100644 --- a/src/DataProbePostProcessing.C +++ b/src/DataProbePostProcessing.C @@ -576,11 +576,10 @@ DataProbePostProcessing::setup() // extract the part stk::mesh::Part* probePart = probeInfo->part_[p]; // everyone needs coordinates to be registered - VectorFieldType* coordinates = &(metaData.declare_field( - stk::topology::NODE_RANK, "coordinates")); + VectorFieldType* coordinates = + &(metaData.declare_field( + stk::topology::NODE_RANK, "coordinates")); stk::mesh::put_field_on_mesh(*coordinates, *probePart, nDim, nullptr); - stk::io::set_field_output_type( - *coordinates, stk::io::FieldOutputType::VECTOR_3D); // now the general set of fields for this probe for (size_t j = 0; j < probeSpec->fieldInfo_.size(); ++j) { @@ -690,8 +689,8 @@ DataProbePostProcessing::initialize() // populate values for coord; probe stays the same place // FIXME: worry about mesh motion (if the probe moves around?) - VectorFieldType* coordinates = - metaData.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coordinates = metaData.get_field( + stk::topology::NODE_RANK, "coordinates"); const int nDim = metaData.spatial_dimension(); for (size_t idps = 0; idps < dataProbeSpecInfo_.size(); ++idps) { @@ -828,8 +827,9 @@ DataProbePostProcessing::register_field( stk::mesh::MetaData& metaData, stk::mesh::Part* part) { - stk::mesh::FieldBase* toField = - &(metaData.declare_field(stk::topology::NODE_RANK, fieldName)); + stk::mesh::FieldBase* toField = &( + metaData.declare_field>( + stk::topology::NODE_RANK, fieldName)); stk::mesh::put_field_on_mesh(*toField, *part, fieldSize, nullptr); } @@ -979,8 +979,8 @@ DataProbePostProcessing::provide_output_txt(const double currentTime) << "DataProbePostProcessing::Writing dataprobes..." << std::endl; stk::mesh::MetaData& metaData = realm_.meta_data(); - VectorFieldType* coordinates = - metaData.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coordinates = metaData.get_field( + stk::topology::NODE_RANK, "coordinates"); const int nDim = metaData.spatial_dimension(); @@ -1060,7 +1060,8 @@ DataProbePostProcessing::provide_output_txt(const double currentTime) // output in a single row for (size_t inv = 0; inv < nodeVec.size(); ++inv) { stk::mesh::Entity node = nodeVec[inv]; - double* theCoord = stk::mesh::field_data(*coordinates, node); + double* theCoord = + (double*)stk::mesh::field_data(*coordinates, node); // always output time and coordinates myfile << std::left << std::setw(w_) @@ -1267,7 +1268,8 @@ DataProbePostProcessing::provide_output_txt(const double currentTime) stk::mesh::Entity node = nodeVec[inv]; // only output coordinates if required if (printcoords) { - double* theCoord = stk::mesh::field_data(*coordinates, node); + double* theCoord = + (double*)stk::mesh::field_data(*coordinates, node); // Output plane indices const int planei = inv / pointsPerPlane; const int localn = inv - planei * pointsPerPlane; diff --git a/src/EnthalpyEquationSystem.C b/src/EnthalpyEquationSystem.C index 01cbffbb9..359b243d6 100644 --- a/src/EnthalpyEquationSystem.C +++ b/src/EnthalpyEquationSystem.C @@ -98,6 +98,7 @@ #include #include #include +#include #include // stk_io @@ -144,7 +145,7 @@ EnthalpyEquationSystem::EnthalpyEquationSystem( specHeat_(NULL), divQ_(NULL), pOld_(NULL), - nodalGradAlgDriver_(realm_, "enthalpy", "dhdx"), + nodalGradAlgDriver_(realm_, "dhdx"), assembleWallHeatTransferAlgDriver_(NULL), pmrCouplingActive_(false), lowSpeedCompressActive_(false), @@ -257,28 +258,28 @@ EnthalpyEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // register dof; set it as a restart variable - enthalpy_ = &(meta_data.declare_field( + enthalpy_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "enthalpy", numStates)); stk::mesh::put_field_on_mesh(*enthalpy_, selector, nullptr); realm_.augment_restart_variable_list("enthalpy"); // temperature required in restart - temperature_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "temperature")); + temperature_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "temperature")); stk::mesh::put_field_on_mesh(*temperature_, selector, nullptr); realm_.augment_restart_variable_list("temperature"); - dhdx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dhdx")); + dhdx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dhdx")); stk::mesh::put_field_on_mesh(*dhdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dhdx_, stk::io::FieldOutputType::VECTOR_3D); // props - specHeat_ = &( - meta_data.declare_field(stk::topology::NODE_RANK, "specific_heat")); + specHeat_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "specific_heat")); stk::mesh::put_field_on_mesh(*specHeat_, selector, nullptr); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); // push standard props to property list; enthalpy managed along with Cp @@ -286,7 +287,7 @@ EnthalpyEquationSystem::register_nodal_fields( realm_.augment_property_map(VISCOSITY_ID, visc_); // special thermal conductivity - thermalCond_ = &(meta_data.declare_field( + thermalCond_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "thermal_conductivity")); stk::mesh::put_field_on_mesh(*thermalCond_, selector, nullptr); @@ -309,24 +310,25 @@ EnthalpyEquationSystem::register_nodal_fields( } // delta solution for linear solver; share delta since this is a split system - hTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); + hTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); stk::mesh::put_field_on_mesh(*hTmp_, selector, nullptr); // turbulent viscosity and effective viscosity if (realm_.is_turbulent()) { - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); } - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_h")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); // register divergence of radiative heat flux; for now this is an explicit // coupling if (pmrCouplingActive_) { - divQ_ = &(meta_data.declare_field( + divQ_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "div_radiative_heat_flux")); stk::mesh::put_field_on_mesh(*divQ_, selector, nullptr); } @@ -334,7 +336,7 @@ EnthalpyEquationSystem::register_nodal_fields( // need to save off old pressure for pressure time derivative (avoid state for // now) if (lowSpeedCompressActive_) { - pOld_ = &(meta_data.declare_field( + pOld_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "pressure_old")); stk::mesh::put_field_on_mesh(*pOld_, selector, nullptr); } @@ -550,11 +552,11 @@ EnthalpyEquationSystem::register_inflow_bc( InflowUserData userData = inflowBCData.userData_; // bc data work (copy, enthalpy evaluation, etc.) - ScalarFieldType* temperatureBc = &(meta_data.declare_field( + ScalarFieldType* temperatureBc = &(meta_data.declare_field( stk::topology::NODE_RANK, "temperature_bc")); stk::mesh::put_field_on_mesh(*temperatureBc, *part, nullptr); - ScalarFieldType* enthalpyBc = - &(meta_data.declare_field(stk::topology::NODE_RANK, "enthalpy_bc")); + ScalarFieldType* enthalpyBc = &(meta_data.declare_field( + stk::topology::NODE_RANK, "enthalpy_bc")); stk::mesh::put_field_on_mesh(*enthalpyBc, *part, nullptr); temperature_bc_setup(userData, part, temperatureBc, enthalpyBc); @@ -605,10 +607,10 @@ EnthalpyEquationSystem::register_open_bc( // bc data work (copy, enthalpy evaluation, etc.) const bool copyBcVal = false; const bool isInterface = false; - ScalarFieldType* temperatureBc = &(meta_data.declare_field( + ScalarFieldType* temperatureBc = &(meta_data.declare_field( stk::topology::NODE_RANK, "open_temperature_bc")); stk::mesh::put_field_on_mesh(*temperatureBc, *part, nullptr); - ScalarFieldType* enthalpyBc = &(meta_data.declare_field( + ScalarFieldType* enthalpyBc = &(meta_data.declare_field( stk::topology::NODE_RANK, "open_enthalpy_bc")); stk::mesh::put_field_on_mesh(*enthalpyBc, *part, nullptr); temperature_bc_setup( @@ -684,11 +686,11 @@ EnthalpyEquationSystem::register_wall_bc( if (bc_data_specified(userData, temperatureName)) { // bc data work (copy, enthalpy evaluation, etc.) - ScalarFieldType* temperatureBc = &(meta_data.declare_field( + ScalarFieldType* temperatureBc = &(meta_data.declare_field( stk::topology::NODE_RANK, "temperature_bc")); stk::mesh::put_field_on_mesh(*temperatureBc, *part, nullptr); - ScalarFieldType* enthalpyBc = &( - meta_data.declare_field(stk::topology::NODE_RANK, "enthalpy_bc")); + ScalarFieldType* enthalpyBc = &(meta_data.declare_field( + stk::topology::NODE_RANK, "enthalpy_bc")); stk::mesh::put_field_on_mesh(*enthalpyBc, *part, nullptr); temperature_bc_setup( userData, part, temperatureBc, enthalpyBc, isInterface); @@ -707,20 +709,25 @@ EnthalpyEquationSystem::register_wall_bc( // interface bc fields // register the fields - ScalarFieldType* assembledWallArea = &(meta_data.declare_field( - stk::topology::NODE_RANK, "assembled_wall_area_ht")); + ScalarFieldType* assembledWallArea = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "assembled_wall_area_ht")); stk::mesh::put_field_on_mesh(*assembledWallArea, *part, nullptr); - ScalarFieldType* referenceTemperature = &(meta_data.declare_field( - stk::topology::NODE_RANK, "reference_temperature")); + ScalarFieldType* referenceTemperature = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "reference_temperature")); stk::mesh::put_field_on_mesh(*referenceTemperature, *part, nullptr); - ScalarFieldType* heatTransferCoeff = &(meta_data.declare_field( - stk::topology::NODE_RANK, "heat_transfer_coefficient")); + ScalarFieldType* heatTransferCoeff = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "heat_transfer_coefficient")); stk::mesh::put_field_on_mesh(*heatTransferCoeff, *part, nullptr); - ScalarFieldType* normalHeatFlux = &(meta_data.declare_field( - stk::topology::NODE_RANK, "normal_heat_flux")); + ScalarFieldType* normalHeatFlux = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "normal_heat_flux")); stk::mesh::put_field_on_mesh(*normalHeatFlux, *part, nullptr); - ScalarFieldType* robinCouplingParameter = &(meta_data.declare_field( - stk::topology::NODE_RANK, "robin_coupling_parameter")); + ScalarFieldType* robinCouplingParameter = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "robin_coupling_parameter")); stk::mesh::put_field_on_mesh(*robinCouplingParameter, *part, nullptr); // create the driver @@ -752,7 +759,7 @@ EnthalpyEquationSystem::register_wall_bc( // because it has its own): else if (userData.heatFluxSpec_ && !ablWallFunctionApproach) { - ScalarFieldType* theBcField = &(meta_data.declare_field( + ScalarFieldType* theBcField = &(meta_data.declare_field( stk::topology::NODE_RANK, "heat_flux_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); @@ -795,7 +802,7 @@ EnthalpyEquationSystem::register_wall_bc( else if (ablWallFunctionApproach) { GenericFieldType* theBcField = - meta_data.get_field(sideRank, "wall_heat_flux_bip"); + meta_data.get_field(sideRank, "wall_heat_flux_bip"); { auto& solverAlgMap = solverAlgDriver_->solverAlgorithmMap_; @@ -880,7 +887,7 @@ EnthalpyEquationSystem::register_abltop_bc( // If specifying the normal temperature gradient. if (userData.normalTemperatureGradientSpec_) { - ScalarFieldType* theBcField = &(meta_data.declare_field( + ScalarFieldType* theBcField = &(meta_data.declare_field( stk::topology::NODE_RANK, "temperature_gradient_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); @@ -1083,7 +1090,7 @@ EnthalpyEquationSystem::solve_and_update() { // Enthalpy BC field might not exist depending on boundary conditions - auto* enthalpyBC = realm_.meta_data().get_field( + auto* enthalpyBC = realm_.meta_data().get_field( stk::topology::NODE_RANK, "enthalpy_bc"); if (enthalpyBC != nullptr) { enthalpyBC->modify_on_host(); @@ -1153,7 +1160,7 @@ EnthalpyEquationSystem::post_iter_work_dep() { // enthalpy BC field might not exist depending on boundary conditions - auto* enthalpyBC = realm_.meta_data().get_field( + auto* enthalpyBC = realm_.meta_data().get_field( stk::topology::NODE_RANK, "enthalpy_bc"); if (enthalpyBC != nullptr) { enthalpyBC->modify_on_host(); @@ -1344,8 +1351,8 @@ EnthalpyEquationSystem::post_converged_work() if (lowSpeedCompressActive_) { stk::mesh::MetaData& meta_data = realm_.meta_data(); // copy pressure to pOld - ScalarFieldType* pressure = - meta_data.get_field(stk::topology::NODE_RANK, "pressure"); + ScalarFieldType* pressure = meta_data.get_field( + stk::topology::NODE_RANK, "pressure"); field_copy( meta_data, realm_.bulk_data(), *pressure, *pOld_, realm_.get_activate_aura()); diff --git a/src/EnthalpyLowSpeedCompressibleNodeSuppAlg.C b/src/EnthalpyLowSpeedCompressibleNodeSuppAlg.C index f94c728fc..c1288912e 100644 --- a/src/EnthalpyLowSpeedCompressibleNodeSuppAlg.C +++ b/src/EnthalpyLowSpeedCompressibleNodeSuppAlg.C @@ -40,12 +40,12 @@ EnthalpyLowSpeedCompressibleNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - pressureN_ = - meta_data.get_field(stk::topology::NODE_RANK, "pressure_old"); + pressureN_ = meta_data.get_field( + stk::topology::NODE_RANK, "pressure_old"); pressureNp1_ = - meta_data.get_field(stk::topology::NODE_RANK, "pressure"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + meta_data.get_field(stk::topology::NODE_RANK, "pressure"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/EnthalpyPmrSrcNodeSuppAlg.C b/src/EnthalpyPmrSrcNodeSuppAlg.C index 758cf1951..8f03b304e 100644 --- a/src/EnthalpyPmrSrcNodeSuppAlg.C +++ b/src/EnthalpyPmrSrcNodeSuppAlg.C @@ -34,10 +34,10 @@ EnthalpyPmrSrcNodeSuppAlg::EnthalpyPmrSrcNodeSuppAlg(Realm& realm) { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - divRadFlux_ = meta_data.get_field( + divRadFlux_ = meta_data.get_field( stk::topology::NODE_RANK, "div_radiative_heat_flux"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/EnthalpyPressureWorkNodeSuppAlg.C b/src/EnthalpyPressureWorkNodeSuppAlg.C index f656de0e4..1ee920806 100644 --- a/src/EnthalpyPressureWorkNodeSuppAlg.C +++ b/src/EnthalpyPressureWorkNodeSuppAlg.C @@ -39,10 +39,12 @@ EnthalpyPressureWorkNodeSuppAlg::EnthalpyPressureWorkNodeSuppAlg(Realm& realm) { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - dpdx_ = meta_data.get_field(stk::topology::NODE_RANK, "dpdx"); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dpdx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dpdx"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/EnthalpyViscousWorkNodeSuppAlg.C b/src/EnthalpyViscousWorkNodeSuppAlg.C index 720b284f9..c0ed8871c 100644 --- a/src/EnthalpyViscousWorkNodeSuppAlg.C +++ b/src/EnthalpyViscousWorkNodeSuppAlg.C @@ -40,12 +40,14 @@ EnthalpyViscousWorkNodeSuppAlg::EnthalpyViscousWorkNodeSuppAlg(Realm& realm) { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - dudx_ = meta_data.get_field(stk::topology::NODE_RANK, "dudx"); + dudx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dudx"); const std::string viscName = realm.is_turbulent() ? "effective_viscosity_u" : "viscosity"; - viscosity_ = meta_data.get_field(stk::topology::NODE_RANK, viscName); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + viscosity_ = + meta_data.get_field(stk::topology::NODE_RANK, viscName); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/EquationSystems.C b/src/EquationSystems.C index 9deac309c..dddf47078 100644 --- a/src/EquationSystems.C +++ b/src/EquationSystems.C @@ -315,7 +315,7 @@ EquationSystems::register_element_fields( const std::vector& targetNames) { stk::mesh::MetaData& meta_data = realm_.meta_data(); - ScalarFieldType& elemVolume = meta_data.declare_field( + ScalarFieldType& elemVolume = meta_data.declare_field( stk::topology::ELEMENT_RANK, "element_volume"); const stk::mesh::PartVector part_vec = @@ -329,7 +329,7 @@ EquationSystems::register_element_fields( (*ii)->register_element_fields(part, the_topo); } stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); - stk::mesh::put_field_on_mesh(elemVolume, selector, nullptr); + stk::mesh::put_field_on_mesh(elemVolume, selector, 1, nullptr); } //-------------------------------------------------------------------------- diff --git a/src/FieldManager.C b/src/FieldManager.C index 7bb993620..1e30e7263 100644 --- a/src/FieldManager.C +++ b/src/FieldManager.C @@ -8,7 +8,6 @@ // #include "FieldManager.h" #include "stk_mesh/base/MetaData.hpp" -#include "stk_io/IossBridge.hpp" namespace sierra { namespace nalu { @@ -25,7 +24,7 @@ FieldManager::field_exists(const std::string& name) return std::visit( [&](auto def) -> bool { - return meta_.get_field( + return meta_.get_field( def.rank, name) != nullptr; }, definition); @@ -43,24 +42,16 @@ FieldManager::register_field( return std::visit( [&](auto def) -> FieldPointerTypes { - using val_type = typename decltype(def)::DataType; + using field_type = typename decltype(def)::FieldType; + using val_type = typename stk::mesh::FieldTraits::data_type; const int num_states = numStates ? numStates : def.num_states; const int num_components = numComponents ? numComponents : def.num_components; - const FieldLayout layout = def.layout; const val_type* init = static_cast(init_val); - auto* id = &(meta_.declare_field(def.rank, name, num_states)); + auto* id = &(meta_.declare_field(def.rank, name, num_states)); for (auto&& part : parts) { stk::mesh::put_field_on_mesh(*id, *part, num_components, init); - - if (layout == FieldLayout::VECTOR) { - stk::io::set_field_output_type( - *id, stk::io::FieldOutputType::VECTOR_3D); - } else if (layout == FieldLayout::TENSOR) { - stk::io::set_field_output_type( - *id, stk::io::FieldOutputType::FULL_TENSOR_36); - } } #if 0 std::cout << "Registring field '" << name << "' on parts:"; diff --git a/src/FieldRegistry.C b/src/FieldRegistry.C index 6459181a4..c6db47e8a 100644 --- a/src/FieldRegistry.C +++ b/src/FieldRegistry.C @@ -21,25 +21,25 @@ const std::map& Registry() { // clang-format off - FieldDefGeneric SingleStateElemGeneric = FieldDefGeneric{stk::topology::ELEM_RANK}; - FieldDefGeneric SingleStateEdgeGeneric = FieldDefGeneric{stk::topology::EDGE_RANK}; - FieldDefGeneric SingleStateNodeGeneric = FieldDefGeneric{stk::topology::NODE_RANK}; + FieldDefGeneric SingleStateElemGeneric = {stk::topology::ELEM_RANK}; + FieldDefGeneric SingleStateEdgeGeneric = {stk::topology::EDGE_RANK}; + FieldDefGeneric SingleStateNodeGeneric = {stk::topology::NODE_RANK}; - FieldDefScalar SingleStateNodalScalar = FieldDefScalar{stk::topology::NODE_RANK}; - FieldDefScalar SingleStateElemScalar = FieldDefScalar{stk::topology::ELEM_RANK}; - FieldDefVector SingleStateElemVector = FieldDefVector{stk::topology::ELEM_RANK, 1, NUM_DIM}; - FieldDefScalar MultiStateNodalScalar = FieldDefScalar{stk::topology::NODE_RANK, NUM_STATES}; + FieldDefScalar SingleStateNodalScalar = {stk::topology::NODE_RANK}; + FieldDefScalar SingleStateElemScalar = {stk::topology::ELEM_RANK}; + FieldDefVector SingleStateElemVector = {stk::topology::ELEM_RANK, 1, NUM_DIM}; + FieldDefScalar MultiStateNodalScalar = {stk::topology::NODE_RANK, NUM_STATES}; - FieldDefVector SingleStateNodalVector = FieldDefVector{stk::topology::NODE_RANK, 1, NUM_DIM}; - FieldDefVector SingleStateEdgeVector = FieldDefVector{stk::topology::EDGE_RANK, 1, NUM_DIM}; - FieldDefVector MultiStateNodalVector = FieldDefVector{stk::topology::NODE_RANK, NUM_STATES, NUM_DIM}; + FieldDefVector SingleStateNodalVector = {stk::topology::NODE_RANK, 1, NUM_DIM}; + FieldDefVector SingleStateEdgeVector = {stk::topology::EDGE_RANK, 1, NUM_DIM}; + FieldDefVector MultiStateNodalVector = {stk::topology::NODE_RANK, NUM_STATES, NUM_DIM}; - FieldDefTensor SingleStateNodalTensor = FieldDefTensor{stk::topology::NODE_RANK, 1, NUM_DIM*NUM_DIM}; + FieldDefTensor SingleStateNodalTensor = {stk::topology::NODE_RANK, 1, NUM_DIM*NUM_DIM}; - FieldDefTpetraId TpetraId = FieldDefTpetraId{stk::topology::NODE_RANK}; - FieldDefGlobalId GlobalId = FieldDefGlobalId{stk::topology::NODE_RANK}; - FieldDefHypreId HypreId = FieldDefHypreId{stk::topology::NODE_RANK}; - FieldDefScalarInt NodalScalarInt = FieldDefScalarInt{stk::topology::NODE_RANK}; + FieldDefTpetraId TpetraId = {stk::topology::NODE_RANK}; + FieldDefGlobalId GlobalId = {stk::topology::NODE_RANK}; + FieldDefHypreId HypreId = {stk::topology::NODE_RANK}; + FieldDefScalarInt NodalScalarInt = {stk::topology::NODE_RANK}; static const std::map registry = { {"average_dudx" , SingleStateNodalTensor}, diff --git a/src/FixPressureAtNodeAlgorithm.C b/src/FixPressureAtNodeAlgorithm.C index 2cb5ca2ab..4a9ef8c8b 100644 --- a/src/FixPressureAtNodeAlgorithm.C +++ b/src/FixPressureAtNodeAlgorithm.C @@ -36,9 +36,10 @@ FixPressureAtNodeAlgorithm::FixPressureAtNodeAlgorithm( { auto& meta = realm_.meta_data(); - coordinates_ = meta.get_field( + coordinates_ = meta.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - pressure_ = meta.get_field(stk::topology::NODE_RANK, "pressure"); + pressure_ = + meta.get_field(stk::topology::NODE_RANK, "pressure"); } FixPressureAtNodeAlgorithm::~FixPressureAtNodeAlgorithm() {} diff --git a/src/GammaEquationSystem.C b/src/GammaEquationSystem.C index b6a198a37..38bebb68a 100644 --- a/src/GammaEquationSystem.C +++ b/src/GammaEquationSystem.C @@ -69,6 +69,7 @@ #include #include #include +#include #include // stk_io @@ -101,7 +102,7 @@ GammaEquationSystem::GammaEquationSystem(EquationSystems& eqSystems) visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "gamma_transition", "dgamdx") + nodalGradAlgDriver_(realm_, "dgamdx") { dofName_ = "gamma_transition"; @@ -147,30 +148,29 @@ GammaEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // register dof; set it as a restart variable - gamma_ = &(meta_data.declare_field( + gamma_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "gamma_transition", numStates)); stk::mesh::put_field_on_mesh(*gamma_, selector, nullptr); realm_.augment_restart_variable_list("gamma_transition"); - dgamdx_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "dgamdx")); + dgamdx_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "dgamdx")); stk::mesh::put_field_on_mesh(*dgamdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dgamdx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta since this is a split system - gamTmp_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "gamTmp")); + gamTmp_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "gamTmp")); stk::mesh::put_field_on_mesh(*gamTmp_, selector, nullptr); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_gamma")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); @@ -304,8 +304,8 @@ GammaEquationSystem::register_inflow_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; gamma_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "gamma_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "gamma_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction diff --git a/src/InputOutputRealm.C b/src/InputOutputRealm.C index 9b42c3092..723a09f27 100644 --- a/src/InputOutputRealm.C +++ b/src/InputOutputRealm.C @@ -107,15 +107,17 @@ InputOutputRealm::register_io_fields() if (fieldName.find(velocityName) != std::string::npos) { // FIXME: // require // FieldType? - VectorFieldType* velocity = &(meta_data().declare_field( - stk::topology::NODE_RANK, fieldName)); + VectorFieldType* velocity = + &(meta_data().declare_field( + stk::topology::NODE_RANK, fieldName)); stk::mesh::put_field_on_mesh( *velocity, *targetPart, fieldSize, nullptr); - stk::io::set_field_output_type( - *velocity, stk::io::FieldOutputType::VECTOR_3D); } else { - stk::mesh::FieldBase* theField = &(meta_data().declare_field( - stk::topology::NODE_RANK, fieldName)); + stk::mesh::FieldBase* theField = + &(meta_data() + .declare_field< + stk::mesh::Field>( + stk::topology::NODE_RANK, fieldName)); stk::mesh::put_field_on_mesh( *theField, *targetPart, fieldSize, nullptr); } diff --git a/src/LowMachEquationSystem.C b/src/LowMachEquationSystem.C index fcfec16fd..75e5ca98e 100644 --- a/src/LowMachEquationSystem.C +++ b/src/LowMachEquationSystem.C @@ -188,11 +188,11 @@ #include #include #include +#include #include #include #include #include "stk_mesh/base/NgpMesh.hpp" -#include "stk_io/IossBridge.hpp" // stk_topo #include @@ -302,13 +302,13 @@ LowMachEquationSystem::register_nodal_fields( // add properties; denisty needs to be a restart field const int numStates = realm_.number_of_states(); - density_ = &(meta_data.declare_field( + density_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "density", numStates)); stk::mesh::put_field_on_mesh(*density_, selector, nullptr); realm_.augment_restart_variable_list("density"); - viscosity_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + viscosity_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*viscosity_, selector, nullptr); // push to property list @@ -318,7 +318,7 @@ LowMachEquationSystem::register_nodal_fields( // dual nodal volume (should push up...) const int numVolStates = realm_.does_mesh_move() ? realm_.number_of_states() : 1; - dualNodalVolume_ = &(meta_data.declare_field( + dualNodalVolume_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", numVolStates)); stk::mesh::put_field_on_mesh(*dualNodalVolume_, selector, nullptr); if (numVolStates > 1) @@ -367,26 +367,28 @@ LowMachEquationSystem::register_element_fields( sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( theTopo); const int numScsIp = meSCS->num_integration_points(); - GenericFieldType* massFlowRate = &(meta_data.declare_field( - stk::topology::ELEMENT_RANK, "mass_flow_rate_scs")); + GenericFieldType* massFlowRate = + &(meta_data.declare_field( + stk::topology::ELEMENT_RANK, "mass_flow_rate_scs")); stk::mesh::put_field_on_mesh(*massFlowRate, selector, numScsIp, nullptr); } // register the intersected elemental field if (realm_.query_for_overset()) { const int sizeOfElemField = 1; - GenericFieldType* intersectedElement = &(meta_data.declare_field( - stk::topology::ELEMENT_RANK, "intersected_element")); + GenericFieldType* intersectedElement = + &(meta_data.declare_field( + stk::topology::ELEMENT_RANK, "intersected_element")); stk::mesh::put_field_on_mesh( *intersectedElement, selector, sizeOfElemField, nullptr); } // provide mean element Peclet and Courant fields; always... - GenericFieldType* elemReynolds = &(meta_data.declare_field( + GenericFieldType* elemReynolds = &(meta_data.declare_field( stk::topology::ELEMENT_RANK, "element_reynolds")); - stk::mesh::put_field_on_mesh(*elemReynolds, selector, nullptr); - GenericFieldType* elemCourant = &(meta_data.declare_field( + stk::mesh::put_field_on_mesh(*elemReynolds, selector, 1, nullptr); + GenericFieldType* elemCourant = &(meta_data.declare_field( stk::topology::ELEMENT_RANK, "element_courant")); - stk::mesh::put_field_on_mesh(*elemCourant, selector, nullptr); + stk::mesh::put_field_on_mesh(*elemCourant, selector, 1, nullptr); } //-------------------------------------------------------------------------- @@ -400,11 +402,9 @@ LowMachEquationSystem::register_edge_fields( if (realm_.realmUsesEdges_) { stk::mesh::MetaData& meta_data = realm_.meta_data(); const int nDim = meta_data.spatial_dimension(); - edgeAreaVec_ = &(meta_data.declare_field( + edgeAreaVec_ = &(meta_data.declare_field( stk::topology::EDGE_RANK, "edge_area_vector")); stk::mesh::put_field_on_mesh(*edgeAreaVec_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *edgeAreaVec_, stk::io::FieldOutputType::VECTOR_3D); } } @@ -423,11 +423,9 @@ LowMachEquationSystem::register_open_bc( const int nDim = metaData.spatial_dimension(); - VectorFieldType* velocityBC = &(metaData.declare_field( + VectorFieldType* velocityBC = &(metaData.declare_field( stk::topology::NODE_RANK, "open_velocity_bc")); stk::mesh::put_field_on_mesh(*velocityBC, *part, nDim, nullptr); - stk::io::set_field_output_type( - *velocityBC, stk::io::FieldOutputType::VECTOR_3D); // extract the value for user specified velocity and save off the AuxFunction OpenUserData userData = openBCData.userData_; @@ -449,8 +447,8 @@ LowMachEquationSystem::register_open_bc( // extract the value for user specified pressure and save off the AuxFunction if (!realm_.solutionOptions_->activateOpenMdotCorrection_) { - ScalarFieldType* pressureBC = &( - metaData.declare_field(stk::topology::NODE_RANK, "pressure_bc")); + ScalarFieldType* pressureBC = &(metaData.declare_field( + stk::topology::NODE_RANK, "pressure_bc")); stk::mesh::put_field_on_mesh(*pressureBC, *part, nullptr); Pressure pSpec = userData.p_; @@ -478,12 +476,12 @@ LowMachEquationSystem::register_open_bc( sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( theTopo); const int numScsBip = meFC->num_integration_points(); - GenericFieldType* mdotBip = &(metaData.declare_field( + GenericFieldType* mdotBip = &(metaData.declare_field( static_cast(metaData.side_rank()), "open_mass_flow_rate")); stk::mesh::put_field_on_mesh(*mdotBip, *part, numScsBip, nullptr); - auto& dynPress = metaData.declare_field( + auto& dynPress = metaData.declare_field( static_cast(metaData.side_rank()), "dynamic_pressure"); std::vector ic(numScsBip, 0); @@ -501,33 +499,27 @@ LowMachEquationSystem::register_surface_pp_algorithm( // register nodal fields in common stk::mesh::MetaData& meta_data = realm_.meta_data(); - VectorFieldType* pressureForce = &(meta_data.declare_field( + VectorFieldType* pressureForce = &(meta_data.declare_field( stk::topology::NODE_RANK, "pressure_force")); stk::mesh::put_field_on_mesh( *pressureForce, stk::mesh::selectUnion(partVector), meta_data.spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *pressureForce, stk::io::FieldOutputType::VECTOR_3D); - VectorFieldType* viscousForce = &( - meta_data.declare_field(stk::topology::NODE_RANK, "viscous_force")); + VectorFieldType* viscousForce = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscous_force")); stk::mesh::put_field_on_mesh( *viscousForce, stk::mesh::selectUnion(partVector), meta_data.spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *viscousForce, stk::io::FieldOutputType::VECTOR_3D); - VectorFieldType* tauWallVector = &(meta_data.declare_field( + VectorFieldType* tauWallVector = &(meta_data.declare_field( stk::topology::NODE_RANK, "tau_wall_vector")); stk::mesh::put_field_on_mesh( *tauWallVector, stk::mesh::selectUnion(partVector), meta_data.spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *tauWallVector, stk::io::FieldOutputType::VECTOR_3D); - ScalarFieldType* tauWall = - &(meta_data.declare_field(stk::topology::NODE_RANK, "tau_wall")); + ScalarFieldType* tauWall = &(meta_data.declare_field( + stk::topology::NODE_RANK, "tau_wall")); stk::mesh::put_field_on_mesh( *tauWall, stk::mesh::selectUnion(partVector), nullptr); - ScalarFieldType* yplus = - &(meta_data.declare_field(stk::topology::NODE_RANK, "yplus")); + ScalarFieldType* yplus = &(meta_data.declare_field( + stk::topology::NODE_RANK, "yplus")); stk::mesh::put_field_on_mesh( *yplus, stk::mesh::selectUnion(partVector), nullptr); @@ -545,7 +537,7 @@ LowMachEquationSystem::register_surface_pp_algorithm( << std::endl; } - ScalarFieldType* assembledArea = &(meta_data.declare_field( + ScalarFieldType* assembledArea = &(meta_data.declare_field( stk::topology::NODE_RANK, "assembled_area_force_moment")); stk::mesh::put_field_on_mesh( *assembledArea, stk::mesh::selectUnion(partVector), nullptr); @@ -563,7 +555,7 @@ LowMachEquationSystem::register_surface_pp_algorithm( << std::endl; } - ScalarFieldType* assembledArea = &(meta_data.declare_field( + ScalarFieldType* assembledArea = &(meta_data.declare_field( stk::topology::NODE_RANK, "assembled_area_force_moment_wf")); stk::mesh::put_field_on_mesh( *assembledArea, stk::mesh::selectUnion(partVector), nullptr); @@ -599,8 +591,8 @@ LowMachEquationSystem::register_initial_condition_fcn( std::string fcnName = (*iterName).second; // save off the field (np1 state) - VectorFieldType* velocityNp1 = - meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + VectorFieldType* velocityNp1 = meta_data.get_field( + stk::topology::NODE_RANK, "velocity"); // create a few Aux things AuxFunction* theAuxFunc = NULL; @@ -1039,7 +1031,7 @@ MomentumEquationSystem::MomentumEquationSystem(EquationSystems& eqSystems) visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "velocity", "dudx"), + nodalGradAlgDriver_(realm_, "dudx"), wallFuncAlgDriver_(realm_), dynPressAlgDriver_(realm_), cflReAlgDriver_(realm_), @@ -1150,38 +1142,33 @@ MomentumEquationSystem::register_nodal_fields( const int numStates = realm_.number_of_states(); // register dof; set it as a restart variable - velocity_ = &(meta_data.declare_field( + velocity_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "velocity", numStates)); stk::mesh::put_field_on_mesh(*velocity_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *velocity_, stk::io::FieldOutputType::VECTOR_3D); realm_.augment_restart_variable_list("velocity"); - dudx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dudx")); + dudx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dudx")); stk::mesh::put_field_on_mesh(*dudx_, selector, nDim * nDim, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); // delta solution for linear solver - uTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "uTmp")); + uTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "uTmp")); stk::mesh::put_field_on_mesh(*uTmp_, selector, nDim, nullptr); - stk::io::set_field_output_type(*uTmp_, stk::io::FieldOutputType::VECTOR_3D); - coordinates_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "coordinates")); + coordinates_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "coordinates")); stk::mesh::put_field_on_mesh(*coordinates_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *coordinates_, stk::io::FieldOutputType::VECTOR_3D); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); if (realm_.is_turbulent()) { - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_u")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); @@ -1190,24 +1177,25 @@ MomentumEquationSystem::register_nodal_fields( if ( realm_.solutionOptions_->turbulenceModel_ == TurbulenceModel::SST_IDDES) { - iddesRansIndicator_ = &(meta_data.declare_field( + iddesRansIndicator_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "iddes_rans_indicator")); stk::mesh::put_field_on_mesh(*iddesRansIndicator_, selector, nullptr); } } if (realm_.realmUsesEdges_) { - ScalarFieldType* pecletAtNodes = &(realm_.meta_data().declare_field( - stk::topology::NODE_RANK, "max_peclet_factor")); + ScalarFieldType* pecletAtNodes = + &(realm_.meta_data().declare_field( + stk::topology::NODE_RANK, "max_peclet_factor")); stk::mesh::put_field_on_mesh(*pecletAtNodes, selector, nullptr); ScalarFieldType* pecletNumAtNodes = - &(realm_.meta_data().declare_field( + &(realm_.meta_data().declare_field( stk::topology::NODE_RANK, "max_peclet_number")); stk::mesh::put_field_on_mesh(*pecletNumAtNodes, selector, nullptr); } - Udiag_ = &( - meta_data.declare_field(stk::topology::NODE_RANK, "momentum_diag")); + Udiag_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "momentum_diag")); stk::mesh::put_field_on_mesh(*Udiag_, selector, nullptr); realm_.augment_restart_variable_list("momentum_diag"); @@ -1228,10 +1216,9 @@ MomentumEquationSystem::register_nodal_fields( // register specialty fields for PNG if (managePNG_) { // create temp vector field for duidx that will hold the active dudx - VectorFieldType* duidx = - &(meta_data.declare_field(stk::topology::NODE_RANK, "duidx")); + VectorFieldType* duidx = &(meta_data.declare_field( + stk::topology::NODE_RANK, "duidx")); stk::mesh::put_field_on_mesh(*duidx, selector, nDim, nullptr); - stk::io::set_field_output_type(*duidx, stk::io::FieldOutputType::VECTOR_3D); } // Add actuator and other source terms @@ -1241,10 +1228,11 @@ MomentumEquationSystem::register_nodal_fields( realm_.aeroModels_->register_nodal_fields(meta_data, part_vec); } - ScalarFieldType& node_mask = realm_.meta_data().declare_field( - stk::topology::NODE_RANK, "abl_wall_no_slip_wall_func_node_mask"); + ScalarFieldType& node_mask = + realm_.meta_data().declare_field( + stk::topology::NODE_RANK, "abl_wall_no_slip_wall_func_node_mask"); double one = 1; - stk::mesh::put_field_on_mesh(node_mask, selector, &one); + stk::mesh::put_field_on_mesh(node_mask, selector, 1, &one); } //-------------------------------------------------------------------------- @@ -1265,11 +1253,13 @@ MomentumEquationSystem::register_edge_fields( const stk::mesh::PartVector& part_vec) { stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); - ScalarFieldType* pecletFactor = &(realm_.meta_data().declare_field( - stk::topology::EDGE_RANK, "peclet_factor")); + ScalarFieldType* pecletFactor = + &(realm_.meta_data().declare_field( + stk::topology::EDGE_RANK, "peclet_factor")); stk::mesh::put_field_on_mesh(*pecletFactor, selector, nullptr); - ScalarFieldType* pecletNumber = &(realm_.meta_data().declare_field( - stk::topology::EDGE_RANK, "peclet_number")); + ScalarFieldType* pecletNumber = + &(realm_.meta_data().declare_field( + stk::topology::EDGE_RANK, "peclet_number")); stk::mesh::put_field_on_mesh(*pecletNumber, selector, nullptr); if (realm_.solutionOptions_->turbulenceModel_ == TurbulenceModel::SST_AMS) AMSAlgDriver_->register_edge_fields(part_vec); @@ -1573,11 +1563,9 @@ MomentumEquationSystem::register_inflow_bc( const unsigned nDim = meta_data.spatial_dimension(); // register boundary data; velocity_bc - VectorFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "velocity_bc")); + VectorFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "velocity_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nDim, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); // extract the value for user specified velocity and save off the AuxFunction InflowUserData userData = inflowBCData.userData_; @@ -1687,11 +1675,9 @@ MomentumEquationSystem::register_open_bc( const int nDim = meta_data.spatial_dimension(); - VectorFieldType* theBcField = &(meta_data.declare_field( + VectorFieldType* theBcField = &(meta_data.declare_field( stk::topology::NODE_RANK, "open_velocity_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nDim, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); // extract the value for user specified velocity and save off the AuxFunction OpenUserData userData = openBCData.userData_; @@ -1789,11 +1775,9 @@ MomentumEquationSystem::register_wall_bc( anyWallFunctionActivated ? "wall_velocity_bc" : "velocity_bc"; // register boundary data; velocity_bc - VectorFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, bcFieldName)); + VectorFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, bcFieldName)); stk::mesh::put_field_on_mesh(*theBcField, *part, nDim, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); // if mesh motion is enabled ... if (realm_.does_mesh_move()) { @@ -1803,8 +1787,8 @@ MomentumEquationSystem::register_wall_bc( << std::endl; // get the mesh velocity field - VectorFieldType* meshVelocity = - meta_data.get_field(stk::topology::NODE_RANK, "mesh_velocity"); + VectorFieldType* meshVelocity = meta_data.get_field( + stk::topology::NODE_RANK, "mesh_velocity"); // create algorithm to copy mesh velocity to wall velocity CopyFieldAlgorithm* wallVelCopyAlg = new CopyFieldAlgorithm( @@ -1889,12 +1873,13 @@ MomentumEquationSystem::register_wall_bc( } if (anyWallFunctionActivated || RANSAblBcApproach_) { - ScalarFieldType* assembledWallArea = &(meta_data.declare_field( - stk::topology::NODE_RANK, "assembled_wall_area_wf")); + ScalarFieldType* assembledWallArea = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "assembled_wall_area_wf")); stk::mesh::put_field_on_mesh(*assembledWallArea, *part, nullptr); ScalarFieldType* assembledWallNormalDistance = - &(meta_data.declare_field( + &(meta_data.declare_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance")); stk::mesh::put_field_on_mesh(*assembledWallNormalDistance, *part, nullptr); @@ -1907,13 +1892,15 @@ MomentumEquationSystem::register_wall_bc( stk::topology::rank_t sideRank = static_cast(meta_data.side_rank()); - GenericFieldType* wallFrictionVelocityBip = &( - meta_data.declare_field(sideRank, "wall_friction_velocity_bip")); + GenericFieldType* wallFrictionVelocityBip = + &(meta_data.declare_field( + sideRank, "wall_friction_velocity_bip")); stk::mesh::put_field_on_mesh( *wallFrictionVelocityBip, *part, numScsBip, nullptr); GenericFieldType* wallNormalDistanceBip = - &(meta_data.declare_field(sideRank, "wall_normal_distance_bip")); + &(meta_data.declare_field( + sideRank, "wall_normal_distance_bip")); stk::mesh::put_field_on_mesh( *wallNormalDistanceBip, *part, numScsBip, nullptr); @@ -1929,7 +1916,8 @@ MomentumEquationSystem::register_wall_bc( // Wall models. if (anyWallFunctionActivated) { GenericFieldType* wallShearStressBip = - &(meta_data.declare_field(sideRank, "wall_shear_stress_bip")); + &(meta_data.declare_field( + sideRank, "wall_shear_stress_bip")); stk::mesh::put_field_on_mesh( *wallShearStressBip, *part, nDim * numScsBip, nullptr); @@ -1940,8 +1928,9 @@ MomentumEquationSystem::register_wall_bc( userSpec[0] = heatFlux.qn_; ConstantAuxFunction* theHeatFluxAuxFunc = new ConstantAuxFunction(0, 1, userSpec); - ScalarFieldType* theHeatFluxBcField = &(meta_data.declare_field( - stk::topology::NODE_RANK, "heat_flux_bc")); + ScalarFieldType* theHeatFluxBcField = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "heat_flux_bc")); stk::mesh::put_field_on_mesh(*theHeatFluxBcField, *part, nullptr); bcDataAlg_.push_back(new AuxFunctionAlgorithm( realm_, part, theHeatFluxBcField, theHeatFluxAuxFunc, @@ -1955,7 +1944,8 @@ MomentumEquationSystem::register_wall_bc( // register boundary data: wall_heat_flux_bip. This is the ABL // integration-point-based heat flux field. GenericFieldType* wallHeatFluxBip = - &(meta_data.declare_field(sideRank, "wall_heat_flux_bip")); + &(meta_data.declare_field( + sideRank, "wall_heat_flux_bip")); stk::mesh::put_field_on_mesh( *wallHeatFluxBip, *part, numScsBip, nullptr); @@ -2137,8 +2127,10 @@ MomentumEquationSystem::register_symmetry_bc( build_face_elem_topo_kernel_automatic( partTopo, elemTopo, *this, activeKernels, "momentum_symmetry_edge", metaData, *realm_.solutionOptions_, - metaData.get_field(stk::topology::NODE_RANK, "velocity"), - metaData.get_field(stk::topology::NODE_RANK, viscName), + metaData.get_field( + stk::topology::NODE_RANK, "velocity"), + metaData.get_field( + stk::topology::NODE_RANK, viscName), faceElemSolverAlg->faceDataNeeded_, faceElemSolverAlg->elemDataNeeded_); } @@ -2189,11 +2181,9 @@ MomentumEquationSystem::register_symmetry_bc( // register boundary data; velocity_bc const std::string bcFieldName = "strong_sym_velocity"; - VectorFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, bcFieldName)); + VectorFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, bcFieldName)); stk::mesh::put_field_on_mesh(*theBcField, *part, nDim, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); std::vector userSpec(nDim, 0.0); AuxFunction* theAuxFunc = NULL; @@ -2265,11 +2255,9 @@ MomentumEquationSystem::register_abltop_bc( std::string bcFieldName = realm_.solutionOptions_->activateOpenMdotCorrection_ ? "velocity_bc" : "cont_velocity_bc"; - VectorFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, bcFieldName)); + VectorFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, bcFieldName)); stk::mesh::put_field_on_mesh(*theBcField, *part, 3, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); auto it = solverAlgDriver_->solverDirichAlgMap_.find(algType); if (it == solverAlgDriver_->solverDirichAlgMap_.end()) { @@ -2303,8 +2291,10 @@ MomentumEquationSystem::register_abltop_bc( // build_face_elem_topo_kernel_automatic( // partTopo, elemTopo, *this, activeKernels, "momentum_symmetry", // metaData, *realm_.solutionOptions_, - // metaData.get_field(stk::topology::NODE_RANK, "velocity"), - // metaData.get_field(stk::topology::NODE_RANK, viscName), + // metaData.get_field(stk::topology::NODE_RANK, + // "velocity"), + // metaData.get_field(stk::topology::NODE_RANK, + // viscName), // faceElemSolverAlg->faceDataNeeded_, // faceElemSolverAlg->elemDataNeeded_); // } @@ -2342,7 +2332,7 @@ MomentumEquationSystem::register_non_conformal_bc( stk::topology::rank_t sideRank = static_cast(meta_data.side_rank()); GenericFieldType* mdotBip = - &(meta_data.declare_field(sideRank, "nc_mass_flow_rate")); + &(meta_data.declare_field(sideRank, "nc_mass_flow_rate")); stk::mesh::put_field_on_mesh(*mdotBip, *part, numScsBip, nullptr); // non-solver; contribution to Gjui; DG algorithm decides on locations for @@ -2511,10 +2501,10 @@ MomentumEquationSystem::compute_projected_nodal_gradient() // pTmp // extract fields - ScalarFieldType* pTmp = - realm_.meta_data().get_field(stk::topology::NODE_RANK, "pTmp"); - VectorFieldType* duidx = - realm_.meta_data().get_field(stk::topology::NODE_RANK, "duidx"); + ScalarFieldType* pTmp = realm_.meta_data().get_field( + stk::topology::NODE_RANK, "pTmp"); + VectorFieldType* duidx = realm_.meta_data().get_field( + stk::topology::NODE_RANK, "duidx"); const int nDim = realm_.meta_data().spatial_dimension(); @@ -2603,7 +2593,7 @@ MomentumEquationSystem::save_diagonal_term( *stk::mesh::field_data(*realm_.naluGlobalId_, entities[in]); const auto mnode = bulk.get_entity(stk::topology::NODE_RANK, naluID); int ix = in * nDim * (offset + 1); - double* diagVal = stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = (double*)stk::mesh::field_data(*Udiag_, mnode); diagVal[0] += lhs[ix]; } } @@ -2624,7 +2614,7 @@ MomentumEquationSystem::save_diagonal_term( *stk::mesh::field_data(*realm_.naluGlobalId_, entities[in]); const auto mnode = bulk.get_entity(stk::topology::NODE_RANK, naluID); int ix = in * nDim; - double* diagVal = stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = (double*)stk::mesh::field_data(*Udiag_, mnode); if (forceAtomic) Kokkos::atomic_add(diagVal, lhs(ix, ix)); else @@ -2649,7 +2639,7 @@ MomentumEquationSystem::save_diagonal_term( *stk::mesh::field_data(*realm_.naluGlobalId_, entities[in]); const auto mnode = bulk.get_entity(stk::topology::NODE_RANK, naluID); int ix = in * nDim; - double* diagVal = stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = (double*)stk::mesh::field_data(*Udiag_, mnode); if (forceAtomic) Kokkos::atomic_add(diagVal, lhs(ix, ix)); else @@ -2693,10 +2683,10 @@ MomentumEquationSystem::assemble_and_solve(stk::mesh::FieldBase* deltaSolution) EquationSystem::assemble_and_solve(deltaSolution); // Post-process the Udiag term - ScalarFieldType* dualVol = - meta.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + ScalarFieldType* dualVol = meta.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); ScalarFieldType* density = - meta.get_field(stk::topology::NODE_RANK, "density"); + meta.get_field(stk::topology::NODE_RANK, "density"); if (realm_.solutionOptions_->tscaleType_ == TSCALE_UDIAGINV) { const std::string dofName = "velocity"; @@ -2789,7 +2779,7 @@ ContinuityEquationSystem::ContinuityEquationSystem( massFlowRate_(NULL), coordinates_(NULL), pTmp_(NULL), - nodalGradAlgDriver_(realm_, "pressure", "dpdx"), + nodalGradAlgDriver_(realm_, "dpdx"), mdotAlgDriver_(new MdotAlgDriver(realm_, elementContinuityEqs)), projectedNodalGradEqs_(NULL) { @@ -2848,24 +2838,23 @@ ContinuityEquationSystem::register_nodal_fields( // register dof; set it as a restart variable const int numStates = 2; - pressure_ = &(meta_data.declare_field( + pressure_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "pressure", numStates)); stk::mesh::put_field_on_mesh(*pressure_, selector, nullptr); realm_.augment_restart_variable_list("pressure"); - dpdx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dpdx")); + dpdx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dpdx")); stk::mesh::put_field_on_mesh(*dpdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dpdx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta with other split systems - pTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); + pTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); stk::mesh::put_field_on_mesh(*pTmp_, selector, nullptr); - coordinates_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "coordinates")); + coordinates_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "coordinates")); stk::mesh::put_field_on_mesh(*coordinates_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *coordinates_, stk::io::FieldOutputType::VECTOR_3D); } //-------------------------------------------------------------------------- @@ -2888,7 +2877,7 @@ ContinuityEquationSystem::register_edge_fields( { stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); stk::mesh::MetaData& meta_data = realm_.meta_data(); - massFlowRate_ = &(meta_data.declare_field( + massFlowRate_ = &(meta_data.declare_field( stk::topology::EDGE_RANK, "mass_flow_rate")); stk::mesh::put_field_on_mesh(*massFlowRate_, selector, nullptr); } @@ -3038,11 +3027,9 @@ ContinuityEquationSystem::register_inflow_bc( // register boundary data; cont_velocity_bc if (!realm_.solutionOptions_->activateOpenMdotCorrection_) { - VectorFieldType* theBcField = &(meta_data.declare_field( + VectorFieldType* theBcField = &(meta_data.declare_field( stk::topology::NODE_RANK, "cont_velocity_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nDim, nullptr); - stk::io::set_field_output_type( - *theBcField, stk::io::FieldOutputType::VECTOR_3D); // extract the value for user specified velocity and save off the // AuxFunction @@ -3169,8 +3156,8 @@ ContinuityEquationSystem::register_open_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); ScalarFieldType* pressureBC = NULL; if (!realm_.solutionOptions_->activateOpenMdotCorrection_) { - pressureBC = &( - meta_data.declare_field(stk::topology::NODE_RANK, "pressure_bc")); + pressureBC = &(meta_data.declare_field( + stk::topology::NODE_RANK, "pressure_bc")); stk::mesh::put_field_on_mesh(*pressureBC, *part, nullptr); } @@ -3353,7 +3340,7 @@ ContinuityEquationSystem::register_non_conformal_bc( stk::topology::rank_t sideRank = static_cast(meta_data.side_rank()); GenericFieldType* mdotBip = - &(meta_data.declare_field(sideRank, "nc_mass_flow_rate")); + &(meta_data.declare_field(sideRank, "nc_mass_flow_rate")); stk::mesh::put_field_on_mesh(*mdotBip, *part, numScsBip, nullptr); // non-solver; contribution to Gjp; DG algorithm decides on locations for diff --git a/src/MatrixFreeHeatCondEquationSystem.C b/src/MatrixFreeHeatCondEquationSystem.C index 978aebc1d..ac6a54db2 100644 --- a/src/MatrixFreeHeatCondEquationSystem.C +++ b/src/MatrixFreeHeatCondEquationSystem.C @@ -25,7 +25,6 @@ #include #include #include -#include namespace sierra { namespace nalu { @@ -71,32 +70,32 @@ MatrixFreeHeatCondEquationSystem::register_nodal_fields( const double zero = 0; stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::temperature, three_states); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::delta, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::volume_weight, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::density, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::specific_heat, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::thermal_conductivity, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } @@ -104,21 +103,20 @@ MatrixFreeHeatCondEquationSystem::register_nodal_fields( const double zero = 0; constexpr int dim = MatrixFreeHeatCondEquationSystem::dim; const std::array x{{zero, zero, zero}}; - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::dtdx, one_state); stk::mesh::put_field_on_mesh(field, selector, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } realm_.augment_restart_variable_list(names::temperature); realm_.augment_property_map( - DENSITY_ID, - meta_.get_field(stk::topology::NODE_RANK, names::density)); + DENSITY_ID, meta_.get_field>( + stk::topology::NODE_RANK, names::density)); realm_.augment_property_map( - SPEC_HEAT_ID, - meta_.get_field(stk::topology::NODE_RANK, names::specific_heat)); + SPEC_HEAT_ID, meta_.get_field>( + stk::topology::NODE_RANK, names::specific_heat)); realm_.augment_property_map( - THERMAL_COND_ID, meta_.get_field( + THERMAL_COND_ID, meta_.get_field>( stk::topology::NODE_RANK, names::thermal_conductivity)); } @@ -147,13 +145,13 @@ MatrixFreeHeatCondEquationSystem::register_wall_bc( constexpr int one_state = 1; if (userData.tempSpec_) { const auto temperature_data = wallBCData.userData_.temperature_; - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::qbc, one_state); stk::mesh::put_field_on_mesh(field, *part, &temperature_data.temperature_); dirichlet_selector_ |= *part; } else if (userData.heatFluxSpec_) { const auto flux_data = wallBCData.userData_.q_; - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::flux, one_state); stk::mesh::put_field_on_mesh(field, *part, &flux_data.qn_); flux_selector_ |= *part; @@ -348,9 +346,12 @@ MatrixFreeHeatCondEquationSystem::solve_and_update() sync_field_on_periodic_nodes(names::delta, 1); solution_update( - 1.0, *meta_.get_field(stk::topology::NODE_RANK, names::delta), 1.0, - meta_.get_field(stk::topology::NODE_RANK, names::temperature) + *meta_.get_field(stk::topology::NODE_RANK, names::delta), + 1.0, + meta_ + .get_field( + stk::topology::NODE_RANK, names::temperature) ->field_of_state(stk::mesh::StateNP1)); update_->update_solution_fields(); diff --git a/src/MatrixFreeLowMachEquationSystem.C b/src/MatrixFreeLowMachEquationSystem.C index b068bd19e..7b7bd49f3 100644 --- a/src/MatrixFreeLowMachEquationSystem.C +++ b/src/MatrixFreeLowMachEquationSystem.C @@ -50,7 +50,6 @@ #include "stk_mesh/base/Types.hpp" #include "stk_util/parallel/ParallelReduce.hpp" #include "stk_util/util/ReportHandler.hpp" -#include "stk_io/IossBridge.hpp" #include #include @@ -152,60 +151,56 @@ MatrixFreeLowMachEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::density, three_states); stk::mesh::put_field_on_mesh(field, selector, &zero); } realm_.augment_restart_variable_list(names::density); realm_.augment_property_map( DENSITY_ID, - meta_.get_field(stk::topology::NODE_RANK, names::density)); + meta_.get_field(stk::topology::NODE_RANK, names::density)); register_copy_state_algorithm(names::density, 1, part_vec); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::velocity, three_states); stk::mesh::put_field_on_mesh(field, selector, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } realm_.augment_restart_variable_list(names::velocity); register_copy_state_algorithm(names::velocity, dim, part_vec); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::viscosity, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } realm_.augment_property_map( - VISCOSITY_ID, - meta_.get_field(stk::topology::NODE_RANK, names::viscosity)); + VISCOSITY_ID, meta_.get_field( + stk::topology::NODE_RANK, names::viscosity)); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::pressure, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } realm_.augment_restart_variable_list(names::pressure); { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::scaled_filter_length, one_state); stk::mesh::put_field_on_mesh(field, selector, &zero); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::dpdx_tmp, one_state); stk::mesh::put_field_on_mesh(field, selector, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::dpdx, one_state); stk::mesh::put_field_on_mesh(field, selector, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } { - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::body_force, one_state); stk::mesh::put_field_on_mesh(field, selector, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } } @@ -233,10 +228,9 @@ MatrixFreeLowMachEquationSystem::register_wall_bc( { constexpr int one_state = 1; const std::array x{{data.u_.ux_, data.u_.uy_, data.u_.uz_}}; - auto& field = meta_.declare_field( + auto& field = meta_.declare_field( stk::topology::NODE_RANK, names::velocity_bc, one_state); stk::mesh::put_field_on_mesh(field, *part, dim, x.data()); - stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); } auto velocity_name = std::string(names::velocity); @@ -330,16 +324,16 @@ MatrixFreeLowMachEquationSystem::register_initial_condition_fcn( "matrix-free"); if (it->second == "TaylorGreen") { - auto* velocity_field = - meta_.get_field(stk::topology::NODE_RANK, names::velocity); + auto* velocity_field = meta_.get_field( + stk::topology::NODE_RANK, names::velocity); ThrowRequire(velocity_field); auto* vel_func = new TaylorGreenVelocityAuxFunction(0, dim); auto* vel_aux_alg = new AuxFunctionAlgorithm( realm_, part, velocity_field, vel_func, stk::topology::NODE_RANK); realm_.initCondAlg_.push_back(vel_aux_alg); } else if (it->second == "SinProfileChannelFlow") { - auto* velocity_field = - meta_.get_field(stk::topology::NODE_RANK, names::velocity); + auto* velocity_field = meta_.get_field( + stk::topology::NODE_RANK, names::velocity); ThrowRequire(velocity_field); auto* vel_func = new SinProfileChannelFlowVelocityAuxFunction(0, dim); auto* vel_aux_alg = new AuxFunctionAlgorithm( @@ -348,8 +342,8 @@ MatrixFreeLowMachEquationSystem::register_initial_condition_fcn( } if (it->second == "TaylorGreen") { - auto pressure_field = - meta_.get_field(stk::topology::NODE_RANK, names::pressure); + auto pressure_field = meta_.get_field( + stk::topology::NODE_RANK, names::pressure); ThrowRequire(pressure_field); auto* pressure_func = new TaylorGreenPressureAuxFunction(); auto* pressure_aux_alg = new AuxFunctionAlgorithm( diff --git a/src/MomentumBoussinesqRASrcNodeSuppAlg.C b/src/MomentumBoussinesqRASrcNodeSuppAlg.C index c8b880253..4d8cc35c2 100644 --- a/src/MomentumBoussinesqRASrcNodeSuppAlg.C +++ b/src/MomentumBoussinesqRASrcNodeSuppAlg.C @@ -49,12 +49,12 @@ MomentumBoussinesqRASrcNodeSuppAlg::MomentumBoussinesqRASrcNodeSuppAlg( // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - temperature_ = - meta_data.get_field(stk::topology::NODE_RANK, "temperature"); + temperature_ = meta_data.get_field( + stk::topology::NODE_RANK, "temperature"); ThrowRequire(temperature_ != nullptr); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); ThrowRequire(dualNodalVolume_ != nullptr); rhoRef_ = realm_.solutionOptions_->referenceDensity_; @@ -70,7 +70,7 @@ void MomentumBoussinesqRASrcNodeSuppAlg::setup() { // filtered temperature is registered after this alg is created - raTemperature_ = realm_.meta_data().get_field( + raTemperature_ = realm_.meta_data().get_field( stk::topology::NODE_RANK, MovingAveragePostProcessor::filtered_field_name("temperature")); ThrowRequire(raTemperature_ != nullptr); diff --git a/src/MomentumBuoyancySrcNodeSuppAlg.C b/src/MomentumBuoyancySrcNodeSuppAlg.C index 4bb8f96c3..70e7715d2 100644 --- a/src/MomentumBuoyancySrcNodeSuppAlg.C +++ b/src/MomentumBuoyancySrcNodeSuppAlg.C @@ -40,10 +40,10 @@ MomentumBuoyancySrcNodeSuppAlg::MomentumBuoyancySrcNodeSuppAlg(Realm& realm) // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); ScalarFieldType* density = - meta_data.get_field(stk::topology::NODE_RANK, "density"); + meta_data.get_field(stk::topology::NODE_RANK, "density"); densityNp1_ = &(density->field_of_state(stk::mesh::StateNP1)); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); nDim_ = meta_data.spatial_dimension(); gravity_.resize(nDim_); diff --git a/src/NonConformalInfo.C b/src/NonConformalInfo.C index bc9e1349c..78879c31d 100644 --- a/src/NonConformalInfo.C +++ b/src/NonConformalInfo.C @@ -286,7 +286,7 @@ NonConformalInfo::construct_bounding_points() std::vector ws_face_shape_function; // fields - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); std::vector>::iterator ii; @@ -541,7 +541,7 @@ NonConformalInfo::complete_search() double bestElemIpCoords[3]; // fields - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); std::vector currentGaussPointCoords(nDim); @@ -799,7 +799,7 @@ NonConformalInfo::construct_bounding_boxes() const double dynamicFac = dynamicSearchTolAlg_ ? 0.0 : 1.0; // fields - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); // points @@ -877,7 +877,7 @@ NonConformalInfo::provide_diagnosis() stk::mesh::BulkData& bulk_data = realm_.bulk_data(); const int nDim = meta_data.spatial_dimension(); - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); std::vector currentGaussPointCoords(nDim); diff --git a/src/NonConformalManager.C b/src/NonConformalManager.C index 2c0e58163..7e098377f 100644 --- a/src/NonConformalManager.C +++ b/src/NonConformalManager.C @@ -119,7 +119,7 @@ NonConformalManager::initialize() // search) are up-to-date if (nonConformalGhosting_ != NULL) { VectorFieldType* coordinates = - realm_.bulk_data().mesh_meta_data().get_field( + realm_.bulk_data().mesh_meta_data().get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); std::vector fieldVec = {coordinates}; stk::mesh::communicate_field_data(*nonConformalGhosting_, fieldVec); diff --git a/src/PeriodicManager.C b/src/PeriodicManager.C index c91b82cca..ce8c7deaf 100644 --- a/src/PeriodicManager.C +++ b/src/PeriodicManager.C @@ -268,7 +268,7 @@ PeriodicManager::determine_translation( stk::mesh::MetaData& meta_data = realm_.meta_data(); // fields - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); const int nDim = meta_data.spatial_dimension(); @@ -455,7 +455,7 @@ PeriodicManager::populate_search_key_vec( std::vector sphereBoundingBoxSlaveVec; // fields - VectorFieldType* coordinates = meta_data.get_field( + VectorFieldType* coordinates = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); const int nDim = meta_data.spatial_dimension(); diff --git a/src/ProjectedNodalGradientEquationSystem.C b/src/ProjectedNodalGradientEquationSystem.C index 2d383f364..744c912a6 100644 --- a/src/ProjectedNodalGradientEquationSystem.C +++ b/src/ProjectedNodalGradientEquationSystem.C @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -136,16 +137,14 @@ ProjectedNodalGradientEquationSystem::register_nodal_fields( const int nDim = meta_data.spatial_dimension(); stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); - dqdx_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, dofName_)); + dqdx_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, dofName_)); stk::mesh::put_field_on_mesh(*dqdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dqdx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver - qTmp_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, deltaName_)); + qTmp_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, deltaName_)); stk::mesh::put_field_on_mesh(*qTmp_, selector, nDim, nullptr); - stk::io::set_field_output_type(*qTmp_, stk::io::FieldOutputType::VECTOR_3D); } //-------------------------------------------------------------------------- diff --git a/src/Realm.C b/src/Realm.C index 9391d2925..f96f62fbd 100644 --- a/src/Realm.C +++ b/src/Realm.C @@ -118,6 +118,7 @@ #include #include #include +#include #include #include #include @@ -520,8 +521,8 @@ Realm::initialize_prolog() populate_boundary_data(); - ScalarIntFieldType* iblank = - meta_data().get_field(stk::topology::NODE_RANK, "iblank"); + ScalarIntFieldType* iblank = meta_data().get_field( + stk::topology::NODE_RANK, "iblank"); stk::mesh::field_fill(1, *iblank); if (solutionOptions_->meshTransformation_) @@ -926,7 +927,7 @@ Realm::setup_nodal_fields() setup_field_manager(); } #ifdef NALU_USES_HYPRE - hypreGlobalId_ = fieldManager_->register_field( + hypreGlobalId_ = fieldManager_->register_field( "hypre_global_id", meta_data().get_parts()); #endif #ifdef NALU_USES_TRILINOS_SOLVERS @@ -934,10 +935,10 @@ Realm::setup_nodal_fields() // the manager instead const LinSys::GlobalOrdinal init_val = std::numeric_limits::max(); - tpetGlobalId_ = fieldManager_->register_field( + tpetGlobalId_ = fieldManager_->register_field( "tpet_global_id", meta_data().get_parts(), &init_val); #endif - naluGlobalId_ = fieldManager_->register_field( + naluGlobalId_ = fieldManager_->register_field( "nalu_global_id", meta_data().get_parts()); // loop over all material props targets and register nodal fields @@ -975,9 +976,10 @@ Realm::setup_element_fields() const std::string sv_fieldName = realmUsesEdges_ ? "edge_swept_face_volume" : "swept_face_volume"; GenericFieldType* faceVelMag = - &(meta_data().declare_field(entityRank, fvm_fieldName)); - GenericFieldType* sweptFaceVolume = &(meta_data().declare_field( - entityRank, sv_fieldName, numVolStates)); + &(meta_data().declare_field(entityRank, fvm_fieldName)); + GenericFieldType* sweptFaceVolume = + &(meta_data().declare_field( + entityRank, sv_fieldName, numVolStates)); for (auto target : targetNames) { auto* targetPart = meta_data().get_part(target); auto fieldSize = 1; @@ -1471,7 +1473,7 @@ Realm::setup_property() case MIXFRAC_MAT: { // extract the mixture fraction field - ScalarFieldType* mixFrac = meta_data().get_field( + ScalarFieldType* mixFrac = meta_data().get_field( stk::topology::NODE_RANK, "mixture_fraction"); // primary and secondary @@ -1494,7 +1496,7 @@ Realm::setup_property() case VOF_MAT: { // extract the volume of fluid field - ScalarFieldType* VOF = meta_data().get_field( + ScalarFieldType* VOF = meta_data().get_field( stk::topology::NODE_RANK, "volume_of_fluid"); // primary and secondary @@ -2053,7 +2055,6 @@ Realm::create_mesh() activateAura_ ? stk::mesh::BulkData::AUTO_AURA : stk::mesh::BulkData::NO_AUTO_AURA); bulkData_ = meshBuilder.create(); - bulkData_->mesh_meta_data().use_simple_fields(); ioBroker_ = new stk::io::StkMeshIoBroker(pm); ioBroker_->set_auto_load_distribution_factor_per_nodeset(false); ioBroker_->set_bulk_data(*bulkData_); @@ -2560,11 +2561,11 @@ Realm::set_current_coordinates(stk::mesh::Part* targetPart) { const int nDim = meta_data().spatial_dimension(); - VectorFieldType* modelCoords = - meta_data().get_field(stk::topology::NODE_RANK, "coordinates"); - VectorFieldType* currentCoords = meta_data().get_field( + VectorFieldType* modelCoords = meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* currentCoords = meta_data().get_field( stk::topology::NODE_RANK, "current_coordinates"); - VectorFieldType* displacement = meta_data().get_field( + VectorFieldType* displacement = meta_data().get_field( stk::topology::NODE_RANK, "mesh_displacement"); currentCoords->clear_sync_state(); @@ -2624,8 +2625,8 @@ Realm::compute_vrtm(const std::string& velName) auto vrtm = fieldMgr.get_field( get_field_ordinal(meta_data(), velName + "_rtm")); - auto* vrtm_field = - meta_data().get_field(stk::topology::NODE_RANK, velName + "_rtm"); + auto* vrtm_field = meta_data().get_field( + stk::topology::NODE_RANK, velName + "_rtm"); const stk::mesh::Selector sel = (meta_data().locally_owned_part() | meta_data().globally_shared_part()) & stk::mesh::selectField(*vrtm_field); @@ -2647,11 +2648,11 @@ Realm::init_current_coordinates() { const int nDim = meta_data().spatial_dimension(); - VectorFieldType* modelCoords = - meta_data().get_field(stk::topology::NODE_RANK, "coordinates"); - VectorFieldType* currentCoords = meta_data().get_field( + VectorFieldType* modelCoords = meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* currentCoords = meta_data().get_field( stk::topology::NODE_RANK, "current_coordinates"); - VectorFieldType* displacement = meta_data().get_field( + VectorFieldType* displacement = meta_data().get_field( stk::topology::NODE_RANK, "mesh_displacement"); currentCoords->clear_sync_state(); @@ -2807,9 +2808,10 @@ Realm::register_wall_bc(stk::mesh::Part* part, const stk::topology& theTopo) MasterElementRepo::get_surface_master_element_on_host(theTopo); const int numScsIp = meFC->num_integration_points(); - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -2842,9 +2844,10 @@ Realm::register_inflow_bc(stk::mesh::Part* part, const stk::topology& theTopo) MasterElementRepo::get_surface_master_element_on_host(theTopo); const int numScsIp = meFC->num_integration_points(); - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -2877,9 +2880,10 @@ Realm::register_open_bc(stk::mesh::Part* part, const stk::topology& theTopo) MasterElementRepo::get_surface_master_element_on_host(theTopo); const int numScsIp = meFC->num_integration_points(); - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -2911,9 +2915,10 @@ Realm::register_symmetry_bc(stk::mesh::Part* part, const stk::topology& theTopo) MasterElementRepo::get_surface_master_element_on_host(theTopo); const int numScsIp = meFC->num_integration_points(); - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -3003,9 +3008,10 @@ Realm::register_non_conformal_bc( const int numScsIp = meFC->num_integration_points(); // exposed area vector - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -3027,9 +3033,10 @@ Realm::register_overset_bc() const int numScsIp = meFC->num_integration_points(); // exposed area vector - GenericFieldType* exposedAreaVec_ = &(meta_data().declare_field( - static_cast(meta_data().side_rank()), - "exposed_area_vector")); + GenericFieldType* exposedAreaVec_ = + &(meta_data().declare_field( + static_cast(meta_data().side_rank()), + "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec_, *part, nDim * numScsIp, nullptr); @@ -4772,8 +4779,8 @@ Realm::promote_mesh() << "Realm::promote_elements() Begin " << std::endl; auto timeA = stk::wall_time(); - auto& coords = - *meta_data().get_field(stk::topology::NODE_RANK, "coordinates"); + auto& coords = *meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); if (!restarted_simulation()) { #ifdef NALU_HAS_MATRIXFREE std::vector gllNodes = @@ -4813,8 +4820,8 @@ Realm::create_promoted_output_mesh() return; } - auto* coords = - meta_data().get_field(stk::topology::NODE_RANK, "coordinates"); + auto* coords = meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); promotionIO_ = std::make_unique( promotionOrder_, meta_data(), *bulkData_, meta_data().get_mesh_parts(), outputInfo_->outputDBName_, *coords); diff --git a/src/ShearStressTransportEquationSystem.C b/src/ShearStressTransportEquationSystem.C index 24aa93354..a67b5fc56 100644 --- a/src/ShearStressTransportEquationSystem.C +++ b/src/ShearStressTransportEquationSystem.C @@ -139,23 +139,23 @@ ShearStressTransportEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // re-register tke and sdr for convenience - tke_ = &(meta_data.declare_field( + tke_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_ke", numStates)); stk::mesh::put_field_on_mesh(*tke_, selector, nullptr); - sdr_ = &(meta_data.declare_field( + sdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate", numStates)); stk::mesh::put_field_on_mesh(*sdr_, selector, nullptr); if (realm_.solutionOptions_->gammaEqActive_) { - gamma_ = &(meta_data.declare_field( + gamma_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "gamma_transition", numStates)); stk::mesh::put_field_on_mesh(*gamma_, selector, nullptr); } // SST parameters that everyone needs - minDistanceToWall_ = &(meta_data.declare_field( + minDistanceToWall_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")); stk::mesh::put_field_on_mesh(*minDistanceToWall_, selector, nullptr); - fOneBlending_ = &(meta_data.declare_field( + fOneBlending_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "sst_f_one_blending")); stk::mesh::put_field_on_mesh(*fOneBlending_, selector, nullptr); @@ -163,7 +163,7 @@ ShearStressTransportEquationSystem::register_nodal_fields( if ( (TurbulenceModel::SST_DES == realm_.solutionOptions_->turbulenceModel_) || (TurbulenceModel::SST_IDDES == realm_.solutionOptions_->turbulenceModel_)) { - maxLengthScale_ = &(meta_data.declare_field( + maxLengthScale_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "sst_max_length_scale")); stk::mesh::put_field_on_mesh(*maxLengthScale_, selector, nullptr); } @@ -221,14 +221,14 @@ ShearStressTransportEquationSystem::register_wall_bc( wallBcPart_.push_back(part); auto& meta = realm_.meta_data(); - auto& assembledWallArea = meta.declare_field( + auto& assembledWallArea = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_area_wf"); stk::mesh::put_field_on_mesh(assembledWallArea, *part, nullptr); - auto& assembledWallNormDist = meta.declare_field( + auto& assembledWallNormDist = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance"); stk::mesh::put_field_on_mesh(assembledWallNormDist, *part, nullptr); - auto& wallNormDistBip = - meta.declare_field(meta.side_rank(), "wall_normal_distance_bip"); + auto& wallNormDistBip = meta.declare_field( + meta.side_rank(), "wall_normal_distance_bip"); auto* meFC = MasterElementRepo::get_surface_master_element_on_host(partTopo); const int numScsBip = meFC->num_integration_points(); stk::mesh::put_field_on_mesh(wallNormDistBip, *part, numScsBip, nullptr); @@ -364,8 +364,10 @@ ShearStressTransportEquationSystem::post_external_data_transfer_work() clip_sst_gamma(ngpMesh, interior_sel, gammaNp1); } - auto sdrBCField = meta.get_field(stk::topology::NODE_RANK, "sdr_bc"); - auto tkeBCField = meta.get_field(stk::topology::NODE_RANK, "tke_bc"); + auto sdrBCField = + meta.get_field(stk::topology::NODE_RANK, "sdr_bc"); + auto tkeBCField = + meta.get_field(stk::topology::NODE_RANK, "tke_bc"); if (sdrBCField != nullptr) { ThrowRequire(tkeBCField); @@ -379,7 +381,7 @@ ShearStressTransportEquationSystem::post_external_data_transfer_work() if (realm_.solutionOptions_->gammaEqActive_) { auto gammaBCField = - meta.get_field(stk::topology::NODE_RANK, "gamma_bc"); + meta.get_field(stk::topology::NODE_RANK, "gamma_bc"); auto ngpGammaBC = fieldMgr.get_field(gammaBCField->mesh_meta_data_ordinal()); @@ -408,8 +410,8 @@ ShearStressTransportEquationSystem::update_and_clip() const auto& wTmp = fieldMgr.get_field(sdrEqSys_->wTmp_->mesh_meta_data_ordinal()); - auto* turbViscosity = - meta.get_field(stk::topology::NODE_RANK, "turbulent_viscosity"); + auto* turbViscosity = meta.get_field( + stk::topology::NODE_RANK, "turbulent_viscosity"); const stk::mesh::Selector sel = (meta.locally_owned_part() | meta.globally_shared_part()) & @@ -449,8 +451,8 @@ ShearStressTransportEquationSystem::update_and_clip_gamma() auto& gammaNp1 = fieldMgr.get_field(gamma_->mesh_meta_data_ordinal()); const auto& gamTmp = fieldMgr.get_field(gammaEqSys_->gamTmp_->mesh_meta_data_ordinal()); - auto* turbViscosity = - meta.get_field(stk::topology::NODE_RANK, "turbulent_viscosity"); + auto* turbViscosity = meta.get_field( + stk::topology::NODE_RANK, "turbulent_viscosity"); const stk::mesh::Selector sel = (meta.locally_owned_part() | meta.globally_shared_part()) & @@ -654,8 +656,8 @@ ShearStressTransportEquationSystem::post_iter_work() ngpIddesRans.modify_on_device(); ngpIddesRans.sync_to_host(); - ScalarFieldType* iddesRansInd = - meta.get_field(stk::topology::NODE_RANK, "iddes_rans_indicator"); + ScalarFieldType* iddesRansInd = meta.get_field( + stk::topology::NODE_RANK, "iddes_rans_indicator"); stk::mesh::copy_owned_to_shared(bulk, {iddesRansInd}); if (realm_.hasPeriodic_) { diff --git a/src/SideWriter.C b/src/SideWriter.C index a32a3d138..c26971bad 100644 --- a/src/SideWriter.C +++ b/src/SideWriter.C @@ -71,11 +71,12 @@ get_dimension(const stk::mesh::BulkData& bulk) return int(bulk.mesh_meta_data().spatial_dimension()); } -const stk::mesh::Field& +const stk::mesh::Field& get_coordinate_field(const stk::mesh::BulkData& bulk) { - auto* coord = dynamic_cast*>( - bulk.mesh_meta_data().coordinate_field()); + auto* coord = + dynamic_cast*>( + bulk.mesh_meta_data().coordinate_field()); ThrowRequireMsg(coord, "Model coordinates must be a double-valued vector"); return *coord; } diff --git a/src/SmartField.C b/src/SmartField.C index 39ca4eaa6..6b1b48d1c 100644 --- a/src/SmartField.C +++ b/src/SmartField.C @@ -38,10 +38,14 @@ EXPLICIT_TYPE_INSTANTIATOR_NGP(stk::mesh::EntityId); /* EXPLICIT_TYPE_INSTANTIATOR_LEGACY(HypreIDFieldType); */ /* #endif */ -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(int); -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(double); -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(stk::mesh::EntityId); -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(LocalId); -EXPLICIT_TYPE_INSTANTIATOR_LEGACY(TpetIdType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(ScalarFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(VectorFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(TensorFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(GenericFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(GenericIntFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(TpetIDFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(LocalIdFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(GlobalIdFieldType); +EXPLICIT_TYPE_INSTANTIATOR_LEGACY(ScalarIntFieldType); } // namespace sierra::nalu diff --git a/src/SolutionNormPostProcessing.C b/src/SolutionNormPostProcessing.C index 9d70f7dda..78209026e 100644 --- a/src/SolutionNormPostProcessing.C +++ b/src/SolutionNormPostProcessing.C @@ -193,7 +193,9 @@ SolutionNormPostProcessing::setup() const std::string dofNameExact = dofName + "_exact"; stk::mesh::FieldBase* exactDofField = - &(metaData.declare_field(stk::topology::NODE_RANK, dofNameExact)); + &(metaData + .declare_field>( + stk::topology::NODE_RANK, dofNameExact)); // push back to vector of pairs; unique list fieldPairVec_.push_back(std::make_pair(dofField, exactDofField)); diff --git a/src/SolverAlgorithm.C b/src/SolverAlgorithm.C index 041acd91a..9ff897571 100644 --- a/src/SolverAlgorithm.C +++ b/src/SolverAlgorithm.C @@ -35,7 +35,7 @@ fix_overset_rows( const size_t numRows = nobj * nDim; ScalarIntFieldType* iblank = - meta.get_field(stk::topology::NODE_RANK, "iblank"); + meta.get_field(stk::topology::NODE_RANK, "iblank"); for (size_t in = 0; in < nobj; in++) { const int* ibl = stk::mesh::field_data(*iblank, entities[in]); diff --git a/src/SpecificDissipationRateEquationSystem.C b/src/SpecificDissipationRateEquationSystem.C index edf466847..442383f2d 100644 --- a/src/SpecificDissipationRateEquationSystem.C +++ b/src/SpecificDissipationRateEquationSystem.C @@ -79,6 +79,7 @@ #include #include #include +#include #include // stk_io @@ -115,7 +116,7 @@ SpecificDissipationRateEquationSystem::SpecificDissipationRateEquationSystem( sdrWallBc_(NULL), assembledWallSdr_(NULL), assembledWallArea_(NULL), - nodalGradAlgDriver_(realm_, "specific_dissipation_rate", "dwdx") + nodalGradAlgDriver_(realm_, "dwdx") { dofName_ = "specific_dissipation_rate"; @@ -162,28 +163,29 @@ SpecificDissipationRateEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // register dof; set it as a restart variable - sdr_ = &(meta_data.declare_field( + sdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate", numStates)); stk::mesh::put_field_on_mesh(*sdr_, selector, nullptr); realm_.augment_restart_variable_list("specific_dissipation_rate"); - dwdx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dwdx")); + dwdx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dwdx")); stk::mesh::put_field_on_mesh(*dwdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dwdx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta since this is a split system - wTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "wTmp")); + wTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "wTmp")); stk::mesh::put_field_on_mesh(*wTmp_, selector, nullptr); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_sdr")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); @@ -342,8 +344,8 @@ SpecificDissipationRateEquationSystem::register_inflow_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; sdr_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "sdr_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "sdr_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -408,8 +410,8 @@ SpecificDissipationRateEquationSystem::register_open_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; sdr_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "open_sdr_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "open_sdr_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -471,17 +473,17 @@ SpecificDissipationRateEquationSystem::register_wall_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; sdr_bc - sdrWallBc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "sdr_bc")); + sdrWallBc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "sdr_bc")); stk::mesh::put_field_on_mesh(*sdrWallBc_, *part, nullptr); // need to register the assembles wall value for sdr; can not share with // sdr_bc - assembledWallSdr_ = &(meta_data.declare_field( + assembledWallSdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "wall_model_sdr_bc")); stk::mesh::put_field_on_mesh(*assembledWallSdr_, *part, nullptr); - assembledWallArea_ = &(meta_data.declare_field( + assembledWallArea_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "assembled_wall_area_sdr")); stk::mesh::put_field_on_mesh(*assembledWallArea_, *part, nullptr); diff --git a/src/SurfaceForceAndMomentAlgorithm.C b/src/SurfaceForceAndMomentAlgorithm.C index c685cd151..c9c842b91 100644 --- a/src/SurfaceForceAndMomentAlgorithm.C +++ b/src/SurfaceForceAndMomentAlgorithm.C @@ -75,26 +75,32 @@ SurfaceForceAndMomentAlgorithm::SurfaceForceAndMomentAlgorithm( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - pressure_ = meta_data.get_field(stk::topology::NODE_RANK, "pressure"); - pressureForce_ = - meta_data.get_field(stk::topology::NODE_RANK, "pressure_force"); - viscousForce_ = - meta_data.get_field(stk::topology::NODE_RANK, "viscous_force"); - tauWallVector_ = - meta_data.get_field(stk::topology::NODE_RANK, "tau_wall_vector"); - tauWall_ = meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); - yplus_ = meta_data.get_field(stk::topology::NODE_RANK, "yplus"); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); + pressure_ = + meta_data.get_field(stk::topology::NODE_RANK, "pressure"); + pressureForce_ = meta_data.get_field( + stk::topology::NODE_RANK, "pressure_force"); + viscousForce_ = meta_data.get_field( + stk::topology::NODE_RANK, "viscous_force"); + tauWallVector_ = meta_data.get_field( + stk::topology::NODE_RANK, "tau_wall_vector"); + tauWall_ = + meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); + yplus_ = + meta_data.get_field(stk::topology::NODE_RANK, "yplus"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); // extract viscosity name const std::string viscName = realm_.is_turbulent() ? "effective_viscosity_u" : "viscosity"; - viscosity_ = meta_data.get_field(stk::topology::NODE_RANK, viscName); - dudx_ = meta_data.get_field(stk::topology::NODE_RANK, "dudx"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - assembledArea_ = meta_data.get_field( + viscosity_ = + meta_data.get_field(stk::topology::NODE_RANK, viscName); + dudx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dudx"); + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + assembledArea_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment"); // error check on params const size_t nDim = meta_data.spatial_dimension(); diff --git a/src/SurfaceForceAndMomentAlgorithmDriver.C b/src/SurfaceForceAndMomentAlgorithmDriver.C index 6e3ab8e0f..d132baa0a 100644 --- a/src/SurfaceForceAndMomentAlgorithmDriver.C +++ b/src/SurfaceForceAndMomentAlgorithmDriver.C @@ -66,20 +66,20 @@ SurfaceForceAndMomentAlgorithmDriver::zero_fields() stk::mesh::MetaData& meta_data = realm_.meta_data(); // extract the fields - VectorFieldType* pressureForce = - meta_data.get_field(stk::topology::NODE_RANK, "pressure_force"); - VectorFieldType* viscousForce = - meta_data.get_field(stk::topology::NODE_RANK, "viscous_force"); - VectorFieldType* tauWallVector = - meta_data.get_field(stk::topology::NODE_RANK, "tau_wall_vector"); + VectorFieldType* pressureForce = meta_data.get_field( + stk::topology::NODE_RANK, "pressure_force"); + VectorFieldType* viscousForce = meta_data.get_field( + stk::topology::NODE_RANK, "viscous_force"); + VectorFieldType* tauWallVector = meta_data.get_field( + stk::topology::NODE_RANK, "tau_wall_vector"); ScalarFieldType* tauWall = - meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); + meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); ScalarFieldType* yplus = - meta_data.get_field(stk::topology::NODE_RANK, "yplus"); + meta_data.get_field(stk::topology::NODE_RANK, "yplus"); // one of these might be null - ScalarFieldType* assembledArea = meta_data.get_field( + ScalarFieldType* assembledArea = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment"); - ScalarFieldType* assembledAreaWF = meta_data.get_field( + ScalarFieldType* assembledAreaWF = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment_wf"); // zero fields @@ -111,16 +111,16 @@ SurfaceForceAndMomentAlgorithmDriver::parallel_assemble_fields() const size_t nDim = meta_data.spatial_dimension(); // extract the fields - VectorFieldType* pressureForce = - meta_data.get_field(stk::topology::NODE_RANK, "pressure_force"); - VectorFieldType* viscousForce = - meta_data.get_field(stk::topology::NODE_RANK, "viscous_force"); - VectorFieldType* tauWallVector = - meta_data.get_field(stk::topology::NODE_RANK, "tau_wall_vector"); + VectorFieldType* pressureForce = meta_data.get_field( + stk::topology::NODE_RANK, "pressure_force"); + VectorFieldType* viscousForce = meta_data.get_field( + stk::topology::NODE_RANK, "viscous_force"); + VectorFieldType* tauWallVector = meta_data.get_field( + stk::topology::NODE_RANK, "tau_wall_vector"); ScalarFieldType* tauWall = - meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); + meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); ScalarFieldType* yplus = - meta_data.get_field(stk::topology::NODE_RANK, "yplus"); + meta_data.get_field(stk::topology::NODE_RANK, "yplus"); stk::mesh::parallel_sum( bulk_data, {pressureForce, viscousForce, tauWallVector, tauWall, yplus}); @@ -148,9 +148,9 @@ SurfaceForceAndMomentAlgorithmDriver::parallel_assemble_area() stk::mesh::MetaData& meta_data = realm_.meta_data(); // extract the fields; one of these might be null - ScalarFieldType* assembledArea = meta_data.get_field( + ScalarFieldType* assembledArea = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment"); - ScalarFieldType* assembledAreaWF = meta_data.get_field( + ScalarFieldType* assembledAreaWF = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment_wf"); // parallel assemble diff --git a/src/SurfaceForceAndMomentWallFunctionAlgorithm.C b/src/SurfaceForceAndMomentWallFunctionAlgorithm.C index dd5fa7f80..e2c3d2f2d 100644 --- a/src/SurfaceForceAndMomentWallFunctionAlgorithm.C +++ b/src/SurfaceForceAndMomentWallFunctionAlgorithm.C @@ -80,28 +80,33 @@ SurfaceForceAndMomentWallFunctionAlgorithm:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - velocity_ = meta_data.get_field(stk::topology::NODE_RANK, "velocity"); - pressure_ = meta_data.get_field(stk::topology::NODE_RANK, "pressure"); - pressureForce_ = - meta_data.get_field(stk::topology::NODE_RANK, "pressure_force"); - viscousForce_ = - meta_data.get_field(stk::topology::NODE_RANK, "viscous_force"); - tauWall_ = meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); - yplus_ = meta_data.get_field(stk::topology::NODE_RANK, "yplus"); - bcVelocity_ = - meta_data.get_field(stk::topology::NODE_RANK, "wall_velocity_bc"); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); + velocity_ = + meta_data.get_field(stk::topology::NODE_RANK, "velocity"); + pressure_ = + meta_data.get_field(stk::topology::NODE_RANK, "pressure"); + pressureForce_ = meta_data.get_field( + stk::topology::NODE_RANK, "pressure_force"); + viscousForce_ = meta_data.get_field( + stk::topology::NODE_RANK, "viscous_force"); + tauWall_ = + meta_data.get_field(stk::topology::NODE_RANK, "tau_wall"); + yplus_ = + meta_data.get_field(stk::topology::NODE_RANK, "yplus"); + bcVelocity_ = meta_data.get_field( + stk::topology::NODE_RANK, "wall_velocity_bc"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); viscosity_ = - meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); - wallFrictionVelocityBip_ = meta_data.get_field( + meta_data.get_field(stk::topology::NODE_RANK, "viscosity"); + wallFrictionVelocityBip_ = meta_data.get_field( meta_data.side_rank(), "wall_friction_velocity_bip"); - wallNormalDistanceBip_ = meta_data.get_field( + wallNormalDistanceBip_ = meta_data.get_field( meta_data.side_rank(), "wall_normal_distance_bip"); - exposedAreaVec_ = - meta_data.get_field(meta_data.side_rank(), "exposed_area_vector"); - assembledArea_ = meta_data.get_field( + exposedAreaVec_ = meta_data.get_field( + meta_data.side_rank(), "exposed_area_vector"); + assembledArea_ = meta_data.get_field( stk::topology::NODE_RANK, "assembled_area_force_moment_wf"); // error check on params diff --git a/src/TotalDissipationRateEquationSystem.C b/src/TotalDissipationRateEquationSystem.C index 723898465..1a7d37306 100644 --- a/src/TotalDissipationRateEquationSystem.C +++ b/src/TotalDissipationRateEquationSystem.C @@ -69,6 +69,7 @@ #include #include #include +#include #include // stk_io @@ -104,7 +105,7 @@ TotalDissipationRateEquationSystem::TotalDissipationRateEquationSystem( tdrWallBc_(NULL), assembledWallTdr_(NULL), assembledWallArea_(NULL), - nodalGradAlgDriver_(realm_, "total_dissipation_rate", "dedx") + nodalGradAlgDriver_(realm_, "dedx") { dofName_ = "total_dissipation_rate"; @@ -151,28 +152,29 @@ TotalDissipationRateEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // register dof; set it as a restart variable - tdr_ = &(meta_data.declare_field( + tdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "total_dissipation_rate", numStates)); stk::mesh::put_field_on_mesh(*tdr_, selector, nullptr); realm_.augment_restart_variable_list("total_dissipation_rate"); - dedx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dedx")); + dedx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dedx")); stk::mesh::put_field_on_mesh(*dedx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dedx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta since this is a split system - eTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "eTmp")); + eTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "eTmp")); stk::mesh::put_field_on_mesh(*eTmp_, selector, nullptr); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_tdr")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); @@ -301,8 +303,8 @@ TotalDissipationRateEquationSystem::register_inflow_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tdr_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "tdr_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "tdr_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -367,8 +369,8 @@ TotalDissipationRateEquationSystem::register_open_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tdr_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "open_tdr_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "open_tdr_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -430,17 +432,17 @@ TotalDissipationRateEquationSystem::register_wall_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tdr_bc - tdrWallBc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "tdr_bc")); + tdrWallBc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "tdr_bc")); stk::mesh::put_field_on_mesh(*tdrWallBc_, *part, nullptr); // need to register the assembles wall value for tdr; can not share with // tdr_bc - assembledWallTdr_ = &(meta_data.declare_field( + assembledWallTdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "wall_model_tdr_bc")); stk::mesh::put_field_on_mesh(*assembledWallTdr_, *part, nullptr); - assembledWallArea_ = &(meta_data.declare_field( + assembledWallArea_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "assembled_wall_area_tdr")); stk::mesh::put_field_on_mesh(*assembledWallArea_, *part, nullptr); diff --git a/src/TpetraLinearSystem.C b/src/TpetraLinearSystem.C index 17236a5fa..204c195c1 100644 --- a/src/TpetraLinearSystem.C +++ b/src/TpetraLinearSystem.C @@ -1262,7 +1262,7 @@ TpetraLinearSystem::finalizeLinearSystem() reinterpret_cast(linearSolver_); if (linearSolver != nullptr) { - VectorFieldType* coordinates = metaData.get_field( + VectorFieldType* coordinates = metaData.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); if (linearSolver->activeMueLu()) copy_stk_to_tpetra(coordinates, coords); diff --git a/src/TpetraSegregatedLinearSystem.C b/src/TpetraSegregatedLinearSystem.C index 023388ada..c8be4266e 100644 --- a/src/TpetraSegregatedLinearSystem.C +++ b/src/TpetraSegregatedLinearSystem.C @@ -1088,7 +1088,7 @@ TpetraSegregatedLinearSystem::finalizeLinearSystem() reinterpret_cast(linearSolver_); if (linearSolver != nullptr) { - VectorFieldType* coordinates = metaData.get_field( + VectorFieldType* coordinates = metaData.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); if (linearSolver->activeMueLu()) copy_stk_to_tpetra(coordinates, coords); diff --git a/src/TurbKineticEnergyEquationSystem.C b/src/TurbKineticEnergyEquationSystem.C index 1075c3242..3452d2f9e 100644 --- a/src/TurbKineticEnergyEquationSystem.C +++ b/src/TurbKineticEnergyEquationSystem.C @@ -87,6 +87,7 @@ #include #include #include +#include #include #include @@ -123,7 +124,7 @@ TurbKineticEnergyEquationSystem::TurbKineticEnergyEquationSystem( visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "turbulent_ke", "dkdx"), + nodalGradAlgDriver_(realm_, "dkdx"), turbulenceModel_(realm_.solutionOptions_->turbulenceModel_), projectedNodalGradEqs_(NULL), isInit_(true) @@ -193,28 +194,29 @@ TurbKineticEnergyEquationSystem::register_nodal_fields( const int numStates = realm_.number_of_states(); // register dof; set it as a restart variable - tke_ = &(meta_data.declare_field( + tke_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_ke", numStates)); stk::mesh::put_field_on_mesh(*tke_, selector, nullptr); realm_.augment_restart_variable_list("turbulent_ke"); - dkdx_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "dkdx")); + dkdx_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "dkdx")); stk::mesh::put_field_on_mesh(*dkdx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dkdx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta since this is a split system - kTmp_ = &(meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); + kTmp_ = &( + meta_data.declare_field(stk::topology::NODE_RANK, "pTmp")); stk::mesh::put_field_on_mesh(*kTmp_, selector, nullptr); - visc_ = - &(meta_data.declare_field(stk::topology::NODE_RANK, "viscosity")); + visc_ = &(meta_data.declare_field( + stk::topology::NODE_RANK, "viscosity")); stk::mesh::put_field_on_mesh(*visc_, selector, nullptr); - tvisc_ = &(meta_data.declare_field( + tvisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")); stk::mesh::put_field_on_mesh(*tvisc_, selector, nullptr); - evisc_ = &(meta_data.declare_field( + evisc_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "effective_viscosity_tke")); stk::mesh::put_field_on_mesh(*evisc_, selector, nullptr); @@ -407,8 +409,8 @@ TurbKineticEnergyEquationSystem::register_inflow_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tke_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "tke_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "tke_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -475,8 +477,8 @@ TurbKineticEnergyEquationSystem::register_open_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tke_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "open_tke_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "open_tke_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -540,8 +542,8 @@ TurbKineticEnergyEquationSystem::register_wall_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; tke_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "tke_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "tke_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -563,8 +565,9 @@ TurbKineticEnergyEquationSystem::register_wall_bc( if (wallFunctionApproach || RANSAblBcApproach) { // need to register the assembles wall value for tke; can not share with // tke_bc - ScalarFieldType* theAssembledField = &(meta_data.declare_field( - stk::topology::NODE_RANK, "wall_model_tke_bc")); + ScalarFieldType* theAssembledField = + &(meta_data.declare_field( + stk::topology::NODE_RANK, "wall_model_tke_bc")); stk::mesh::put_field_on_mesh(*theAssembledField, *part, nullptr); if (!wallFuncAlgDriver_) @@ -838,7 +841,8 @@ TurbKineticEnergyEquationSystem::post_external_data_transfer_work() }); ngpTke.modify_on_device(); - auto* tkeBCField = meta.get_field(stk::topology::NODE_RANK, "tke_bc"); + auto* tkeBCField = + meta.get_field(stk::topology::NODE_RANK, "tke_bc"); if (tkeBCField != nullptr) { const stk::mesh::Selector bc_sel = (meta.locally_owned_part() | meta.globally_shared_part()) & diff --git a/src/TurbViscSmagorinskyAlgorithm.C b/src/TurbViscSmagorinskyAlgorithm.C index e247c535b..9e0dea48e 100644 --- a/src/TurbViscSmagorinskyAlgorithm.C +++ b/src/TurbViscSmagorinskyAlgorithm.C @@ -44,12 +44,14 @@ TurbViscSmagorinskyAlgorithm::TurbViscSmagorinskyAlgorithm( stk::mesh::MetaData& meta_data = realm_.meta_data(); - dudx_ = meta_data.get_field(stk::topology::NODE_RANK, "dudx"); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - tvisc_ = meta_data.get_field( + dudx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dudx"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + tvisc_ = meta_data.get_field( stk::topology::NODE_RANK, "turbulent_viscosity"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/TurbViscWaleAlgorithm.C b/src/TurbViscWaleAlgorithm.C index 8c4b1f399..b673ba662 100644 --- a/src/TurbViscWaleAlgorithm.C +++ b/src/TurbViscWaleAlgorithm.C @@ -44,12 +44,14 @@ TurbViscWaleAlgorithm::TurbViscWaleAlgorithm( stk::mesh::MetaData& meta_data = realm_.meta_data(); - dudx_ = meta_data.get_field(stk::topology::NODE_RANK, "dudx"); - density_ = meta_data.get_field(stk::topology::NODE_RANK, "density"); - tvisc_ = meta_data.get_field( + dudx_ = + meta_data.get_field(stk::topology::NODE_RANK, "dudx"); + density_ = + meta_data.get_field(stk::topology::NODE_RANK, "density"); + tvisc_ = meta_data.get_field( stk::topology::NODE_RANK, "turbulent_viscosity"); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); // need NDTW... } diff --git a/src/TurbulenceAveragingPostProcessing.C b/src/TurbulenceAveragingPostProcessing.C index f33872491..63601fa57 100644 --- a/src/TurbulenceAveragingPostProcessing.C +++ b/src/TurbulenceAveragingPostProcessing.C @@ -34,7 +34,6 @@ #include #include #include -#include // basic c++ #include @@ -294,8 +293,8 @@ TurbulenceAveragingPostProcessing::setup() ThrowRequireMsg( tempField != nullptr, "Temperature field must be registered"); - auto& field = - metaData.declare_field(stk::topology::NODE_RANK, fTempName); + auto& field = metaData.declare_field( + stk::topology::NODE_RANK, fTempName); stk::mesh::put_field_on_mesh( field, stk::mesh::selectField(*tempField), nullptr); realm_.augment_restart_variable_list(fTempName); @@ -348,12 +347,10 @@ TurbulenceAveragingPostProcessing::setup() if (avInfo->computeVorticity_) { const int vortSize = realm_.spatialDimension_; const std::string vorticityName = "vorticity"; - VectorFieldType* vortField = &(metaData.declare_field( + VectorFieldType* vortField = &(metaData.declare_field( stk::topology::NODE_RANK, vorticityName)); stk::mesh::put_field_on_mesh( *vortField, *targetPart, vortSize, nullptr); - stk::io::set_field_output_type( - *vortField, stk::io::FieldOutputType::VECTOR_3D); } if (avInfo->computeQcriterion_) { @@ -411,8 +408,9 @@ TurbulenceAveragingPostProcessing::setup() // deal with density; always need Reynolds averaged quantity const std::string densityReynoldsName = "density_ra_" + averageBlockName; - ScalarFieldType* densityReynolds = &(metaData.declare_field( - stk::topology::NODE_RANK, densityReynoldsName)); + ScalarFieldType* densityReynolds = + &(metaData.declare_field( + stk::topology::NODE_RANK, densityReynoldsName)); stk::mesh::put_field_on_mesh(*densityReynolds, *targetPart, nullptr); // Reynolds @@ -528,15 +526,15 @@ TurbulenceAveragingPostProcessing::register_field_from_primitive( // register the averaged field with this size; treat velocity as a special // case to retain the vector aspect if (primitiveName == "velocity") { - VectorFieldType* averagedField = - &(metaData.declare_field(stk::topology::NODE_RANK, averagedName)); + VectorFieldType* averagedField = &(metaData.declare_field( + stk::topology::NODE_RANK, averagedName)); stk::mesh::put_field_on_mesh( *averagedField, *part, fieldSizePrimitive, nullptr); - stk::io::set_field_output_type( - *averagedField, stk::io::FieldOutputType::VECTOR_3D); } else { stk::mesh::FieldBase* averagedField = - &(metaData.declare_field(stk::topology::NODE_RANK, averagedName)); + &(metaData + .declare_field>( + stk::topology::NODE_RANK, averagedName)); stk::mesh::put_field_on_mesh( *averagedField, *part, fieldSizePrimitive, nullptr); } @@ -583,8 +581,9 @@ TurbulenceAveragingPostProcessing::register_field( stk::mesh::Part* targetPart) { // register and put the field - stk::mesh::FieldBase* theField = - &(metaData.declare_field(stk::topology::NODE_RANK, fieldName)); + stk::mesh::FieldBase* theField = &( + metaData.declare_field>( + stk::topology::NODE_RANK, fieldName)); stk::mesh::put_field_on_mesh(*theField, *targetPart, fieldSize, nullptr); // augment the restart list realm_.augment_restart_variable_list(fieldName); @@ -1435,7 +1434,7 @@ TurbulenceAveragingPostProcessing::compute_lambda_ci( stk::mesh::FieldBase* Lambda = metaData.get_field(stk::topology::NODE_RANK, lambdaName); TensorFieldType* dudx_ = - metaData.get_field(stk::topology::NODE_RANK, "dudx"); + metaData.get_field(stk::topology::NODE_RANK, "dudx"); stk::mesh::BucketVector const& node_buckets_vort = realm_.get_buckets(stk::topology::NODE_RANK, s_all_nodes); diff --git a/src/VolumeOfFluidEquationSystem.C b/src/VolumeOfFluidEquationSystem.C index 846447589..7e5723e81 100644 --- a/src/VolumeOfFluidEquationSystem.C +++ b/src/VolumeOfFluidEquationSystem.C @@ -46,7 +46,6 @@ #include "ngp_utils/NgpFieldBLAS.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldUtils.h" -#include "stk_io/IossBridge.hpp" namespace sierra { namespace nalu { @@ -66,7 +65,7 @@ VolumeOfFluidEquationSystem::VolumeOfFluidEquationSystem( volumeOfFluid_(NULL), dvolumeOfFluiddx_(NULL), vofTmp_(NULL), - nodalGradAlgDriver_(realm_, "volume_of_fluid", "dvolume_of_fluiddx"), + nodalGradAlgDriver_(realm_, "dvolume_of_fluiddx"), projectedNodalGradEqs_(NULL), isInit_(false) { @@ -118,7 +117,7 @@ VolumeOfFluidEquationSystem::register_nodal_fields( // register dof; set it as a restart variable const int numStates = realm_.number_of_states(); - auto density_ = &(meta_data.declare_field( + auto density_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "density", numStates)); stk::mesh::put_field_on_mesh(*density_, selector, nullptr); realm_.augment_restart_variable_list("density"); @@ -126,16 +125,14 @@ VolumeOfFluidEquationSystem::register_nodal_fields( // push to property list realm_.augment_property_map(DENSITY_ID, density_); - volumeOfFluid_ = &(meta_data.declare_field( + volumeOfFluid_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "volume_of_fluid", numStates)); stk::mesh::put_field_on_mesh(*volumeOfFluid_, selector, nullptr); realm_.augment_restart_variable_list("volume_of_fluid"); - dvolumeOfFluiddx_ = &(meta_data.declare_field( + dvolumeOfFluiddx_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "dvolume_of_fluiddx")); stk::mesh::put_field_on_mesh(*dvolumeOfFluiddx_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *dvolumeOfFluiddx_, stk::io::FieldOutputType::VECTOR_3D); // delta solution for linear solver; share delta since this is a split system vofTmp_ = @@ -175,7 +172,7 @@ VolumeOfFluidEquationSystem::register_edge_fields( { stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); stk::mesh::MetaData& meta_data = realm_.meta_data(); - auto massFlowRate_ = &(meta_data.declare_field( + auto massFlowRate_ = &(meta_data.declare_field( stk::topology::EDGE_RANK, "mass_flow_rate")); stk::mesh::put_field_on_mesh(*massFlowRate_, selector, nullptr); } @@ -271,8 +268,8 @@ VolumeOfFluidEquationSystem::register_inflow_bc( stk::mesh::MetaData& meta_data = realm_.meta_data(); // register boundary data; gamma_bc - ScalarFieldType* theBcField = - &(meta_data.declare_field(stk::topology::NODE_RANK, "vof_bc")); + ScalarFieldType* theBcField = &(meta_data.declare_field( + stk::topology::NODE_RANK, "vof_bc")); stk::mesh::put_field_on_mesh(*theBcField, *part, nullptr); // extract the value for user specified tke and save off the AuxFunction @@ -487,8 +484,9 @@ VolumeOfFluidEquationSystem::register_initial_condition_fcn( TurbulenceModel::SST_AMS) ? true : false; - ScalarFieldType* density_ = realm_.meta_data().get_field( - stk::topology::NODE_RANK, "density"); + ScalarFieldType* density_ = + realm_.meta_data().get_field( + stk::topology::NODE_RANK, "density"); std::vector userSpec(1); userSpec[0] = 1.0; AuxFunction* constantAuxFunc = new ConstantAuxFunction(0, 1, userSpec); @@ -507,8 +505,9 @@ VolumeOfFluidEquationSystem::register_initial_condition_fcn( TurbulenceModel::SST_AMS) ? true : false; - ScalarFieldType* density_ = realm_.meta_data().get_field( - stk::topology::NODE_RANK, "density"); + ScalarFieldType* density_ = + realm_.meta_data().get_field( + stk::topology::NODE_RANK, "density"); std::vector userSpec(1); userSpec[0] = 1.0; AuxFunction* constantAuxFunc = new ConstantAuxFunction(0, 1, userSpec); diff --git a/src/WallDistEquationSystem.C b/src/WallDistEquationSystem.C index 2f08ac3b3..1a72feec1 100644 --- a/src/WallDistEquationSystem.C +++ b/src/WallDistEquationSystem.C @@ -59,7 +59,6 @@ #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldParallel.hpp" #include "stk_topology/topology.hpp" -#include "stk_io/IossBridge.hpp" #include @@ -68,7 +67,7 @@ namespace nalu { WallDistEquationSystem::WallDistEquationSystem(EquationSystems& eqSystems) : EquationSystem(eqSystems, "WallDistEQS", "ndtw"), - nodalGradAlgDriver_(realm_, "ndtw", "dwalldistdx"), + nodalGradAlgDriver_(realm_, "dwalldistdx"), managePNG_(realm_.get_consistent_mass_matrix_png("ndtw")) { if (managePNG_) @@ -120,28 +119,25 @@ WallDistEquationSystem::register_nodal_fields( const int nDim = meta.spatial_dimension(); stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); - wallDistPhi_ = &( - meta.declare_field(stk::topology::NODE_RANK, "wall_distance_phi")); + wallDistPhi_ = &(meta.declare_field( + stk::topology::NODE_RANK, "wall_distance_phi")); stk::mesh::put_field_on_mesh(*wallDistPhi_, selector, nullptr); - dphidx_ = - &(meta.declare_field(stk::topology::NODE_RANK, "dwalldistdx")); + dphidx_ = &(meta.declare_field( + stk::topology::NODE_RANK, "dwalldistdx")); stk::mesh::put_field_on_mesh(*dphidx_, selector, nDim, nullptr); - stk::io::set_field_output_type(*dphidx_, stk::io::FieldOutputType::VECTOR_3D); - wallDistance_ = &(meta.declare_field( + wallDistance_ = &(meta.declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")); stk::mesh::put_field_on_mesh(*wallDistance_, selector, nullptr); - coordinates_ = &(meta.declare_field( + coordinates_ = &(meta.declare_field( stk::topology::NODE_RANK, realm_.get_coordinates_name())); stk::mesh::put_field_on_mesh(*coordinates_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *coordinates_, stk::io::FieldOutputType::VECTOR_3D); const int numVolStates = realm_.does_mesh_move() ? realm_.number_of_states() : 1; - dualNodalVolume_ = &(meta.declare_field( + dualNodalVolume_ = &(meta.declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", numVolStates)); stk::mesh::put_field_on_mesh(*dualNodalVolume_, selector, nullptr); } @@ -155,11 +151,9 @@ WallDistEquationSystem::register_edge_fields( if (realm_.realmUsesEdges_) { const int nDim = meta.spatial_dimension(); - edgeAreaVec_ = &( - meta.declare_field(stk::topology::EDGE_RANK, "edge_area_vector")); + edgeAreaVec_ = &(meta.declare_field( + stk::topology::EDGE_RANK, "edge_area_vector")); stk::mesh::put_field_on_mesh(*edgeAreaVec_, selector, nDim, nullptr); - stk::io::set_field_output_type( - *edgeAreaVec_, stk::io::FieldOutputType::VECTOR_3D); } } @@ -170,9 +164,9 @@ WallDistEquationSystem::register_element_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); if (realm_.query_for_overset()) { auto& meta = realm_.meta_data(); - GenericFieldType& intersectedElement = meta.declare_field( + GenericFieldType& intersectedElement = meta.declare_field( stk::topology::ELEMENT_RANK, "intersected_element"); - stk::mesh::put_field_on_mesh(intersectedElement, selector, nullptr); + stk::mesh::put_field_on_mesh(intersectedElement, selector, 1, nullptr); } } @@ -278,7 +272,7 @@ WallDistEquationSystem::register_wall_bc( algType, part, "nodal_grad", &wPhiNp1, &dPhiDxNone, edgeNodalGradient_); auto& meta = realm_.meta_data(); - ScalarFieldType& theBCField = meta.declare_field( + ScalarFieldType& theBCField = meta.declare_field( stk::topology::NODE_RANK, "wall_distance_phi_bc"); stk::mesh::put_field_on_mesh(theBCField, *part, nullptr); std::vector userSpec(1, 0.0); diff --git a/src/WilcoxKOmegaEquationSystem.C b/src/WilcoxKOmegaEquationSystem.C index 32a116544..3732f01a0 100644 --- a/src/WilcoxKOmegaEquationSystem.C +++ b/src/WilcoxKOmegaEquationSystem.C @@ -120,15 +120,15 @@ WilcoxKOmegaEquationSystem::register_nodal_fields( stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); // re-register tke and sdr for convenience - tke_ = &(meta_data.declare_field( + tke_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "turbulent_ke", numStates)); stk::mesh::put_field_on_mesh(*tke_, selector, nullptr); - sdr_ = &(meta_data.declare_field( + sdr_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate", numStates)); stk::mesh::put_field_on_mesh(*sdr_, selector, nullptr); // SST parameters that everyone needs - minDistanceToWall_ = &(meta_data.declare_field( + minDistanceToWall_ = &(meta_data.declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")); stk::mesh::put_field_on_mesh(*minDistanceToWall_, selector, nullptr); @@ -162,14 +162,14 @@ WilcoxKOmegaEquationSystem::register_wall_bc( wallBcPart_.push_back(part); auto& meta = realm_.meta_data(); - auto& assembledWallArea = meta.declare_field( + auto& assembledWallArea = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_area_wf"); stk::mesh::put_field_on_mesh(assembledWallArea, *part, nullptr); - auto& assembledWallNormDist = meta.declare_field( + auto& assembledWallNormDist = meta.declare_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance"); stk::mesh::put_field_on_mesh(assembledWallNormDist, *part, nullptr); - auto& wallNormDistBip = - meta.declare_field(meta.side_rank(), "wall_normal_distance_bip"); + auto& wallNormDistBip = meta.declare_field( + meta.side_rank(), "wall_normal_distance_bip"); auto* meFC = MasterElementRepo::get_surface_master_element_on_host(partTopo); const int numScsBip = meFC->num_integration_points(); stk::mesh::put_field_on_mesh(wallNormDistBip, *part, numScsBip, nullptr); @@ -261,8 +261,10 @@ WilcoxKOmegaEquationSystem::post_external_data_transfer_work() auto interior_sel = owned_and_shared & stk::mesh::selectField(*sdr_); clip_ko(ngpMesh, interior_sel, tkeNp1, sdrNp1); - auto sdrBCField = meta.get_field(stk::topology::NODE_RANK, "sdr_bc"); - auto tkeBCField = meta.get_field(stk::topology::NODE_RANK, "tke_bc"); + auto sdrBCField = + meta.get_field(stk::topology::NODE_RANK, "sdr_bc"); + auto tkeBCField = + meta.get_field(stk::topology::NODE_RANK, "tke_bc"); if (sdrBCField != nullptr) { ThrowRequire(tkeBCField); auto bc_sel = owned_and_shared & stk::mesh::selectField(*sdrBCField); @@ -293,8 +295,8 @@ WilcoxKOmegaEquationSystem::update_and_clip() const auto& wTmp = fieldMgr.get_field(sdrEqSys_->wTmp_->mesh_meta_data_ordinal()); - auto* turbViscosity = - meta.get_field(stk::topology::NODE_RANK, "turbulent_viscosity"); + auto* turbViscosity = meta.get_field( + stk::topology::NODE_RANK, "turbulent_viscosity"); const stk::mesh::Selector sel = (meta.locally_owned_part() | meta.globally_shared_part()) & diff --git a/src/aero/AeroContainer.C b/src/aero/AeroContainer.C index dbefe85f7..ce7f7d73e 100644 --- a/src/aero/AeroContainer.C +++ b/src/aero/AeroContainer.C @@ -13,7 +13,6 @@ #include "aero/fsi/OpenfastFSI.h" #endif #include -#include namespace sierra { namespace nalu { @@ -68,16 +67,12 @@ AeroContainer::register_nodal_fields( if (has_actuators()) { stk::mesh::Selector selector = stk::mesh::selectUnion(part_vec); const int nDim = meta.spatial_dimension(); - VectorFieldType* actuatorSource = &( - meta.declare_field(stk::topology::NODE_RANK, "actuator_source")); - VectorFieldType* actuatorSourceLHS = &(meta.declare_field( + VectorFieldType* actuatorSource = &(meta.declare_field( + stk::topology::NODE_RANK, "actuator_source")); + VectorFieldType* actuatorSourceLHS = &(meta.declare_field( stk::topology::NODE_RANK, "actuator_source_lhs")); stk::mesh::put_field_on_mesh(*actuatorSource, selector, nDim, nullptr); stk::mesh::put_field_on_mesh(*actuatorSourceLHS, selector, nDim, nullptr); - stk::io::set_field_output_type( - *actuatorSource, stk::io::FieldOutputType::VECTOR_3D); - stk::io::set_field_output_type( - *actuatorSourceLHS, stk::io::FieldOutputType::VECTOR_3D); } } diff --git a/src/aero/actuator/ActuatorBulk.C b/src/aero/actuator/ActuatorBulk.C index 69b4c8028..3e1f59988 100644 --- a/src/aero/actuator/ActuatorBulk.C +++ b/src/aero/actuator/ActuatorBulk.C @@ -111,10 +111,10 @@ ActuatorBulk::zero_source_terms(stk::mesh::BulkData& stkBulk) const stk::mesh::MetaData& stkMeta = stkBulk.mesh_meta_data(); - VectorFieldType* actuatorSource = - stkMeta.get_field(stk::topology::NODE_RANK, "actuator_source"); - ScalarFieldType* actuatorSourceLhs = - stkMeta.get_field(stk::topology::NODE_RANK, "actuator_source_lhs"); + VectorFieldType* actuatorSource = stkMeta.get_field( + stk::topology::NODE_RANK, "actuator_source"); + ScalarFieldType* actuatorSourceLhs = stkMeta.get_field( + stk::topology::NODE_RANK, "actuator_source_lhs"); const double zero[3] = {0.0, 0.0, 0.0}; @@ -127,8 +127,8 @@ ActuatorBulk::parallel_sum_source_term(stk::mesh::BulkData& stkBulk) { const stk::mesh::MetaData& stkMeta = stkBulk.mesh_meta_data(); - VectorFieldType* actuatorSource = - stkMeta.get_field(stk::topology::NODE_RANK, "actuator_source"); + VectorFieldType* actuatorSource = stkMeta.get_field( + stk::topology::NODE_RANK, "actuator_source"); stk::mesh::parallel_sum(stkBulk, {actuatorSource}); actuatorSource->modify_on_host(); diff --git a/src/aero/actuator/ActuatorFunctors.C b/src/aero/actuator/ActuatorFunctors.C index ca55f0003..8bc6c17c9 100644 --- a/src/aero/actuator/ActuatorFunctors.C +++ b/src/aero/actuator/ActuatorFunctors.C @@ -19,9 +19,9 @@ InterpActuatorVel::InterpActuatorVel( ActuatorBulk& actBulk, stk::mesh::BulkData& stkBulk) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_(stkBulk_.mesh_meta_data().get_field( + coordinates_(stkBulk_.mesh_meta_data().get_field( stk::topology::NODE_RANK, "coordinates")), - velocity_(stkBulk_.mesh_meta_data().get_field( + velocity_(stkBulk_.mesh_meta_data().get_field( stk::topology::NODE_RANK, "velocity")) { velocity_->sync_to_host(); diff --git a/src/aero/actuator/ActuatorFunctorsSimple.C b/src/aero/actuator/ActuatorFunctorsSimple.C index 0b9835412..8914089f0 100644 --- a/src/aero/actuator/ActuatorFunctorsSimple.C +++ b/src/aero/actuator/ActuatorFunctorsSimple.C @@ -25,9 +25,9 @@ InterpActuatorDensity::InterpActuatorDensity( ActuatorBulkSimple& actBulk, stk::mesh::BulkData& stkBulk) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_(stkBulk_.mesh_meta_data().get_field( + coordinates_(stkBulk_.mesh_meta_data().get_field( stk::topology::NODE_RANK, "coordinates")), - density_(stkBulk_.mesh_meta_data().get_field( + density_(stkBulk_.mesh_meta_data().get_field( stk::topology::NODE_RANK, "density")) { actBulk_.density_.sync_host(); diff --git a/src/aero/actuator/ActuatorSearch.C b/src/aero/actuator/ActuatorSearch.C index 168f4aee1..6b20fc383 100644 --- a/src/aero/actuator/ActuatorSearch.C +++ b/src/aero/actuator/ActuatorSearch.C @@ -49,7 +49,7 @@ CreateElementBoxes( // fields VectorFieldType* coordinates = - stkMeta.get_field(stk::topology::NODE_RANK, "coordinates"); + stkMeta.get_field(stk::topology::NODE_RANK, "coordinates"); // point data structures Point minCorner, maxCorner; @@ -167,7 +167,7 @@ ExecuteFineSearch( // extract fields stk::mesh::MetaData& stkMeta = stkBulk.mesh_meta_data(); VectorFieldType* coordinates = - stkMeta.get_field(stk::topology::NODE_RANK, "coordinates"); + stkMeta.get_field(stk::topology::NODE_RANK, "coordinates"); for (unsigned i = 0; i < isLocalPoint.extent(0); i++) { isLocalPoint(i) = false; diff --git a/src/aero/fsi/CalcLoads.C b/src/aero/fsi/CalcLoads.C index 0119860d3..e6c8c518b 100644 --- a/src/aero/fsi/CalcLoads.C +++ b/src/aero/fsi/CalcLoads.C @@ -66,21 +66,24 @@ CalcLoads::initialize() { auto& meta = bulk_->mesh_meta_data(); - coordinates_ = - meta.get_field(stk::topology::NODE_RANK, "current_coordinates"); - pressure_ = meta.get_field(stk::topology::NODE_RANK, "pressure"); - density_ = meta.get_field(stk::topology::NODE_RANK, "density"); - viscosity_ = - meta.get_field(stk::topology::NODE_RANK, "effective_viscosity_u"); + coordinates_ = meta.get_field( + stk::topology::NODE_RANK, "current_coordinates"); + pressure_ = + meta.get_field(stk::topology::NODE_RANK, "pressure"); + density_ = + meta.get_field(stk::topology::NODE_RANK, "density"); + viscosity_ = meta.get_field( + stk::topology::NODE_RANK, "effective_viscosity_u"); if (viscosity_ == nullptr) { - viscosity_ = meta.get_field(stk::topology::NODE_RANK, "viscosity"); + viscosity_ = + meta.get_field(stk::topology::NODE_RANK, "viscosity"); } - dudx_ = meta.get_field(stk::topology::NODE_RANK, "dudx"); + dudx_ = meta.get_field(stk::topology::NODE_RANK, "dudx"); exposedAreaVec_ = - meta.get_field(meta.side_rank(), "exposed_area_vector"); - tforceSCS_ = meta.get_field(meta.side_rank(), "tforce_scs"); + meta.get_field(meta.side_rank(), "exposed_area_vector"); + tforceSCS_ = meta.get_field(meta.side_rank(), "tforce_scs"); } //-------------------------------------------------------------------------- //-------- destructor ------------------------------------------------------ diff --git a/src/aero/fsi/FSIturbine.C b/src/aero/fsi/FSIturbine.C index 72b27de7f..f49dd20b5 100644 --- a/src/aero/fsi/FSIturbine.C +++ b/src/aero/fsi/FSIturbine.C @@ -198,9 +198,9 @@ fsiTurbine::populateParts( allPartVec.push_back(part); } - stk::mesh::put_field_on_mesh(*dispMap_, *part, nullptr); - stk::mesh::put_field_on_mesh(*dispMapInterp_, *part, nullptr); - stk::mesh::put_field_on_mesh(*deflectionRamp_, *part, nullptr); + stk::mesh::put_field_on_mesh(*dispMap_, *part, 1, nullptr); + stk::mesh::put_field_on_mesh(*dispMapInterp_, *part, 1, nullptr); + stk::mesh::put_field_on_mesh(*deflectionRamp_, *part, 1, nullptr); } } @@ -247,53 +247,59 @@ fsiTurbine::setup(std::shared_ptr bulk) bulk_ = bulk; auto& meta = bulk_->mesh_meta_data(); - deflectionRamp_ = - meta.get_field(stk::topology::NODE_RANK, "deflection_ramp"); + deflectionRamp_ = meta.get_field( + stk::topology::NODE_RANK, "deflection_ramp"); if (deflectionRamp_ == NULL) - deflectionRamp_ = &( - meta.declare_field(stk::topology::NODE_RANK, "deflection_ramp")); + deflectionRamp_ = &(meta.declare_field( + stk::topology::NODE_RANK, "deflection_ramp")); - dispMap_ = meta.get_field(stk::topology::NODE_RANK, "disp_map"); + dispMap_ = + meta.get_field(stk::topology::NODE_RANK, "disp_map"); if (dispMap_ == NULL) - dispMap_ = &(meta.declare_field(stk::topology::NODE_RANK, "disp_map")); + dispMap_ = &(meta.declare_field( + stk::topology::NODE_RANK, "disp_map")); - dispMapInterp_ = - meta.get_field(stk::topology::NODE_RANK, "disp_map_interp"); + dispMapInterp_ = meta.get_field( + stk::topology::NODE_RANK, "disp_map_interp"); if (dispMapInterp_ == NULL) - dispMapInterp_ = &( - meta.declare_field(stk::topology::NODE_RANK, "disp_map_interp")); + dispMapInterp_ = &(meta.declare_field( + stk::topology::NODE_RANK, "disp_map_interp")); - loadMap_ = meta.get_field(meta.side_rank(), "load_map"); + loadMap_ = meta.get_field(meta.side_rank(), "load_map"); if (loadMap_ == NULL) - loadMap_ = &(meta.declare_field(meta.side_rank(), "load_map")); + loadMap_ = + &(meta.declare_field(meta.side_rank(), "load_map")); - loadMapInterp_ = meta.get_field(meta.side_rank(), "load_map_interp"); + loadMapInterp_ = + meta.get_field(meta.side_rank(), "load_map_interp"); if (loadMapInterp_ == NULL) - loadMapInterp_ = - &(meta.declare_field(meta.side_rank(), "load_map_interp")); + loadMapInterp_ = &(meta.declare_field( + meta.side_rank(), "load_map_interp")); - tforceSCS_ = meta.get_field(meta.side_rank(), "tforce_scs"); + tforceSCS_ = meta.get_field(meta.side_rank(), "tforce_scs"); if (tforceSCS_ == NULL) - tforceSCS_ = &(meta.declare_field(meta.side_rank(), "tforce_scs")); + tforceSCS_ = + &(meta.declare_field(meta.side_rank(), "tforce_scs")); - VectorFieldType* mesh_disp_ref = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement_ref"); + VectorFieldType* mesh_disp_ref = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement_ref"); if (mesh_disp_ref == NULL) - mesh_disp_ref = &(meta.declare_field( + mesh_disp_ref = &(meta.declare_field( stk::topology::NODE_RANK, "mesh_displacement_ref")); - VectorFieldType* mesh_vel_ref = - meta.get_field(stk::topology::NODE_RANK, "mesh_velocity_ref"); + VectorFieldType* mesh_vel_ref = meta.get_field( + stk::topology::NODE_RANK, "mesh_velocity_ref"); if (mesh_vel_ref == NULL) - mesh_vel_ref = &(meta.declare_field( + mesh_vel_ref = &(meta.declare_field( stk::topology::NODE_RANK, "mesh_velocity_ref")); - ScalarFieldType* div_mesh_vel = - meta.get_field(stk::topology::NODE_RANK, "div_mesh_velocity"); + ScalarFieldType* div_mesh_vel = meta.get_field( + stk::topology::NODE_RANK, "div_mesh_velocity"); if (div_mesh_vel == NULL) - div_mesh_vel = &(meta.declare_field( + div_mesh_vel = &(meta.declare_field( stk::topology::NODE_RANK, "div_mesh_velocity")); - stk::mesh::put_field_on_mesh(*div_mesh_vel, meta.universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *div_mesh_vel, meta.universal_part(), 1, nullptr); populateParts(twrPartNames_, twrParts_, partVec_, "Tower"); populateParts(nacellePartNames_, nacelleParts_, partVec_, "Nacelle"); @@ -911,9 +917,9 @@ fsiTurbine::mapLoads() auto& meta = bulk_->mesh_meta_data(); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); - const VectorFieldType* meshDisp = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); + const VectorFieldType* meshDisp = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement"); // syncs done inside functions fsi::mapTowerLoad( @@ -944,15 +950,15 @@ fsiTurbine::computeHubForceMomentForPart( auto& meta = bulk_->mesh_meta_data(); VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); modelCoords->sync_to_host(); - VectorFieldType* meshDisp = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement"); + VectorFieldType* meshDisp = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement"); meshDisp->sync_to_host(); GenericFieldType* tforce = - meta.get_field(meta.side_rank(), "tforce_scs"); + meta.get_field(meta.side_rank(), "tforce_scs"); tforce->sync_to_host(); std::vector l_hubForceMoment(6, 0.0); @@ -1232,11 +1238,11 @@ fsiTurbine::setRefDisplacement(double curTime) auto& meta = bulk_->mesh_meta_data(); const int ndim = meta.spatial_dimension(); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); - VectorFieldType* refDisp = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement_ref"); - VectorFieldType* refVel = - meta.get_field(stk::topology::NODE_RANK, "mesh_velocity_ref"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* refDisp = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement_ref"); + VectorFieldType* refVel = meta.get_field( + stk::topology::NODE_RANK, "mesh_velocity_ref"); modelCoords->sync_to_host(); refDisp->sync_to_host(); @@ -1371,14 +1377,14 @@ fsiTurbine::mapDisplacements(double time) auto& meta = bulk_->mesh_meta_data(); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); - VectorFieldType* curCoords = - meta.get_field(stk::topology::NODE_RANK, "current_coordinates"); - VectorFieldType* displacement = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* curCoords = meta.get_field( + stk::topology::NODE_RANK, "current_coordinates"); + VectorFieldType* displacement = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement"); VectorFieldType* meshVelocity = - meta.get_field(stk::topology::NODE_RANK, "mesh_velocity"); + meta.get_field(stk::topology::NODE_RANK, "mesh_velocity"); modelCoords->sync_to_host(); curCoords->sync_to_host(); @@ -1656,7 +1662,7 @@ fsiTurbine::computeMapping() const int ndim = meta.spatial_dimension(); ThrowRequireMsg(ndim == 3, "fsiTurbine: spatial dim is required to be 3."); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); modelCoords->sync_to_host(); dispMap_->clear_sync_state(); dispMapInterp_->clear_sync_state(); @@ -1841,7 +1847,7 @@ fsiTurbine::computeLoadMapping() auto& meta = bulk_->mesh_meta_data(); const int ndim = meta.spatial_dimension(); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); modelCoords->sync_to_host(); loadMap_->clear_sync_state(); @@ -2120,11 +2126,11 @@ fsiTurbine::compute_div_mesh_velocity() auto& meta = bulk_->mesh_meta_data(); - ScalarFieldType* divMeshVel = - meta.get_field(stk::topology::NODE_RANK, "div_mesh_velocity"); + ScalarFieldType* divMeshVel = meta.get_field( + stk::topology::NODE_RANK, "div_mesh_velocity"); - GenericFieldType* faceVelMag = - meta.get_field(stk::topology::EDGE_RANK, "edge_face_velocity_mag"); + GenericFieldType* faceVelMag = meta.get_field( + stk::topology::EDGE_RANK, "edge_face_velocity_mag"); // syncs are done inside this function compute_edge_scalar_divergence( diff --git a/src/aero/fsi/OpenfastFSI.C b/src/aero/fsi/OpenfastFSI.C index 38ed14a69..9a6a882a4 100644 --- a/src/aero/fsi/OpenfastFSI.C +++ b/src/aero/fsi/OpenfastFSI.C @@ -242,10 +242,10 @@ OpenfastFSI::initialize(int restartFreqNalu, double curTime) auto& meta = bulk_->mesh_meta_data(); - const VectorFieldType* meshDisp = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement"); - const VectorFieldType* meshVel = - meta.get_field(stk::topology::NODE_RANK, "mesh_velocity"); + const VectorFieldType* meshDisp = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement"); + const VectorFieldType* meshVel = meta.get_field( + stk::topology::NODE_RANK, "mesh_velocity"); const VectorFieldType* meshDispNp1 = &(meshDisp->field_of_state(stk::mesh::StateNP1)); @@ -607,11 +607,11 @@ OpenfastFSI::map_displacements(double current_time, bool updateCurCoor) if (updateCurCoor) { auto& meta = bulk_->mesh_meta_data(); const VectorFieldType* modelCoords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); - VectorFieldType* curCoords = - meta.get_field(stk::topology::NODE_RANK, "current_coordinates"); - VectorFieldType* displacement = - meta.get_field(stk::topology::NODE_RANK, "mesh_displacement"); + meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* curCoords = meta.get_field( + stk::topology::NODE_RANK, "current_coordinates"); + VectorFieldType* displacement = meta.get_field( + stk::topology::NODE_RANK, "mesh_displacement"); modelCoords->sync_to_host(); curCoords->sync_to_host(); diff --git a/src/edge_kernels/MomentumEdgePecletAlg.C b/src/edge_kernels/MomentumEdgePecletAlg.C index 1c68d2a8a..d046901cf 100644 --- a/src/edge_kernels/MomentumEdgePecletAlg.C +++ b/src/edge_kernels/MomentumEdgePecletAlg.C @@ -105,10 +105,10 @@ void determine_max_peclet_factor( stk::mesh::BulkData& bulk, const stk::mesh::MetaData& meta) { - ScalarFieldType* maxPecFac = - meta.get_field(stk::topology::NODE_RANK, "max_peclet_factor"); + ScalarFieldType* maxPecFac = meta.get_field( + stk::topology::NODE_RANK, "max_peclet_factor"); ScalarFieldType* pecletFactor = - meta.get_field(stk::topology::EDGE_RANK, "peclet_factor"); + meta.get_field(stk::topology::EDGE_RANK, "peclet_factor"); stk::mesh::field_fill(0.0, *maxPecFac); @@ -135,10 +135,10 @@ void determine_max_peclet_number( stk::mesh::BulkData& bulk, const stk::mesh::MetaData& meta) { - ScalarFieldType* maxPecNum = - meta.get_field(stk::topology::NODE_RANK, "max_peclet_number"); + ScalarFieldType* maxPecNum = meta.get_field( + stk::topology::NODE_RANK, "max_peclet_number"); ScalarFieldType* pecletNumber = - meta.get_field(stk::topology::EDGE_RANK, "peclet_number"); + meta.get_field(stk::topology::EDGE_RANK, "peclet_number"); stk::mesh::field_fill(0.0, *maxPecNum); diff --git a/src/gcl/MeshVelocityAlg.C b/src/gcl/MeshVelocityAlg.C index 947595c73..36fa64869 100644 --- a/src/gcl/MeshVelocityAlg.C +++ b/src/gcl/MeshVelocityAlg.C @@ -12,6 +12,7 @@ #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" #include "master_element/Hex8GeometryFunctions.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "Realm.h" diff --git a/src/gcl/MeshVelocityEdgeAlg.C b/src/gcl/MeshVelocityEdgeAlg.C index ae7794763..39d715ebd 100644 --- a/src/gcl/MeshVelocityEdgeAlg.C +++ b/src/gcl/MeshVelocityEdgeAlg.C @@ -12,6 +12,7 @@ #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" #include "master_element/Hex8GeometryFunctions.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "Realm.h" diff --git a/src/mesh_motion/FrameBase.C b/src/mesh_motion/FrameBase.C index 00b05d1e6..a303a78ff 100644 --- a/src/mesh_motion/FrameBase.C +++ b/src/mesh_motion/FrameBase.C @@ -178,7 +178,7 @@ FrameBase::compute_centroid_on_parts(mm::ThreeDVecType& centroid) // get the field from the NGP mesh stk::mesh::NgpField modelCoords = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "coordinates")); + *meta_.get_field(entityRank, "coordinates")); // sync fields to device modelCoords.sync_to_device(); diff --git a/src/mesh_motion/FrameMoving.C b/src/mesh_motion/FrameMoving.C index 784cac92b..88250ac2a 100644 --- a/src/mesh_motion/FrameMoving.C +++ b/src/mesh_motion/FrameMoving.C @@ -34,16 +34,16 @@ FrameMoving::update_coordinates_velocity(const double time) // get the field from the NGP mesh stk::mesh::NgpField modelCoords = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "coordinates")); + *meta_.get_field(entityRank, "coordinates")); stk::mesh::NgpField currCoords = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "current_coordinates")); + *meta_.get_field(entityRank, "current_coordinates")); stk::mesh::NgpField displacement = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "mesh_displacement")); + *meta_.get_field(entityRank, "mesh_displacement")); stk::mesh::NgpField meshVelocity = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "mesh_velocity")); + *meta_.get_field(entityRank, "mesh_velocity")); // sync fields to device modelCoords.sync_to_device(); @@ -132,13 +132,13 @@ FrameMoving::post_compute_geometry() continue; // compute divergence of mesh velocity - ScalarFieldType* meshDivVelocity = - meta_.get_field(stk::topology::NODE_RANK, "div_mesh_velocity"); - GenericFieldType* faceVelMag = - meta_.get_field(stk::topology::ELEMENT_RANK, "face_velocity_mag"); + ScalarFieldType* meshDivVelocity = meta_.get_field( + stk::topology::NODE_RANK, "div_mesh_velocity"); + GenericFieldType* faceVelMag = meta_.get_field( + stk::topology::ELEMENT_RANK, "face_velocity_mag"); if (faceVelMag == NULL) { - faceVelMag = meta_.get_field( + faceVelMag = meta_.get_field( stk::topology::EDGE_RANK, "edge_face_velocity_mag"); compute_edge_scalar_divergence( bulk_, partVec_, partVecBc_, faceVelMag, meshDivVelocity); diff --git a/src/mesh_motion/FrameReference.C b/src/mesh_motion/FrameReference.C index 953c1e4f8..f12beaae5 100644 --- a/src/mesh_motion/FrameReference.C +++ b/src/mesh_motion/FrameReference.C @@ -28,7 +28,7 @@ FrameReference::update_coordinates(const double time) // get the field from the NGP mesh stk::mesh::NgpField modelCoords = stk::mesh::get_updated_ngp_field( - *meta_.get_field(entityRank, "coordinates")); + *meta_.get_field(entityRank, "coordinates")); // sync fields to device modelCoords.sync_to_device(); diff --git a/src/mesh_motion/MotionDeformingInteriorKernel.C b/src/mesh_motion/MotionDeformingInteriorKernel.C index 6869ad208..54c88f8be 100644 --- a/src/mesh_motion/MotionDeformingInteriorKernel.C +++ b/src/mesh_motion/MotionDeformingInteriorKernel.C @@ -19,8 +19,8 @@ MotionDeformingInteriorKernel::MotionDeformingInteriorKernel( // declare divergence of mesh velocity for this motion isDeforming_ = true; - ScalarFieldType* divV = &( - meta.declare_field(stk::topology::NODE_RANK, "div_mesh_velocity")); + ScalarFieldType* divV = &(meta.declare_field( + stk::topology::NODE_RANK, "div_mesh_velocity")); stk::mesh::put_field_on_mesh(*divV, meta.universal_part(), nullptr); stk::mesh::field_fill(0.0, *divV); } diff --git a/src/mesh_motion/MotionScalingKernel.C b/src/mesh_motion/MotionScalingKernel.C index a422b1b5e..d96d58026 100644 --- a/src/mesh_motion/MotionScalingKernel.C +++ b/src/mesh_motion/MotionScalingKernel.C @@ -20,7 +20,7 @@ MotionScalingKernel::MotionScalingKernel( if (useRate_) { // declare divergence of mesh velocity for this motion isDeforming_ = true; - ScalarFieldType* divV = &(meta.declare_field( + ScalarFieldType* divV = &(meta.declare_field( stk::topology::NODE_RANK, "div_mesh_velocity")); stk::mesh::put_field_on_mesh(*divV, meta.universal_part(), nullptr); stk::mesh::field_fill(0.0, *divV); diff --git a/src/mesh_motion/MotionWavesKernel.C b/src/mesh_motion/MotionWavesKernel.C index 2706b2da3..c6542abfb 100644 --- a/src/mesh_motion/MotionWavesKernel.C +++ b/src/mesh_motion/MotionWavesKernel.C @@ -17,8 +17,8 @@ MotionWavesKernel::MotionWavesKernel( // declare divergence of mesh velocity for this motion isDeforming_ = true; - ScalarFieldType* divV = &( - meta.declare_field(stk::topology::NODE_RANK, "div_mesh_velocity")); + ScalarFieldType* divV = &(meta.declare_field( + stk::topology::NODE_RANK, "div_mesh_velocity")); stk::mesh::put_field_on_mesh(*divV, meta.universal_part(), nullptr); } diff --git a/src/mesh_motion/TurbineSurrogateKernel.C b/src/mesh_motion/TurbineSurrogateKernel.C index fbbc9c7d8..4dcd88e60 100644 --- a/src/mesh_motion/TurbineSurrogateKernel.C +++ b/src/mesh_motion/TurbineSurrogateKernel.C @@ -17,8 +17,8 @@ TurbineSurrogateKernel::TurbineSurrogateKernel( // declare divergence of mesh velocity for this motion isDeforming_ = true; - ScalarFieldType* divV = &( - meta.declare_field(stk::topology::NODE_RANK, "div_mesh_velocity")); + ScalarFieldType* divV = &(meta.declare_field( + stk::topology::NODE_RANK, "div_mesh_velocity")); stk::mesh::put_field_on_mesh(*divV, meta.universal_part(), nullptr); stk::mesh::field_fill(0.0, *divV); } diff --git a/src/ngp_algorithms/CourantReAlg.C b/src/ngp_algorithms/CourantReAlg.C index 4f619ef8f..9819ac62b 100644 --- a/src/ngp_algorithms/CourantReAlg.C +++ b/src/ngp_algorithms/CourantReAlg.C @@ -13,6 +13,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_algorithms/CourantReAlgDriver.h" #include "ngp_algorithms/CourantReReduceHelper.h" #include "ngp_utils/NgpLoopUtils.h" diff --git a/src/ngp_algorithms/FieldUpdateAlgDriver.C b/src/ngp_algorithms/FieldUpdateAlgDriver.C index 30192da3b..ff23df5b1 100644 --- a/src/ngp_algorithms/FieldUpdateAlgDriver.C +++ b/src/ngp_algorithms/FieldUpdateAlgDriver.C @@ -35,7 +35,7 @@ FieldUpdateAlgDriver::pre_work() auto field = fieldMgr.get_field(get_field_ordinal(meta, fieldName_)); auto* nonngpField = - meta.get_field(stk::topology::NODE_RANK, fieldName_); + meta.get_field(stk::topology::NODE_RANK, fieldName_); stk::mesh::field_fill(0.0, *nonngpField); field.set_all(ngpMesh, 0.0); diff --git a/src/ngp_algorithms/GeometryAlgDriver.C b/src/ngp_algorithms/GeometryAlgDriver.C index e9a810bf8..3e389ea4f 100644 --- a/src/ngp_algorithms/GeometryAlgDriver.C +++ b/src/ngp_algorithms/GeometryAlgDriver.C @@ -37,7 +37,7 @@ compute_volume_stats(Realm& realm, double* gVolStats) const auto& meshInfo = realm.mesh_info(); const auto& meta = meshInfo.meta(); - auto* dualVol = meta.template get_field( + auto* dualVol = meta.template get_field( stk::topology::NODE_RANK, "dual_nodal_volume"); const auto& ngpMesh = meshInfo.ngp_mesh(); const auto& fieldMgr = meshInfo.ngp_field_manager(); @@ -89,7 +89,7 @@ void GeometryAlgDriver::pre_work() { const auto& meta = realm_.meta_data(); - auto* dualVol = meta.template get_field( + auto* dualVol = meta.template get_field( stk::topology::NODE_RANK, "dual_nodal_volume"); stk::mesh::field_fill(0.0, *dualVol); @@ -107,7 +107,7 @@ GeometryAlgDriver::pre_work() mesh_motion_prework(); if (realm_.realmUsesEdges_) { - auto* edgeAreaVec = meta.template get_field( + auto* edgeAreaVec = meta.template get_field( stk::topology::EDGE_RANK, "edge_area_vector"); stk::mesh::field_fill(0.0, *edgeAreaVec); @@ -149,7 +149,7 @@ GeometryAlgDriver::mesh_motion_prework() ngpFaceVelMag.clear_sync_state(); ngpFaceVelMag.set_all(ngpMesh, 0.0); - auto* faceVelMag = meta.get_field(entityRank, fvmFieldName); + auto* faceVelMag = meta.get_field(entityRank, fvmFieldName); stk::mesh::field_fill(0.0, *faceVelMag); const std::string svFieldName = realm_.realmUsesEdges_ ? "edge_swept_face_volume" : "swept_face_volume"; @@ -160,7 +160,7 @@ GeometryAlgDriver::mesh_motion_prework() ngpSweptVol.clear_sync_state(); ngpSweptVol.set_all(ngpMesh, 0.0); - auto* sweptVol = meta.get_field(entityRank, svFieldName); + auto* sweptVol = meta.get_field(entityRank, svFieldName); stk::mesh::field_fill(0.0, *sweptVol); ngpSweptVol.sync_to_device(); @@ -172,7 +172,7 @@ GeometryAlgDriver::mesh_motion_prework() realm_.mesh_info(), "edge_swept_face_volume", stk::mesh::StateN, stk::topology::EDGE_RANK); - auto* sweptVolEdge = meta.template get_field( + auto* sweptVolEdge = meta.template get_field( stk::topology::EDGE_RANK, "edge_swept_face_volume"); const stk::mesh::Selector sel = stk::mesh::selectField(*sweptVolEdge) & meta.locally_owned_part(); @@ -234,7 +234,7 @@ GeometryAlgDriver::post_work() if (realm_.hasPeriodic_) { const auto& meta = realm_.meta_data(); const unsigned nComponents = 1; - auto* dualVol = meta.template get_field( + auto* dualVol = meta.template get_field( stk::topology::NODE_RANK, "dual_nodal_volume"); realm_.periodic_field_update(dualVol, nComponents); diff --git a/src/ngp_algorithms/GeometryBoundaryAlg.C b/src/ngp_algorithms/GeometryBoundaryAlg.C index d5a305a75..2371c3dba 100644 --- a/src/ngp_algorithms/GeometryBoundaryAlg.C +++ b/src/ngp_algorithms/GeometryBoundaryAlg.C @@ -11,6 +11,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "ngp_utils/NgpFieldManager.h" diff --git a/src/ngp_algorithms/GeometryInteriorAlg.C b/src/ngp_algorithms/GeometryInteriorAlg.C index 1144cac3e..4e84cfaf8 100644 --- a/src/ngp_algorithms/GeometryInteriorAlg.C +++ b/src/ngp_algorithms/GeometryInteriorAlg.C @@ -11,6 +11,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "ngp_utils/NgpFieldManager.h" diff --git a/src/ngp_algorithms/MdotAlgDriver.C b/src/ngp_algorithms/MdotAlgDriver.C index aba99f221..3cfa5abd6 100644 --- a/src/ngp_algorithms/MdotAlgDriver.C +++ b/src/ngp_algorithms/MdotAlgDriver.C @@ -95,7 +95,7 @@ MdotAlgDriver::pre_work() // Assume that the presence of "open_mass_flow_rate" means there is at least // one open BC sideset - auto* openMassFlowRate = realm_.meta_data().get_field( + auto* openMassFlowRate = realm_.meta_data().get_field( realm_.meta_data().side_rank(), "open_mass_flow_rate"); hasOpenBC_ = !(openMassFlowRate == nullptr); diff --git a/src/ngp_algorithms/MdotDensityAccumAlg.C b/src/ngp_algorithms/MdotDensityAccumAlg.C index 1fba7291e..e2368c863 100644 --- a/src/ngp_algorithms/MdotDensityAccumAlg.C +++ b/src/ngp_algorithms/MdotDensityAccumAlg.C @@ -11,6 +11,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_algorithms/MdotAlgDriver.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" @@ -85,8 +86,9 @@ MdotDensityAccumAlg::execute() Kokkos::Sum mdotReducer(rhoAcc); const stk::mesh::Selector sel = - stk::mesh::selectField(*realm_.meta_data().template get_field( - stk::topology::NODE_RANK, "density")) & + stk::mesh::selectField( + *realm_.meta_data().template get_field( + stk::topology::NODE_RANK, "density")) & !(realm_.get_inactive_selector()); nalu_ngp::run_elem_par_reduce( diff --git a/src/ngp_algorithms/MetricTensorElemAlg.C b/src/ngp_algorithms/MetricTensorElemAlg.C index 903d18c84..a20158547 100644 --- a/src/ngp_algorithms/MetricTensorElemAlg.C +++ b/src/ngp_algorithms/MetricTensorElemAlg.C @@ -12,6 +12,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "ngp_utils/NgpFieldManager.h" diff --git a/src/ngp_algorithms/NodalGradAlgDriver.C b/src/ngp_algorithms/NodalGradAlgDriver.C index 692eb1b82..f133de5b9 100644 --- a/src/ngp_algorithms/NodalGradAlgDriver.C +++ b/src/ngp_algorithms/NodalGradAlgDriver.C @@ -22,8 +22,8 @@ namespace nalu { template NodalGradAlgDriver::NodalGradAlgDriver( - Realm& realm, const std::string& phiName, const std::string& gradPhiName) - : NgpAlgDriver(realm), phiName_(phiName), gradPhiName_(gradPhiName) + Realm& realm, const std::string& gradPhiName) + : NgpAlgDriver(realm), gradPhiName_(gradPhiName) { } @@ -33,8 +33,8 @@ NodalGradAlgDriver::pre_work() { const auto& meta = realm_.meta_data(); - auto* gradPhi = - meta.template get_field(stk::topology::NODE_RANK, gradPhiName_); + auto* gradPhi = meta.template get_field( + stk::topology::NODE_RANK, gradPhiName_); stk::mesh::field_fill(0.0, *gradPhi); @@ -57,11 +57,8 @@ NodalGradAlgDriver::post_work() const auto& bulk = realm_.bulk_data(); const auto& meshInfo = realm_.mesh_info(); - auto* phi = - meta.template get_field(stk::topology::NODE_RANK, phiName_); - - auto* gradPhi = - meta.template get_field(stk::topology::NODE_RANK, gradPhiName_); + auto* gradPhi = meta.template get_field( + stk::topology::NODE_RANK, gradPhiName_); auto& ngpGradPhi = nalu_ngp::get_ngp_field(meshInfo, gradPhiName_); ngpGradPhi.sync_to_host(); @@ -70,7 +67,7 @@ NodalGradAlgDriver::post_work() stk::mesh::parallel_sum(bulk, fVec, doFinalSyncToDevice); const int dim2 = meta.spatial_dimension(); - const int dim1 = max_extent(*phi, 0); + const int dim1 = std::is_same::value ? 1 : dim2; if (realm_.hasPeriodic_) { realm_.periodic_field_update(gradPhi, dim2 * dim1); @@ -85,6 +82,8 @@ NodalGradAlgDriver::post_work() } template class NodalGradAlgDriver; +template class NodalGradAlgDriver; +template class NodalGradAlgDriver; } // namespace nalu } // namespace sierra diff --git a/src/ngp_algorithms/NodalGradBndryElemAlg.C b/src/ngp_algorithms/NodalGradBndryElemAlg.C index 60207bdad..b0ba724e9 100644 --- a/src/ngp_algorithms/NodalGradBndryElemAlg.C +++ b/src/ngp_algorithms/NodalGradBndryElemAlg.C @@ -12,6 +12,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "ngp_utils/NgpFieldManager.h" @@ -20,23 +21,17 @@ #include "SolutionOptions.h" #include "utils/StkHelpers.h" #include "stk_mesh/base/NgpMesh.hpp" -#include "stk_mesh/base/FieldRestriction.hpp" namespace sierra { namespace nalu { -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> -NodalGradBndryElemAlg:: - NodalGradBndryElemAlg( - Realm& realm, - stk::mesh::Part* part, - PhiType* phi, - GradPhiType* gradPhi, - bool useShifted) +template +NodalGradBndryElemAlg::NodalGradBndryElemAlg( + Realm& realm, + stk::mesh::Part* part, + PhiType* phi, + GradPhiType* gradPhi, + bool useShifted) : Algorithm(realm, part), dataNeeded_(realm.meta_data()), phi_(phi->mesh_meta_data_ordinal()), @@ -46,42 +41,17 @@ NodalGradBndryElemAlg:: realm_.meta_data(), "exposed_area_vector", realm_.meta_data().side_rank())), - phiSize_(max_extent(*phi, 0)), - gradPhiSize_(max_extent(*gradPhi, 0)), useShifted_(useShifted), meFC_( MasterElementRepo::get_surface_master_element_on_dev(AlgTraits::topo_)) { - if (phiSize_ == 1u) { - ThrowRequireMsg( - gradPhiSize_ == AlgTraits::nDim_, - "NodalGradBndryElemAlg called with scalar input field '" - << phi->name() << "' but with non-vector output field '" - << gradPhi->name() << "' of length " << gradPhiSize_ << " (should be " - << AlgTraits::nDim_ << ")"); - } else if (phiSize_ == AlgTraits::nDim_) { - ThrowRequireMsg( - gradPhiSize_ == AlgTraits::nDim_ * AlgTraits::nDim_, - "NodalGradBndryElemAlg called with vector input field '" - << phi->name() << "' but with non-tensor output field '" - << gradPhi->name() << "' of length " << gradPhiSize_ << " (should be " - << AlgTraits::nDim_ * AlgTraits::nDim_ << ")"); - } else { - ThrowErrorMsg( - "NodalGradBndryElemAlg called with an input field '" - << phi->name() - << "' that is not a scalar or a vector. " - "Actual length = " - << phiSize_); - } - dataNeeded_.add_cvfem_face_me(meFC_); const auto coordID = get_field_ordinal( realm_.meta_data(), realm_.solutionOptions_->get_coordinates_name()); dataNeeded_.add_coordinates_field( coordID, AlgTraits::nDim_, CURRENT_COORDINATES); - dataNeeded_.add_gathered_nodal_field(phi_, phiSize_); + dataNeeded_.add_gathered_nodal_field(phi_, NumComp); dataNeeded_.add_gathered_nodal_field(dualNodalVol_, 1); dataNeeded_.add_face_field( exposedAreaVec_, AlgTraits::numFaceIp_, AlgTraits::nDim_); @@ -90,15 +60,14 @@ NodalGradBndryElemAlg:: dataNeeded_.add_master_element_call(shpfcn, CURRENT_COORDINATES); } -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> +template void -NodalGradBndryElemAlg:: - execute() +NodalGradBndryElemAlg::execute() { + using ElemSimdDataType = + sierra::nalu::nalu_ngp::ElemSimdData; + using ViewHelperType = nalu_ngp::ViewHelper; + const auto& meshInfo = realm_.mesh_info(); const auto& meta = meshInfo.meta(); const auto ngpMesh = meshInfo.ngp_mesh(); @@ -112,7 +81,6 @@ NodalGradBndryElemAlg:: const auto dnvID = dualNodalVol_; const auto exposedAreaID = exposedAreaVec_; const auto phiID = phi_; - const auto phiSize = phiSize_; auto* meFC = meFC_; gradPhi.sync_to_device(); @@ -124,7 +92,7 @@ NodalGradBndryElemAlg:: std::to_string(AlgTraits::topo_)); nalu_ngp::run_elem_algorithm( algName, meshInfo, meta.side_rank(), dataNeeded_, sel, - KOKKOS_LAMBDA(typename ViewHelperType::SimdDataType & edata) { + KOKKOS_LAMBDA(ElemSimdDataType & edata) { const int* ipNodeMap = meFC->ipNodeMap(); auto& scrView = edata.simdScrView; @@ -136,7 +104,7 @@ NodalGradBndryElemAlg:: const auto& v_shape_fcn = useShifted ? meViews.fc_shifted_shape_fcn : meViews.fc_shape_fcn; - for (int di = 0; di < phiSize; ++di) { + for (int di = 0; di < NumComp; ++di) { for (int ip = 0; ip < AlgTraits::numFaceIp_; ++ip) { DoubleType qIp = 0.0; for (int n = 0; n < AlgTraits::nodesPerFace_; ++n) { @@ -159,13 +127,11 @@ NodalGradBndryElemAlg:: // NOTE: Can't use BuildTemplates here because of additional template arguments #define INSTANTIATE_ALG(AlgTraits) \ template class NodalGradBndryElemAlg< \ - AlgTraits, ScalarFieldType, VectorFieldType, \ - nalu_ngp::ScalarViewHelper< \ - NodalGradBndryElemSimdDataType, ScalarFieldType>>; \ + AlgTraits, ScalarFieldType, VectorFieldType>; \ + template class NodalGradBndryElemAlg< \ + AlgTraits, VectorFieldType, GenericFieldType>; \ template class NodalGradBndryElemAlg< \ - AlgTraits, VectorFieldType, TensorFieldType, \ - nalu_ngp::VectorViewHelper< \ - NodalGradBndryElemSimdDataType, VectorFieldType>> + AlgTraits, VectorFieldType, TensorFieldType> INSTANTIATE_ALG(AlgTraitsTri3); INSTANTIATE_ALG(AlgTraitsQuad4); diff --git a/src/ngp_algorithms/NodalGradEdgeAlg.C b/src/ngp_algorithms/NodalGradEdgeAlg.C index 7a53cfcf5..bca6dab33 100644 --- a/src/ngp_algorithms/NodalGradEdgeAlg.C +++ b/src/ngp_algorithms/NodalGradEdgeAlg.C @@ -27,32 +27,11 @@ NodalGradEdgeAlg::NodalGradEdgeAlg( edgeAreaVec_(get_field_ordinal( realm_.meta_data(), "edge_area_vector", stk::topology::EDGE_RANK)), dualNodalVol_(get_field_ordinal(realm_.meta_data(), "dual_nodal_volume")), - dim1_(max_extent(*phi, 0)), + dim1_( + std::is_same::value ? 1 + : realm_.spatialDimension_), dim2_(realm_.meta_data().spatial_dimension()) { - const int gradPhiSize = max_extent(*gradPhi, 0); - if (dim1_ == 1) { - ThrowRequireMsg( - gradPhiSize == dim2_, "NodalGradEdgeAlg called with scalar input field '" - << phi->name() - << "' but with non-vector output field '" - << gradPhi->name() << "' of length " - << gradPhiSize << " (should be " << dim2_ << ")"); - } else if (dim1_ == dim2_) { - ThrowRequireMsg( - gradPhiSize == dim2_ * dim2_, - "NodalGradBndryElemAlg called with vector input field '" - << phi->name() << "' but with non-tensor output field '" - << gradPhi->name() << "' of length " << gradPhiSize << " (should be " - << dim2_ * dim2_ << ")"); - } else { - ThrowErrorMsg( - "NodalGradBndryElemAlg called with an input field '" - << phi->name() - << "' that is not a scalar or a vector. " - "Actual length = " - << dim1_); - } } template @@ -111,6 +90,8 @@ NodalGradEdgeAlg::execute() } template class NodalGradEdgeAlg; +template class NodalGradEdgeAlg; +template class NodalGradEdgeAlg; } // namespace nalu } // namespace sierra diff --git a/src/ngp_algorithms/NodalGradElemAlg.C b/src/ngp_algorithms/NodalGradElemAlg.C index bdcd702d4..1d9345e92 100644 --- a/src/ngp_algorithms/NodalGradElemAlg.C +++ b/src/ngp_algorithms/NodalGradElemAlg.C @@ -25,59 +25,29 @@ namespace sierra { namespace nalu { -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> -NodalGradElemAlg:: - NodalGradElemAlg( - Realm& realm, - stk::mesh::Part* part, - PhiType* phi, - GradPhiType* gradPhi, - bool useShifted) +template +NodalGradElemAlg::NodalGradElemAlg( + Realm& realm, + stk::mesh::Part* part, + PhiType* phi, + GradPhiType* gradPhi, + bool useShifted) : Algorithm(realm, part), dataNeeded_(realm.meta_data()), phi_(phi->mesh_meta_data_ordinal()), gradPhi_(gradPhi->mesh_meta_data_ordinal()), dualNodalVol_(get_field_ordinal(realm_.meta_data(), "dual_nodal_volume")), - phiSize_(max_extent(*phi, 0)), - gradPhiSize_(max_extent(*gradPhi, 0)), useShifted_(useShifted), meSCS_( MasterElementRepo::get_surface_master_element_on_dev(AlgTraits::topo_)) { - if (phiSize_ == 1u) { - ThrowRequireMsg( - gradPhiSize_ == AlgTraits::nDim_, - "NodalGradElemAlg called with scalar input field '" - << phi->name() << "' but with non-vector output field '" - << gradPhi->name() << "' of length " << gradPhiSize_ << " (should be " - << AlgTraits::nDim_ << ")"); - } else if (phiSize_ == AlgTraits::nDim_) { - ThrowRequireMsg( - gradPhiSize_ == AlgTraits::nDim_ * AlgTraits::nDim_, - "NodalGradElemAlg called with vector input field '" - << phi->name() << "' but with non-tensor output field '" - << gradPhi->name() << "' of length " << gradPhiSize_ << " (should be " - << AlgTraits::nDim_ * AlgTraits::nDim_ << ")"); - } else { - ThrowErrorMsg( - "NodalGradBndryElemAlg called with an input field '" - << phi->name() - << "' that is not a scalar or a vector. " - "Actual length = " - << phiSize_); - } - dataNeeded_.add_cvfem_surface_me(meSCS_); const auto coordID = get_field_ordinal( realm_.meta_data(), realm_.solutionOptions_->get_coordinates_name()); dataNeeded_.add_coordinates_field( coordID, AlgTraits::nDim_, CURRENT_COORDINATES); - dataNeeded_.add_gathered_nodal_field(phi_, phiSize_); + dataNeeded_.add_gathered_nodal_field(phi_, NumComp); dataNeeded_.add_gathered_nodal_field(dualNodalVol_, 1); dataNeeded_.add_master_element_call(SCS_AREAV, CURRENT_COORDINATES); @@ -85,14 +55,14 @@ NodalGradElemAlg:: dataNeeded_.add_master_element_call(shpfcn, CURRENT_COORDINATES); } -template < - typename AlgTraits, - typename PhiType, - typename GradPhiType, - typename ViewHelperType> +template void -NodalGradElemAlg::execute() +NodalGradElemAlg::execute() { + using ElemSimdDataType = + sierra::nalu::nalu_ngp::ElemSimdData; + using ViewHelperType = nalu_ngp::ViewHelper; + const auto& meshInfo = realm_.mesh_info(); const auto& meta = meshInfo.meta(); const auto ngpMesh = meshInfo.ngp_mesh(); @@ -105,7 +75,6 @@ NodalGradElemAlg::execute() const bool useShifted = useShifted_; const auto dnvID = dualNodalVol_; const auto phiID = phi_; - const auto phiSize = phiSize_; auto* meSCS = meSCS_; gradPhi.sync_to_device(); @@ -119,7 +88,7 @@ NodalGradElemAlg::execute() std::to_string(AlgTraits::topo_)); nalu_ngp::run_elem_algorithm( algName, meshInfo, stk::topology::ELEM_RANK, dataNeeded_, sel, - KOKKOS_LAMBDA(typename ViewHelperType::SimdDataType & edata) { + KOKKOS_LAMBDA(ElemSimdDataType & edata) { const int* lrscv = meSCS->adjacentNodes(); auto& scrView = edata.simdScrView; @@ -131,7 +100,7 @@ NodalGradElemAlg::execute() const auto& v_shape_fcn = useShifted ? meViews.scs_shifted_shape_fcn : meViews.scs_shape_fcn; - for (int di = 0; di < phiSize; ++di) { + for (int di = 0; di < NumComp; ++di) { for (int ip = 0; ip < AlgTraits::numScsIp_; ++ip) { DoubleType qIp = 0.0; for (int n = 0; n < AlgTraits::nodesPerElement_; ++n) { @@ -159,11 +128,10 @@ NodalGradElemAlg::execute() // NOTE: Can't use BuildTemplates here because of additional template arguments #define INSTANTIATE_ALG(AlgTraits) \ template class NodalGradElemAlg< \ - AlgTraits, ScalarFieldType, VectorFieldType, \ - nalu_ngp::ScalarViewHelper>; \ + AlgTraits, ScalarFieldType, VectorFieldType>; \ template class NodalGradElemAlg< \ - AlgTraits, VectorFieldType, TensorFieldType, \ - nalu_ngp::VectorViewHelper> + AlgTraits, VectorFieldType, GenericFieldType>; \ + template class NodalGradElemAlg INSTANTIATE_ALG(AlgTraitsHex8); INSTANTIATE_ALG(AlgTraitsTet4); diff --git a/src/ngp_algorithms/SSTMaxLengthScaleAlg.C b/src/ngp_algorithms/SSTMaxLengthScaleAlg.C index 4423ec536..2fe6c512c 100644 --- a/src/ngp_algorithms/SSTMaxLengthScaleAlg.C +++ b/src/ngp_algorithms/SSTMaxLengthScaleAlg.C @@ -11,6 +11,7 @@ #include "BuildTemplates.h" #include "master_element/MasterElement.h" #include "master_element/MasterElementRepo.h" +#include "ngp_algorithms/ViewHelper.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldOps.h" #include "ngp_utils/NgpFieldManager.h" diff --git a/src/ngp_algorithms/SSTMaxLengthScaleDriver.C b/src/ngp_algorithms/SSTMaxLengthScaleDriver.C index 67a7cae49..148ff8e8e 100644 --- a/src/ngp_algorithms/SSTMaxLengthScaleDriver.C +++ b/src/ngp_algorithms/SSTMaxLengthScaleDriver.C @@ -31,7 +31,7 @@ void SSTMaxLengthScaleDriver::pre_work() { - auto* maxLengthScale = realm_.meta_data().template get_field( + auto* maxLengthScale = realm_.meta_data().template get_field( stk::topology::NODE_RANK, "sst_max_length_scale"); stk::mesh::field_fill(0.0, *maxLengthScale); @@ -52,7 +52,7 @@ SSTMaxLengthScaleDriver::post_work() nalu_ngp::get_ngp_field(meshInfo, "sst_max_length_scale"); const auto& meta = realm_.meta_data(); - auto* maxLengthScale = meta.template get_field( + auto* maxLengthScale = meta.template get_field( stk::topology::NODE_RANK, "sst_max_length_scale"); // Algorithms should have marked the fields as modified, but call this here to diff --git a/src/node_kernels/ContinuityGclNodeKernel.C b/src/node_kernels/ContinuityGclNodeKernel.C index 115df77f2..fd055fdf2 100644 --- a/src/node_kernels/ContinuityGclNodeKernel.C +++ b/src/node_kernels/ContinuityGclNodeKernel.C @@ -24,7 +24,7 @@ ContinuityGclNodeKernel::ContinuityGclNodeKernel( const auto& meta = bulk.mesh_meta_data(); const ScalarFieldType* density = - meta.get_field(stk::topology::NODE_RANK, "density"); + meta.get_field(stk::topology::NODE_RANK, "density"); densityNp1ID_ = get_field_ordinal(meta, "density", stk::mesh::StateNP1); divVID_ = get_field_ordinal(meta, "div_mesh_velocity"); diff --git a/src/node_kernels/ContinuityMassBDFNodeKernel.C b/src/node_kernels/ContinuityMassBDFNodeKernel.C index 077b527d6..f692633ca 100644 --- a/src/node_kernels/ContinuityMassBDFNodeKernel.C +++ b/src/node_kernels/ContinuityMassBDFNodeKernel.C @@ -25,7 +25,7 @@ ContinuityMassBDFNodeKernel::ContinuityMassBDFNodeKernel( const auto& meta = bulk.mesh_meta_data(); const ScalarFieldType* density = - meta.get_field(stk::topology::NODE_RANK, "density"); + meta.get_field(stk::topology::NODE_RANK, "density"); densityNID_ = get_field_ordinal(meta, "density", stk::mesh::StateN); diff --git a/src/node_kernels/MomentumBodyForceBoxNodeKernel.C b/src/node_kernels/MomentumBodyForceBoxNodeKernel.C index 39df5ef3a..1ddea3463 100644 --- a/src/node_kernels/MomentumBodyForceBoxNodeKernel.C +++ b/src/node_kernels/MomentumBodyForceBoxNodeKernel.C @@ -66,7 +66,7 @@ MomentumBodyForceBoxNodeKernel::MomentumBodyForceBoxNodeKernel( MasterElementRepo::get_surface_master_element_on_host(topo); const int numScsIp = meFC->num_integration_points(); GenericFieldType* exposedAreaVec_ = - &(realm.meta_data().declare_field( + &(realm.meta_data().declare_field( static_cast(realm.meta_data().side_rank()), "exposed_area_vector")); stk::mesh::put_field_on_mesh( diff --git a/src/node_kernels/MomentumGclNodeKernel.C b/src/node_kernels/MomentumGclNodeKernel.C index 01fc53976..817952bea 100644 --- a/src/node_kernels/MomentumGclNodeKernel.C +++ b/src/node_kernels/MomentumGclNodeKernel.C @@ -24,12 +24,12 @@ MomentumGclSrcNodeKernel::MomentumGclSrcNodeKernel( const auto& meta = bulk.mesh_meta_data(); // const VectorFieldType *velocity = - // meta.get_field(stk::topology::NODE_RANK, "velocity"); + // meta.get_field(stk::topology::NODE_RANK, "velocity"); // const ScalarFieldType *dualNdVol = - // meta.get_field(stk::topology::NODE_RANK, + // meta.get_field(stk::topology::NODE_RANK, // "dual_nodal_volume"); const ScalarFieldType* density = - meta.get_field(stk::topology::NODE_RANK, "density"); + meta.get_field(stk::topology::NODE_RANK, "density"); velocityNp1ID_ = get_field_ordinal(meta, "velocity", stk::mesh::StateNP1); densityNp1ID_ = get_field_ordinal(meta, "density", stk::mesh::StateNP1); diff --git a/src/node_kernels/MomentumMassBDFNodeKernel.C b/src/node_kernels/MomentumMassBDFNodeKernel.C index f53b69b9e..778731ea5 100644 --- a/src/node_kernels/MomentumMassBDFNodeKernel.C +++ b/src/node_kernels/MomentumMassBDFNodeKernel.C @@ -26,7 +26,7 @@ MomentumMassBDFNodeKernel::MomentumMassBDFNodeKernel( const auto& meta = bulk.mesh_meta_data(); const auto* velocity = - meta.get_field(stk::topology::NODE_RANK, "velocity"); + meta.get_field(stk::topology::NODE_RANK, "velocity"); velocityNID_ = velocity->field_of_state(stk::mesh::StateN).mesh_meta_data_ordinal(); diff --git a/src/node_kernels/ScalarGclNodeKernel.C b/src/node_kernels/ScalarGclNodeKernel.C index e2e715271..307c93a06 100644 --- a/src/node_kernels/ScalarGclNodeKernel.C +++ b/src/node_kernels/ScalarGclNodeKernel.C @@ -24,7 +24,7 @@ ScalarGclNodeKernel::ScalarGclNodeKernel( const auto& meta = bulk.mesh_meta_data(); const ScalarFieldType* density = - meta.get_field(stk::topology::NODE_RANK, "density"); + meta.get_field(stk::topology::NODE_RANK, "density"); scalarQNp1ID_ = scalarQ->field_of_state(stk::mesh::StateNP1).mesh_meta_data_ordinal(); diff --git a/src/overset/AssembleOversetPressureAlgorithm.C b/src/overset/AssembleOversetPressureAlgorithm.C index 28801672e..383823d7d 100644 --- a/src/overset/AssembleOversetPressureAlgorithm.C +++ b/src/overset/AssembleOversetPressureAlgorithm.C @@ -39,7 +39,8 @@ AssembleOversetPressureAlgorithm::AssembleOversetPressureAlgorithm( : OversetConstraintBase(realm, part, eqSystem, fieldQ) { auto& meta = realm.meta_data(); - Udiag_ = meta.get_field(stk::topology::NODE_RANK, "momentum_diag"); + Udiag_ = + meta.get_field(stk::topology::NODE_RANK, "momentum_diag"); } void diff --git a/src/overset/OversetConstraintBase.C b/src/overset/OversetConstraintBase.C index 8ac2fdc1c..eac34ae76 100644 --- a/src/overset/OversetConstraintBase.C +++ b/src/overset/OversetConstraintBase.C @@ -26,7 +26,7 @@ OversetConstraintBase::OversetConstraintBase( stk::mesh::FieldBase* fieldQ) : SolverAlgorithm(realm, part, eqSystem), fieldQ_(fieldQ), - dualNodalVolume_(realm.meta_data().get_field( + dualNodalVolume_(realm.meta_data().get_field( stk::topology::NODE_RANK, "dual_nodal_volume")) { } diff --git a/src/overset/TiogaBlock.C b/src/overset/TiogaBlock.C index 14a725de9..f05364e8f 100644 --- a/src/overset/TiogaBlock.C +++ b/src/overset/TiogaBlock.C @@ -82,14 +82,14 @@ TiogaBlock::setup(stk::mesh::PartVector& bcPartVec) if (ovsetNames_.size() > 0) names_to_parts(ovsetNames_, ovsetParts_); - sierra::nalu::ScalarIntFieldType& ibf = - meta_.declare_field(stk::topology::NODE_RANK, "iblank"); + ScalarIntFieldType& ibf = + meta_.declare_field(stk::topology::NODE_RANK, "iblank"); - sierra::nalu::ScalarIntFieldType& ibcell = - meta_.declare_field(stk::topology::ELEM_RANK, "iblank_cell"); + ScalarIntFieldType& ibcell = meta_.declare_field( + stk::topology::ELEM_RANK, "iblank_cell"); - sierra::nalu::ScalarFieldType& nVol = - meta_.declare_field(stk::topology::NODE_RANK, "tioga_nodal_volume"); + ScalarFieldType& nVol = meta_.declare_field( + stk::topology::NODE_RANK, "tioga_nodal_volume"); for (auto p : blkParts_) { stk::mesh::put_field_on_mesh(ibf, *p, nullptr); @@ -123,10 +123,10 @@ TiogaBlock::update_coords() stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); - sierra::nalu::VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coords_name_); - sierra::nalu::ScalarFieldType* nodeVol = - meta_.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coords_name_); + ScalarFieldType* nodeVol = meta_.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); #if 0 std::vector bboxMin(3); @@ -185,8 +185,8 @@ TiogaBlock::update_element_volumes() stk::mesh::Selector mesh_selector = get_elem_selector(blkParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::ELEM_RANK, mesh_selector); - sierra::nalu::ScalarFieldType* elemVolume = - meta_.get_field(stk::topology::ELEMENT_RANK, "element_volume"); + ScalarFieldType* elemVolume = meta_.get_field( + stk::topology::ELEMENT_RANK, "element_volume"); auto& numverts = bdata_.num_verts_.h_view; auto& numcells = bdata_.num_cells_.h_view; @@ -228,8 +228,8 @@ TiogaBlock::update_iblanks( std::vector& holeNodes, std::vector& fringeNodes) { - sierra::nalu::ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = @@ -254,8 +254,8 @@ TiogaBlock::update_iblanks( void TiogaBlock::update_iblank_cell() { - sierra::nalu::ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::ELEM_RANK, "iblank_cell"); + ScalarIntFieldType* ibf = meta_.get_field( + stk::topology::ELEM_RANK, "iblank_cell"); stk::mesh::Selector mesh_selector = get_elem_selector(blkParts_); const stk::mesh::BucketVector& mbkts = @@ -282,8 +282,8 @@ TiogaBlock::adjust_cell_resolutions() stk::mesh::Selector mesh_selector = get_node_selector(ovsetParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); - auto* nodeVol = - meta_.get_field(stk::topology::NODE_RANK, "tioga_nodal_volume"); + auto* nodeVol = meta_.get_field( + stk::topology::NODE_RANK, "tioga_nodal_volume"); auto& eidmap = bdata_.eid_map_.h_view; auto& cellres = bdata_.cell_res_.h_view; @@ -317,8 +317,8 @@ TiogaBlock::adjust_node_resolutions() stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); - sierra::nalu::ScalarFieldType* nodeVol = - meta_.get_field(stk::topology::NODE_RANK, "tioga_nodal_volume"); + ScalarFieldType* nodeVol = meta_.get_field( + stk::topology::NODE_RANK, "tioga_nodal_volume"); auto& eidmap = bdata_.eid_map_.h_view; auto& noderes = bdata_.node_res_.h_view; @@ -429,10 +429,10 @@ TiogaBlock::process_nodes() stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); - sierra::nalu::VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coords_name_); - sierra::nalu::ScalarFieldType* nodeVol = - meta_.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coords_name_); + ScalarFieldType* nodeVol = meta_.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); int ncount = 0; for (auto b : mbkts) diff --git a/src/overset/TiogaSTKIface.C b/src/overset/TiogaSTKIface.C index 3fbbb8837..318fb9bd6 100644 --- a/src/overset/TiogaSTKIface.C +++ b/src/overset/TiogaSTKIface.C @@ -175,8 +175,8 @@ TiogaSTKIface::post_connectivity_work(const bool isDecoupled) } // Synchronize IBLANK data for shared nodes - sierra::nalu::ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); std::vector pvec{ibf}; stk::mesh::copy_owned_to_shared(bulk_, pvec); @@ -244,8 +244,8 @@ TiogaSTKIface::update_ghosting() // Communicate coordinates field when populating oversetInfoVec if (oversetManager_.oversetGhosting_ != nullptr) { - sierra::nalu::VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coordsName_); + VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coordsName_); std::vector fVec = {coords}; stk::mesh::communicate_field_data(*oversetManager_.oversetGhosting_, fVec); } @@ -254,8 +254,8 @@ TiogaSTKIface::update_ghosting() void TiogaSTKIface::get_receptor_info() { - sierra::nalu::ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); std::vector nodesToReset; @@ -388,8 +388,8 @@ TiogaSTKIface::populate_overset_info() // Ensure that the oversetInfoVec has been cleared out ThrowAssert(osetInfo.size() == 0); - sierra::nalu::VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coordsName_); + VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coordsName_); size_t numReceptors = receptorIDs_.size(); for (size_t i = 0; i < numReceptors; i++) { @@ -559,11 +559,12 @@ TiogaSTKIface::overset_update_field( void TiogaSTKIface::pre_connectivity_sync() { - auto* coords = meta_.get_field(stk::topology::NODE_RANK, coordsName_); - auto* dualVol = - meta_.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); - auto* elemVol = - meta_.get_field(stk::topology::ELEMENT_RANK, "element_volume"); + auto* coords = + meta_.get_field(stk::topology::NODE_RANK, coordsName_); + auto* dualVol = meta_.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); + auto* elemVol = meta_.get_field( + stk::topology::ELEMENT_RANK, "element_volume"); coords->sync_to_host(); dualVol->sync_to_host(); @@ -580,9 +581,10 @@ TiogaSTKIface::post_connectivity_sync() { // Push iblank fields to device { - auto* ibnode = meta_.get_field(stk::topology::NODE_RANK, "iblank"); - auto* ibcell = - meta_.get_field(stk::topology::ELEM_RANK, "iblank_cell"); + auto* ibnode = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); + auto* ibcell = meta_.get_field( + stk::topology::ELEM_RANK, "iblank_cell"); ibnode->modify_on_host(); ibnode->sync_to_device(); ibcell->modify_on_host(); diff --git a/src/property_evaluator/EnthalpyPropertyEvaluator.C b/src/property_evaluator/EnthalpyPropertyEvaluator.C index 126de8e8e..88ea9502b 100644 --- a/src/property_evaluator/EnthalpyPropertyEvaluator.C +++ b/src/property_evaluator/EnthalpyPropertyEvaluator.C @@ -121,8 +121,8 @@ EnthalpyTYkPropertyEvaluator::EnthalpyTYkPropertyEvaluator( massFraction_(NULL) { // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); } //-------------------------------------------------------------------------- @@ -226,8 +226,8 @@ EnthalpyConstCpkPropertyEvaluator::EnthalpyConstCpkPropertyEvaluator( massFraction_(NULL) { // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); // save off Cp_k as vector cpVec_.resize(cpVecSize_); diff --git a/src/property_evaluator/IdealGasPropertyEvaluator.C b/src/property_evaluator/IdealGasPropertyEvaluator.C index 5b1852118..d8b91baff 100644 --- a/src/property_evaluator/IdealGasPropertyEvaluator.C +++ b/src/property_evaluator/IdealGasPropertyEvaluator.C @@ -89,8 +89,8 @@ IdealGasTYkPropertyEvaluator::IdealGasTYkPropertyEvaluator( } // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); } //-------------------------------------------------------------------------- @@ -145,7 +145,8 @@ IdealGasTPPropertyEvaluator::IdealGasTPPropertyEvaluator( { // save off mass fraction field - pressure_ = metaData.get_field(stk::topology::NODE_RANK, "pressure"); + pressure_ = + metaData.get_field(stk::topology::NODE_RANK, "pressure"); // compute mixture mw double sum = 0.0; @@ -205,8 +206,8 @@ IdealGasYkPropertyEvaluator::IdealGasYkPropertyEvaluator( } // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); } //-------------------------------------------------------------------------- diff --git a/src/property_evaluator/InverseDualVolumePropAlgorithm.C b/src/property_evaluator/InverseDualVolumePropAlgorithm.C index 8dc1f8e68..454e4336b 100644 --- a/src/property_evaluator/InverseDualVolumePropAlgorithm.C +++ b/src/property_evaluator/InverseDualVolumePropAlgorithm.C @@ -27,8 +27,8 @@ InverseDualVolumePropAlgorithm::InverseDualVolumePropAlgorithm( { // extract dual volume stk::mesh::MetaData& meta_data = realm_.meta_data(); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } InverseDualVolumePropAlgorithm::~InverseDualVolumePropAlgorithm() {} diff --git a/src/property_evaluator/SpecificHeatPropertyEvaluator.C b/src/property_evaluator/SpecificHeatPropertyEvaluator.C index 299937e7e..3b485c893 100644 --- a/src/property_evaluator/SpecificHeatPropertyEvaluator.C +++ b/src/property_evaluator/SpecificHeatPropertyEvaluator.C @@ -122,8 +122,8 @@ SpecificHeatTYkPropertyEvaluator::SpecificHeatTYkPropertyEvaluator( massFraction_(NULL) { // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); } //-------------------------------------------------------------------------- @@ -187,8 +187,8 @@ SpecificHeatConstCpkPropertyEvaluator::SpecificHeatConstCpkPropertyEvaluator( : PropertyEvaluator(), cpVecSize_(cpConstMap.size()), massFraction_(NULL) { // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); // save off Cp_k as vector cpVec_.resize(cpVecSize_); diff --git a/src/property_evaluator/SutherlandsPropertyEvaluator.C b/src/property_evaluator/SutherlandsPropertyEvaluator.C index 7cb4db028..4b76d5845 100644 --- a/src/property_evaluator/SutherlandsPropertyEvaluator.C +++ b/src/property_evaluator/SutherlandsPropertyEvaluator.C @@ -130,8 +130,8 @@ SutherlandsYkPropertyEvaluator::SutherlandsYkPropertyEvaluator( polynomialCoeffs_.resize(ykVecSize_); // save off mass fraction field - massFraction_ = - metaData.get_field(stk::topology::NODE_RANK, "mass_fraction"); + massFraction_ = metaData.get_field( + stk::topology::NODE_RANK, "mass_fraction"); // save off polynomial coeffs size_t k = 0; diff --git a/src/property_evaluator/TemperaturePropAlgorithm.C b/src/property_evaluator/TemperaturePropAlgorithm.C index d68e04b16..67c05bf12 100644 --- a/src/property_evaluator/TemperaturePropAlgorithm.C +++ b/src/property_evaluator/TemperaturePropAlgorithm.C @@ -36,7 +36,7 @@ TemperaturePropAlgorithm::TemperaturePropAlgorithm( // extract temperature field stk::mesh::MetaData& meta_data = realm_.meta_data(); temperature_ = - meta_data.get_field(stk::topology::NODE_RANK, tempName); + meta_data.get_field(stk::topology::NODE_RANK, tempName); if (NULL == temperature_) { throw std::runtime_error("Realm::setup_property: TemperaturePropAlgorithm " "requires temperature/bc:"); diff --git a/src/user_functions/BoussinesqNonIsoEnthalpySrcNodeSuppAlg.C b/src/user_functions/BoussinesqNonIsoEnthalpySrcNodeSuppAlg.C index 9ca68cf59..8f44f9181 100644 --- a/src/user_functions/BoussinesqNonIsoEnthalpySrcNodeSuppAlg.C +++ b/src/user_functions/BoussinesqNonIsoEnthalpySrcNodeSuppAlg.C @@ -36,10 +36,10 @@ BoussinesqNonIsoEnthalpySrcNodeSuppAlg::BoussinesqNonIsoEnthalpySrcNodeSuppAlg( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/user_functions/BoussinesqNonIsoMomentumSrcNodeSuppAlg.C b/src/user_functions/BoussinesqNonIsoMomentumSrcNodeSuppAlg.C index 6f0ed4b07..63127ab2c 100644 --- a/src/user_functions/BoussinesqNonIsoMomentumSrcNodeSuppAlg.C +++ b/src/user_functions/BoussinesqNonIsoMomentumSrcNodeSuppAlg.C @@ -41,10 +41,10 @@ BoussinesqNonIsoMomentumSrcNodeSuppAlg::BoussinesqNonIsoMomentumSrcNodeSuppAlg( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); // extract user parameters from solution options gravity = realm_.solutionOptions_->gravity_; diff --git a/src/user_functions/SteadyTaylorVortexMomentumSrcNodeSuppAlg.C b/src/user_functions/SteadyTaylorVortexMomentumSrcNodeSuppAlg.C index 028c08c43..e257b1435 100644 --- a/src/user_functions/SteadyTaylorVortexMomentumSrcNodeSuppAlg.C +++ b/src/user_functions/SteadyTaylorVortexMomentumSrcNodeSuppAlg.C @@ -43,10 +43,10 @@ SteadyTaylorVortexMomentumSrcNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); // internal source srcXi_.resize(nDim_); diff --git a/src/user_functions/VariableDensityContinuitySrcNodeSuppAlg.C b/src/user_functions/VariableDensityContinuitySrcNodeSuppAlg.C index 312f0925b..a5ef54bb3 100644 --- a/src/user_functions/VariableDensityContinuitySrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityContinuitySrcNodeSuppAlg.C @@ -48,10 +48,10 @@ VariableDensityContinuitySrcNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/user_functions/VariableDensityMixFracSrcNodeSuppAlg.C b/src/user_functions/VariableDensityMixFracSrcNodeSuppAlg.C index 2454973fd..e3fdea104 100644 --- a/src/user_functions/VariableDensityMixFracSrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityMixFracSrcNodeSuppAlg.C @@ -50,10 +50,10 @@ VariableDensityMixFracSrcNodeSuppAlg::VariableDensityMixFracSrcNodeSuppAlg( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/user_functions/VariableDensityMomentumSrcNodeSuppAlg.C b/src/user_functions/VariableDensityMomentumSrcNodeSuppAlg.C index 08f23b9fe..6f2ffbf1b 100644 --- a/src/user_functions/VariableDensityMomentumSrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityMomentumSrcNodeSuppAlg.C @@ -55,10 +55,10 @@ VariableDensityMomentumSrcNodeSuppAlg::VariableDensityMomentumSrcNodeSuppAlg( { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); // internal source srcXi_.resize(nDim_); diff --git a/src/user_functions/VariableDensityNonIsoContinuitySrcNodeSuppAlg.C b/src/user_functions/VariableDensityNonIsoContinuitySrcNodeSuppAlg.C index 144850a96..92ed11c57 100644 --- a/src/user_functions/VariableDensityNonIsoContinuitySrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityNonIsoContinuitySrcNodeSuppAlg.C @@ -52,10 +52,10 @@ VariableDensityNonIsoContinuitySrcNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/user_functions/VariableDensityNonIsoEnthalpySrcNodeSuppAlg.C b/src/user_functions/VariableDensityNonIsoEnthalpySrcNodeSuppAlg.C index ba0e064d4..642df088a 100644 --- a/src/user_functions/VariableDensityNonIsoEnthalpySrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityNonIsoEnthalpySrcNodeSuppAlg.C @@ -52,10 +52,10 @@ VariableDensityNonIsoEnthalpySrcNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); } //-------------------------------------------------------------------------- diff --git a/src/user_functions/VariableDensityNonIsoMomentumSrcNodeSuppAlg.C b/src/user_functions/VariableDensityNonIsoMomentumSrcNodeSuppAlg.C index abb0c8b59..113ff4112 100644 --- a/src/user_functions/VariableDensityNonIsoMomentumSrcNodeSuppAlg.C +++ b/src/user_functions/VariableDensityNonIsoMomentumSrcNodeSuppAlg.C @@ -58,10 +58,10 @@ VariableDensityNonIsoMomentumSrcNodeSuppAlg:: { // save off fields stk::mesh::MetaData& meta_data = realm_.meta_data(); - coordinates_ = meta_data.get_field( + coordinates_ = meta_data.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); - dualNodalVolume_ = - meta_data.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + dualNodalVolume_ = meta_data.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); // internal source srcXi_.resize(nDim_); diff --git a/src/utils/ComputeVectorDivergence.C b/src/utils/ComputeVectorDivergence.C index 0478792d5..631c0c9e1 100644 --- a/src/utils/ComputeVectorDivergence.C +++ b/src/utils/ComputeVectorDivergence.C @@ -41,13 +41,13 @@ compute_vector_divergence( const std::string coordName = hasMeshDeformation ? "current_coordinates" : "coordinates"; VectorFieldType* coordinates = - meta.get_field(stk::topology::NODE_RANK, coordName); + meta.get_field(stk::topology::NODE_RANK, coordName); - ScalarFieldType* dualVol = - meta.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + ScalarFieldType* dualVol = meta.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); GenericFieldType* exposedAreaVec = - meta.get_field(meta.side_rank(), "exposed_area_vector"); + meta.get_field(meta.side_rank(), "exposed_area_vector"); // sync fields to host coordinates->sync_to_host(); diff --git a/src/utils/FieldHelpers.C b/src/utils/FieldHelpers.C index 57e74af77..bcee4cbb3 100644 --- a/src/utils/FieldHelpers.C +++ b/src/utils/FieldHelpers.C @@ -22,8 +22,8 @@ populate_dnv_states( unsigned& np1ID) { np1ID = get_field_ordinal(meta, "dual_nodal_volume", stk::mesh::StateNP1); - const auto* dnv = - meta.get_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + const auto* dnv = meta.get_field( + stk::topology::NODE_RANK, "dual_nodal_volume"); switch (dnv->number_of_states()) { case 1: nID = np1ID; @@ -44,4 +44,4 @@ populate_dnv_states( } } // namespace nalu -} // namespace sierra +} // namespace sierra \ No newline at end of file diff --git a/src/utils/StkHelpers.C b/src/utils/StkHelpers.C index 379bf9350..c942c2eea 100644 --- a/src/utils/StkHelpers.C +++ b/src/utils/StkHelpers.C @@ -215,33 +215,5 @@ compute_precise_ghosting_lists( bulk, sendGhostsToRemove, recvGhostsToRemove); } -unsigned -max_extent(const stk::mesh::FieldBase& field, unsigned dimension) -{ - if (dimension == 0) { - stk::mesh::FieldRestriction::size_type max = 0; - for (const stk::mesh::FieldRestriction& res : field.restrictions()) { - max = std::max(max, res.dimension()); - } - return max; - } else if (dimension == 1) { - stk::mesh::FieldRestriction::size_type max = 0; - for (const stk::mesh::FieldRestriction& res : field.restrictions()) { - if (res.dimension() != 0) { - max = std::max(max, res.num_scalars_per_entity() / res.dimension()); - } - } - return max; - - } else { - for (const stk::mesh::FieldRestriction& res : field.restrictions()) { - if (res.num_scalars_per_entity() > 0) { - return 1; - } - } - return 0; - } -} - } // namespace nalu } // namespace sierra diff --git a/src/wind_energy/BdyHeightAlgorithm.C b/src/wind_energy/BdyHeightAlgorithm.C index 9f435d40e..83b49b0cf 100644 --- a/src/wind_energy/BdyHeightAlgorithm.C +++ b/src/wind_energy/BdyHeightAlgorithm.C @@ -52,7 +52,7 @@ RectilinearMeshHeightAlg::calc_height_levels( auto& bulk = realm_.bulk_data(); const auto bkts = bulk.get_buckets(stk::topology::NODE_RANK, nodeSel); - const VectorFieldType* coords = meta.get_field( + const VectorFieldType* coords = meta.get_field( stk::topology::NODE_RANK, realm_.get_coordinates_name()); // Index of the wall normal coordinate diff --git a/src/wind_energy/BdyLayerStatistics.C b/src/wind_energy/BdyLayerStatistics.C index d23648363..58c2fcffc 100644 --- a/src/wind_energy/BdyLayerStatistics.C +++ b/src/wind_energy/BdyLayerStatistics.C @@ -188,7 +188,7 @@ BdyLayerStatistics::setup() fluidParts_[i] = part; } - heightIndex_ = &meta.declare_field( + heightIndex_ = &meta.declare_field( stk::topology::NODE_RANK, "bdy_layer_height_index_field"); for (auto* part : fluidParts_) stk::mesh::put_field_on_mesh(*heightIndex_, *part, nullptr); diff --git a/src/wind_energy/SyntheticLidar.C b/src/wind_energy/SyntheticLidar.C index 7c2b25cad..357369cce 100644 --- a/src/wind_energy/SyntheticLidar.C +++ b/src/wind_energy/SyntheticLidar.C @@ -344,17 +344,21 @@ LidarLineOfSite::output( {seg.tail_[0] + j * dx[0], seg.tail_[1] + j * dx[1], seg.tail_[2] + j * dx[2]}}; } - const auto& coord_field = *bulk.mesh_meta_data().get_field( - stk::topology::NODE_RANK, coordinates_name); + const auto& coord_field = + *bulk.mesh_meta_data() + .get_field>( + stk::topology::NODE_RANK, coordinates_name); const auto& velocity_field = bulk.mesh_meta_data() - .get_field(stk::topology::NODE_RANK, "velocity") + .get_field>( + stk::topology::NODE_RANK, "velocity") ->field_of_state(stk::mesh::StateNP1); const auto& velocity_prev = bulk.mesh_meta_data() - .get_field(stk::topology::NODE_RANK, "velocity") + .get_field>( + stk::topology::NODE_RANK, "velocity") ->field_of_state(stk::mesh::StateN); const double extrap_dt = predictor_ == Predictor::NEAREST ? 0 : dtratio; @@ -558,17 +562,21 @@ LidarLineOfSite::output_cone_filtered( } } - const auto& coord_field = *bulk.mesh_meta_data().get_field( - stk::topology::NODE_RANK, coordinates_name); + const auto& coord_field = + *bulk.mesh_meta_data() + .get_field>( + stk::topology::NODE_RANK, coordinates_name); const auto& velocity_field = bulk.mesh_meta_data() - .get_field(stk::topology::NODE_RANK, "velocity") + .get_field>( + stk::topology::NODE_RANK, "velocity") ->field_of_state(stk::mesh::StateNP1); const auto& velocity_prev = bulk.mesh_meta_data() - .get_field(stk::topology::NODE_RANK, "velocity") + .get_field>( + stk::topology::NODE_RANK, "velocity") ->field_of_state(stk::mesh::StateN); const double extrap_dt = predictor_ == Predictor::NEAREST ? 0 : dtratio; diff --git a/src/xfer/LocalVolumeSearch.C b/src/xfer/LocalVolumeSearch.C index a84c07f73..58c5d314e 100644 --- a/src/xfer/LocalVolumeSearch.C +++ b/src/xfer/LocalVolumeSearch.C @@ -20,7 +20,7 @@ namespace nalu { namespace { constexpr int dim = 3; -using vector_field_type = stk::mesh::Field; +using vector_field_type = stk::mesh::Field; using sphere_t = LocalVolumeSearchData::sphere_t; using box_t = LocalVolumeSearchData::box_t; using ident_t = LocalVolumeSearchData::ident_t; @@ -310,9 +310,9 @@ local_field_interpolation( const stk::mesh::BulkData& bulk, const stk::mesh::Selector& active, const std::vector>& points, - const stk::mesh::Field& x_field, - const stk::mesh::Field& field_prev, - const stk::mesh::Field& field, + const stk::mesh::Field& x_field, + const stk::mesh::Field& field_prev, + const stk::mesh::Field& field, double dtratio, LocalVolumeSearchData& data) { @@ -339,4 +339,4 @@ local_field_interpolation( } } // namespace nalu -} // namespace sierra +} // namespace sierra \ No newline at end of file diff --git a/unit_tests/UnitTest1ElemCoordCheck.C b/unit_tests/UnitTest1ElemCoordCheck.C index 2cb94cd37..eda102baa 100644 --- a/unit_tests/UnitTest1ElemCoordCheck.C +++ b/unit_tests/UnitTest1ElemCoordCheck.C @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -24,8 +25,8 @@ count_locally_owned_elems(const stk::mesh::BulkData& bulk) void verify_elems_are_unit_cubes(const stk::mesh::BulkData& bulk) { - typedef stk::mesh::Field CoordFieldType; - CoordFieldType* coordField = bulk.mesh_meta_data().get_field( + typedef stk::mesh::Field CoordFieldType; + CoordFieldType* coordField = bulk.mesh_meta_data().get_field( stk::topology::NODE_RANK, "coordinates"); EXPECT_TRUE(coordField != nullptr); @@ -65,7 +66,6 @@ TEST(Basic, CheckCoords1Elem) stk::mesh::MeshBuilder meshBuilder(comm); meshBuilder.set_spatial_dimension(spatialDimension); auto bulk = meshBuilder.create(); - bulk->mesh_meta_data().use_simple_fields(); unit_test_utils::fill_mesh_1_elem_per_proc_hex8(*bulk); diff --git a/unit_tests/UnitTestEigenDecomposition.C b/unit_tests/UnitTestEigenDecomposition.C index 24236083a..6cf5f8b39 100644 --- a/unit_tests/UnitTestEigenDecomposition.C +++ b/unit_tests/UnitTestEigenDecomposition.C @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/unit_tests/UnitTestElemSuppAlg.C b/unit_tests/UnitTestElemSuppAlg.C index e2007d3d3..de9f5dba6 100644 --- a/unit_tests/UnitTestElemSuppAlg.C +++ b/unit_tests/UnitTestElemSuppAlg.C @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -27,8 +28,8 @@ namespace { void element_discrete_laplacian_kernel_3d( sierra::nalu::MasterElement& meSCS, - const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, - const sierra::nalu::ScalarFieldType* nodalPressureField, + const ScalarFieldType* discreteLaplacianOfPressure, + const ScalarFieldType* nodalPressureField, sierra::nalu::ScratchViews& elemData) { const int nDim = 3; @@ -83,9 +84,9 @@ class DiscreteLaplacianSuppAlg : public SuppAlg public: DiscreteLaplacianSuppAlg( sierra::nalu::ElemDataRequests& dataNeeded, - const sierra::nalu::VectorFieldType* coordField, - const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, - const sierra::nalu::ScalarFieldType* nodalPressureField, + const VectorFieldType* coordField, + const ScalarFieldType* discreteLaplacianOfPressure, + const ScalarFieldType* nodalPressureField, const stk::topology& topo) : discreteLaplacianOfPressure_(discreteLaplacianOfPressure), nodalPressureField_(nodalPressureField) @@ -118,8 +119,8 @@ public: } private: - const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure_; - const sierra::nalu::ScalarFieldType* nodalPressureField_; + const ScalarFieldType* discreteLaplacianOfPressure_; + const ScalarFieldType* nodalPressureField_; }; //=========== Test class that mimics an element alg with supplemental alg and diff --git a/unit_tests/UnitTestFieldManager.C b/unit_tests/UnitTestFieldManager.C index 018c5d090..1baaa9843 100644 --- a/unit_tests/UnitTestFieldManager.C +++ b/unit_tests/UnitTestFieldManager.C @@ -26,7 +26,6 @@ protected: stk::mesh::MeshBuilder builder(MPI_COMM_WORLD); builder.set_spatial_dimension(3); meta_ = builder.create_meta_data(); - meta_->use_simple_fields(); key_ = "velocity"; } stk::mesh::MetaData& meta() { return *(meta_.get()); } @@ -45,11 +44,11 @@ TEST_F(FieldManagerTest, nameIsEnoughInfoToRegisterAField) // check that field is on the mesh const auto findFieldPtr = - meta().get_field(stk::topology::NODE_RANK, name); + meta().get_field(stk::topology::NODE_RANK, name); EXPECT_EQ(findFieldPtr, std::get(ptr)); EXPECT_TRUE(fm.field_exists(name)); - auto ptr2 = fm.get_field_ptr(name); + auto ptr2 = fm.get_field_ptr(name); EXPECT_EQ(findFieldPtr, ptr2); } @@ -104,9 +103,9 @@ TEST_F(FieldManagerTest, fieldStateCanBeSelected) FieldManager fm(meta(), numStates); fm.register_field(name, universal); // clang-format off - const auto np1 = fm.get_field_ptr(name, stk::mesh::StateNP1); - const auto n = fm.get_field_ptr(name, stk::mesh::StateN); - const auto nm1 = fm.get_field_ptr(name, stk::mesh::StateNM1); + const auto np1 = fm.get_field_ptr(name, stk::mesh::StateNP1); + const auto n = fm.get_field_ptr(name, stk::mesh::StateN); + const auto nm1 = fm.get_field_ptr(name, stk::mesh::StateNM1); // clang-format on EXPECT_TRUE(np1 != nullptr); EXPECT_TRUE(n != nullptr); @@ -122,7 +121,7 @@ TEST_F(FieldManagerTest, numStatesCanBeChangedAtRegistration) const stk::mesh::PartVector universal(1, &meta().universal_part()); FieldManager fm(meta(), numStates); fm.register_field(name, universal, numStates); - auto field = fm.get_field_ptr(name); + auto field = fm.get_field_ptr(name); ASSERT_TRUE(field != nullptr); EXPECT_EQ(numStates, field->number_of_states()); } @@ -142,7 +141,7 @@ TEST_F(TestFieldManagerWithElems, minimalSmartFieldCreation) managerNgpField = fieldManager->get_device_smart_field(name); SmartField managerLegacyField = - fieldManager->get_legacy_smart_field(name); + fieldManager->get_legacy_smart_field(name); } } // namespace } // namespace nalu diff --git a/unit_tests/UnitTestFieldRegistry.C b/unit_tests/UnitTestFieldRegistry.C index 18cb11223..63a3f0b54 100644 --- a/unit_tests/UnitTestFieldRegistry.C +++ b/unit_tests/UnitTestFieldRegistry.C @@ -24,7 +24,6 @@ protected: { stk::mesh::MeshBuilder builder(MPI_COMM_WORLD); meta_ = builder.create_meta_data(); - meta_->use_simple_fields(); key_ = "velocity"; } std::shared_ptr meta_; @@ -39,13 +38,13 @@ TEST_F(FieldRegistryTest, allDataNeededToDeclareFieldIsKnownThroughQuery) ASSERT_NO_THROW(std::visit( [&](auto arg) { - meta_->declare_field( + meta_->declare_field( arg.rank, key_, arg.num_states); }, def)); const auto findFieldPtr = - meta_->get_field(stk::topology::NODE_RANK, key_); + meta_->get_field(stk::topology::NODE_RANK, key_); // pointer to field is valid through stk api EXPECT_TRUE(findFieldPtr); } @@ -60,7 +59,7 @@ TEST_F(FieldRegistryTest, registeredFieldPointerCanBeStored) EXPECT_EQ(0, field_pointers.size()); ASSERT_NO_THROW(std::visit( [&](auto arg) { - auto* ptr = &(meta_->declare_field( + auto* ptr = &(meta_->declare_field( arg.rank, key_, arg.num_states)); field_pointers.push_back(ptr); }, @@ -70,7 +69,7 @@ TEST_F(FieldRegistryTest, registeredFieldPointerCanBeStored) EXPECT_EQ(1, field_pointers.size()); const auto findFieldPtr = - meta_->get_field(stk::topology::NODE_RANK, key_); + meta_->get_field(stk::topology::NODE_RANK, key_); // stk api and stored pointer are the same EXPECT_EQ(findFieldPtr, std::get(field_pointers[0])); } diff --git a/unit_tests/UnitTestFieldUtils.C b/unit_tests/UnitTestFieldUtils.C index 17459b672..1ccd412e6 100644 --- a/unit_tests/UnitTestFieldUtils.C +++ b/unit_tests/UnitTestFieldUtils.C @@ -13,7 +13,7 @@ namespace unit_test_utils { double field_norm( - const sierra::nalu::ScalarFieldType& field, + const ScalarFieldType& field, const stk::mesh::BulkData& bulk, stk::mesh::Selector selector) { diff --git a/unit_tests/UnitTestFieldUtils.h b/unit_tests/UnitTestFieldUtils.h index 7c1bcc803..fc4dfdb52 100644 --- a/unit_tests/UnitTestFieldUtils.h +++ b/unit_tests/UnitTestFieldUtils.h @@ -17,7 +17,7 @@ namespace unit_test_utils { double field_norm( - const sierra::nalu::ScalarFieldType& field, + const ScalarFieldType& field, const stk::mesh::BulkData& bulk, stk::mesh::Selector selector); diff --git a/unit_tests/UnitTestHexElementPromotion.C b/unit_tests/UnitTestHexElementPromotion.C index 8ecebbbca..0fbc056de 100644 --- a/unit_tests/UnitTestHexElementPromotion.C +++ b/unit_tests/UnitTestHexElementPromotion.C @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -23,7 +24,6 @@ #include #include -#include #include #include @@ -32,6 +32,10 @@ namespace { +typedef stk::mesh::Field ScalarFieldType; +typedef stk::mesh::Field ScalarIntFieldType; +typedef stk::mesh::Field VectorFieldType; + size_t count_nodes( const stk::mesh::BulkData& bulk, const stk::mesh::Selector& selector) @@ -53,8 +57,8 @@ protected: void init(int nx, int ny, int nz, int in_polyOrder) { auto aura = stk::mesh::BulkData::NO_AUTO_AURA; - fixture = std::make_unique( - comm, nx, ny, nz, aura); + fixture = + std::make_unique(comm, nx, ny, nz, aura); meta = &fixture->m_meta; bulk = &fixture->m_bulk_data; surfSupPart = nullptr; @@ -63,9 +67,9 @@ protected: hexPart = fixture->m_elem_parts[0]; ThrowRequire(hexPart != nullptr); coordField = - &meta->declare_field(stk::topology::NODE_RANK, "coords"); - intField = - &meta->declare_field(stk::topology::NODE_RANK, "integer field"); + &meta->declare_field(stk::topology::NODE_RANK, "coords"); + intField = &meta->declare_field( + stk::topology::NODE_RANK, "integer field"); poly_order = in_polyOrder; @@ -84,9 +88,8 @@ protected: stk::mesh::put_field_on_entire_mesh(*intField); fixture->m_meta.commit(); - fixture->generate_mesh( - stk::mesh::fixtures::simple_fields::FixedCartesianCoordinateMapping( - nx, ny, nz, nx, ny, nz)); + fixture->generate_mesh(stk::mesh::fixtures::FixedCartesianCoordinateMapping( + nx, ny, nz, nx, ny, nz)); stk::mesh::PartVector surfParts = {surfSubPart}; stk::mesh::skin_mesh(*bulk, surfParts); } @@ -147,7 +150,7 @@ protected: stk::ParallelMachine comm; unsigned nDim; - std::unique_ptr fixture; + std::unique_ptr fixture; stk::mesh::MetaData* meta; stk::mesh::BulkData* bulk; unsigned poly_order; @@ -160,8 +163,8 @@ protected: stk::mesh::Part* edgePart; stk::mesh::Part* facePart; std::unique_ptr io; - sierra::nalu::VectorFieldType* coordField; - sierra::nalu::ScalarIntFieldType* intField; + VectorFieldType* coordField; + ScalarIntFieldType* intField; }; TEST_F(PromoteElementHexTest, node_count) diff --git a/unit_tests/UnitTestHexMasterElements.C b/unit_tests/UnitTestHexMasterElements.C index 2b51783e4..6f5bd728f 100644 --- a/unit_tests/UnitTestHexMasterElements.C +++ b/unit_tests/UnitTestHexMasterElements.C @@ -264,7 +264,6 @@ protected: meshBuilder.set_spatial_dimension(spatialDimension); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); } void setup_poly_order_1_hex_8() diff --git a/unit_tests/UnitTestHexSCVDeterminant.C b/unit_tests/UnitTestHexSCVDeterminant.C index 4a733b293..6e44ca64c 100644 --- a/unit_tests/UnitTestHexSCVDeterminant.C +++ b/unit_tests/UnitTestHexSCVDeterminant.C @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -42,8 +43,8 @@ determinant33(const double* mat) void check_HexSCV_determinant(const stk::mesh::BulkData& bulk) { - typedef stk::mesh::Field CoordFieldType; - CoordFieldType* coordField = bulk.mesh_meta_data().get_field( + typedef stk::mesh::Field CoordFieldType; + CoordFieldType* coordField = bulk.mesh_meta_data().get_field( stk::topology::NODE_RANK, "coordinates"); EXPECT_TRUE(coordField != nullptr); @@ -97,7 +98,6 @@ TEST(HexSCV, determinant) stk::mesh::MeshBuilder meshBuilder(comm); meshBuilder.set_spatial_dimension(spatialDimension); auto bulk = meshBuilder.create(); - bulk->mesh_meta_data().use_simple_fields(); unit_test_utils::fill_mesh_1_elem_per_proc_hex8(*bulk); @@ -112,10 +112,9 @@ TEST(HexSCV, grandyvol) stk::mesh::MeshBuilder meshBuilder(comm); meshBuilder.set_spatial_dimension(spatialDimension); auto bulk = meshBuilder.create(); - bulk->mesh_meta_data().use_simple_fields(); unit_test_utils::fill_mesh_1_elem_per_proc_hex8(*bulk); - const auto& coordField = *static_cast( + const auto& coordField = *static_cast( bulk->mesh_meta_data().coordinate_field()); double v_coords[8][3]; diff --git a/unit_tests/UnitTestKokkosME.h b/unit_tests/UnitTestKokkosME.h index 4e418f033..df8387d2b 100644 --- a/unit_tests/UnitTestKokkosME.h +++ b/unit_tests/UnitTestKokkosME.h @@ -36,7 +36,6 @@ class KokkosMEViews meshBuilder.set_spatial_dimension(AlgTraits::nDim_); bulk_ = meshBuilder.create(); meta_ = &bulk_->mesh_meta_data(); - meta_->use_simple_fields(); if (doInit) fill_mesh_and_init_data(doPerturb); } @@ -59,8 +58,8 @@ class KokkosMEViews unit_test_utils::create_one_reference_element(*bulk_, AlgTraits::topo_); partVec_ = {meta_->get_part("block_1")}; - coordinates_ = static_cast( - meta_->coordinate_field()); + coordinates_ = + static_cast(meta_->coordinate_field()); EXPECT_TRUE(coordinates_ != nullptr); @@ -137,7 +136,7 @@ class KokkosMEViews stk::mesh::MetaData* meta_; std::shared_ptr bulk_; stk::mesh::PartVector partVec_; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; std::unique_ptr helperObjs_{nullptr}; diff --git a/unit_tests/UnitTestKokkosMEBC.h b/unit_tests/UnitTestKokkosMEBC.h index efd51262f..2740d1961 100644 --- a/unit_tests/UnitTestKokkosMEBC.h +++ b/unit_tests/UnitTestKokkosMEBC.h @@ -37,7 +37,6 @@ class KokkosMEBC meshBuilder.set_spatial_dimension(BcAlgTraits::nDim_); bulk_ = meshBuilder.create(); meta_ = &bulk_->mesh_meta_data(); - meta_->use_simple_fields(); if (doInit) fill_mesh_and_init_data(doPerturb); } @@ -62,8 +61,8 @@ class KokkosMEBC *bulk_, BcAlgTraits::elemTopo_); partVec_ = {meta_->get_part("surface_" + std::to_string(faceOrdinal_))}; - coordinates_ = static_cast( - meta_->coordinate_field()); + coordinates_ = + static_cast(meta_->coordinate_field()); EXPECT_TRUE(coordinates_ != nullptr); @@ -125,7 +124,7 @@ class KokkosMEBC std::shared_ptr bulk_; int faceOrdinal_; stk::mesh::PartVector partVec_; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; std::unique_ptr helperObjs_; diff --git a/unit_tests/UnitTestKokkosViews.C b/unit_tests/UnitTestKokkosViews.C index 6effdd335..0cb8ce381 100644 --- a/unit_tests/UnitTestKokkosViews.C +++ b/unit_tests/UnitTestKokkosViews.C @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -49,9 +50,9 @@ class TestElemAlgorithmWithVectors public: TestElemAlgorithmWithVectors( stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType* coord, - sierra::nalu::ScalarFieldType* discreteLaplacian, - sierra::nalu::ScalarFieldType* nodalPressure) + const VectorFieldType* coord, + ScalarFieldType* discreteLaplacian, + ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -155,9 +156,9 @@ public: private: stk::mesh::BulkData& bulkData_; - sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; - sierra::nalu::ScalarFieldType* nodalPressureField; - const sierra::nalu::VectorFieldType* coordField; + ScalarFieldType* discreteLaplacianOfPressure; + ScalarFieldType* nodalPressureField; + const VectorFieldType* coordField; }; //======= templated element kernel function ================== @@ -168,9 +169,9 @@ element_discrete_laplacian_kernel_3d( stk::mesh::BulkData& bulkData, stk::mesh::Entity elem, sierra::nalu::MasterElement& meSCS, - sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, - sierra::nalu::ScalarFieldType* nodalPressureField, - const sierra::nalu::VectorFieldType* coordField) + ScalarFieldType* discreteLaplacianOfPressure, + ScalarFieldType* nodalPressureField, + const VectorFieldType* coordField) { const int nDim = 3; const stk::mesh::Entity* elemNodes = bulkData.begin_nodes(elem); @@ -233,9 +234,9 @@ class TestElemAlgorithmWithTemplate public: TestElemAlgorithmWithTemplate( stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType* coord, - sierra::nalu::ScalarFieldType* discreteLaplacian, - sierra::nalu::ScalarFieldType* nodalPressure) + const VectorFieldType* coord, + ScalarFieldType* discreteLaplacian, + ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -291,9 +292,9 @@ public: private: stk::mesh::BulkData& bulkData_; - sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; - sierra::nalu::ScalarFieldType* nodalPressureField; - const sierra::nalu::VectorFieldType* coordField; + ScalarFieldType* discreteLaplacianOfPressure; + ScalarFieldType* nodalPressureField; + const VectorFieldType* coordField; }; //=========== Test class that mimics an element algorithm ============== @@ -304,9 +305,9 @@ class TestElemAlgorithmWithViews public: TestElemAlgorithmWithViews( stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType* coord, - sierra::nalu::ScalarFieldType* discreteLaplacian, - sierra::nalu::ScalarFieldType* nodalPressure) + const VectorFieldType* coord, + ScalarFieldType* discreteLaplacian, + ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -412,9 +413,9 @@ public: private: stk::mesh::BulkData& bulkData_; - sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; - sierra::nalu::ScalarFieldType* nodalPressureField; - const sierra::nalu::VectorFieldType* coordField; + ScalarFieldType* discreteLaplacianOfPressure; + ScalarFieldType* nodalPressureField; + const VectorFieldType* coordField; }; //========= below are the test 'main's... =============== diff --git a/unit_tests/UnitTestLidarLOS.C b/unit_tests/UnitTestLidarLOS.C index e459963b7..ca90aaa06 100644 --- a/unit_tests/UnitTestLidarLOS.C +++ b/unit_tests/UnitTestLidarLOS.C @@ -94,7 +94,6 @@ public: bulk(*bulkptr), meta(bulk.mesh_meta_data()) { - meta.use_simple_fields(); stk::io::StkMeshIoBroker io(bulk.parallel()); io.set_bulk_data(bulk); @@ -107,12 +106,11 @@ public: io.add_mesh_database(mesh_name, stk::io::READ_MESH); io.create_input_mesh(); - using vector_field_type = stk::mesh::Field; + using vector_field_type = stk::mesh::Field; auto node_rank = stk::topology::NODE_RANK; - auto& vel_field = meta.declare_field(node_rank, "velocity", 2); - stk::mesh::put_field_on_entire_mesh(vel_field, meta.spatial_dimension()); - stk::io::set_field_output_type( - vel_field, stk::io::FieldOutputType::VECTOR_3D); + auto& vel_field = + meta.declare_field(node_rank, "velocity", 2); + stk::mesh::put_field_on_entire_mesh(vel_field); io.populate_bulk_data(); stk::mesh::field_fill(1., vel_field.field_of_state(stk::mesh::StateNP1)); stk::mesh::field_fill(1., vel_field.field_of_state(stk::mesh::StateN)); diff --git a/unit_tests/UnitTestMasterElements.C b/unit_tests/UnitTestMasterElements.C index 75585916e..cd5b34e13 100644 --- a/unit_tests/UnitTestMasterElements.C +++ b/unit_tests/UnitTestMasterElements.C @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ TEST(pyramid, is_in_element) ASSERT_TRUE(std::isfinite(dist)); } -using VectorFieldType = stk::mesh::Field; +using VectorFieldType = stk::mesh::Field; //------------------------------------------------------------------------- double linear_scalar_value(int dim, double a, const double* b, const double* x) @@ -561,7 +562,6 @@ protected: meshBuilder.set_spatial_dimension(topo.dimension()); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); elem = unit_test_utils::create_one_reference_element(*bulk, topo); meSS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host(topo); diff --git a/unit_tests/UnitTestMetricTensor.C b/unit_tests/UnitTestMetricTensor.C index acac3dbc4..e9918277e 100644 --- a/unit_tests/UnitTestMetricTensor.C +++ b/unit_tests/UnitTestMetricTensor.C @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -59,7 +60,7 @@ calculate_metric_tensor( return {ws_contravariant_metric_tensor, ws_covariant_metric_tensor}; } -using VectorFieldType = stk::mesh::Field; +using VectorFieldType = stk::mesh::Field; void test_metric_for_topo_2D(stk::topology topo, double tol) @@ -70,7 +71,6 @@ test_metric_for_topo_2D(stk::topology topo, double tol) stk::mesh::MeshBuilder meshBuilder(MPI_COMM_WORLD); meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); - bulk->mesh_meta_data().use_simple_fields(); stk::mesh::Entity elem = unit_test_utils::create_one_reference_element(*bulk, topo); @@ -136,7 +136,6 @@ test_metric_for_topo_3D(stk::topology topo, double tol) stk::mesh::MeshBuilder meshBuilder(MPI_COMM_WORLD); meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); - bulk->mesh_meta_data().use_simple_fields(); stk::mesh::Entity elem = unit_test_utils::create_one_reference_element(*bulk, topo); diff --git a/unit_tests/UnitTestMijTensor.C b/unit_tests/UnitTestMijTensor.C index 8dc820f86..f149674f1 100644 --- a/unit_tests/UnitTestMijTensor.C +++ b/unit_tests/UnitTestMijTensor.C @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ calculate_mij_tensor( return mij_tensor; } -using VectorFieldType = stk::mesh::Field; +using VectorFieldType = stk::mesh::Field; void test_metric_for_topo_2D(stk::topology topo, double tol) @@ -64,7 +65,6 @@ test_metric_for_topo_2D(stk::topology topo, double tol) meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); stk::mesh::Entity elem = unit_test_utils::create_one_reference_element(*bulk, topo); @@ -132,7 +132,6 @@ test_metric_for_topo_3D(stk::topology topo, double tol) meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); stk::mesh::Entity elem = unit_test_utils::create_one_reference_element(*bulk, topo); diff --git a/unit_tests/UnitTestMovingAverage.C b/unit_tests/UnitTestMovingAverage.C index 29d5fed73..ecb7834de 100644 --- a/unit_tests/UnitTestMovingAverage.C +++ b/unit_tests/UnitTestMovingAverage.C @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -32,12 +33,11 @@ public: meshBuilder.set_spatial_dimension(numberOfDimensions); bulk_ = meshBuilder.create(); auto& meta_ = bulk_->mesh_meta_data(); - meta_.use_simple_fields(); - temperature_ = - &meta_.declare_field(stk::topology::NODE_RANK, "temperature"); + temperature_ = &meta_.declare_field( + stk::topology::NODE_RANK, "temperature"); - raTemperature_ = &meta_.declare_field( + raTemperature_ = &meta_.declare_field( stk::topology::NODE_RANK, sierra::nalu::MovingAveragePostProcessor::filtered_field_name( "temperature")); @@ -60,8 +60,8 @@ public: int numSteps; stk::mesh::Entity node; - sierra::nalu::ScalarFieldType* temperature_; - sierra::nalu::ScalarFieldType* raTemperature_; + ScalarFieldType* temperature_; + ScalarFieldType* raTemperature_; }; } // namespace diff --git a/unit_tests/UnitTestNgpMesh1.C b/unit_tests/UnitTestNgpMesh1.C index 040b54e11..a01fb27b2 100644 --- a/unit_tests/UnitTestNgpMesh1.C +++ b/unit_tests/UnitTestNgpMesh1.C @@ -97,8 +97,8 @@ void test_ngp_mesh_field_values( sierra::nalu::FieldManager& fieldManager, const stk::mesh::BulkData& bulk, - sierra::nalu::VectorFieldType* velocity, - sierra::nalu::GenericFieldType* massFlowRate) + VectorFieldType* velocity, + GenericFieldType* massFlowRate) { const stk::mesh::MetaData& meta = bulk.mesh_meta_data(); stk::mesh::Selector all_local = @@ -156,10 +156,14 @@ test_ngp_mesh_field_values( }); }); - auto flowRateData = fieldManager.get_legacy_smart_field( - "mass_flow_rate_scs"); + auto flowRateData = + fieldManager + .get_legacy_smart_field( + "mass_flow_rate_scs"); auto velocityData = - fieldManager.get_legacy_smart_field("velocity"); + fieldManager + .get_legacy_smart_field( + "velocity"); const double tol = 1.0e-16; for (const stk::mesh::Bucket* b : elemBuckets) { for (stk::mesh::Entity elem : *b) { diff --git a/unit_tests/UnitTestRealm.C b/unit_tests/UnitTestRealm.C index a9c043902..09bd83e3e 100644 --- a/unit_tests/UnitTestRealm.C +++ b/unit_tests/UnitTestRealm.C @@ -187,7 +187,6 @@ NaluTest::create_realm( stk::mesh::MeshBuilder meshBuilder(comm_); meshBuilder.set_spatial_dimension(spatialDim_); realm->bulkData_ = meshBuilder.create(); - realm->bulkData_->mesh_meta_data().use_simple_fields(); } sim_.realms_->realmVector_.push_back(realm); @@ -197,7 +196,7 @@ NaluTest::create_realm( void verify_field_values( double expectedValue, - sierra::nalu::ScalarFieldType* maxLengthScaleField, + ScalarFieldType* maxLengthScaleField, const stk::mesh::BulkData& mesh) { const stk::mesh::BucketVector& nodeBuckets = @@ -230,8 +229,8 @@ TEST(NaluMock, test_nalu_mock) sierra::nalu::Realm& realm = naluObj.create_realm(realm_node); // 4. Create necessary fields... - sierra::nalu::ScalarFieldType& maxLengthScaleField = - realm.meta_data().declare_field( + ScalarFieldType& maxLengthScaleField = + realm.meta_data().declare_field( stk::topology::NODE_RANK, "sst_max_length_scale"); double zero = 0.0; stk::mesh::put_field_on_mesh( diff --git a/unit_tests/UnitTestSideIsInElement.C b/unit_tests/UnitTestSideIsInElement.C index 45a2b2ca4..c9649ab15 100644 --- a/unit_tests/UnitTestSideIsInElement.C +++ b/unit_tests/UnitTestSideIsInElement.C @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -23,7 +24,7 @@ #include "UnitTestUtils.h" namespace { -using VectorFieldType = stk::mesh::Field; +using VectorFieldType = stk::mesh::Field; void randomly_perturb_element_coords( @@ -76,7 +77,6 @@ check_side_is_in_element(stk::topology topo) meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); auto elem = unit_test_utils::create_one_reference_element(*bulk, topo); const VectorFieldType& coordField = diff --git a/unit_tests/UnitTestSidePCoords.C b/unit_tests/UnitTestSidePCoords.C index e258cf904..aa1d179df 100644 --- a/unit_tests/UnitTestSidePCoords.C +++ b/unit_tests/UnitTestSidePCoords.C @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -40,14 +41,13 @@ check_elem_to_side_coords(stk::topology topo) meshBuilder.set_spatial_dimension(dim); auto bulk = meshBuilder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); auto elem = unit_test_utils::create_one_reference_element(*bulk, topo); const stk::mesh::Entity* elem_node_rels = bulk->begin_nodes(elem); auto* meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host(topo); - using VectorFieldType = stk::mesh::Field; + using VectorFieldType = stk::mesh::Field; const VectorFieldType& coordField = *static_cast(meta.coordinate_field()); diff --git a/unit_tests/UnitTestSideWriter.C b/unit_tests/UnitTestSideWriter.C index eee3d6651..b9da728e3 100644 --- a/unit_tests/UnitTestSideWriter.C +++ b/unit_tests/UnitTestSideWriter.C @@ -20,12 +20,13 @@ public: meshBuilder.set_aura_option(stk::mesh::BulkData::NO_AUTO_AURA); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); stk::io::StkMeshIoBroker io(bulk->parallel()); - test_field = &meta->declare_field(stk::topology::NODE_RANK, "test"); + test_field = &meta->declare_field>( + stk::topology::NODE_RANK, "test"); test_vector_field = - &meta->declare_field(stk::topology::NODE_RANK, "test_vector"); + &meta->declare_field>( + stk::topology::NODE_RANK, "test_vector"); double minus_one = -1; stk::mesh::put_field_on_mesh( @@ -33,8 +34,6 @@ public: stk::mesh::put_field_on_mesh( *test_vector_field, meta->universal_part(), 3, &minus_one); - stk::io::set_field_output_type( - *test_vector_field, stk::io::FieldOutputType::VECTOR_3D); const std::string name = "generated:3x3x3|sideset:xXyYzZ"; io.set_bulk_data(*bulk); @@ -48,7 +47,7 @@ public: std::shared_ptr bulk; // stk::io::StkMeshIoBroker io; stk::mesh::Field* test_field; - stk::mesh::Field* test_vector_field; + stk::mesh::Field* test_vector_field; }; TEST_F(SideWriterFixture, side) @@ -60,7 +59,8 @@ TEST_F(SideWriterFixture, side) *bulk, sides, {test_field, test_vector_field}, "test_output/file.e"); auto& coord_field = - *static_cast*>(meta->coordinate_field()); + *static_cast*>( + meta->coordinate_field()); const auto& all_node_buckets = bulk->get_buckets(stk::topology::NODE_RANK, meta->universal_part()); @@ -116,4 +116,4 @@ TEST(SideWriterContainerTest, load) } } // namespace nalu -} // namespace sierra +} // namespace sierra \ No newline at end of file diff --git a/unit_tests/UnitTestSingleHexPromotion.C b/unit_tests/UnitTestSingleHexPromotion.C index aff775d99..8a5aab6f4 100644 --- a/unit_tests/UnitTestSingleHexPromotion.C +++ b/unit_tests/UnitTestSingleHexPromotion.C @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -71,8 +72,8 @@ fill_and_promote_hex_mesh( io.populate_bulk_data(); stk::mesh::create_exposed_block_boundary_sides(bulk, *blockPart, {surfPart}); - sierra::nalu::VectorFieldType* coords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coords = + meta.get_field(stk::topology::NODE_RANK, "coordinates"); stk::mesh::PartVector baseParts = {blockPart, surfPart}; std::vector nodes(polyOrder + 1); for (size_t j = 0; j < polyOrder + 1; ++j) { @@ -90,8 +91,8 @@ dump_promoted_mesh_file(stk::mesh::BulkData& bulk, int polyOrder) std::string fileName = "out.e"; auto desc = sierra::nalu::HexNElementDescription(polyOrder); - sierra::nalu::VectorFieldType* coordField = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coordField = + meta.get_field(stk::topology::NODE_RANK, "coordinates"); sierra::nalu::PromotedElementIO io( polyOrder, meta, bulk, outParts, fileName, *coordField); @@ -126,7 +127,6 @@ TEST(SingleHexPromotion, coords_p2) meshBuilder.set_aura_option(stk::mesh::BulkData::NO_AUTO_AURA); auto bulk = meshBuilder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); std::string singleElemMeshSpec = "generated:1x1x1"; fill_and_promote_hex_mesh(singleElemMeshSpec, *bulk, polynomialOrder); @@ -141,8 +141,8 @@ TEST(SingleHexPromotion, coords_p2) stk::mesh::get_selected_entities(promotedElemSelector, buckets, elems); ASSERT_EQ(elems.size(), 1u); - sierra::nalu::VectorFieldType* coordField = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* coordField = + meta.get_field(stk::topology::NODE_RANK, "coordinates"); for (stk::mesh::Entity elem : elems) { const stk::mesh::Entity* elemNodeRelations = bulk->begin_nodes(elem); for (unsigned k = 0; k < bulk->num_nodes(elem); ++k) { diff --git a/unit_tests/UnitTestSmartField.C b/unit_tests/UnitTestSmartField.C index c44a1c502..7a0d10b75 100644 --- a/unit_tests/UnitTestSmartField.C +++ b/unit_tests/UnitTestSmartField.C @@ -21,7 +21,7 @@ protected: { fill_mesh_and_initialize_test_fields(); - auto* field = fieldManager->get_field_ptr("scalarQ"); + auto* field = fieldManager->get_field_ptr("scalarQ"); ngpField_ = &stk::mesh::get_updated_ngp_field(*field); @@ -169,7 +169,7 @@ TEST_F(TestSmartField, update_field_on_device_check_on_host) { double sum = 0.0; int counter = 0; - auto* field = fieldManager->get_field_ptr("scalarQ"); + auto* field = fieldManager->get_field_ptr("scalarQ"); auto fieldRef = sierra::nalu::MakeSmartField()(field); stk::mesh::Selector sel = stk::mesh::selectUnion(partVec); diff --git a/unit_tests/UnitTestSpinnerLidarPattern.C b/unit_tests/UnitTestSpinnerLidarPattern.C index fa689db5b..0fd418478 100644 --- a/unit_tests/UnitTestSpinnerLidarPattern.C +++ b/unit_tests/UnitTestSpinnerLidarPattern.C @@ -70,7 +70,6 @@ TEST(SpinnerLidar, volume_interp) builder.set_spatial_dimension(3U); auto bulk = builder.create(); auto& meta = bulk->mesh_meta_data(); - meta.use_simple_fields(); stk::io::StkMeshIoBroker io(bulk->parallel()); io.set_bulk_data(*bulk); @@ -83,10 +82,11 @@ TEST(SpinnerLidar, volume_interp) io.add_mesh_database(mesh_name, stk::io::READ_MESH); io.create_input_mesh(); - using vector_field_type = stk::mesh::Field; + using vector_field_type = stk::mesh::Field; auto node_rank = stk::topology::NODE_RANK; - auto& vel_field = meta.declare_field(node_rank, "velocity", 2); - stk::mesh::put_field_on_entire_mesh(vel_field, meta.spatial_dimension()); + auto& vel_field = + meta.declare_field(node_rank, "velocity", 2); + stk::mesh::put_field_on_entire_mesh(vel_field); io.populate_bulk_data(); auto& vel_field_old = vel_field.field_of_state(stk::mesh::StateN); diff --git a/unit_tests/UnitTestSuppAlgDataSharing.C b/unit_tests/UnitTestSuppAlgDataSharing.C index 7503b6827..0ae19590d 100644 --- a/unit_tests/UnitTestSuppAlgDataSharing.C +++ b/unit_tests/UnitTestSuppAlgDataSharing.C @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -48,11 +49,14 @@ public: elemVectorField(nullptr), elemTensorField(nullptr) { - nodalScalarField = fldMgr.register_field("nodalScalarField", parts); + nodalScalarField = + fldMgr.register_field("nodalScalarField", parts); nodalVectorField = fldMgr.register_generic_field("nodalGenericField", parts, 0, 4); - nodalTensorField = fldMgr.register_field("nodalTensorField", parts); - elemScalarField = fldMgr.register_field("elemScalarField", parts); + nodalTensorField = + fldMgr.register_field("nodalTensorField", parts); + elemScalarField = + fldMgr.register_field("elemScalarField", parts); elemVectorField = fldMgr.register_generic_field("elemVectorField", parts, 0, 8); elemTensorField = @@ -102,12 +106,12 @@ public: } private: - const sierra::nalu::ScalarFieldType* nodalScalarField; - const sierra::nalu::GenericFieldType* nodalVectorField; - const sierra::nalu::TensorFieldType* nodalTensorField; - const sierra::nalu::ScalarFieldType* elemScalarField; - const sierra::nalu::GenericFieldType* elemVectorField; - const sierra::nalu::GenericFieldType* elemTensorField; + const ScalarFieldType* nodalScalarField; + const GenericFieldType* nodalVectorField; + const TensorFieldType* nodalTensorField; + const ScalarFieldType* elemScalarField; + const GenericFieldType* elemVectorField; + const GenericFieldType* elemTensorField; }; //=========== Test class that mimics an alg with supplemental algs ======== @@ -202,14 +206,14 @@ TEST_F(Hex8Mesh, supp_alg_data_sharing) TEST_F(Hex8Mesh, inconsistent_field_requests) { - sierra::nalu::ScalarFieldType& nodalScalarField = - meta->declare_field(stk::topology::NODE_RANK, "nodalScalarField"); - sierra::nalu::TensorFieldType& nodalTensorField = - meta->declare_field(stk::topology::NODE_RANK, "nodalTensorField"); - sierra::nalu::ScalarFieldType& elemScalarField = - meta->declare_field(stk::topology::ELEM_RANK, "elemScalarField"); - sierra::nalu::TensorFieldType& elemTensorField = - meta->declare_field(stk::topology::ELEM_RANK, "elemTensorField"); + ScalarFieldType& nodalScalarField = meta->declare_field( + stk::topology::NODE_RANK, "nodalScalarField"); + TensorFieldType& nodalTensorField = meta->declare_field( + stk::topology::NODE_RANK, "nodalTensorField"); + ScalarFieldType& elemScalarField = meta->declare_field( + stk::topology::ELEM_RANK, "elemScalarField"); + TensorFieldType& elemTensorField = meta->declare_field( + stk::topology::ELEM_RANK, "elemTensorField"); const stk::mesh::Part& wholemesh = meta->universal_part(); diff --git a/unit_tests/UnitTestUtils.C b/unit_tests/UnitTestUtils.C index d70b28a45..28ee4864b 100644 --- a/unit_tests/UnitTestUtils.C +++ b/unit_tests/UnitTestUtils.C @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -57,8 +58,8 @@ perturb_coord_hex_8(stk::mesh::BulkData& bulk, double perturbSize) Lcg lcg(bulk.parallel_rank() + 1); const auto& meta = bulk.mesh_meta_data(); - const sierra::nalu::VectorFieldType* coordField = - dynamic_cast(meta.coordinate_field()); + const VectorFieldType* coordField = + dynamic_cast(meta.coordinate_field()); ThrowRequire(coordField != nullptr); for (const auto* ib : @@ -137,13 +138,12 @@ create_one_element( } // set a coordinate field - auto& coordField = - meta.declare_field(stk::topology::NODE_RANK, "coordinates"); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta.declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); stk::mesh::put_field_on_mesh( - coordField, block_1, meta.spatial_dimension(), nullptr); - stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), - nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta.set_coordinate_field(&coordField); meta.commit(); @@ -382,8 +382,8 @@ global_norm( double initialize_linear_scalar_field( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordField, - const sierra::nalu::ScalarFieldType& qField) + const VectorFieldType& coordField, + const ScalarFieldType& qField) { // q = a + b^T x std::mt19937 rng; @@ -416,8 +416,8 @@ initialize_linear_scalar_field( double initialize_quadratic_scalar_field( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordField, - const sierra::nalu::ScalarFieldType& qField) + const VectorFieldType& coordField, + const ScalarFieldType& qField) { // q = a + b^T x + 1/2 x^T H x std::mt19937 rng; @@ -588,21 +588,24 @@ Hex8MeshWithNSOFields::Hex8MeshWithNSOFields() : Hex8Mesh() "exposed_area_vector", universal, num_states, quad_vec_len, oneVecTwelve.data()); - velocity = - fieldManager->register_field("velocity", universal, oneVecThree); + velocity = fieldManager->register_field( + "velocity", universal, oneVecThree); - dpdx = fieldManager->register_field("dpdx", universal, oneVecThree); + dpdx = fieldManager->register_field( + "dpdx", universal, oneVecThree); - density = fieldManager->register_field("density", universal, &one); + density = + fieldManager->register_field("density", universal, &one); viscosity = - fieldManager->register_field("viscosity", universal, &one); + fieldManager->register_field("viscosity", universal, &one); - pressure = fieldManager->register_field("pressure", universal, &one); + pressure = + fieldManager->register_field("pressure", universal, &one); - udiag = - fieldManager->register_field("momentum_diag", universal, &one); + udiag = fieldManager->register_field( + "momentum_diag", universal, &one); - dnvField = - fieldManager->register_field("dual_nodal_volume", universal, &one); + dnvField = fieldManager->register_field( + "dual_nodal_volume", universal, &one); } diff --git a/unit_tests/UnitTestUtils.h b/unit_tests/UnitTestUtils.h index d2cd03ac2..a9b6d927f 100644 --- a/unit_tests/UnitTestUtils.h +++ b/unit_tests/UnitTestUtils.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include @@ -29,7 +29,14 @@ #include -using IdFieldType = sierra::nalu::ScalarFieldType; +using sierra::nalu::GlobalIdFieldType; +using sierra::nalu::ScalarFieldType; +using IdFieldType = ScalarFieldType; +using sierra::nalu::GenericFieldType; +using sierra::nalu::GenericIntFieldType; +using sierra::nalu::ScalarIntFieldType; +using sierra::nalu::TensorFieldType; +using sierra::nalu::VectorFieldType; namespace unit_test_utils { @@ -63,8 +70,8 @@ double global_norm( double initialize_quadratic_scalar_field( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordField, - const sierra::nalu::ScalarFieldType& qField); + const VectorFieldType& coordField, + const ScalarFieldType& qField); std::array random_rotation_matrix(int dim, std::mt19937& rng); std::array @@ -90,23 +97,24 @@ class Hex8Mesh : public ::testing::Test meshBuilder.set_spatial_dimension(spatialDimension); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); fieldManager = std::make_shared(*meta, numStates); double one = 1.0; double zero = 0.0; const stk::mesh::PartVector parts(1, &meta->universal_part()); - elemCentroidField = - fieldManager->register_field("elemCentroid", parts, &zero); - nodalPressureField = - fieldManager->register_field("nodalPressure", parts, &one); - discreteLaplacianOfPressure = - fieldManager->register_field("discreteLaplacian", parts, &zero); - scalarQ = fieldManager->register_field("scalarQ", parts, &zero); - diffFluxCoeff = - fieldManager->register_field("diffFluxCoeff", parts, &zero); - idField = fieldManager->register_field("idField", parts, &zero); + elemCentroidField = fieldManager->register_field( + "elemCentroid", parts, &zero); + nodalPressureField = fieldManager->register_field( + "nodalPressure", parts, &one); + discreteLaplacianOfPressure = fieldManager->register_field( + "discreteLaplacian", parts, &zero); + scalarQ = + fieldManager->register_field("scalarQ", parts, &zero); + diffFluxCoeff = fieldManager->register_field( + "diffFluxCoeff", parts, &zero); + idField = + fieldManager->register_field("idField", parts, &zero); } ~Hex8Mesh() {} @@ -127,8 +135,7 @@ class Hex8Mesh : public ::testing::Test partVec = {meta->get_part("block_1")}; - coordField = static_cast( - meta->coordinate_field()); + coordField = static_cast(meta->coordinate_field()); EXPECT_TRUE(coordField != nullptr); exactLaplacian = unit_test_utils::initialize_quadratic_scalar_field( @@ -146,14 +153,14 @@ class Hex8Mesh : public ::testing::Test std::shared_ptr bulk; std::shared_ptr fieldManager; stk::topology topo; - sierra::nalu::VectorFieldType* elemCentroidField; - sierra::nalu::ScalarFieldType* nodalPressureField; - sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; - sierra::nalu::ScalarFieldType* scalarQ; - sierra::nalu::ScalarFieldType* diffFluxCoeff; + VectorFieldType* elemCentroidField; + ScalarFieldType* nodalPressureField; + ScalarFieldType* discreteLaplacianOfPressure; + ScalarFieldType* scalarQ; + ScalarFieldType* diffFluxCoeff; IdFieldType* idField; stk::mesh::PartVector partVec; - const sierra::nalu::VectorFieldType* coordField; + const VectorFieldType* coordField; double exactLaplacian; }; @@ -162,16 +169,16 @@ class Hex8MeshWithNSOFields : public Hex8Mesh protected: Hex8MeshWithNSOFields(); - sierra::nalu::GenericFieldType* massFlowRate; - sierra::nalu::GenericFieldType* Gju; - sierra::nalu::VectorFieldType* velocity; - sierra::nalu::VectorFieldType* dpdx; - sierra::nalu::GenericFieldType* exposedAreaVec; - sierra::nalu::ScalarFieldType* density; - sierra::nalu::ScalarFieldType* viscosity; - sierra::nalu::ScalarFieldType* pressure; - sierra::nalu::ScalarFieldType* udiag; - sierra::nalu::ScalarFieldType* dnvField; + GenericFieldType* massFlowRate; + GenericFieldType* Gju; + VectorFieldType* velocity; + VectorFieldType* dpdx; + GenericFieldType* exposedAreaVec; + ScalarFieldType* density; + ScalarFieldType* viscosity; + ScalarFieldType* pressure; + ScalarFieldType* udiag; + ScalarFieldType* dnvField; }; class Hex8ElementWithBCFields : public ::testing::Test @@ -190,49 +197,48 @@ class Hex8ElementWithBCFields : public ::testing::Test meshBuilder.set_spatial_dimension(3); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); - velocity = - &meta->declare_field(stk::topology::NODE_RANK, "velocity"); - bcVelocity = &meta->declare_field( + velocity = &meta->declare_field( + stk::topology::NODE_RANK, "velocity"); + bcVelocity = &meta->declare_field( stk::topology::NODE_RANK, "wall_velocity_bc"); - density = &meta->declare_field(stk::topology::NODE_RANK, "density"); - viscosity = - &meta->declare_field(stk::topology::NODE_RANK, "viscosity"); - bcHeatFlux = - &meta->declare_field(stk::topology::NODE_RANK, "heat_flux_bc"); - specificHeat = - &meta->declare_field(stk::topology::NODE_RANK, "specific_heat"); - exposedAreaVec = - &meta->declare_field(meta->side_rank(), "exposed_area_vector"); - wallFrictionVelocityBip = &meta->declare_field( + density = &meta->declare_field( + stk::topology::NODE_RANK, "density"); + viscosity = &meta->declare_field( + stk::topology::NODE_RANK, "viscosity"); + bcHeatFlux = &meta->declare_field( + stk::topology::NODE_RANK, "heat_flux_bc"); + specificHeat = &meta->declare_field( + stk::topology::NODE_RANK, "specific_heat"); + exposedAreaVec = &meta->declare_field( + meta->side_rank(), "exposed_area_vector"); + wallFrictionVelocityBip = &meta->declare_field( meta->side_rank(), "wall_friction_velocity_bip"); - wallNormalDistanceBip = &meta->declare_field( + wallNormalDistanceBip = &meta->declare_field( meta->side_rank(), "wall_normal_distance_bip"); - bcVelocityOpen = &meta->declare_field( + bcVelocityOpen = &meta->declare_field( stk::topology::NODE_RANK, "open_velocity_bc"); - openMdot = - &meta->declare_field(meta->side_rank(), "open_mass_flow_rate"); - Gjui = &meta->declare_field(stk::topology::NODE_RANK, "dudx"); - scalarQ = - &meta->declare_field(stk::topology::NODE_RANK, "scalar_q"); - bcScalarQ = - &meta->declare_field(stk::topology::NODE_RANK, "bc_scalar_q"); - Gjq = &meta->declare_field(stk::topology::NODE_RANK, "Gjq"); + openMdot = &meta->declare_field( + meta->side_rank(), "open_mass_flow_rate"); + Gjui = + &meta->declare_field(stk::topology::NODE_RANK, "dudx"); + scalarQ = &meta->declare_field( + stk::topology::NODE_RANK, "scalar_q"); + bcScalarQ = &meta->declare_field( + stk::topology::NODE_RANK, "bc_scalar_q"); + Gjq = + &meta->declare_field(stk::topology::NODE_RANK, "Gjq"); stk::mesh::put_field_on_mesh( *velocity, meta->universal_part(), 3, oneVecThree); - stk::io::set_field_output_type( - *velocity, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *bcVelocity, meta->universal_part(), 3, oneVecThree); - stk::io::set_field_output_type( - *bcVelocity, stk::io::FieldOutputType::VECTOR_3D); - stk::mesh::put_field_on_mesh(*density, meta->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*viscosity, meta->universal_part(), &one); - stk::mesh::put_field_on_mesh(*bcHeatFlux, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*density, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*viscosity, meta->universal_part(), 1, &one); stk::mesh::put_field_on_mesh( - *specificHeat, meta->universal_part(), nullptr); + *bcHeatFlux, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *specificHeat, meta->universal_part(), 1, nullptr); const sierra::nalu::MasterElement* meFC = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( @@ -249,19 +255,14 @@ class Hex8ElementWithBCFields : public ::testing::Test stk::mesh::put_field_on_mesh( *bcVelocityOpen, meta->universal_part(), 3, oneVecThree); - stk::io::set_field_output_type( - *bcVelocityOpen, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *openMdot, meta->universal_part(), 4, oneVecFour); stk::mesh::put_field_on_mesh( *Gjui, meta->universal_part(), 3 * 3, oneVecNine); - stk::io::set_field_output_type( - *Gjui, stk::io::FieldOutputType::FULL_TENSOR_36); - stk::mesh::put_field_on_mesh(*scalarQ, meta->universal_part(), &one); - stk::mesh::put_field_on_mesh(*bcScalarQ, meta->universal_part(), &one); + stk::mesh::put_field_on_mesh(*scalarQ, meta->universal_part(), 1, &one); + stk::mesh::put_field_on_mesh(*bcScalarQ, meta->universal_part(), 1, &one); stk::mesh::put_field_on_mesh(*Gjq, meta->universal_part(), 3, oneVecThree); - stk::io::set_field_output_type(*Gjq, stk::io::FieldOutputType::VECTOR_3D); unit_test_utils::create_one_reference_element( *bulk, stk::topology::HEXAHEDRON_8); @@ -271,21 +272,21 @@ class Hex8ElementWithBCFields : public ::testing::Test stk::mesh::MetaData* meta; std::shared_ptr bulk; - sierra::nalu::VectorFieldType* velocity; - sierra::nalu::VectorFieldType* bcVelocity; - sierra::nalu::ScalarFieldType* density; - sierra::nalu::ScalarFieldType* viscosity; - sierra::nalu::ScalarFieldType* bcHeatFlux; - sierra::nalu::ScalarFieldType* specificHeat; - sierra::nalu::GenericFieldType* exposedAreaVec; - sierra::nalu::GenericFieldType* wallFrictionVelocityBip; - sierra::nalu::GenericFieldType* wallNormalDistanceBip; - sierra::nalu::VectorFieldType* bcVelocityOpen; - sierra::nalu::GenericFieldType* openMdot; - sierra::nalu::TensorFieldType* Gjui; - sierra::nalu::ScalarFieldType* scalarQ; - sierra::nalu::ScalarFieldType* bcScalarQ; - sierra::nalu::VectorFieldType* Gjq; + VectorFieldType* velocity; + VectorFieldType* bcVelocity; + ScalarFieldType* density; + ScalarFieldType* viscosity; + ScalarFieldType* bcHeatFlux; + ScalarFieldType* specificHeat; + GenericFieldType* exposedAreaVec; + GenericFieldType* wallFrictionVelocityBip; + GenericFieldType* wallNormalDistanceBip; + VectorFieldType* bcVelocityOpen; + GenericFieldType* openMdot; + TensorFieldType* Gjui; + ScalarFieldType* scalarQ; + ScalarFieldType* bcScalarQ; + VectorFieldType* Gjq; }; class CylinderMesh : public ::testing::Test @@ -305,78 +306,71 @@ class CylinderMesh : public ::testing::Test meshBuilder.set_spatial_dimension(spatialDimension); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); - testField = - &meta->declare_field(stk::topology::NODE_RANK, "testField"); - curCoords_ = &meta->declare_field( + testField = &meta->declare_field( + stk::topology::NODE_RANK, "testField"); + curCoords_ = &meta->declare_field( stk::topology::NODE_RANK, "current_coordinates"); - meshDisp_ = &meta->declare_field( + meshDisp_ = &meta->declare_field( stk::topology::NODE_RANK, "mesh_displacement"); - deflectionRamp_ = - &meta->declare_field(stk::topology::NODE_RANK, "deflection_ramp"); - dispMap_ = &meta->declare_field(stk::topology::NODE_RANK, "disp_map"); - dispMapInterp_ = - &meta->declare_field(stk::topology::NODE_RANK, "disp_map_interp"); - loadMap_ = &meta->declare_field(stk::topology::NODE_RANK, "load_map"); - loadMapInterp_ = - &meta->declare_field(stk::topology::NODE_RANK, "load_map_interp"); - tforceSCS_ = - &meta->declare_field(stk::topology::NODE_RANK, "tforce_scs"); - mesh_displacement_ref_ = &meta->declare_field( + deflectionRamp_ = &meta->declare_field( + stk::topology::NODE_RANK, "deflection_ramp"); + dispMap_ = &meta->declare_field( + stk::topology::NODE_RANK, "disp_map"); + dispMapInterp_ = &meta->declare_field( + stk::topology::NODE_RANK, "disp_map_interp"); + loadMap_ = &meta->declare_field( + stk::topology::NODE_RANK, "load_map"); + loadMapInterp_ = &meta->declare_field( + stk::topology::NODE_RANK, "load_map_interp"); + tforceSCS_ = &meta->declare_field( + stk::topology::NODE_RANK, "tforce_scs"); + mesh_displacement_ref_ = &meta->declare_field( stk::topology::NODE_RANK, "mesh_displacement_ref"); - mesh_velocity_ref_ = &meta->declare_field( + mesh_velocity_ref_ = &meta->declare_field( stk::topology::NODE_RANK, "mesh_velocity_ref"); - div_mesh_velocity_ = &meta->declare_field( + div_mesh_velocity_ = &meta->declare_field( stk::topology::NODE_RANK, "div_mesh_velocity"); - density_ = &meta->declare_field( + density_ = &meta->declare_field( stk::topology::NODE_RANK, "density", 3 /*num-states*/); - pressure_ = - &meta->declare_field(stk::topology::NODE_RANK, "pressure"); - viscosity_ = &meta->declare_field( + pressure_ = &meta->declare_field( + stk::topology::NODE_RANK, "pressure"); + viscosity_ = &meta->declare_field( stk::topology::NODE_RANK, "effective_viscosity_u"); - exposedAreaVec_ = - &meta->declare_field(meta->side_rank(), "exposed_area_vector"); - dudx_ = &meta->declare_field(stk::topology::NODE_RANK, "dudx"); + exposedAreaVec_ = &meta->declare_field( + meta->side_rank(), "exposed_area_vector"); + dudx_ = + &meta->declare_field(stk::topology::NODE_RANK, "dudx"); const double zeroVecThree[3] = {0.0, 0.0, 0.0}; stk::mesh::put_field_on_mesh( *testField, meta->universal_part(), 3, zeroVecThree); - stk::io::set_field_output_type( - *testField, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *curCoords_, meta->universal_part(), 3, zeroVecThree); - stk::io::set_field_output_type( - *curCoords_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *meshDisp_, meta->universal_part(), 3, zeroVecThree); - stk::io::set_field_output_type( - *meshDisp_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *deflectionRamp_, meta->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*dispMap_, meta->universal_part(), nullptr); + *deflectionRamp_, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*dispMap_, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *dispMapInterp_, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*loadMap_, meta->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *dispMapInterp_, meta->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*loadMap_, meta->universal_part(), nullptr); + *loadMapInterp_, meta->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *loadMapInterp_, meta->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tforceSCS_, meta->universal_part(), nullptr); + *tforceSCS_, meta->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *mesh_displacement_ref_, meta->universal_part(), 3, nullptr); - stk::io::set_field_output_type( - *mesh_displacement_ref_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *mesh_velocity_ref_, meta->universal_part(), 3, nullptr); - stk::io::set_field_output_type( - *mesh_velocity_ref_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *div_mesh_velocity_, meta->universal_part(), nullptr); + *div_mesh_velocity_, meta->universal_part(), 1, nullptr); constexpr double one = 1.0; - stk::mesh::put_field_on_mesh(*density_, meta->universal_part(), &one); - stk::mesh::put_field_on_mesh(*pressure_, meta->universal_part(), &one); - stk::mesh::put_field_on_mesh(*viscosity_, meta->universal_part(), &one); + stk::mesh::put_field_on_mesh(*density_, meta->universal_part(), 1, &one); + stk::mesh::put_field_on_mesh(*pressure_, meta->universal_part(), 1, &one); + stk::mesh::put_field_on_mesh(*viscosity_, meta->universal_part(), 1, &one); const sierra::nalu::MasterElement* meFC = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::QUAD_4); @@ -418,8 +412,7 @@ class CylinderMesh : public ::testing::Test } fill_mesh(meshSpec); - coordField = static_cast( - meta->coordinate_field()); + coordField = static_cast(meta->coordinate_field()); EXPECT_TRUE(coordField != nullptr); transform_to_cylinder(innerRad, outerRad); @@ -442,7 +435,7 @@ class CylinderMesh : public ::testing::Test const double yfac = 2 * M_PI / yMax; auto nodeCoord = sierra::nalu::MakeSmartField()( - const_cast(coordField)); + coordField); for (const stk::mesh::Bucket* bptr : bkts) { for (stk::mesh::Entity node : *bptr) { @@ -460,25 +453,25 @@ class CylinderMesh : public ::testing::Test stk::mesh::MetaData* meta; std::shared_ptr bulk; stk::topology topo; - const sierra::nalu::VectorFieldType* coordField; - sierra::nalu::VectorFieldType* testField; - - sierra::nalu::VectorFieldType* curCoords_; - sierra::nalu::VectorFieldType* meshDisp_; - sierra::nalu::ScalarFieldType* deflectionRamp_; - sierra::nalu::ScalarIntFieldType* dispMap_; - sierra::nalu::ScalarFieldType* dispMapInterp_; - sierra::nalu::GenericIntFieldType* loadMap_; - sierra::nalu::GenericFieldType* loadMapInterp_; - sierra::nalu::GenericFieldType* tforceSCS_; - sierra::nalu::VectorFieldType* mesh_displacement_ref_; - sierra::nalu::VectorFieldType* mesh_velocity_ref_; - sierra::nalu::ScalarFieldType* div_mesh_velocity_; - sierra::nalu::ScalarFieldType* density_; - sierra::nalu::ScalarFieldType* pressure_; - sierra::nalu::ScalarFieldType* viscosity_; - sierra::nalu::GenericFieldType* exposedAreaVec_; - sierra::nalu::GenericFieldType* dudx_; + const VectorFieldType* coordField; + VectorFieldType* testField; + + VectorFieldType* curCoords_; + VectorFieldType* meshDisp_; + ScalarFieldType* deflectionRamp_; + ScalarIntFieldType* dispMap_; + ScalarFieldType* dispMapInterp_; + GenericIntFieldType* loadMap_; + GenericFieldType* loadMapInterp_; + GenericFieldType* tforceSCS_; + VectorFieldType* mesh_displacement_ref_; + VectorFieldType* mesh_velocity_ref_; + ScalarFieldType* div_mesh_velocity_; + ScalarFieldType* density_; + ScalarFieldType* pressure_; + ScalarFieldType* viscosity_; + GenericFieldType* exposedAreaVec_; + GenericFieldType* dudx_; }; class ABLWallFunctionHex8ElementWithBCFields : public Hex8ElementWithBCFields diff --git a/unit_tests/actuator/UnitTestActuatorFunctors.C b/unit_tests/actuator/UnitTestActuatorFunctors.C index 749cd98d6..cad2a3aee 100644 --- a/unit_tests/actuator/UnitTestActuatorFunctors.C +++ b/unit_tests/actuator/UnitTestActuatorFunctors.C @@ -17,6 +17,7 @@ namespace sierra { namespace nalu { +using VectorFieldType = stk::mesh::Field; //----------------------------------------------------------------- @@ -156,10 +157,10 @@ protected: stk::mesh::MetaData* stkMeta_; std::shared_ptr stkBulk_; const double tol_; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; - sierra::nalu::VectorFieldType* velocity_{nullptr}; - sierra::nalu::VectorFieldType* actuatorForce_{nullptr}; - sierra::nalu::ScalarFieldType* dualNodalVolume_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; + VectorFieldType* velocity_{nullptr}; + VectorFieldType* actuatorForce_{nullptr}; + ScalarFieldType* dualNodalVolume_{nullptr}; ActuatorFunctorTests() : tol_(1e-8), coordinates_(nullptr) { @@ -167,25 +168,20 @@ protected: meshBuilder.set_spatial_dimension(3); stkBulk_ = meshBuilder.create(); stkMeta_ = &stkBulk_->mesh_meta_data(); - stkMeta_->use_simple_fields(); - velocity_ = - &stkMeta_->declare_field(stk::topology::NODE_RANK, "velocity"); - actuatorForce_ = &stkMeta_->declare_field( + velocity_ = &stkMeta_->declare_field( + stk::topology::NODE_RANK, "velocity"); + actuatorForce_ = &stkMeta_->declare_field( stk::topology::NODE_RANK, "actuator_source"); - dualNodalVolume_ = &stkMeta_->declare_field( + dualNodalVolume_ = &stkMeta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume"); stk::mesh::put_field_on_mesh( *velocity_, stkMeta_->universal_part(), 3, nullptr); - stk::io::set_field_output_type( - *velocity_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *actuatorForce_, stkMeta_->universal_part(), 3, nullptr); - stk::io::set_field_output_type( - *actuatorForce_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *dualNodalVolume_, stkMeta_->universal_part(), nullptr); + *dualNodalVolume_, stkMeta_->universal_part(), 1, nullptr); stk::mesh::field_fill(1.0, *dualNodalVolume_); } @@ -193,8 +189,8 @@ protected: { const std::string meshSpec = "generated:5x5x5"; unit_test_utils::fill_hex8_mesh(meshSpec, *stkBulk_); - coordinates_ = static_cast( - stkMeta_->coordinate_field()); + coordinates_ = + static_cast(stkMeta_->coordinate_field()); const stk::mesh::Selector selector = stkMeta_->locally_owned_part() | stkMeta_->globally_shared_part(); const auto& buckets = @@ -283,7 +279,7 @@ TEST_F(ActuatorFunctorTests, NGP_testSpreadForces) for (unsigned j = 0; j < numNodes; ++j) { stk::mesh::Entity node = elem_node_rels[j]; nodesMatch.push_back(node); - double* actSource = stk::mesh::field_data(*actuatorForce_, node); + double* actSource = (double*)stk::mesh::field_data(*actuatorForce_, node); for (int k = 0; k < 3; ++k) { EXPECT_TRUE(actSource[k] > 0.0) << "Value is: " << actSource[k] << std::endl diff --git a/unit_tests/actuator/UnitTestActuatorSearch.C b/unit_tests/actuator/UnitTestActuatorSearch.C index 2895b4828..d5503fa58 100644 --- a/unit_tests/actuator/UnitTestActuatorSearch.C +++ b/unit_tests/actuator/UnitTestActuatorSearch.C @@ -38,7 +38,6 @@ public: nx("nx"), slabSize(4) { - ioBroker.use_simple_fields(); } void SetUp() @@ -100,9 +99,10 @@ TEST_F(ActuatorSearchTest, NGP_createBoundingSpheres) TEST_F(ActuatorSearchTest, NGP_createElementBoxes) { stk::mesh::BulkData& stkBulk = ioBroker.bulk_data(); - typedef stk::mesh::Field CoordFieldType; - CoordFieldType* coordField = stkBulk.mesh_meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + typedef stk::mesh::Field CoordFieldType; + CoordFieldType* coordField = + stkBulk.mesh_meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); EXPECT_TRUE(coordField != nullptr); try { auto elemVec = CreateElementBoxes(stkBulk, partNames); diff --git a/unit_tests/aero/UnitTestFSIturbine.C b/unit_tests/aero/UnitTestFSIturbine.C index c5b8e9e99..04d9948d7 100644 --- a/unit_tests/aero/UnitTestFSIturbine.C +++ b/unit_tests/aero/UnitTestFSIturbine.C @@ -111,8 +111,8 @@ get_mesh_bounding_box( const unsigned spatialDim = mesh.mesh_meta_data().spatial_dimension(); for (const stk::mesh::Bucket* bptr : nodeBuckets) { - const double* nodeCoords = - static_cast(stk::mesh::field_data(*nodeCoordField, *bptr)); + const double* nodeCoords = reinterpret_cast( + stk::mesh::field_data(*nodeCoordField, *bptr)); for (unsigned i = 0; i < bptr->size(); ++i) { minCoords.x() = std::min(minCoords.x(), nodeCoords[i * spatialDim]); minCoords.y() = std::min(minCoords.y(), nodeCoords[i * spatialDim + 1]); @@ -174,7 +174,7 @@ template void verify_all_zeros(const stk::mesh::BulkData& mesh, FieldType& field) { - using DataType = typename FieldType::value_type; + using DataType = typename stk::mesh::FieldTraits::data_type; const DataType zero = 0; stk::mesh::Selector selector(field); stk::mesh::for_each_entity_run( @@ -194,9 +194,9 @@ void verify_all_less_equal( const stk::mesh::BulkData& mesh, FieldType& field, - typename FieldType::value_type scalar) + typename stk::mesh::FieldTraits::data_type scalar) { - using DataType = typename FieldType::value_type; + using DataType = typename stk::mesh::FieldTraits::data_type; const DataType zero = 0; stk::mesh::Selector selector(field); stk::mesh::for_each_entity_run( diff --git a/unit_tests/algorithms/UnitTestAlgorithm.C b/unit_tests/algorithms/UnitTestAlgorithm.C index 3eaabf3a0..612732a9c 100644 --- a/unit_tests/algorithms/UnitTestAlgorithm.C +++ b/unit_tests/algorithms/UnitTestAlgorithm.C @@ -23,14 +23,13 @@ TestAlgorithm::fill_mesh(const std::string mesh_spec) unit_test_utils::fill_hex8_mesh(mesh_spec, bulk()); meshPart_ = meta().get_part("block_1"); - coordinates_ = static_cast( - meta().coordinate_field()); + coordinates_ = static_cast(meta().coordinate_field()); EXPECT_TRUE(coordinates_ != nullptr); } double TestAlgorithm::field_norm( - const sierra::nalu::ScalarFieldType& field, stk::mesh::Selector* selector) + const ScalarFieldType& field, stk::mesh::Selector* selector) { auto& meta = this->meta(); @@ -54,8 +53,11 @@ TestTurbulenceAlgorithm::declare_fields() } const int numStates = 1; + using FieldDef = std::variant< + ScalarFieldType**, VectorFieldType**, TensorFieldType**, + GenericFieldType**>; // clang-format off - const std::vector**>> Fields = { + const std::vector> Fields = { {"density", &density_ }, {"viscosity", &viscosity_ }, {"turbulent_ke", &tke_ }, @@ -80,17 +82,21 @@ TestTurbulenceAlgorithm::declare_fields() for (auto& Field : Fields) { const std::string& name = Field.first; const stk::mesh::PartVector universal(1, &meta.universal_part()); - using to_field = typename std::remove_pointer::type; - sierra::nalu::FieldPointerTypes new_field = - realm_->fieldManager_->register_field(name, universal, numStates); std::visit( - [&](auto fld) { - using from_field = decltype(fld); - if constexpr (std::is_same_v) { - *Field.second = fld; - } + [&](auto member_field) { + using to_field = + typename std::remove_pointer::type; + sierra::nalu::FieldPointerTypes new_field = + realm_->fieldManager_->register_field(name, universal, numStates); + std::visit( + [&](auto fld) { + using from_field = decltype(fld); + if constexpr (std::is_same_v) + *member_field = fld; + }, + new_field); }, - new_field); + Field.second); } } diff --git a/unit_tests/algorithms/UnitTestAlgorithm.h b/unit_tests/algorithms/UnitTestAlgorithm.h index 54f87c163..f2e1dd815 100644 --- a/unit_tests/algorithms/UnitTestAlgorithm.h +++ b/unit_tests/algorithms/UnitTestAlgorithm.h @@ -60,8 +60,7 @@ class TestAlgorithm : public ::testing::Test inline stk::mesh::BulkData& bulk() const { return realm().bulk_data(); } double field_norm( - const sierra::nalu::ScalarFieldType& field, - stk::mesh::Selector* selector = nullptr); + const ScalarFieldType& field, stk::mesh::Selector* selector = nullptr); //! Reference to test Nalu instance used to hold Simulation and Realm std::unique_ptr naluObj_; @@ -70,7 +69,7 @@ class TestAlgorithm : public ::testing::Test sierra::nalu::Realm* realm_{nullptr}; stk::mesh::Part* meshPart_{nullptr}; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; stk::ParallelMachine comm_; }; @@ -86,25 +85,25 @@ class TestTurbulenceAlgorithm : public TestAlgorithm virtual void fill_mesh_and_init_fields(const std::string mesh_spec = "generated:10x10x10"); - sierra::nalu::ScalarFieldType* density_{nullptr}; - sierra::nalu::ScalarFieldType* viscosity_{nullptr}; - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* sdr_{nullptr}; - sierra::nalu::ScalarFieldType* minDistance_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::GenericFieldType* openMassFlowRate_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* maxLengthScale_{nullptr}; - sierra::nalu::ScalarFieldType* fOneBlend_{nullptr}; - sierra::nalu::ScalarFieldType* evisc_{nullptr}; - sierra::nalu::ScalarFieldType* dualNodalVolume_{nullptr}; - sierra::nalu::VectorFieldType* dkdx_{nullptr}; - sierra::nalu::VectorFieldType* dwdx_{nullptr}; - sierra::nalu::VectorFieldType* dhdx_{nullptr}; - sierra::nalu::ScalarFieldType* specificHeat_{nullptr}; - sierra::nalu::ScalarFieldType* tkebc_{nullptr}; - sierra::nalu::TensorFieldType* avgDudx_{nullptr}; - sierra::nalu::ScalarFieldType* avgTime_{nullptr}; + ScalarFieldType* density_{nullptr}; + ScalarFieldType* viscosity_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* sdr_{nullptr}; + ScalarFieldType* minDistance_{nullptr}; + TensorFieldType* dudx_{nullptr}; + GenericFieldType* openMassFlowRate_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* maxLengthScale_{nullptr}; + ScalarFieldType* fOneBlend_{nullptr}; + ScalarFieldType* evisc_{nullptr}; + ScalarFieldType* dualNodalVolume_{nullptr}; + VectorFieldType* dkdx_{nullptr}; + VectorFieldType* dwdx_{nullptr}; + VectorFieldType* dhdx_{nullptr}; + ScalarFieldType* specificHeat_{nullptr}; + ScalarFieldType* tkebc_{nullptr}; + TensorFieldType* avgDudx_{nullptr}; + ScalarFieldType* avgTime_{nullptr}; }; struct NodeSuppHelper diff --git a/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C b/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C index b0dcccfa6..0a902fbb8 100644 --- a/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C +++ b/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C @@ -31,13 +31,13 @@ TEST(MomentumBoussinesqSrcNodeSuppAlg, single_value) NodeSuppHelper helper; auto& meta = helper.realm.meta_data(); - auto& dnv = - meta.declare_field(stk::topology::NODE_RANK, "dual_nodal_volume"); - stk::mesh::put_field_on_mesh(dnv, meta.universal_part(), nullptr); + auto& dnv = meta.declare_field>( + stk::topology::NODE_RANK, "dual_nodal_volume"); + stk::mesh::put_field_on_mesh(dnv, meta.universal_part(), 1, nullptr); - auto& temperature = - meta.declare_field(stk::topology::NODE_RANK, "temperature"); - stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), nullptr); + auto& temperature = meta.declare_field>( + stk::topology::NODE_RANK, "temperature"); + stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), 1, nullptr); meta.commit(); @@ -83,20 +83,21 @@ TEST(MomentumBoussinesqRASrcNodeSuppAlg, single_value) auto& meta = helper.realm.meta_data(); auto& bulk = helper.realm.bulk_data(); - auto& dnv = - meta.declare_field(stk::topology::NODE_RANK, "dual_nodal_volume"); - stk::mesh::put_field_on_mesh(dnv, meta.universal_part(), nullptr); + auto& dnv = meta.declare_field>( + stk::topology::NODE_RANK, "dual_nodal_volume"); + stk::mesh::put_field_on_mesh(dnv, meta.universal_part(), 1, nullptr); - auto& temperature = - meta.declare_field(stk::topology::NODE_RANK, "temperature"); - stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), nullptr); + auto& temperature = meta.declare_field>( + stk::topology::NODE_RANK, "temperature"); + stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), 1, nullptr); std::string avgTempFieldName = sierra::nalu::MovingAveragePostProcessor::filtered_field_name( "temperature"); - auto& raTemperature = - meta.declare_field(stk::topology::NODE_RANK, avgTempFieldName); - stk::mesh::put_field_on_mesh(raTemperature, meta.universal_part(), nullptr); + auto& raTemperature = meta.declare_field>( + stk::topology::NODE_RANK, avgTempFieldName); + stk::mesh::put_field_on_mesh( + raTemperature, meta.universal_part(), 1, nullptr); meta.commit(); diff --git a/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C b/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C index a0b36252b..f38051bb9 100644 --- a/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C +++ b/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C @@ -219,8 +219,10 @@ TEST_F(MixtureFractionKernelHex8Mesh, NGP_adv_diff_edge_tpetra) stk::topology::NODE_RANK, bulk_->mesh_meta_data().locally_owned_part()); for (const stk::mesh::Bucket* bptr : buckets) { for (stk::mesh::Entity node : *bptr) { - const double* data1 = stk::mesh::field_data(*viscosity_, node); - const double* data2 = stk::mesh::field_data(*mixFraction_, node); + const double* data1 = + static_cast(stk::mesh::field_data(*viscosity_, node)); + const double* data2 = + static_cast(stk::mesh::field_data(*mixFraction_, node)); EXPECT_NEAR(*data1, *data2, 1.e-12); } } diff --git a/unit_tests/gcl/UnitTestGCL.h b/unit_tests/gcl/UnitTestGCL.h index a6c728226..7c9acbc85 100644 --- a/unit_tests/gcl/UnitTestGCL.h +++ b/unit_tests/gcl/UnitTestGCL.h @@ -34,54 +34,47 @@ class GCLTest : public ::testing::Test meta_(realm_.meta_data()), bulk_(realm_.bulk_data()), geomAlgDriver_(realm_), - currCoords_(&meta_.declare_field( + currCoords_(&meta_.declare_field( stk::topology::NODE_RANK, "current_coordinates", numStates_)), - dualVol_(&meta_.declare_field( + dualVol_(&meta_.declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", numStates_)), - elemVol_(&meta_.declare_field( + elemVol_(&meta_.declare_field( stk::topology::ELEM_RANK, "element_volume")), - edgeAreaVec_(&meta_.declare_field( + edgeAreaVec_(&meta_.declare_field( stk::topology::EDGE_RANK, "edge_area_vector")), - exposedAreaVec_( - &meta_.declare_field(meta_.side_rank(), "exposed_area_vector")), - meshDisp_(&meta_.declare_field( + exposedAreaVec_(&meta_.declare_field( + meta_.side_rank(), "exposed_area_vector")), + meshDisp_(&meta_.declare_field( stk::topology::NODE_RANK, "mesh_displacement", numStates_)), - meshVel_(&meta_.declare_field( + meshVel_(&meta_.declare_field( stk::topology::NODE_RANK, "mesh_velocity", numStates_)), - sweptVol_(&(meta_.declare_field( + sweptVol_(&(meta_.declare_field( stk::topology::ELEM_RANK, "swept_face_volume", numStates_))), - faceVelMag_(&(meta_.declare_field( + faceVelMag_(&(meta_.declare_field( stk::topology::ELEM_RANK, "face_velocity_mag", numStates_))), - edgeSweptVol_(&(meta_.declare_field( + edgeSweptVol_(&(meta_.declare_field( stk::topology::EDGE_RANK, "edge_swept_face_volume", numStates_))), - edgeFaceVelMag_(&(meta_.declare_field( + edgeFaceVelMag_(&(meta_.declare_field( stk::topology::EDGE_RANK, "edge_face_velocity_mag", numStates_))), - divMeshVel_(&meta_.declare_field( + divMeshVel_(&meta_.declare_field( stk::topology::NODE_RANK, "div_mesh_velocity")), - dVoldt_(&meta_.declare_field(stk::topology::NODE_RANK, "dvol_dt")) + dVoldt_(&meta_.declare_field( + stk::topology::NODE_RANK, "dvol_dt")) { realm_.timeIntegrator_ = naluObj_.sim_.timeIntegrator_; stk::mesh::put_field_on_mesh( *currCoords_, meta_.universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *currCoords_, stk::io::FieldOutputType::VECTOR_3D); - stk::mesh::put_field_on_mesh(*dualVol_, meta_.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*elemVol_, meta_.universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*dualVol_, meta_.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*elemVol_, meta_.universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *edgeAreaVec_, meta_.universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *edgeAreaVec_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *exposedAreaVec_, meta_.universal_part(), spatialDim_ * sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); stk::mesh::put_field_on_mesh( *meshDisp_, meta_.universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *meshDisp_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *meshVel_, meta_.universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *meshVel_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *sweptVol_, meta_.universal_part(), sierra::nalu::AlgTraitsHex8::numScsIp_, nullptr); @@ -89,11 +82,12 @@ class GCLTest : public ::testing::Test *faceVelMag_, meta_.universal_part(), sierra::nalu::AlgTraitsHex8::numScsIp_, nullptr); stk::mesh::put_field_on_mesh( - *edgeSweptVol_, meta_.universal_part(), nullptr); + *edgeSweptVol_, meta_.universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *edgeFaceVelMag_, meta_.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*divMeshVel_, meta_.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*dVoldt_, meta_.universal_part(), nullptr); + *edgeFaceVelMag_, meta_.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *divMeshVel_, meta_.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*dVoldt_, meta_.universal_part(), 1, nullptr); } virtual ~GCLTest() = default; @@ -111,8 +105,8 @@ class GCLTest : public ::testing::Test unit_test_utils::perturb_coord_hex_8(bulk_); partVec_ = {meta_.get_part("block_1")}; - coordinates_ = static_cast( - meta_.coordinate_field()); + coordinates_ = + static_cast(meta_.coordinate_field()); EXPECT_TRUE(coordinates_ != nullptr); stk::mesh::create_edges(bulk_, meta_.universal_part()); @@ -295,20 +289,20 @@ class GCLTest : public ::testing::Test stk::mesh::PartVector partVec_; stk::mesh::PartVector bndyPartVec_; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; - sierra::nalu::VectorFieldType* currCoords_{nullptr}; - sierra::nalu::ScalarFieldType* dualVol_{nullptr}; - sierra::nalu::ScalarFieldType* elemVol_{nullptr}; - sierra::nalu::VectorFieldType* edgeAreaVec_{nullptr}; - sierra::nalu::GenericFieldType* exposedAreaVec_{nullptr}; - sierra::nalu::VectorFieldType* meshDisp_{nullptr}; - sierra::nalu::VectorFieldType* meshVel_{nullptr}; - sierra::nalu::GenericFieldType* sweptVol_{nullptr}; - sierra::nalu::GenericFieldType* faceVelMag_{nullptr}; - sierra::nalu::GenericFieldType* edgeSweptVol_{nullptr}; - sierra::nalu::GenericFieldType* edgeFaceVelMag_{nullptr}; - sierra::nalu::ScalarFieldType* divMeshVel_{nullptr}; - sierra::nalu::ScalarFieldType* dVoldt_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; + VectorFieldType* currCoords_{nullptr}; + ScalarFieldType* dualVol_{nullptr}; + ScalarFieldType* elemVol_{nullptr}; + VectorFieldType* edgeAreaVec_{nullptr}; + GenericFieldType* exposedAreaVec_{nullptr}; + VectorFieldType* meshDisp_{nullptr}; + VectorFieldType* meshVel_{nullptr}; + GenericFieldType* sweptVol_{nullptr}; + GenericFieldType* faceVelMag_{nullptr}; + GenericFieldType* edgeSweptVol_{nullptr}; + GenericFieldType* edgeFaceVelMag_{nullptr}; + ScalarFieldType* divMeshVel_{nullptr}; + ScalarFieldType* dVoldt_{nullptr}; }; } // namespace diff --git a/unit_tests/gcl/UnitTestMeshVelocityAlg.C b/unit_tests/gcl/UnitTestMeshVelocityAlg.C index 18b929eae..6c7a455d2 100644 --- a/unit_tests/gcl/UnitTestMeshVelocityAlg.C +++ b/unit_tests/gcl/UnitTestMeshVelocityAlg.C @@ -76,34 +76,28 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_x_rot) return; // declare relevant fields - dnvField_ = &(meta_->declare_field( + dnvField_ = &(meta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", 3)); stk::mesh::put_field_on_mesh(*dnvField_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( + VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh( - *meshDisp_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *meshDisp_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( + VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh( - *cCoords_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *cCoords_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - sierra::nalu::GenericFieldType* sweptVolume_ = &(meta_->declare_field( + GenericFieldType* sweptVolume_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "swept_face_volume", 3)); stk::mesh::put_field_on_mesh( *sweptVolume_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); - sierra::nalu::GenericFieldType* faceVelMag_ = &(meta_->declare_field( + GenericFieldType* faceVelMag_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "face_velocity_mag", 2)); stk::mesh::put_field_on_mesh( *faceVelMag_, meta_->universal_part(), meSCS->num_integration_points(), @@ -140,11 +134,10 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_x_rot) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - sierra::nalu::VectorFieldType* meshDispNp1 = + VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - sierra::nalu::VectorFieldType* meshDispN = - &(meshDisp_->field_of_state(stk::mesh::StateN)); - sierra::nalu::VectorFieldType* meshDispNm1 = + VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); + VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { @@ -216,34 +209,28 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot) return; // declare relevant fields - dnvField_ = &(meta_->declare_field( + dnvField_ = &(meta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", 3)); stk::mesh::put_field_on_mesh(*dnvField_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( + VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh( - *meshDisp_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *meshDisp_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( + VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh( - *cCoords_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *cCoords_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - sierra::nalu::GenericFieldType* sweptVolume_ = &(meta_->declare_field( + GenericFieldType* sweptVolume_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "swept_face_volume", 3)); stk::mesh::put_field_on_mesh( *sweptVolume_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); - sierra::nalu::GenericFieldType* faceVelMag_ = &(meta_->declare_field( + GenericFieldType* faceVelMag_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "face_velocity_mag", 2)); stk::mesh::put_field_on_mesh( *faceVelMag_, meta_->universal_part(), meSCS->num_integration_points(), @@ -280,11 +267,10 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - sierra::nalu::VectorFieldType* meshDispNp1 = + VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - sierra::nalu::VectorFieldType* meshDispN = - &(meshDisp_->field_of_state(stk::mesh::StateN)); - sierra::nalu::VectorFieldType* meshDispNm1 = + VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); + VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { @@ -356,34 +342,28 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot_scs_center) return; // declare relevant fields - dnvField_ = &(meta_->declare_field( + dnvField_ = &(meta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", 3)); stk::mesh::put_field_on_mesh(*dnvField_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( + VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh( - *meshDisp_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *meshDisp_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); - sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( + VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh( - *cCoords_, meta_->universal_part(), meta_->spatial_dimension(), nullptr); - stk::io::set_field_output_type( - *cCoords_, stk::io::FieldOutputType::VECTOR_3D); + stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - sierra::nalu::GenericFieldType* sweptVolume_ = &(meta_->declare_field( + GenericFieldType* sweptVolume_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "swept_face_volume", 3)); stk::mesh::put_field_on_mesh( *sweptVolume_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); - sierra::nalu::GenericFieldType* faceVelMag_ = &(meta_->declare_field( + GenericFieldType* faceVelMag_ = &(meta_->declare_field( stk::topology::ELEM_RANK, "face_velocity_mag", 2)); stk::mesh::put_field_on_mesh( *faceVelMag_, meta_->universal_part(), meSCS->num_integration_points(), @@ -420,11 +400,10 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot_scs_center) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - sierra::nalu::VectorFieldType* meshDispNp1 = + VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - sierra::nalu::VectorFieldType* meshDispN = - &(meshDisp_->field_of_state(stk::mesh::StateN)); - sierra::nalu::VectorFieldType* meshDispNm1 = + VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); + VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { diff --git a/unit_tests/kernels/UnitTestFaceBasic.C b/unit_tests/kernels/UnitTestFaceBasic.C index d9a7b036b..b9e7cbf23 100644 --- a/unit_tests/kernels/UnitTestFaceBasic.C +++ b/unit_tests/kernels/UnitTestFaceBasic.C @@ -14,7 +14,7 @@ class TestFaceKernel : public sierra::nalu::Kernel public: TestFaceKernel( stk::topology topo, - sierra::nalu::ScalarFieldType* scalarQ, + ScalarFieldType* scalarQ, sierra::nalu::ElemDataRequests& dataNeeded) : numTimesExecuted_(0), topo_(topo), scalarQ_(scalarQ) { @@ -37,7 +37,7 @@ public: private: stk::topology topo_; - sierra::nalu::ScalarFieldType* scalarQ_; + ScalarFieldType* scalarQ_; }; #ifndef KOKKOS_ENABLE_GPU diff --git a/unit_tests/kernels/UnitTestKernelUtils.C b/unit_tests/kernels/UnitTestKernelUtils.C index 0b96c4dcf..9e6b3d70e 100644 --- a/unit_tests/kernels/UnitTestKernelUtils.C +++ b/unit_tests/kernels/UnitTestKernelUtils.C @@ -314,7 +314,7 @@ template void init_trigonometric_field( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, + const VectorFieldType& coordinates, T& qField) { using FieldInitFunction = @@ -409,8 +409,8 @@ namespace unit_test_kernel_utils { void velocity_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& velocity) + const VectorFieldType& coordinates, + VectorFieldType& velocity) { // Add additional test functions in future? init_trigonometric_field(bulk, coordinates, velocity); @@ -419,8 +419,8 @@ velocity_test_function( void dudx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::TensorFieldType& dudx) + const VectorFieldType& coordinates, + TensorFieldType& dudx) { // Add additional test functions in future? init_trigonometric_field(bulk, coordinates, dudx); @@ -429,8 +429,8 @@ dudx_test_function( void pressure_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& pressure) + const VectorFieldType& coordinates, + ScalarFieldType& pressure) { init_trigonometric_field(bulk, coordinates, pressure); } @@ -438,8 +438,8 @@ pressure_test_function( void dpdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dpdx) + const VectorFieldType& coordinates, + VectorFieldType& dpdx) { init_trigonometric_field(bulk, coordinates, dpdx); } @@ -447,8 +447,8 @@ dpdx_test_function( void temperature_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& temperature) + const VectorFieldType& coordinates, + ScalarFieldType& temperature) { init_trigonometric_field(bulk, coordinates, temperature); } @@ -456,8 +456,8 @@ temperature_test_function( void density_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& density) + const VectorFieldType& coordinates, + ScalarFieldType& density) { init_trigonometric_field(bulk, coordinates, density); } @@ -465,8 +465,8 @@ density_test_function( void tke_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& tke) + const VectorFieldType& coordinates, + ScalarFieldType& tke) { init_trigonometric_field(bulk, coordinates, tke); } @@ -474,8 +474,8 @@ tke_test_function( void alpha_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& alpha) + const VectorFieldType& coordinates, + ScalarFieldType& alpha) { init_trigonometric_field(bulk, coordinates, alpha); } @@ -483,8 +483,8 @@ alpha_test_function( void dkdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dkdx) + const VectorFieldType& coordinates, + VectorFieldType& dkdx) { init_trigonometric_field(bulk, coordinates, dkdx); } @@ -492,8 +492,8 @@ dkdx_test_function( void sdr_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& sdr) + const VectorFieldType& coordinates, + ScalarFieldType& sdr) { init_trigonometric_field(bulk, coordinates, sdr); } @@ -501,8 +501,8 @@ sdr_test_function( void tdr_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& tdr) + const VectorFieldType& coordinates, + ScalarFieldType& tdr) { init_trigonometric_field(bulk, coordinates, tdr); } @@ -510,8 +510,8 @@ tdr_test_function( void dwdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dwdx) + const VectorFieldType& coordinates, + VectorFieldType& dwdx) { init_trigonometric_field(bulk, coordinates, dwdx); } @@ -519,8 +519,8 @@ dwdx_test_function( void turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& turbulent_viscosity) + const VectorFieldType& coordinates, + ScalarFieldType& turbulent_viscosity) { init_trigonometric_field(bulk, coordinates, turbulent_viscosity); } @@ -528,8 +528,8 @@ turbulent_viscosity_test_function( void tensor_turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::GenericFieldType& mutij) + const VectorFieldType& coordinates, + GenericFieldType& mutij) { init_trigonometric_field(bulk, coordinates, mutij); } @@ -537,8 +537,8 @@ tensor_turbulent_viscosity_test_function( void sst_f_one_blending_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& sst_f_one_blending) + const VectorFieldType& coordinates, + ScalarFieldType& sst_f_one_blending) { init_trigonometric_field(bulk, coordinates, sst_f_one_blending); } @@ -546,8 +546,8 @@ sst_f_one_blending_test_function( void iddes_rans_indicator_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& iddes_rans_indicator) + const VectorFieldType& coordinates, + ScalarFieldType& iddes_rans_indicator) { init_trigonometric_field(bulk, coordinates, iddes_rans_indicator); } @@ -555,8 +555,8 @@ iddes_rans_indicator_test_function( void minimum_distance_to_wall_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& minimum_distance_to_wall) + const VectorFieldType& coordinates, + ScalarFieldType& minimum_distance_to_wall) { init_trigonometric_field(bulk, coordinates, minimum_distance_to_wall); } @@ -564,8 +564,8 @@ minimum_distance_to_wall_test_function( void dplus_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& dplus) + const VectorFieldType& coordinates, + ScalarFieldType& dplus) { init_trigonometric_field(bulk, coordinates, dplus); } @@ -573,8 +573,8 @@ dplus_test_function( void property_from_mixture_fraction_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::ScalarFieldType& mixFraction, - sierra::nalu::ScalarFieldType& property, + const ScalarFieldType& mixFraction, + ScalarFieldType& property, const double primary, const double secondary) { @@ -588,8 +588,8 @@ property_from_mixture_fraction_test_function( void inverse_property_from_mixture_fraction_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::ScalarFieldType& mixFraction, - sierra::nalu::ScalarFieldType& property, + const ScalarFieldType& mixFraction, + ScalarFieldType& property, const double primary, const double secondary) { @@ -603,8 +603,8 @@ inverse_property_from_mixture_fraction_test_function( void mixture_fraction_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::ScalarFieldType& mixtureFrac, + const VectorFieldType& coordinates, + const ScalarFieldType& mixtureFrac, const double znot, const double amf) { @@ -622,8 +622,8 @@ mixture_fraction_test_function( void dhdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dhdx) + const VectorFieldType& coordinates, + VectorFieldType& dhdx) { init_trigonometric_field(bulk, coordinates, dhdx); } @@ -631,18 +631,18 @@ dhdx_test_function( void calc_mass_flow_rate( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& velocity, - const sierra::nalu::ScalarFieldType& density, - const sierra::nalu::VectorFieldType& edgeAreaVec, - sierra::nalu::ScalarFieldType& massFlowRate) + const VectorFieldType& velocity, + const ScalarFieldType& density, + const VectorFieldType& edgeAreaVec, + ScalarFieldType& massFlowRate) { const auto& meta = bulk.mesh_meta_data(); const int ndim = meta.spatial_dimension(); EXPECT_EQ(ndim, 3); - const sierra::nalu::ScalarFieldType& densityNp1 = + const ScalarFieldType& densityNp1 = density.field_of_state(stk::mesh::StateNP1); - const sierra::nalu::VectorFieldType& velocityNp1 = + const VectorFieldType& velocityNp1 = velocity.field_of_state(stk::mesh::StateNP1); const stk::mesh::Selector selector = @@ -678,10 +678,10 @@ void calc_mass_flow_rate_scs( stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::ScalarFieldType& density, - const sierra::nalu::VectorFieldType& velocity, - const sierra::nalu::GenericFieldType& massFlowRate) + const VectorFieldType& coordinates, + const ScalarFieldType& density, + const VectorFieldType& velocity, + const GenericFieldType& massFlowRate) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Hex8Traits = sierra::nalu::AlgTraitsHex8; @@ -761,11 +761,11 @@ void calc_open_mass_flow_rate( stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::ScalarFieldType& density, - const sierra::nalu::VectorFieldType& velocity, - const sierra::nalu::GenericFieldType& exposedAreaVec, - const sierra::nalu::GenericFieldType& massFlowRate) + const VectorFieldType& coordinates, + const ScalarFieldType& density, + const VectorFieldType& velocity, + const GenericFieldType& exposedAreaVec, + const GenericFieldType& massFlowRate) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Quad4Traits = sierra::nalu::AlgTraitsQuad4; @@ -847,8 +847,8 @@ void calc_edge_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::VectorFieldType& edgeAreaVec) + const VectorFieldType& coordinates, + const VectorFieldType& edgeAreaVec) { const auto& meta = bulk.mesh_meta_data(); const int ndim = meta.spatial_dimension(); @@ -927,8 +927,8 @@ void calc_exposed_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::GenericFieldType& exposedAreaVec) + const VectorFieldType& coordinates, + GenericFieldType& exposedAreaVec) { using Quad4Traits = sierra::nalu::AlgTraitsQuad4; using ElemSimdDataType = diff --git a/unit_tests/kernels/UnitTestKernelUtils.h b/unit_tests/kernels/UnitTestKernelUtils.h index 6ad10f321..455570ecc 100644 --- a/unit_tests/kernels/UnitTestKernelUtils.h +++ b/unit_tests/kernels/UnitTestKernelUtils.h @@ -35,155 +35,155 @@ namespace unit_test_kernel_utils { void velocity_test_function( const stk::mesh::BulkData&, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& velocity); + const VectorFieldType& coordinates, + VectorFieldType& velocity); void dudx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::TensorFieldType& dudx); + const VectorFieldType& coordinates, + TensorFieldType& dudx); void pressure_test_function( const stk::mesh::BulkData&, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& pressure); + const VectorFieldType& coordinates, + ScalarFieldType& pressure); void dpdx_test_function( const stk::mesh::BulkData&, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dpdx); + const VectorFieldType& coordinates, + VectorFieldType& dpdx); void temperature_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& temperature); + const VectorFieldType& coordinates, + ScalarFieldType& temperature); void density_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& density); + const VectorFieldType& coordinates, + ScalarFieldType& density); void tke_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& tke); + const VectorFieldType& coordinates, + ScalarFieldType& tke); void alpha_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& alpha); + const VectorFieldType& coordinates, + ScalarFieldType& alpha); void dkdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dkdx); + const VectorFieldType& coordinates, + VectorFieldType& dkdx); void sdr_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& sdr); + const VectorFieldType& coordinates, + ScalarFieldType& sdr); void tdr_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& tdr); + const VectorFieldType& coordinates, + ScalarFieldType& tdr); void dwdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dwdx); + const VectorFieldType& coordinates, + VectorFieldType& dwdx); void turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& turbulent_viscosity); + const VectorFieldType& coordinates, + ScalarFieldType& turbulent_viscosity); void tensor_turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::GenericFieldType& mutij); + const VectorFieldType& coordinates, + GenericFieldType& mutij); void sst_f_one_blending_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& sst_f_one_blending); + const VectorFieldType& coordinates, + ScalarFieldType& sst_f_one_blending); void iddes_rans_indicator_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& iddes_rans_indicator); + const VectorFieldType& coordinates, + ScalarFieldType& iddes_rans_indicator); void minimum_distance_to_wall_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& minimum_distance_to_wall); + const VectorFieldType& coordinates, + ScalarFieldType& minimum_distance_to_wall); void dplus_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::ScalarFieldType& dplus); + const VectorFieldType& coordinates, + ScalarFieldType& dplus); void property_from_mixture_fraction_test_function( const stk::mesh::BulkData&, - const sierra::nalu::ScalarFieldType& mixFraction, - sierra::nalu::ScalarFieldType& property, + const ScalarFieldType& mixFraction, + ScalarFieldType& property, const double primary, const double secondary); void inverse_property_from_mixture_fraction_test_function( const stk::mesh::BulkData&, - const sierra::nalu::ScalarFieldType& mixFraction, - sierra::nalu::ScalarFieldType& property, + const ScalarFieldType& mixFraction, + ScalarFieldType& property, const double primary, const double secondary); void mixture_fraction_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::ScalarFieldType& mixFrac, + const VectorFieldType& coordinates, + const ScalarFieldType& mixFrac, const double znot, const double amf); void dhdx_test_function( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::VectorFieldType& dhdx); + const VectorFieldType& coordinates, + VectorFieldType& dhdx); void calc_edge_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::VectorFieldType& edgeAreaVec); + const VectorFieldType& coordinates, + const VectorFieldType& edgeAreaVec); void calc_exposed_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - sierra::nalu::GenericFieldType& exposedAreaVec); + const VectorFieldType& coordinates, + GenericFieldType& exposedAreaVec); void calc_mass_flow_rate( const stk::mesh::BulkData&, - const sierra::nalu::VectorFieldType&, - const sierra::nalu::ScalarFieldType&, - const sierra::nalu::VectorFieldType&, - sierra::nalu::ScalarFieldType&); + const VectorFieldType&, + const ScalarFieldType&, + const VectorFieldType&, + ScalarFieldType&); void calc_mass_flow_rate_scs( stk::mesh::BulkData&, const stk::topology&, - const sierra::nalu::VectorFieldType&, - const sierra::nalu::ScalarFieldType&, - const sierra::nalu::VectorFieldType&, - const sierra::nalu::GenericFieldType&); + const VectorFieldType&, + const ScalarFieldType&, + const VectorFieldType&, + const GenericFieldType&); void calc_open_mass_flow_rate( stk::mesh::BulkData& bulk, const stk::topology& topo, - const sierra::nalu::VectorFieldType& coordinates, - const sierra::nalu::ScalarFieldType& density, - const sierra::nalu::VectorFieldType& velocity, - const sierra::nalu::GenericFieldType& exposedAreaVec, - const sierra::nalu::GenericFieldType& massFlowRate); + const VectorFieldType& coordinates, + const ScalarFieldType& density, + const VectorFieldType& velocity, + const GenericFieldType& exposedAreaVec, + const GenericFieldType& massFlowRate); void expect_all_near( const Kokkos::View& calcValue, @@ -260,36 +260,34 @@ class TestKernelHex8Mesh : public ::testing::Test meshBuilder.set_spatial_dimension(spatialDim_); bulk_ = meshBuilder.create(); meta_ = &bulk_->mesh_meta_data(); - meta_->use_simple_fields(); - naluGlobalId_ = &meta_->declare_field( + naluGlobalId_ = &meta_->declare_field( stk::topology::NODE_RANK, "nalu_global_id", 1); - tpetGlobalId_ = &meta_->declare_field( + tpetGlobalId_ = &meta_->declare_field( stk::topology::NODE_RANK, "tpet_global_id", 1); - dnvField_ = &meta_->declare_field( + dnvField_ = &meta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", 3); - divMeshVelField_ = &meta_->declare_field( + divMeshVelField_ = &meta_->declare_field( stk::topology::NODE_RANK, "div_mesh_velocity"); - edgeAreaVec_ = &meta_->declare_field( + edgeAreaVec_ = &meta_->declare_field( stk::topology::EDGE_RANK, "edge_area_vector"); - elementVolume_ = - &meta_->declare_field(stk::topology::ELEM_RANK, "element_volume"); - exposedAreaVec_ = - &meta_->declare_field(meta_->side_rank(), "exposed_area_vector"); + elementVolume_ = &meta_->declare_field( + stk::topology::ELEM_RANK, "element_volume"); + exposedAreaVec_ = &meta_->declare_field( + meta_->side_rank(), "exposed_area_vector"); stk::mesh::put_field_on_mesh( - *naluGlobalId_, meta_->universal_part(), nullptr); + *naluGlobalId_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *tpetGlobalId_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*dnvField_, meta_->universal_part(), nullptr); + *tpetGlobalId_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *divMeshVelField_, meta_->universal_part(), nullptr); + *dnvField_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *divMeshVelField_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *edgeAreaVec_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *edgeAreaVec_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *elementVolume_, meta_->universal_part(), nullptr); + *elementVolume_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *exposedAreaVec_, meta_->universal_part(), spatialDim_ * sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -311,8 +309,8 @@ class TestKernelHex8Mesh : public ::testing::Test partVec_ = {meta_->get_part("block_1")}; - coordinates_ = static_cast( - meta_->coordinate_field()); + coordinates_ = + static_cast(meta_->coordinate_field()); EXPECT_TRUE(coordinates_ != nullptr); @@ -339,14 +337,14 @@ class TestKernelHex8Mesh : public ::testing::Test #endif using TpetIDFieldType = stk::mesh::Field; - const sierra::nalu::VectorFieldType* coordinates_{nullptr}; - sierra::nalu::GlobalIdFieldType* naluGlobalId_{nullptr}; + const VectorFieldType* coordinates_{nullptr}; + GlobalIdFieldType* naluGlobalId_{nullptr}; TpetIDFieldType* tpetGlobalId_{nullptr}; - sierra::nalu::ScalarFieldType* dnvField_{nullptr}; - sierra::nalu::ScalarFieldType* divMeshVelField_{nullptr}; - sierra::nalu::VectorFieldType* edgeAreaVec_{nullptr}; - sierra::nalu::ScalarFieldType* elementVolume_{nullptr}; - sierra::nalu::GenericFieldType* exposedAreaVec_{nullptr}; + ScalarFieldType* dnvField_{nullptr}; + ScalarFieldType* divMeshVelField_{nullptr}; + VectorFieldType* edgeAreaVec_{nullptr}; + ScalarFieldType* elementVolume_{nullptr}; + GenericFieldType* exposedAreaVec_{nullptr}; }; /** Test Fixture for Low-Mach Kernels @@ -362,34 +360,32 @@ class LowMachKernelHex8Mesh : public TestKernelHex8Mesh public: LowMachKernelHex8Mesh() : TestKernelHex8Mesh(), - velocity_( - &meta_->declare_field(stk::topology::NODE_RANK, "velocity", 2)), - dpdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dpdx", 2)), - density_( - &meta_->declare_field(stk::topology::NODE_RANK, "density", 2)), - pressure_( - &meta_->declare_field(stk::topology::NODE_RANK, "pressure", 2)), - Udiag_(&meta_->declare_field( + velocity_(&meta_->declare_field( + stk::topology::NODE_RANK, "velocity", 2)), + dpdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dpdx", 2)), + density_(&meta_->declare_field( + stk::topology::NODE_RANK, "density", 2)), + pressure_(&meta_->declare_field( + stk::topology::NODE_RANK, "pressure", 2)), + Udiag_(&meta_->declare_field( stk::topology::NODE_RANK, "momentum_diag", 2)), - velocityBC_( - &meta_->declare_field(stk::topology::NODE_RANK, "velocity_bc")), - dynP_( - &meta_->declare_field(meta_->side_rank(), "dynamic_pressure")) + velocityBC_(&meta_->declare_field( + stk::topology::NODE_RANK, "velocity_bc")), + dynP_(&meta_->declare_field( + meta_->side_rank(), "dynamic_pressure")) { stk::mesh::put_field_on_mesh( *velocity_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *velocity_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dpdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dpdx_, stk::io::FieldOutputType::VECTOR_3D); - stk::mesh::put_field_on_mesh(*density_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*pressure_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*Udiag_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *density_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *pressure_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*Udiag_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *velocityBC_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *velocityBC_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dynP_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -414,13 +410,13 @@ class LowMachKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *coordinates_, *velocityBC_); } - sierra::nalu::VectorFieldType* velocity_{nullptr}; - sierra::nalu::VectorFieldType* dpdx_{nullptr}; - sierra::nalu::ScalarFieldType* density_{nullptr}; - sierra::nalu::ScalarFieldType* pressure_{nullptr}; - sierra::nalu::ScalarFieldType* Udiag_{nullptr}; - sierra::nalu::VectorFieldType* velocityBC_{nullptr}; - sierra::nalu::GenericFieldType* dynP_{nullptr}; + VectorFieldType* velocity_{nullptr}; + VectorFieldType* dpdx_{nullptr}; + ScalarFieldType* density_{nullptr}; + ScalarFieldType* pressure_{nullptr}; + ScalarFieldType* Udiag_{nullptr}; + VectorFieldType* velocityBC_{nullptr}; + GenericFieldType* dynP_{nullptr}; }; class ContinuityKernelHex8Mesh : public LowMachKernelHex8Mesh @@ -428,13 +424,13 @@ class ContinuityKernelHex8Mesh : public LowMachKernelHex8Mesh public: ContinuityKernelHex8Mesh() : LowMachKernelHex8Mesh(), - pressureBC_( - &meta_->declare_field(stk::topology::NODE_RANK, "pressure_bc")), - dynP_( - &meta_->declare_field(meta_->side_rank(), "dynamic_pressure")) + pressureBC_(&meta_->declare_field( + stk::topology::NODE_RANK, "pressure_bc")), + dynP_(&meta_->declare_field( + meta_->side_rank(), "dynamic_pressure")) { stk::mesh::put_field_on_mesh( - *pressureBC_, meta_->universal_part(), nullptr); + *pressureBC_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dynP_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -452,8 +448,8 @@ class ContinuityKernelHex8Mesh : public LowMachKernelHex8Mesh } private: - sierra::nalu::ScalarFieldType* pressureBC_{nullptr}; - sierra::nalu::GenericFieldType* dynP_{nullptr}; + ScalarFieldType* pressureBC_{nullptr}; + GenericFieldType* dynP_{nullptr}; }; // Provide separate namespace for Edge kernel tests @@ -470,18 +466,19 @@ class MomentumKernelHex8Mesh : public LowMachKernelHex8Mesh public: MomentumKernelHex8Mesh() : LowMachKernelHex8Mesh(), - massFlowRate_(&meta_->declare_field( + massFlowRate_(&meta_->declare_field( stk::topology::ELEM_RANK, "mass_flow_rate_scs")), - viscosity_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")), - temperature_( - &meta_->declare_field(stk::topology::NODE_RANK, "temperature")), - openMassFlowRate_(&meta_->declare_field( + viscosity_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")), + temperature_(&meta_->declare_field( + stk::topology::NODE_RANK, "temperature")), + openMassFlowRate_(&meta_->declare_field( meta_->side_rank(), "open_mass_flow_rate")), - dynP_( - &meta_->declare_field(meta_->side_rank(), "dynamic_pressure")), - openVelocityBC_(&meta_->declare_field( + dynP_(&meta_->declare_field( + meta_->side_rank(), "dynamic_pressure")), + openVelocityBC_(&meta_->declare_field( stk::topology::NODE_RANK, "open_velocity_bc")) { const auto& meSCS = @@ -490,13 +487,12 @@ class MomentumKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::put_field_on_mesh( *massFlowRate_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); - stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *viscosity_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); stk::mesh::put_field_on_mesh( - *temperature_, meta_->universal_part(), nullptr); + *temperature_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *openMassFlowRate_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -505,8 +501,6 @@ class MomentumKernelHex8Mesh : public LowMachKernelHex8Mesh nullptr); stk::mesh::put_field_on_mesh( *openVelocityBC_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *openVelocityBC_, stk::io::FieldOutputType::VECTOR_3D); } virtual ~MomentumKernelHex8Mesh() {} @@ -528,13 +522,13 @@ class MomentumKernelHex8Mesh : public LowMachKernelHex8Mesh *exposedAreaVec_, *openMassFlowRate_); } - sierra::nalu::GenericFieldType* massFlowRate_{nullptr}; - sierra::nalu::ScalarFieldType* viscosity_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::ScalarFieldType* temperature_{nullptr}; - sierra::nalu::GenericFieldType* openMassFlowRate_{nullptr}; - sierra::nalu::GenericFieldType* dynP_{nullptr}; - sierra::nalu::VectorFieldType* openVelocityBC_{nullptr}; + GenericFieldType* massFlowRate_{nullptr}; + ScalarFieldType* viscosity_{nullptr}; + TensorFieldType* dudx_{nullptr}; + ScalarFieldType* temperature_{nullptr}; + GenericFieldType* openMassFlowRate_{nullptr}; + GenericFieldType* dynP_{nullptr}; + VectorFieldType* openVelocityBC_{nullptr}; }; // Provide separate namespace for Edge kernel tests @@ -543,19 +537,19 @@ class MomentumEdgeHex8Mesh : public MomentumKernelHex8Mesh public: MomentumEdgeHex8Mesh() : MomentumKernelHex8Mesh(), - massFlowRateEdge_(&meta_->declare_field( + massFlowRateEdge_(&meta_->declare_field( stk::topology::EDGE_RANK, "mass_flow_rate")), - pecletFactor_(&meta_->declare_field( + pecletFactor_(&meta_->declare_field( stk::topology::EDGE_RANK, "peclet_factor")), - ablWallNodeMask_(&meta_->declare_field( + ablWallNodeMask_(&meta_->declare_field( stk::topology::NODE_RANK, "abl_wall_no_slip_wall_func_node_mask")) { stk::mesh::put_field_on_mesh( *massFlowRateEdge_, meta_->universal_part(), spatialDim_, nullptr); stk::mesh::put_field_on_mesh( - *pecletFactor_, meta_->universal_part(), nullptr); + *pecletFactor_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *ablWallNodeMask_, meta_->universal_part(), nullptr); + *ablWallNodeMask_, meta_->universal_part(), 1, nullptr); } virtual ~MomentumEdgeHex8Mesh() = default; @@ -572,10 +566,10 @@ class MomentumEdgeHex8Mesh : public MomentumKernelHex8Mesh ablWallNodeMask_->sync_to_device(); } - sierra::nalu::ScalarFieldType* massFlowRateEdge_{nullptr}; - sierra::nalu::ScalarFieldType* pecletFactor_{nullptr}; - sierra::nalu::ScalarFieldType* maxPecletFactor_{nullptr}; - sierra::nalu::ScalarFieldType* ablWallNodeMask_{nullptr}; + ScalarFieldType* massFlowRateEdge_{nullptr}; + ScalarFieldType* pecletFactor_{nullptr}; + ScalarFieldType* maxPecletFactor_{nullptr}; + ScalarFieldType* ablWallNodeMask_{nullptr}; }; class MomentumABLKernelHex8Mesh : public MomentumKernelHex8Mesh @@ -583,34 +577,33 @@ class MomentumABLKernelHex8Mesh : public MomentumKernelHex8Mesh public: MomentumABLKernelHex8Mesh() : MomentumKernelHex8Mesh(), - wallVelocityBC_(&meta_->declare_field( + wallVelocityBC_(&meta_->declare_field( stk::topology::NODE_RANK, "wall_velocity_bc")), - bcHeatFlux_(&meta_->declare_field( + bcHeatFlux_(&meta_->declare_field( stk::topology::NODE_RANK, "heat_flux_bc")), - specificHeat_(&meta_->declare_field( + specificHeat_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_heat")), - wallFricVel_(&meta_->declare_field( + wallFricVel_(&meta_->declare_field( meta_->side_rank(), "wall_friction_velocity_bip")), - wallNormDist_(&meta_->declare_field( + wallNormDist_(&meta_->declare_field( meta_->side_rank(), "wall_normal_distance_bip")), - tGradBC_(&meta_->declare_field( + tGradBC_(&meta_->declare_field( stk::topology::NODE_RANK, "temperature_gradient_bc")), ustar_(kappa_ * uh_ / std::log(zh_ / z0_)) { stk::mesh::put_field_on_mesh( *wallVelocityBC_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *wallVelocityBC_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *bcHeatFlux_, meta_->universal_part(), nullptr); + *bcHeatFlux_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *specificHeat_, meta_->universal_part(), nullptr); + *specificHeat_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *wallFricVel_, meta_->universal_part(), 4, nullptr); stk::mesh::put_field_on_mesh( *wallNormDist_, meta_->universal_part(), 4, nullptr); - stk::mesh::put_field_on_mesh(*tGradBC_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *tGradBC_, meta_->universal_part(), 1, nullptr); } virtual ~MomentumABLKernelHex8Mesh() = default; @@ -651,12 +644,12 @@ class MomentumABLKernelHex8Mesh : public MomentumKernelHex8Mesh tGradBC_->sync_to_device(); } - sierra::nalu::VectorFieldType* wallVelocityBC_{nullptr}; - sierra::nalu::ScalarFieldType* bcHeatFlux_{nullptr}; - sierra::nalu::ScalarFieldType* specificHeat_{nullptr}; - sierra::nalu::ScalarFieldType* wallFricVel_{nullptr}; - sierra::nalu::ScalarFieldType* wallNormDist_{nullptr}; - sierra::nalu::ScalarFieldType* tGradBC_{nullptr}; + VectorFieldType* wallVelocityBC_{nullptr}; + ScalarFieldType* bcHeatFlux_{nullptr}; + ScalarFieldType* specificHeat_{nullptr}; + ScalarFieldType* wallFricVel_{nullptr}; + ScalarFieldType* wallNormDist_{nullptr}; + ScalarFieldType* tGradBC_{nullptr}; const double z0_{0.1}; const double zh_{0.25}; @@ -676,21 +669,21 @@ class EnthalpyABLKernelHex8Mesh : public MomentumABLKernelHex8Mesh public: EnthalpyABLKernelHex8Mesh() : MomentumABLKernelHex8Mesh(), - thermalCond_(&meta_->declare_field( + thermalCond_(&meta_->declare_field( stk::topology::NODE_RANK, "thermal_conductivity")), - evisc_(&meta_->declare_field( + evisc_(&meta_->declare_field( stk::topology::NODE_RANK, "effective_viscosity")), - tvisc_(&meta_->declare_field( + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - heatFluxBC_( - &meta_->declare_field(stk::topology::NODE_RANK, "heat_flux_bc")) + heatFluxBC_(&meta_->declare_field( + stk::topology::NODE_RANK, "heat_flux_bc")) { stk::mesh::put_field_on_mesh( - *thermalCond_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*evisc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); + *thermalCond_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*evisc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *heatFluxBC_, meta_->universal_part(), nullptr); + *heatFluxBC_, meta_->universal_part(), 1, nullptr); } virtual ~EnthalpyABLKernelHex8Mesh() {} @@ -706,10 +699,10 @@ class EnthalpyABLKernelHex8Mesh : public MomentumABLKernelHex8Mesh stk::mesh::field_fill(100.0, *heatFluxBC_); } - sierra::nalu::ScalarFieldType* thermalCond_{nullptr}; - sierra::nalu::ScalarFieldType* evisc_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* heatFluxBC_{nullptr}; + ScalarFieldType* thermalCond_{nullptr}; + ScalarFieldType* evisc_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* heatFluxBC_{nullptr}; }; /** Test Fixture for the SST Kernels @@ -720,62 +713,63 @@ class SSTKernelHex8Mesh : public LowMachKernelHex8Mesh public: SSTKernelHex8Mesh() : LowMachKernelHex8Mesh(), - tke_(&meta_->declare_field( + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - tkebc_(&meta_->declare_field( + tkebc_(&meta_->declare_field( stk::topology::NODE_RANK, "bc_turbulent_ke")), - sdr_(&meta_->declare_field( + sdr_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate")), - sdrbc_(&meta_->declare_field(stk::topology::NODE_RANK, "sdr_bc")), - visc_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - tvisc_(&meta_->declare_field( + sdrbc_(&meta_->declare_field( + stk::topology::NODE_RANK, "sdr_bc")), + visc_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - maxLengthScale_(&meta_->declare_field( + maxLengthScale_(&meta_->declare_field( stk::topology::NODE_RANK, "sst_max_length_scale")), - minDistance_(&meta_->declare_field( + minDistance_(&meta_->declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")), - fOneBlend_(&meta_->declare_field( + fOneBlend_(&meta_->declare_field( stk::topology::NODE_RANK, "sst_f_one_blending")), - iddes_rans_indicator_(&meta_->declare_field( + iddes_rans_indicator_(&meta_->declare_field( stk::topology::NODE_RANK, "iddes_rans_indicator")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")), - dkdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dkdx")), - dwdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dwdx")), - openMassFlowRate_(&meta_->declare_field( + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")), + dkdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dkdx")), + dwdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dwdx")), + openMassFlowRate_(&meta_->declare_field( meta_->side_rank(), "open_mass_flow_rate")), - sdrWallbc_(&meta_->declare_field( + sdrWallbc_(&meta_->declare_field( stk::topology::NODE_RANK, "wall_model_sdr_bc")), - sdrWallArea_(&meta_->declare_field( + sdrWallArea_(&meta_->declare_field( stk::topology::NODE_RANK, "assembled_wall_area_sdr")), - wallFricVel_(&meta_->declare_field( + wallFricVel_(&meta_->declare_field( meta_->side_rank(), "wall_friction_velocity_bip")), - pecletFactor_(&meta_->declare_field( + pecletFactor_(&meta_->declare_field( stk::topology::EDGE_RANK, "peclet_factor")) { - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tkebc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*sdrbc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tkebc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*sdrbc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *maxLengthScale_, meta_->universal_part(), nullptr); + *maxLengthScale_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *minDistance_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*fOneBlend_, meta_->universal_part(), nullptr); + *minDistance_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *iddes_rans_indicator_, meta_->universal_part(), nullptr); + *fOneBlend_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *iddes_rans_indicator_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); stk::mesh::put_field_on_mesh( *dkdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dkdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dwdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dwdx_, stk::io::FieldOutputType::VECTOR_3D); double initOpenMassFlowRate[sierra::nalu::AlgTraitsQuad4::numScsIp_]; for (int i = 0; i < sierra::nalu::AlgTraitsQuad4::numScsIp_; ++i) { initOpenMassFlowRate[i] = 10.0; @@ -784,13 +778,14 @@ class SSTKernelHex8Mesh : public LowMachKernelHex8Mesh *openMassFlowRate_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, initOpenMassFlowRate); - stk::mesh::put_field_on_mesh(*sdrWallbc_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *sdrWallArea_, meta_->universal_part(), nullptr); + *sdrWallbc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *sdrWallArea_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *wallFricVel_, meta_->universal_part(), 4, nullptr); stk::mesh::put_field_on_mesh( - *pecletFactor_, meta_->universal_part(), nullptr); + *pecletFactor_, meta_->universal_part(), 1, nullptr); } virtual ~SSTKernelHex8Mesh() {} @@ -819,25 +814,25 @@ class SSTKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *pecletFactor_); } - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* tkebc_{nullptr}; - sierra::nalu::ScalarFieldType* sdr_{nullptr}; - sierra::nalu::ScalarFieldType* sdrbc_{nullptr}; - sierra::nalu::ScalarFieldType* visc_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* maxLengthScale_{nullptr}; - sierra::nalu::ScalarFieldType* minDistance_{nullptr}; - sierra::nalu::ScalarFieldType* fOneBlend_{nullptr}; - sierra::nalu::ScalarFieldType* iddes_rans_indicator_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::VectorFieldType* dkdx_{nullptr}; - sierra::nalu::VectorFieldType* dwdx_{nullptr}; - sierra::nalu::GenericFieldType* openMassFlowRate_{nullptr}; - - sierra::nalu::ScalarFieldType* sdrWallbc_{nullptr}; - sierra::nalu::ScalarFieldType* sdrWallArea_{nullptr}; - sierra::nalu::GenericFieldType* wallFricVel_{nullptr}; - sierra::nalu::ScalarFieldType* pecletFactor_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* tkebc_{nullptr}; + ScalarFieldType* sdr_{nullptr}; + ScalarFieldType* sdrbc_{nullptr}; + ScalarFieldType* visc_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* maxLengthScale_{nullptr}; + ScalarFieldType* minDistance_{nullptr}; + ScalarFieldType* fOneBlend_{nullptr}; + ScalarFieldType* iddes_rans_indicator_{nullptr}; + TensorFieldType* dudx_{nullptr}; + VectorFieldType* dkdx_{nullptr}; + VectorFieldType* dwdx_{nullptr}; + GenericFieldType* openMassFlowRate_{nullptr}; + + ScalarFieldType* sdrWallbc_{nullptr}; + ScalarFieldType* sdrWallArea_{nullptr}; + GenericFieldType* wallFricVel_{nullptr}; + ScalarFieldType* pecletFactor_{nullptr}; }; /** Test Fixture for the KE Kernels @@ -848,31 +843,30 @@ class KEKernelHex8Mesh : public LowMachKernelHex8Mesh public: KEKernelHex8Mesh() : LowMachKernelHex8Mesh(), - tke_(&meta_->declare_field( + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - tdr_(&meta_->declare_field( + tdr_(&meta_->declare_field( stk::topology::NODE_RANK, "total_dissipation_rate")), - visc_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - tvisc_(&meta_->declare_field( + visc_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - minDistance_(&meta_->declare_field( + minDistance_(&meta_->declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")), - dplus_(&meta_->declare_field( + dplus_(&meta_->declare_field( stk::topology::NODE_RANK, "dplus_wall_function")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")) + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")) { - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tdr_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tdr_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *minDistance_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*dplus_, meta_->universal_part(), nullptr); + *minDistance_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*dplus_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); } virtual ~KEKernelHex8Mesh() {} @@ -894,13 +888,13 @@ class KEKernelHex8Mesh : public LowMachKernelHex8Mesh unit_test_kernel_utils::dudx_test_function(*bulk_, *coordinates_, *dudx_); } - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* tdr_{nullptr}; - sierra::nalu::ScalarFieldType* visc_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* minDistance_{nullptr}; - sierra::nalu::ScalarFieldType* dplus_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* tdr_{nullptr}; + ScalarFieldType* visc_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* minDistance_{nullptr}; + ScalarFieldType* dplus_{nullptr}; + TensorFieldType* dudx_{nullptr}; }; /** Test Fixture for the KO Kernels @@ -911,36 +905,35 @@ class KOKernelHex8Mesh : public LowMachKernelHex8Mesh public: KOKernelHex8Mesh() : LowMachKernelHex8Mesh(), - tke_(&meta_->declare_field( + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - sdr_(&meta_->declare_field( + sdr_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate")), - visc_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - tvisc_(&meta_->declare_field( + visc_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - minDistance_(&meta_->declare_field( + minDistance_(&meta_->declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")), - dkdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dkdx")), - dwdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dwdx")) + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")), + dkdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dkdx")), + dwdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dwdx")) { - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *minDistance_, meta_->universal_part(), nullptr); + *minDistance_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); stk::mesh::put_field_on_mesh( *dkdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dkdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dwdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dwdx_, stk::io::FieldOutputType::VECTOR_3D); } virtual ~KOKernelHex8Mesh() {} @@ -963,14 +956,14 @@ class KOKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *dwdx_); } - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* sdr_{nullptr}; - sierra::nalu::ScalarFieldType* visc_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* minDistance_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::VectorFieldType* dkdx_{nullptr}; - sierra::nalu::VectorFieldType* dwdx_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* sdr_{nullptr}; + ScalarFieldType* visc_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* minDistance_{nullptr}; + TensorFieldType* dudx_{nullptr}; + VectorFieldType* dkdx_{nullptr}; + VectorFieldType* dwdx_{nullptr}; }; /** Test Fixture for the Turbulence Kernels @@ -981,70 +974,72 @@ class KsgsKernelHex8Mesh : public LowMachKernelHex8Mesh public: KsgsKernelHex8Mesh() : LowMachKernelHex8Mesh(), - viscosity_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - tke_(&meta_->declare_field( + viscosity_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - sdr_(&meta_->declare_field( + sdr_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate")), - minDistance_(&meta_->declare_field( + minDistance_(&meta_->declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")), - tvisc_(&meta_->declare_field( + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")), + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - maxLengthScale_(&meta_->declare_field( + maxLengthScale_(&meta_->declare_field( stk::topology::NODE_RANK, "sst_max_length_scale")), - fOneBlend_(&meta_->declare_field( + fOneBlend_(&meta_->declare_field( stk::topology::NODE_RANK, "sst_f_one_blending")), - evisc_(&meta_->declare_field( + evisc_(&meta_->declare_field( stk::topology::NODE_RANK, "effective_viscosity")), - dualNodalVolume_(&meta_->declare_field( + dualNodalVolume_(&meta_->declare_field( stk::topology::NODE_RANK, "dual_nodal_volume", 3)), - dkdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dkdx")), - dwdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dwdx")), - dhdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dhdx")), - specificHeat_(&meta_->declare_field( + dkdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dkdx")), + dwdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dwdx")), + dhdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dhdx")), + specificHeat_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_heat")), - wallNormDistBip_(&meta_->declare_field( + wallNormDistBip_(&meta_->declare_field( stk::topology::FACE_RANK, "wall_normal_distance_bip")), - wallArea_(&meta_->declare_field( + wallArea_(&meta_->declare_field( stk::topology::NODE_RANK, "assembled_wall_area_wf")), - wallNormDist_(&meta_->declare_field( + wallNormDist_(&meta_->declare_field( stk::topology::NODE_RANK, "assembled_wall_normal_distance")) { - stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *minDistance_, meta_->universal_part(), nullptr); + *viscosity_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *minDistance_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *maxLengthScale_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *maxLengthScale_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*fOneBlend_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*evisc_, meta_->universal_part(), nullptr); + *fOneBlend_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*evisc_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *dualNodalVolume_, meta_->universal_part(), nullptr); + *dualNodalVolume_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dkdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dkdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dwdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dwdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dhdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dhdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *specificHeat_, meta_->universal_part(), nullptr); + *specificHeat_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *wallNormDistBip_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numFaceIp_, nullptr); - stk::mesh::put_field_on_mesh(*wallArea_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *wallNormDist_, meta_->universal_part(), nullptr); + *wallArea_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *wallNormDist_, meta_->universal_part(), 1, nullptr); } virtual ~KsgsKernelHex8Mesh() = default; @@ -1082,23 +1077,23 @@ class KsgsKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(1000.0, *specificHeat_); } - sierra::nalu::ScalarFieldType* viscosity_{nullptr}; - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* sdr_{nullptr}; - sierra::nalu::ScalarFieldType* minDistance_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* maxLengthScale_{nullptr}; - sierra::nalu::ScalarFieldType* fOneBlend_{nullptr}; - sierra::nalu::ScalarFieldType* evisc_{nullptr}; - sierra::nalu::ScalarFieldType* dualNodalVolume_{nullptr}; - sierra::nalu::VectorFieldType* dkdx_{nullptr}; - sierra::nalu::VectorFieldType* dwdx_{nullptr}; - sierra::nalu::VectorFieldType* dhdx_{nullptr}; - sierra::nalu::ScalarFieldType* specificHeat_{nullptr}; - sierra::nalu::GenericFieldType* wallNormDistBip_{nullptr}; - sierra::nalu::ScalarFieldType* wallArea_{nullptr}; - sierra::nalu::ScalarFieldType* wallNormDist_{nullptr}; + ScalarFieldType* viscosity_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* sdr_{nullptr}; + ScalarFieldType* minDistance_{nullptr}; + TensorFieldType* dudx_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* maxLengthScale_{nullptr}; + ScalarFieldType* fOneBlend_{nullptr}; + ScalarFieldType* evisc_{nullptr}; + ScalarFieldType* dualNodalVolume_{nullptr}; + VectorFieldType* dkdx_{nullptr}; + VectorFieldType* dwdx_{nullptr}; + VectorFieldType* dhdx_{nullptr}; + ScalarFieldType* specificHeat_{nullptr}; + GenericFieldType* wallNormDistBip_{nullptr}; + ScalarFieldType* wallArea_{nullptr}; + ScalarFieldType* wallNormDist_{nullptr}; }; /** Test Fixture for the AMS Kernels @@ -1109,73 +1104,70 @@ class AMSKernelHex8Mesh : public LowMachKernelHex8Mesh public: AMSKernelHex8Mesh() : LowMachKernelHex8Mesh(), - tke_(&meta_->declare_field( + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - sdr_(&meta_->declare_field( + sdr_(&meta_->declare_field( stk::topology::NODE_RANK, "specific_dissipation_rate")), - visc_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - tvisc_(&meta_->declare_field( + visc_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + tvisc_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_viscosity")), - alpha_( - &meta_->declare_field(stk::topology::NODE_RANK, "k_ratio")), - avgVelocity_(&meta_->declare_field( + alpha_(&meta_->declare_field( + stk::topology::NODE_RANK, "k_ratio")), + avgVelocity_(&meta_->declare_field( stk::topology::NODE_RANK, "average_velocity")), - avgResAdeq_(&meta_->declare_field( + avgResAdeq_(&meta_->declare_field( stk::topology::NODE_RANK, "avg_res_adequacy_parameter")), - avgProd_(&meta_->declare_field( + avgProd_(&meta_->declare_field( stk::topology::NODE_RANK, "average_production")), - avgTime_(&meta_->declare_field( + avgTime_(&meta_->declare_field( stk::topology::NODE_RANK, "rans_time_scale")), - minDist_(&meta_->declare_field( + minDist_(&meta_->declare_field( stk::topology::NODE_RANK, "minimum_distance_to_wall")), - Mij_(&meta_->declare_field( + Mij_(&meta_->declare_field( stk::topology::NODE_RANK, "metric_tensor")), - fOneBlend_(&meta_->declare_field( + fOneBlend_(&meta_->declare_field( stk::topology::NODE_RANK, "sst_f_one_blending")), - dudx_(&meta_->declare_field(stk::topology::NODE_RANK, "dudx")), - avgDudx_(&meta_->declare_field( + dudx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dudx")), + avgDudx_(&meta_->declare_field( stk::topology::NODE_RANK, "average_dudx")), - dkdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dkdx")), - dwdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dwdx")), - forcingComp_(&meta_->declare_field( + dkdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dkdx")), + dwdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dwdx")), + forcingComp_(&meta_->declare_field( stk::topology::NODE_RANK, "forcing_components")) { - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*alpha_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*sdr_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*visc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tvisc_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*alpha_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *avgVelocity_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *avgVelocity_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( - *avgResAdeq_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*avgProd_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*avgTime_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*minDist_, meta_->universal_part(), nullptr); + *avgResAdeq_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *avgProd_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *avgTime_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *minDist_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *Mij_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::mesh::put_field_on_mesh(*fOneBlend_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *fOneBlend_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *dudx_, stk::io::FieldOutputType::FULL_TENSOR_36); stk::mesh::put_field_on_mesh( *avgDudx_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::io::set_field_output_type( - *avgDudx_, stk::io::FieldOutputType::FULL_TENSOR_36); stk::mesh::put_field_on_mesh( *dkdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dkdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *dwdx_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type(*dwdx_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *forcingComp_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *forcingComp_, stk::io::FieldOutputType::VECTOR_3D); } virtual ~AMSKernelHex8Mesh() {} @@ -1207,23 +1199,23 @@ class AMSKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *forcingComp_); } - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* sdr_{nullptr}; - sierra::nalu::ScalarFieldType* visc_{nullptr}; - sierra::nalu::ScalarFieldType* tvisc_{nullptr}; - sierra::nalu::ScalarFieldType* alpha_{nullptr}; - sierra::nalu::VectorFieldType* avgVelocity_{nullptr}; - sierra::nalu::ScalarFieldType* avgResAdeq_{nullptr}; - sierra::nalu::ScalarFieldType* avgProd_{nullptr}; - sierra::nalu::ScalarFieldType* avgTime_{nullptr}; - sierra::nalu::ScalarFieldType* minDist_{nullptr}; - sierra::nalu::GenericFieldType* Mij_{nullptr}; - sierra::nalu::ScalarFieldType* fOneBlend_{nullptr}; - sierra::nalu::TensorFieldType* dudx_{nullptr}; - sierra::nalu::TensorFieldType* avgDudx_{nullptr}; - sierra::nalu::VectorFieldType* dkdx_{nullptr}; - sierra::nalu::VectorFieldType* dwdx_{nullptr}; - sierra::nalu::VectorFieldType* forcingComp_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* sdr_{nullptr}; + ScalarFieldType* visc_{nullptr}; + ScalarFieldType* tvisc_{nullptr}; + ScalarFieldType* alpha_{nullptr}; + VectorFieldType* avgVelocity_{nullptr}; + ScalarFieldType* avgResAdeq_{nullptr}; + ScalarFieldType* avgProd_{nullptr}; + ScalarFieldType* avgTime_{nullptr}; + ScalarFieldType* minDist_{nullptr}; + GenericFieldType* Mij_{nullptr}; + ScalarFieldType* fOneBlend_{nullptr}; + TensorFieldType* dudx_{nullptr}; + TensorFieldType* avgDudx_{nullptr}; + VectorFieldType* dkdx_{nullptr}; + VectorFieldType* dwdx_{nullptr}; + VectorFieldType* forcingComp_{nullptr}; }; /** Test Fixture for the hybrid turbulence Kernels @@ -1234,15 +1226,15 @@ class HybridTurbKernelHex8Mesh : public LowMachKernelHex8Mesh public: HybridTurbKernelHex8Mesh() : LowMachKernelHex8Mesh(), - tke_(&meta_->declare_field( + tke_(&meta_->declare_field( stk::topology::NODE_RANK, "turbulent_ke")), - alpha_(&meta_->declare_field( + alpha_(&meta_->declare_field( stk::topology::NODE_RANK, "adaptivity_parameter")), - mutij_(&meta_->declare_field( + mutij_(&meta_->declare_field( stk::topology::NODE_RANK, "tensor_turbulent_viscosity")) { - stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*alpha_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tke_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*alpha_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *mutij_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); } @@ -1264,9 +1256,9 @@ class HybridTurbKernelHex8Mesh : public LowMachKernelHex8Mesh * *alpha_); */ } - sierra::nalu::ScalarFieldType* tke_{nullptr}; - sierra::nalu::ScalarFieldType* alpha_{nullptr}; - sierra::nalu::GenericFieldType* mutij_{nullptr}; + ScalarFieldType* tke_{nullptr}; + ScalarFieldType* alpha_{nullptr}; + GenericFieldType* mutij_{nullptr}; }; /** Text fixture for heat conduction equation kernels @@ -1282,15 +1274,15 @@ class HeatCondKernelHex8Mesh : public TestKernelHex8Mesh public: HeatCondKernelHex8Mesh() : TestKernelHex8Mesh(), - temperature_(&meta_->declare_field( + temperature_(&meta_->declare_field( stk::topology::NODE_RANK, "temperature", 2)), - thermalCond_(&meta_->declare_field( + thermalCond_(&meta_->declare_field( stk::topology::NODE_RANK, "thermal_conductivity", 2)) { stk::mesh::put_field_on_mesh( - *temperature_, meta_->universal_part(), nullptr); + *temperature_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *thermalCond_, meta_->universal_part(), nullptr); + *thermalCond_, meta_->universal_part(), 1, nullptr); } virtual void fill_mesh_and_init_fields( @@ -1303,8 +1295,8 @@ class HeatCondKernelHex8Mesh : public TestKernelHex8Mesh stk::mesh::field_fill(1.0, *thermalCond_); } - sierra::nalu::ScalarFieldType* temperature_{nullptr}; - sierra::nalu::ScalarFieldType* thermalCond_{nullptr}; + ScalarFieldType* temperature_{nullptr}; + ScalarFieldType* thermalCond_{nullptr}; }; /** Text fixture for mixture fraction equation kernels @@ -1320,23 +1312,25 @@ class MixtureFractionKernelHex8Mesh : public TestKernelHex8Mesh public: MixtureFractionKernelHex8Mesh() : TestKernelHex8Mesh(), - mixFraction_(&meta_->declare_field( + mixFraction_(&meta_->declare_field( stk::topology::NODE_RANK, "mixture_fraction", 2)), - velocity_( - &meta_->declare_field(stk::topology::NODE_RANK, "velocity")), - density_( - &meta_->declare_field(stk::topology::NODE_RANK, "density", 2)), - viscosity_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - effectiveViscosity_(&meta_->declare_field( + velocity_(&meta_->declare_field( + stk::topology::NODE_RANK, "velocity")), + density_(&meta_->declare_field( + stk::topology::NODE_RANK, "density", 2)), + viscosity_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + effectiveViscosity_(&meta_->declare_field( stk::topology::NODE_RANK, "effective_viscosity")), - massFlowRate_(&meta_->declare_field( + massFlowRate_(&meta_->declare_field( stk::topology::ELEM_RANK, "mass_flow_rate_scs")), - dzdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dzdx")), - dpdx_(&meta_->declare_field(stk::topology::NODE_RANK, "dpdx", 2)), - openMassFlowRate_(&meta_->declare_field( + dzdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dzdx")), + dpdx_(&meta_->declare_field( + stk::topology::NODE_RANK, "dpdx", 2)), + openMassFlowRate_(&meta_->declare_field( meta_->side_rank(), "open_mass_flow_rate")), - massFlowRateEdge_(&meta_->declare_field( + massFlowRateEdge_(&meta_->declare_field( stk::topology::EDGE_RANK, "mass_flow_rate")), znot_(1.0), amf_(2.0), @@ -1351,11 +1345,13 @@ class MixtureFractionKernelHex8Mesh : public TestKernelHex8Mesh sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); stk::mesh::put_field_on_mesh( - *mixFraction_, meta_->universal_part(), nullptr); + *mixFraction_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *velocity_, meta_->universal_part(), spatialDim_, nullptr); - stk::mesh::put_field_on_mesh(*density_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh( + *density_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *viscosity_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *massFlowRate_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); @@ -1395,16 +1391,16 @@ class MixtureFractionKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *velocity_, *density_, *edgeAreaVec_, *massFlowRateEdge_); } - sierra::nalu::ScalarFieldType* mixFraction_{nullptr}; - sierra::nalu::VectorFieldType* velocity_{nullptr}; - sierra::nalu::ScalarFieldType* density_{nullptr}; - sierra::nalu::ScalarFieldType* viscosity_{nullptr}; - sierra::nalu::ScalarFieldType* effectiveViscosity_{nullptr}; - sierra::nalu::GenericFieldType* massFlowRate_{nullptr}; - sierra::nalu::VectorFieldType* dzdx_{nullptr}; - sierra::nalu::VectorFieldType* dpdx_{nullptr}; - sierra::nalu::GenericFieldType* openMassFlowRate_{nullptr}; - sierra::nalu::ScalarFieldType* massFlowRateEdge_{nullptr}; + ScalarFieldType* mixFraction_{nullptr}; + VectorFieldType* velocity_{nullptr}; + ScalarFieldType* density_{nullptr}; + ScalarFieldType* viscosity_{nullptr}; + ScalarFieldType* effectiveViscosity_{nullptr}; + GenericFieldType* massFlowRate_{nullptr}; + VectorFieldType* dzdx_{nullptr}; + VectorFieldType* dpdx_{nullptr}; + GenericFieldType* openMassFlowRate_{nullptr}; + ScalarFieldType* massFlowRateEdge_{nullptr}; const double znot_; const double amf_; @@ -1429,17 +1425,17 @@ class VOFKernelHex8Mesh : public TestKernelHex8Mesh public: VOFKernelHex8Mesh() : TestKernelHex8Mesh(), - volumeOfFluid_(&meta_->declare_field( + volumeOfFluid_(&meta_->declare_field( stk::topology::NODE_RANK, "volume_of_fluid", 2)), - dvolumeOfFluidDx_(&meta_->declare_field( + dvolumeOfFluidDx_(&meta_->declare_field( stk::topology::NODE_RANK, "volume_of_fluid_gradient")), - velocity_( - &meta_->declare_field(stk::topology::NODE_RANK, "velocity")), - density_( - &meta_->declare_field(stk::topology::NODE_RANK, "density", 2)), - viscosity_( - &meta_->declare_field(stk::topology::NODE_RANK, "viscosity")), - massFlowRateEdge_(&meta_->declare_field( + velocity_(&meta_->declare_field( + stk::topology::NODE_RANK, "velocity")), + density_(&meta_->declare_field( + stk::topology::NODE_RANK, "density", 2)), + viscosity_(&meta_->declare_field( + stk::topology::NODE_RANK, "viscosity")), + massFlowRateEdge_(&meta_->declare_field( stk::topology::EDGE_RANK, "mass_flow_rate")), znot_(1.0), amf_(2.0), @@ -1452,17 +1448,17 @@ class VOFKernelHex8Mesh : public TestKernelHex8Mesh sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); stk::mesh::put_field_on_mesh( - *volumeOfFluid_, meta_->universal_part(), nullptr); + *volumeOfFluid_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( - *dvolumeOfFluidDx_, meta_->universal_part(), nullptr); + *dvolumeOfFluidDx_, meta_->universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh( *velocity_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *velocity_, stk::io::FieldOutputType::VECTOR_3D); - stk::mesh::put_field_on_mesh(*density_, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *massFlowRateEdge_, meta_->universal_part(), nullptr); + *density_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *viscosity_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + *massFlowRateEdge_, meta_->universal_part(), 1, nullptr); } virtual ~VOFKernelHex8Mesh() {} @@ -1485,12 +1481,12 @@ class VOFKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *velocity_, *density_, *edgeAreaVec_, *massFlowRateEdge_); } - sierra::nalu::ScalarFieldType* volumeOfFluid_{nullptr}; - sierra::nalu::ScalarFieldType* dvolumeOfFluidDx_{nullptr}; - sierra::nalu::VectorFieldType* velocity_{nullptr}; - sierra::nalu::ScalarFieldType* density_{nullptr}; - sierra::nalu::ScalarFieldType* viscosity_{nullptr}; - sierra::nalu::ScalarFieldType* massFlowRateEdge_{nullptr}; + ScalarFieldType* volumeOfFluid_{nullptr}; + VectorFieldType* dvolumeOfFluidDx_{nullptr}; + VectorFieldType* velocity_{nullptr}; + ScalarFieldType* density_{nullptr}; + ScalarFieldType* viscosity_{nullptr}; + ScalarFieldType* massFlowRateEdge_{nullptr}; const double znot_; const double amf_; const double rhoPrimary_; @@ -1511,19 +1507,15 @@ class ActuatorSourceKernelHex8Mesh : public TestKernelHex8Mesh public: ActuatorSourceKernelHex8Mesh() : TestKernelHex8Mesh(), - actuator_source_(&meta_->declare_field( + actuator_source_(&meta_->declare_field( stk::topology::NODE_RANK, "actuator_source")), - actuator_source_lhs_(&meta_->declare_field( + actuator_source_lhs_(&meta_->declare_field( stk::topology::NODE_RANK, "actuator_source_lhs")) { stk::mesh::put_field_on_mesh( *actuator_source_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *actuator_source_, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *actuator_source_lhs_, meta_->universal_part(), spatialDim_, nullptr); - stk::io::set_field_output_type( - *actuator_source_lhs_, stk::io::FieldOutputType::VECTOR_3D); } virtual ~ActuatorSourceKernelHex8Mesh() {} @@ -1545,8 +1537,8 @@ class ActuatorSourceKernelHex8Mesh : public TestKernelHex8Mesh act_source_lhs.data(), *actuator_source_lhs_); } - sierra::nalu::VectorFieldType* actuator_source_{nullptr}; - sierra::nalu::VectorFieldType* actuator_source_lhs_{nullptr}; + VectorFieldType* actuator_source_{nullptr}; + VectorFieldType* actuator_source_lhs_{nullptr}; }; class WallDistKernelHex8Mesh : public TestKernelHex8Mesh diff --git a/unit_tests/matrix_free/StkConductionFixture.C b/unit_tests/matrix_free/StkConductionFixture.C index d17a7b346..3b457be46 100644 --- a/unit_tests/matrix_free/StkConductionFixture.C +++ b/unit_tests/matrix_free/StkConductionFixture.C @@ -13,6 +13,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/GetNgpField.hpp" @@ -39,37 +40,37 @@ ConductionFixture::ConductionFixture(int nx, double scale) meta(bulkPtr->mesh_meta_data()), bulk(*bulkPtr), io(bulk.parallel()), - q_field(meta.declare_field( + q_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::q_name, 3)), - qbc_field(meta.declare_field( + qbc_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::qbc_name)), - flux_field(meta.declare_field( + flux_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::flux_name)), - qtmp_field(meta.declare_field( + qtmp_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::qtmp_name)), - alpha_field(meta.declare_field( + alpha_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::volume_weight_name)), - lambda_field(meta.declare_field( + lambda_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::diffusion_weight_name)), - gid_field(meta.declare_field::global_ordinal_type>( + gid_field(meta.declare_field< + stk::mesh::Field::global_ordinal_type>>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::gid_name)) { - meta.use_simple_fields(); - stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(qbc_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(flux_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(qtmp_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(alpha_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(lambda_field, meta.universal_part(), nullptr); + stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(qbc_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(flux_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(qtmp_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(alpha_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(lambda_field, meta.universal_part(), 1, nullptr); const std::string nx_s = std::to_string(nx); const std::string name = @@ -111,10 +112,11 @@ ConductionFixture::ConductionFixture(int nx, double scale) mesh, meta.universal_part(), gid_field_ngp); } -stk::mesh::Field& +stk::mesh::Field& ConductionFixture::coordinate_field() { - return *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + return *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); } ConductionFixtureP2::ConductionFixtureP2(int nx, double scale) @@ -122,21 +124,22 @@ ConductionFixtureP2::ConductionFixtureP2(int nx, double scale) meta(fixture.m_meta), bulk(fixture.m_bulk_data), io(bulk.parallel()), - q_field(meta.declare_field( + q_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::q_name, 3)), - qtmp_field(meta.declare_field( + qtmp_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::qtmp_name, 3)), - alpha_field(meta.declare_field( + alpha_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::volume_weight_name)), - lambda_field(meta.declare_field( + lambda_field(meta.declare_field>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::diffusion_weight_name)), - gid_field(meta.declare_field::global_ordinal_type>( + gid_field(meta.declare_field< + stk::mesh::Field::global_ordinal_type>>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::gid_name)) { @@ -144,11 +147,11 @@ ConductionFixtureP2::ConductionFixtureP2(int nx, double scale) stk::io::put_io_part_attribute(*part); } - stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(qtmp_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(alpha_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(lambda_field, meta.universal_part(), nullptr); + stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(qtmp_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(alpha_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(lambda_field, meta.universal_part(), 1, nullptr); fixture.generate_mesh(); auto& coordField = coordinate_field(); @@ -183,8 +186,9 @@ ConductionFixtureP2::ConductionFixtureP2(int nx, double scale) mesh, meta.universal_part(), gid_field_ngp); } -stk::mesh::Field& +stk::mesh::Field& ConductionFixtureP2::coordinate_field() { - return *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + return *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); } diff --git a/unit_tests/matrix_free/StkConductionFixture.h b/unit_tests/matrix_free/StkConductionFixture.h index 8118fe812..fc108e0bb 100644 --- a/unit_tests/matrix_free/StkConductionFixture.h +++ b/unit_tests/matrix_free/StkConductionFixture.h @@ -17,6 +17,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -39,7 +40,7 @@ class ConductionFixture : public ::testing::Test using gid_type = typename Tpetra::Map<>::global_ordinal_type; static constexpr int order = 1; ConductionFixture(int nx, double scale); - stk::mesh::Field& coordinate_field(); + stk::mesh::Field& coordinate_field(); std::shared_ptr bulkPtr; stk::mesh::BulkData& bulk; stk::mesh::MetaData& meta; @@ -62,8 +63,8 @@ class ConductionFixtureP2 : public ::testing::Test using gid_type = typename Tpetra::Map<>::global_ordinal_type; static constexpr int order = 2; ConductionFixtureP2(int nx, double scale); - stk::mesh::Field& coordinate_field(); - stk::mesh::fixtures::simple_fields::Hex27Fixture fixture; + stk::mesh::Field& coordinate_field(); + stk::mesh::fixtures::Hex27Fixture fixture; stk::mesh::MetaData& meta; stk::mesh::BulkData& bulk; stk::io::StkMeshIoBroker io; diff --git a/unit_tests/matrix_free/StkGradientFixture.C b/unit_tests/matrix_free/StkGradientFixture.C index 957d9d44d..3132cf95d 100644 --- a/unit_tests/matrix_free/StkGradientFixture.C +++ b/unit_tests/matrix_free/StkGradientFixture.C @@ -19,6 +19,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -46,29 +47,24 @@ GradientFixture::GradientFixture(int nx, double scale) meta(bulkPtr->mesh_meta_data()), bulk(*bulkPtr), io(bulk.parallel()), - q_field(meta.declare_field(stk::topology::NODE_RANK, "q")), - dqdx_field(meta.declare_field(stk::topology::NODE_RANK, "dqdx")), - dqdx_tmp_field( - meta.declare_field(stk::topology::NODE_RANK, "dqdx_tmp")), - dqdx_exact_field( - meta.declare_field(stk::topology::NODE_RANK, "dqdx_exact")), - gid_field(meta.declare_field( + q_field(meta.declare_field>( + stk::topology::NODE_RANK, "q")), + dqdx_field(meta.declare_field>( + stk::topology::NODE_RANK, "dqdx")), + dqdx_tmp_field(meta.declare_field>( + stk::topology::NODE_RANK, "dqdx_tmp")), + dqdx_exact_field(meta.declare_field>( + stk::topology::NODE_RANK, "dqdx_exact")), + gid_field(meta.declare_field>( stk::topology::NODE_RANK, linsys_info::gid_name)) { - meta.use_simple_fields(); - stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), nullptr); + stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(q_field, meta.universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh(dqdx_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - dqdx_field, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( dqdx_tmp_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - dqdx_tmp_field, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( dqdx_exact_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - dqdx_exact_field, stk::io::FieldOutputType::VECTOR_3D); const std::string nx_s = std::to_string(nx); const std::string name = @@ -110,4 +106,4 @@ GradientFixture::GradientFixture(int nx, double scale) } } // namespace matrix_free } // namespace nalu -} // namespace sierra +} // namespace sierra \ No newline at end of file diff --git a/unit_tests/matrix_free/StkGradientFixture.h b/unit_tests/matrix_free/StkGradientFixture.h index 9d3d279cd..f8ab8e464 100644 --- a/unit_tests/matrix_free/StkGradientFixture.h +++ b/unit_tests/matrix_free/StkGradientFixture.h @@ -16,6 +16,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -43,9 +44,10 @@ class GradientFixture : public ::testing::Test using gid_type = typename Tpetra::Map<>::global_ordinal_type; static constexpr int order = 1; GradientFixture(int nx, double scale); - stk::mesh::Field& coordinate_field() + stk::mesh::Field& coordinate_field() { - return *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + return *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); } stk::mesh::NgpMesh& mesh() { return stk::mesh::get_updated_ngp_mesh(bulk); } diff --git a/unit_tests/matrix_free/StkLowMachFixture.C b/unit_tests/matrix_free/StkLowMachFixture.C index 6caac68ba..4187daadd 100644 --- a/unit_tests/matrix_free/StkLowMachFixture.C +++ b/unit_tests/matrix_free/StkLowMachFixture.C @@ -19,6 +19,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -46,46 +47,44 @@ LowMachFixture::LowMachFixture(int nx, double scale) meta(bulkPtr->mesh_meta_data()), bulk(*bulkPtr), io(bulk.parallel()), - density_field( - meta.declare_field(stk::topology::NODE_RANK, "density", 3)), + density_field(meta.declare_field>( + stk::topology::NODE_RANK, "density", 3)), velocity_field( - meta.declare_field(stk::topology::NODE_RANK, "velocity", 3)), - viscosity_field( - meta.declare_field(stk::topology::NODE_RANK, "viscosity")), - filter_scale_field(meta.declare_field( + meta.declare_field>( + stk::topology::NODE_RANK, "velocity", 3)), + viscosity_field(meta.declare_field>( + stk::topology::NODE_RANK, "viscosity")), + filter_scale_field(meta.declare_field>( stk::topology::NODE_RANK, "scaled_filter_length")), - pressure_field( - meta.declare_field(stk::topology::NODE_RANK, "pressure")), - dpdx_field(meta.declare_field(stk::topology::NODE_RANK, "dpdx")), + pressure_field(meta.declare_field>( + stk::topology::NODE_RANK, "pressure")), + dpdx_field( + meta.declare_field>( + stk::topology::NODE_RANK, "dpdx")), dpdx_tmp_field( - meta.declare_field(stk::topology::NODE_RANK, "dpdx_tmp")), + meta.declare_field>( + stk::topology::NODE_RANK, "dpdx_tmp")), body_force_field( - meta.declare_field(stk::topology::NODE_RANK, "body_force")), - gid_field(meta.declare_field( + meta.declare_field>( + stk::topology::NODE_RANK, "body_force")), + gid_field(meta.declare_field>( stk::topology::NODE_RANK, linsys_info::gid_name)) { - meta.use_simple_fields(); double one = 1; - stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), nullptr); - stk::mesh::put_field_on_mesh(density_field, meta.universal_part(), &one); + stk::mesh::put_field_on_mesh(gid_field, meta.universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(density_field, meta.universal_part(), 1, &one); stk::mesh::put_field_on_mesh( velocity_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - velocity_field, stk::io::FieldOutputType::VECTOR_3D); - stk::mesh::put_field_on_mesh(viscosity_field, meta.universal_part(), &one); - stk::mesh::put_field_on_mesh(filter_scale_field, meta.universal_part(), &one); - stk::mesh::put_field_on_mesh(pressure_field, meta.universal_part(), nullptr); + stk::mesh::put_field_on_mesh(viscosity_field, meta.universal_part(), 1, &one); + stk::mesh::put_field_on_mesh( + filter_scale_field, meta.universal_part(), 1, &one); + stk::mesh::put_field_on_mesh( + pressure_field, meta.universal_part(), 1, nullptr); stk::mesh::put_field_on_mesh(dpdx_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - dpdx_field, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( dpdx_tmp_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - dpdx_tmp_field, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( body_force_field, meta.universal_part(), 3, nullptr); - stk::io::set_field_output_type( - body_force_field, stk::io::FieldOutputType::VECTOR_3D); const std::string nx_s = std::to_string(nx); const std::string name = @@ -147,4 +146,4 @@ LowMachFixture::LowMachFixture(int nx, double scale) } } // namespace matrix_free } // namespace nalu -} // namespace sierra +} // namespace sierra \ No newline at end of file diff --git a/unit_tests/matrix_free/StkLowMachFixture.h b/unit_tests/matrix_free/StkLowMachFixture.h index ac99f05de..3925ba377 100644 --- a/unit_tests/matrix_free/StkLowMachFixture.h +++ b/unit_tests/matrix_free/StkLowMachFixture.h @@ -16,6 +16,7 @@ #include "stk_io/StkMeshIoBroker.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -43,9 +44,10 @@ class LowMachFixture : public ::testing::Test using gid_type = typename Tpetra::Map<>::global_ordinal_type; static constexpr int order = 1; LowMachFixture(int nx, double scale); - stk::mesh::Field& coordinate_field() + stk::mesh::Field& coordinate_field() { - return *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + return *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); } stk::mesh::NgpMesh& mesh() { return stk::mesh::get_updated_ngp_mesh(bulk); } @@ -61,15 +63,15 @@ class LowMachFixture : public ::testing::Test stk::io::StkMeshIoBroker io; stk::mesh::Field& density_field; - stk::mesh::Field& velocity_field; + stk::mesh::Field& velocity_field; stk::mesh::Field& viscosity_field; stk::mesh::Field& filter_scale_field; stk::mesh::Field& pressure_field; - stk::mesh::Field& dpdx_field; - stk::mesh::Field& dpdx_tmp_field; + stk::mesh::Field& dpdx_field; + stk::mesh::Field& dpdx_tmp_field; - stk::mesh::Field& body_force_field; + stk::mesh::Field& body_force_field; stk::mesh::Field& gid_field; stk::mesh::NgpField gid_field_ngp; diff --git a/unit_tests/matrix_free/UnitTestConductionFields.C b/unit_tests/matrix_free/UnitTestConductionFields.C index cc478d653..5e978d809 100644 --- a/unit_tests/matrix_free/UnitTestConductionFields.C +++ b/unit_tests/matrix_free/UnitTestConductionFields.C @@ -16,6 +16,7 @@ #include "mpi.h" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -43,13 +44,12 @@ protected: meshBuilder.set_spatial_dimension(3u); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); - q_field = &meta->declare_field( + q_field = &meta->declare_field>( stk::topology::NODE_RANK, conduction_info::q_name, 3); - alpha_field = &meta->declare_field( + alpha_field = &meta->declare_field>( stk::topology::NODE_RANK, conduction_info::volume_weight_name); - lambda_field = &meta->declare_field( + lambda_field = &meta->declare_field>( stk::topology::NODE_RANK, conduction_info::diffusion_weight_name); stk::topology topo(stk::topology::HEX_8); @@ -69,14 +69,15 @@ protected: } // set a coordinate field - auto& coordField = - meta->declare_field(stk::topology::NODE_RANK, "coordinates"); - stk::mesh::put_field_on_mesh(coordField, block_1, 3, nullptr); - stk::mesh::put_field_on_mesh(*q_field, block_1, nullptr); - stk::mesh::put_field_on_mesh(*lambda_field, block_1, nullptr); - stk::mesh::put_field_on_mesh(*alpha_field, block_1, nullptr); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta->declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); + stk::mesh::put_field_on_mesh(*q_field, block_1, 1, nullptr); + stk::mesh::put_field_on_mesh(*lambda_field, block_1, 1, nullptr); + stk::mesh::put_field_on_mesh(*alpha_field, block_1, 1, nullptr); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), 3, nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta->set_coordinate_field(&coordField); meta->commit(); diff --git a/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C b/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C index df2f3b527..2e6cf5e40 100644 --- a/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C +++ b/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C @@ -38,7 +38,8 @@ protected: field_gather(bulk, meta.universal_part(), {}) { auto& coordField = - *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); for (auto ib : bulk.get_buckets(stk::topology::NODE_RANK, meta.universal_part())) { for (auto node : *ib) { diff --git a/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C b/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C index c5e9f9039..e58569d3e 100644 --- a/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C @@ -26,10 +26,12 @@ #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Entity.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldState.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" @@ -73,7 +75,8 @@ protected: field_update(Teuchos::ParameterList{}, linsys, exporter, offset_views) { auto& coordField = - *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); for (auto ib : bulk.get_buckets(stk::topology::NODE_RANK, meta.universal_part())) { for (auto node : *ib) { @@ -156,7 +159,8 @@ TEST_F(ConductionSolutionUpdateFixture, correct_behavior_for_linear_problem) delta.sync_to_host(); auto& coord_field = - *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); for (auto ib : bulk.get_buckets(stk::topology::NODE_RANK, meta.universal_part())) { for (auto node : *ib) { diff --git a/unit_tests/matrix_free/UnitTestConductionUpdate.C b/unit_tests/matrix_free/UnitTestConductionUpdate.C index 4f4054f8e..fa0057f5e 100644 --- a/unit_tests/matrix_free/UnitTestConductionUpdate.C +++ b/unit_tests/matrix_free/UnitTestConductionUpdate.C @@ -26,6 +26,7 @@ #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldState.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" #include "stk_mesh/base/NgpField.hpp" diff --git a/unit_tests/matrix_free/UnitTestContinuityOperator.C b/unit_tests/matrix_free/UnitTestContinuityOperator.C index 4810bf7c2..14617204f 100644 --- a/unit_tests/matrix_free/UnitTestContinuityOperator.C +++ b/unit_tests/matrix_free/UnitTestContinuityOperator.C @@ -39,6 +39,7 @@ #include "stk_math/StkMath.hpp" #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/Entity.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/Selector.hpp" #include "stk_mesh/base/Types.hpp" diff --git a/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C b/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C index 01611502f..b5220126e 100644 --- a/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C @@ -27,10 +27,12 @@ #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Entity.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldState.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" diff --git a/unit_tests/matrix_free/UnitTestGreenGaussGradient.C b/unit_tests/matrix_free/UnitTestGreenGaussGradient.C index 5fa16e406..b2a76b4fc 100644 --- a/unit_tests/matrix_free/UnitTestGreenGaussGradient.C +++ b/unit_tests/matrix_free/UnitTestGreenGaussGradient.C @@ -34,6 +34,7 @@ #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/MetaData.hpp" diff --git a/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C b/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C index 6e27f2440..389fb99a8 100644 --- a/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C +++ b/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C @@ -32,6 +32,7 @@ #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldParallel.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Types.hpp" diff --git a/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C b/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C index 704b8077a..7e1b47420 100644 --- a/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C +++ b/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C @@ -37,7 +37,8 @@ protected: : LowMachFixture(nx, scale), field_gather(bulk, meta.universal_part()) { auto& coordField = - *meta.get_field(stk::topology::NODE_RANK, "coordinates"); + *meta.get_field>( + stk::topology::NODE_RANK, "coordinates"); for (auto ib : bulk.get_buckets(stk::topology::NODE_RANK, meta.universal_part())) { for (auto node : *ib) { diff --git a/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C b/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C index cd51a5f69..37993ebcb 100644 --- a/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C +++ b/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C @@ -45,6 +45,7 @@ #include "mpi.h" #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldState.hpp" diff --git a/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C b/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C index 72892b5f9..fe2d953d0 100644 --- a/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C +++ b/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C @@ -39,6 +39,7 @@ #include "stk_math/StkMath.hpp" #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/Entity.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/Selector.hpp" #include "stk_mesh/base/Types.hpp" diff --git a/unit_tests/matrix_free/UnitTestMomentumOperator.C b/unit_tests/matrix_free/UnitTestMomentumOperator.C index ec7b2d297..db53f6ed9 100644 --- a/unit_tests/matrix_free/UnitTestMomentumOperator.C +++ b/unit_tests/matrix_free/UnitTestMomentumOperator.C @@ -39,6 +39,7 @@ #include "stk_math/StkMath.hpp" #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/Entity.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/Selector.hpp" #include "stk_mesh/base/Types.hpp" diff --git a/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C b/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C index c4ef9c7c1..bbf7e2441 100644 --- a/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C @@ -27,10 +27,12 @@ #include "stk_mesh/base/Bucket.hpp" #include "stk_mesh/base/BulkData.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Entity.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/FieldState.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetNgpField.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" diff --git a/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C b/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C index 3939b8754..1fea6871d 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C @@ -17,10 +17,12 @@ #include "stk_io/IossBridge.hpp" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Entity.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetEntities.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" @@ -49,7 +51,6 @@ protected: bulk(*bulkPtr), meta(bulk.mesh_meta_data()) { - meta.use_simple_fields(); stk::topology topo(stk::topology::HEX_8); stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", topo); @@ -66,13 +67,12 @@ protected: } // set a coordinate field - auto& coordField = - meta.declare_field(stk::topology::NODE_RANK, "coordinates"); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta.declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); stk::mesh::put_field_on_mesh( - coordField, block_1, meta.spatial_dimension(), nullptr); - stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), - nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta.set_coordinate_field(&coordField); meta.commit(); @@ -163,7 +163,8 @@ TEST_F(SimdConnectivityFixture, map_has_invalid_entries_for_nonexisting_element) TEST_F(SimdConnectivityFixture, map_is_in_tensor_product_form) { const auto& coord_field = - *static_cast*>(meta.coordinate_field()); + *static_cast*>( + meta.coordinate_field()); constexpr int order = 1; const auto map = stk_connectivity_map(mesh, meta.universal_part()); auto map_h = Kokkos::create_mirror_view(map); diff --git a/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C b/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C index c79c020f2..be3620e56 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C @@ -21,6 +21,7 @@ #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/GetEntities.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Ngp.hpp" @@ -60,7 +61,6 @@ protected: bulk(*bulkPtr), meta(bulk.mesh_meta_data()) { - meta.use_simple_fields(); stk::topology topo(stk::topology::HEX_8); stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", topo); @@ -77,13 +77,12 @@ protected: } // set a coordinate field - auto& coordField = - meta.declare_field(stk::topology::NODE_RANK, "coordinates"); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta.declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); stk::mesh::put_field_on_mesh( - coordField, block_1, meta.spatial_dimension(), nullptr); - stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), - nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta.set_coordinate_field(&coordField); meta.commit(); diff --git a/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C b/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C index 6b77c4c85..f2874b3da 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C +++ b/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C @@ -25,6 +25,7 @@ #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" +#include "stk_mesh/base/FieldTraits.hpp" #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/Selector.hpp" #include "stk_mesh/base/SkinBoundary.hpp" @@ -64,10 +65,10 @@ protected: bulk(*bulkPtr), meta(bulk.mesh_meta_data()) { - meta.use_simple_fields(); stk::topology topo(stk::topology::HEX_8); - auto& q_field = meta.declare_field(stk::topology::NODE_RANK, "q"); + auto& q_field = meta.declare_field>( + stk::topology::NODE_RANK, "q"); stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", topo); stk::io::put_io_part_attribute(block_1); @@ -83,14 +84,13 @@ protected: } // set a coordinate field - auto& coordField = - meta.declare_field(stk::topology::NODE_RANK, "coordinates"); - stk::mesh::put_field_on_mesh( - coordField, block_1, meta.spatial_dimension(), nullptr); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta.declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); stk::mesh::put_field_on_mesh(q_field, block_1, 1, nullptr); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), - nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta.set_coordinate_field(&coordField); meta.commit(); diff --git a/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C b/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C index 0f7a4d1f3..cb2765871 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C @@ -19,6 +19,7 @@ #include "gtest/gtest.h" #include "stk_mesh/base/BulkData.hpp" #include "stk_mesh/base/MeshBuilder.hpp" +#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldBase.hpp" @@ -45,7 +46,6 @@ protected: bulk(*bulkPtr), meta(bulk.mesh_meta_data()) { - meta.use_simple_fields(); stk::topology topo(stk::topology::HEX_8); stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", topo); @@ -62,13 +62,12 @@ protected: } // set a coordinate field - auto& coordField = - meta.declare_field(stk::topology::NODE_RANK, "coordinates"); + using vector_field_type = stk::mesh::Field; + auto& coordField = meta.declare_field( + stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh(coordField, block_1, nullptr); stk::mesh::put_field_on_mesh( - coordField, block_1, meta.spatial_dimension(), nullptr); - stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), - nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), nullptr); meta.set_coordinate_field(&coordField); meta.commit(); diff --git a/unit_tests/matrix_free/UnitTestStkToTpetraMap.C b/unit_tests/matrix_free/UnitTestStkToTpetraMap.C index 97e389577..6eb601963 100644 --- a/unit_tests/matrix_free/UnitTestStkToTpetraMap.C +++ b/unit_tests/matrix_free/UnitTestStkToTpetraMap.C @@ -43,12 +43,12 @@ protected: bulk(*bulkPtr), meta(bulk.mesh_meta_data()), gid_field_h( - meta.declare_field::global_ordinal_type>( + meta.declare_field< + stk::mesh::Field::global_ordinal_type>>( stk::topology::NODE_RANK, "global_ids")) { - meta.use_simple_fields(); active = meta.locally_owned_part() | meta.globally_shared_part(); - stk::mesh::put_field_on_mesh(gid_field_h, active, nullptr); + stk::mesh::put_field_on_mesh(gid_field_h, active, 1, nullptr); stk::io::StkMeshIoBroker io(bulk.parallel()); const auto num_procs = std::to_string(bulk.parallel_size()); const auto name = "generated:1x1x" + num_procs; diff --git a/unit_tests/mesh_motion/UnitTestCompositeFrames.C b/unit_tests/mesh_motion/UnitTestCompositeFrames.C index 8ae4a35a3..e2950e4ad 100644 --- a/unit_tests/mesh_motion/UnitTestCompositeFrames.C +++ b/unit_tests/mesh_motion/UnitTestCompositeFrames.C @@ -158,13 +158,11 @@ TEST(meshMotion, NGP_initialize) // NOTE: This is done to allow computation of gold values later on // because mesh_transformation changes the field - coordinates int nDim = realm.meta_data().spatial_dimension(); - sierra::nalu::VectorFieldType* modelCoordsCopy = - &(realm.meta_data().declare_field( + VectorFieldType* modelCoordsCopy = + &(realm.meta_data().declare_field( stk::topology::NODE_RANK, "coordinates_copy")); stk::mesh::put_field_on_mesh( *modelCoordsCopy, realm.meta_data().universal_part(), nDim, nullptr); - stk::io::set_field_output_type( - *modelCoordsCopy, stk::io::FieldOutputType::VECTOR_3D); // create mesh const std::string meshSpec("generated:2x2x2"); @@ -172,9 +170,8 @@ TEST(meshMotion, NGP_initialize) realm.init_current_coordinates(); // copy coordinates to copy coordinates - sierra::nalu::VectorFieldType* modelCoords = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* modelCoords = realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // get the parts in the current motion frame stk::mesh::Selector sel = @@ -220,12 +217,15 @@ TEST(meshMotion, NGP_initialize) // get fields to be tested { // Scope limiting braces again... - auto oxyz = realm.fieldManager_->get_legacy_smart_field( - "coordinates_copy"); - auto xyz = realm.fieldManager_->get_legacy_smart_field( - "current_coordinates"); - auto vel = realm.fieldManager_->get_legacy_smart_field( - "mesh_velocity"); + auto oxyz = + realm.fieldManager_->get_legacy_smart_field( + "coordinates_copy"); + auto xyz = + realm.fieldManager_->get_legacy_smart_field( + "current_coordinates"); + auto vel = + realm.fieldManager_->get_legacy_smart_field( + "mesh_velocity"); for (auto b : bkts) { for (size_t in = 0; in < b->size(); in++) { @@ -271,13 +271,11 @@ TEST(meshMotion, NGP_execute) // NOTE: This is done to allow computation of gold values later on // because mesh_transformation changes the field - coordinates int nDim = realm.meta_data().spatial_dimension(); - sierra::nalu::VectorFieldType* modelCoordsCopy = - &(realm.meta_data().declare_field( + VectorFieldType* modelCoordsCopy = + &(realm.meta_data().declare_field( stk::topology::NODE_RANK, "coordinates_copy")); stk::mesh::put_field_on_mesh( *modelCoordsCopy, realm.meta_data().universal_part(), nDim, nullptr); - stk::io::set_field_output_type( - *modelCoordsCopy, stk::io::FieldOutputType::VECTOR_3D); // create mesh const std::string meshSpec("generated:2x2x2"); @@ -285,9 +283,8 @@ TEST(meshMotion, NGP_execute) realm.init_current_coordinates(); // copy coordinates to copy coordinates - sierra::nalu::VectorFieldType* modelCoords = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* modelCoords = realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // get the parts in the current motion frame stk::mesh::Selector sel = @@ -330,12 +327,10 @@ TEST(meshMotion, NGP_execute) meshMotionAlg->execute(currTime); // get fields to be tested - sierra::nalu::VectorFieldType* currCoords = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "current_coordinates"); - sierra::nalu::VectorFieldType* meshVelocity = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "mesh_velocity"); + VectorFieldType* currCoords = realm.meta_data().get_field( + stk::topology::NODE_RANK, "current_coordinates"); + VectorFieldType* meshVelocity = realm.meta_data().get_field( + stk::topology::NODE_RANK, "mesh_velocity"); // sync modified coordinates and velocity to host currCoords->sync_to_host(); diff --git a/unit_tests/mesh_motion/UnitTestComputeCentroid.C b/unit_tests/mesh_motion/UnitTestComputeCentroid.C index 4c96a473e..2f53f6774 100644 --- a/unit_tests/mesh_motion/UnitTestComputeCentroid.C +++ b/unit_tests/mesh_motion/UnitTestComputeCentroid.C @@ -108,13 +108,11 @@ TEST(meshMotion, NGP_compute_centroid) // NOTE: This is done to allow computation of gold values later on // because mesh_transformation changes the field - coordinates int nDim = realm.meta_data().spatial_dimension(); - sierra::nalu::VectorFieldType* modelCoordsGold = - &(realm.meta_data().declare_field( + VectorFieldType* modelCoordsGold = + &(realm.meta_data().declare_field( stk::topology::NODE_RANK, "coordinates_gold")); stk::mesh::put_field_on_mesh( *modelCoordsGold, realm.meta_data().universal_part(), nDim, nullptr); - stk::io::set_field_output_type( - *modelCoordsGold, stk::io::FieldOutputType::VECTOR_3D); // create mesh and get dimensions const std::string meshSpec("generated:5x9x11"); @@ -129,9 +127,8 @@ TEST(meshMotion, NGP_compute_centroid) realm.bulk_data().get_buckets(stk::topology::NODE_RANK, sel); // get model coordinate fields - sierra::nalu::VectorFieldType* modelCoords = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* modelCoords = realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // copy over coordinates for (auto b : bkts) { diff --git a/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C b/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C index d3e89a48a..448772a8e 100644 --- a/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C +++ b/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C @@ -19,12 +19,14 @@ TEST_F(MomentumKernelHex8Mesh, NGP_courant_reynolds) { - auto& elemCourant = - meta_->declare_field(stk::topology::ELEM_RANK, "element_courant"); - auto& elemReynolds = - meta_->declare_field(stk::topology::ELEM_RANK, "element_reynolds"); - stk::mesh::put_field_on_mesh(elemCourant, meta_->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(elemReynolds, meta_->universal_part(), nullptr); + auto& elemCourant = meta_->declare_field( + stk::topology::ELEM_RANK, "element_courant"); + auto& elemReynolds = meta_->declare_field( + stk::topology::ELEM_RANK, "element_reynolds"); + stk::mesh::put_field_on_mesh( + elemCourant, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + elemReynolds, meta_->universal_part(), 1, nullptr); fill_mesh_and_init_fields(); std::mt19937 rng; diff --git a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C index bfeaf94f1..a08d23dea 100644 --- a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C +++ b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C @@ -13,15 +13,14 @@ #include "stk_mesh/base/NgpField.hpp" #include "stk_mesh/base/FieldBase.hpp" #include "stk_mesh/base/Field.hpp" -#include "utils/StkHelpers.h" namespace unit_test_alg_utils { void linear_scalar_field( const stk::mesh::BulkData& bulk, - const stk::mesh::Field& coordinates, - stk::mesh::Field& field, + const VectorFieldType& coordinates, + ScalarFieldType& field, const double xCoeff, const double yCoeff, const double zCoeff) @@ -30,26 +29,35 @@ linear_scalar_field( stk::mesh::EntityVector nodes; bulk.get_entities(stk::topology::NODE_RANK, sel, nodes); + for (stk::mesh::Entity& node : nodes) { + double* fieldData = stk::mesh::field_data(field, node); + double* coordsData = stk::mesh::field_data(coordinates, node); + fieldData[0] = + coordsData[0] * xCoeff + coordsData[1] * yCoeff + coordsData[2] * zCoeff; + } + + field.modify_on_host(); +} - const unsigned fieldLength = sierra::nalu::max_extent(field, 0); - if (fieldLength == 1) { - for (stk::mesh::Entity& node : nodes) { - double* fieldData = stk::mesh::field_data(field, node); - double* coordsData = stk::mesh::field_data(coordinates, node); - fieldData[0] = coordsData[0] * xCoeff + coordsData[1] * yCoeff + - coordsData[2] * zCoeff; - } - } else if (fieldLength == 3) { - for (stk::mesh::Entity& node : nodes) { - double* fieldData = stk::mesh::field_data(field, node); - double* coordsData = stk::mesh::field_data(coordinates, node); - fieldData[0] = coordsData[0] * xCoeff; - fieldData[1] = coordsData[1] * yCoeff; - fieldData[2] = coordsData[2] * zCoeff; - } - } else { - ThrowErrorMsg( - "linear_scalar_field(): Field has unhandled length " << fieldLength); +void +linear_scalar_field( + const stk::mesh::BulkData& bulk, + const VectorFieldType& coordinates, + VectorFieldType& field, + const double xCoeff, + const double yCoeff, + const double zCoeff) +{ + const stk::mesh::Selector sel = bulk.mesh_meta_data().universal_part(); + + stk::mesh::EntityVector nodes; + bulk.get_entities(stk::topology::NODE_RANK, sel, nodes); + for (stk::mesh::Entity& node : nodes) { + double* fieldData = stk::mesh::field_data(field, node); + double* coordsData = stk::mesh::field_data(coordinates, node); + fieldData[0] = coordsData[0] * xCoeff; + fieldData[1] = coordsData[1] * yCoeff; + fieldData[2] = coordsData[2] * zCoeff; } field.modify_on_host(); diff --git a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h index 7eb4c9c7e..393b5af2d 100644 --- a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h +++ b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h @@ -16,15 +16,21 @@ #include "stk_mesh/base/BulkData.hpp" namespace unit_test_alg_utils { - void linear_scalar_field( const stk::mesh::BulkData&, - const stk::mesh::Field&, - stk::mesh::Field&, + const VectorFieldType&, + ScalarFieldType&, const double xCoeff = 1.0, const double yCoeff = 1.0, const double zCoeff = 1.0); +void linear_scalar_field( + const stk::mesh::BulkData&, + const VectorFieldType&, + VectorFieldType&, + const double xCoeff = 1.0, + const double yCoeff = 1.0, + const double zCoeff = 1.0); } // namespace unit_test_alg_utils #endif /* UNITTESTNGPALGUTILS_H */ diff --git a/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C b/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C index 939f4f44b..dae7fea19 100644 --- a/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C +++ b/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C @@ -42,8 +42,7 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_edge) // helperObjs.realm, partVec_[0], tke_, dkdx_); // edgeAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, tke_->name(), "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); algDriver.register_edge_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_); algDriver.execute(); @@ -95,8 +94,7 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_edge_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_); // edgeAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver( - helperObjs.realm, velocity_->name(), "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); algDriver.register_edge_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_); algDriver.execute(); @@ -145,8 +143,7 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_elem) // helperObjs.realm, partVec_[0], tke_, dkdx_); // elemAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, tke_->name(), "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_); algDriver.execute(); @@ -196,8 +193,7 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_elem_shifted) // helperObjs.realm, partVec_[0], tke_, dkdx_, useShifted); // elemAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, tke_->name(), "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -250,8 +246,7 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_elem_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_, useShifted); // elemAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver( - helperObjs.realm, velocity_->name(), "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_, useShifted); @@ -306,8 +301,7 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_elem_shifted_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_); // edgeAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver( - helperObjs.realm, velocity_->name(), "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_, useShifted); @@ -362,8 +356,7 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_bndry) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, tke_->name(), "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); algDriver.register_face_algorithm( sierra::nalu::WALL, surfPart, "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -414,8 +407,7 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_bndry_shifted) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, tke_->name(), "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); algDriver.register_face_algorithm( sierra::nalu::WALL, surfPart, "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -470,8 +462,7 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_bndry_elem_vec) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::TensorNodalGradAlgDriver algDriver( - helperObjs.realm, velocity_->name(), "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); algDriver.register_face_algorithm( sierra::nalu::WALL, surfPart, "nodal_grad", velocity_, dudx_, useShifted); algDriver.execute(); diff --git a/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C b/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C index 885b01c51..e9443e7f1 100644 --- a/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C +++ b/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C @@ -65,34 +65,33 @@ TEST_F(LowMachKernelHex8Mesh, NGP_nodal_grad_popen) const auto& bkts = bulk_->get_buckets(stk::topology::NODE_RANK, meta_->universal_part()); - std::function run_alg = - [&](bool zeroGrad, bool useShifted) { - stk::mesh::field_fill(0.0, *dpdx_); - helperObjs.realm.solutionOptions_->explicitlyZeroOpenPressureGradient_ = - zeroGrad; - sierra::nalu::ScalarNodalGradAlgDriver algDriver( - helperObjs.realm, pressure_->name(), "dpdx"); - algDriver - .register_face_elem_algorithm( - sierra::nalu::OPEN, surface1, stk::topology::HEX_8, - "nodal_grad_pressure_open_boundary", useShifted); - algDriver.execute(); - - stk::mesh::NgpField& ngpdpdx = - stk::mesh::get_updated_ngp_field(*dpdx_); - ngpdpdx.modify_on_device(); - ngpdpdx.sync_to_host(); - - for (const auto* b : bkts) { - for (const auto node : *b) { - const double* dp = stk::mesh::field_data(*dpdx_, node); - const double* C = stk::mesh::field_data(*coordinates_, node); - const double re[3] = {x + y * C[0], x + y * C[1], x + y * C[2]}; - for (int i = 0; i < 3; ++i) - EXPECT_NEAR(re[i], dp[i], tol); - } + std::function run_alg = [&]( + bool zeroGrad, bool useShifted) { + stk::mesh::field_fill(0.0, *dpdx_); + helperObjs.realm.solutionOptions_->explicitlyZeroOpenPressureGradient_ = + zeroGrad; + sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dpdx"); + algDriver + .register_face_elem_algorithm( + sierra::nalu::OPEN, surface1, stk::topology::HEX_8, + "nodal_grad_pressure_open_boundary", useShifted); + algDriver.execute(); + + stk::mesh::NgpField& ngpdpdx = + stk::mesh::get_updated_ngp_field(*dpdx_); + ngpdpdx.modify_on_device(); + ngpdpdx.sync_to_host(); + + for (const auto* b : bkts) { + for (const auto node : *b) { + const double* dp = stk::mesh::field_data(*dpdx_, node); + const double* C = stk::mesh::field_data(*coordinates_, node); + const double re[3] = {x + y * C[0], x + y * C[1], x + y * C[2]}; + for (int i = 0; i < 3; ++i) + EXPECT_NEAR(re[i], dp[i], tol); } - }; + } + }; run_alg(false, false); run_alg(true, false); run_alg(false, true); diff --git a/unit_tests/ngp_kernels/UnitTestNgpLoops.C b/unit_tests/ngp_kernels/UnitTestNgpLoops.C index d649cceb4..431f1ac1a 100644 --- a/unit_tests/ngp_kernels/UnitTestNgpLoops.C +++ b/unit_tests/ngp_kernels/UnitTestNgpLoops.C @@ -32,31 +32,29 @@ public: meshBuilder.set_spatial_dimension(3); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - meta->use_simple_fields(); - - density = &meta->declare_field(stk::topology::NODE_RANK, "density"); - pressure = - &meta->declare_field(stk::topology::NODE_RANK, "pressure"); - velocity = - &meta->declare_field(stk::topology::NODE_RANK, "velocity"); - mdotEdge = - &meta->declare_field(stk::topology::EDGE_RANK, "mass_flow_rate"); - massFlowRate = &meta->declare_field( + + density = &meta->declare_field( + stk::topology::NODE_RANK, "density"); + pressure = &meta->declare_field( + stk::topology::NODE_RANK, "pressure"); + velocity = &meta->declare_field( + stk::topology::NODE_RANK, "velocity"); + mdotEdge = &meta->declare_field( + stk::topology::EDGE_RANK, "mass_flow_rate"); + massFlowRate = &meta->declare_field( stk::topology::ELEM_RANK, "mass_flow_rate_scs"); const double ten = 10.0; const double zero = 0.0; const double oneVec[3] = {1.0, 1.0, 1.0}; sierra::nalu::HexSCS hex8SCS; - stk::mesh::put_field_on_mesh(*density, meta->universal_part(), &ten); - stk::mesh::put_field_on_mesh(*pressure, meta->universal_part(), &zero); + stk::mesh::put_field_on_mesh(*density, meta->universal_part(), 1, &ten); + stk::mesh::put_field_on_mesh(*pressure, meta->universal_part(), 1, &zero); stk::mesh::put_field_on_mesh(*velocity, meta->universal_part(), 3, oneVec); - stk::io::set_field_output_type( - *velocity, stk::io::FieldOutputType::VECTOR_3D); stk::mesh::put_field_on_mesh( *massFlowRate, meta->universal_part(), hex8SCS.num_integration_points(), &zero); - stk::mesh::put_field_on_mesh(*mdotEdge, meta->universal_part(), &zero); + stk::mesh::put_field_on_mesh(*mdotEdge, meta->universal_part(), 1, &zero); } ~NgpLoopTest() = default; @@ -67,25 +65,23 @@ public: unit_test_utils::fill_hex8_mesh(meshSpec, *bulk); partVec = {meta->get_part("block_1")}; - coordField = static_cast( - meta->coordinate_field()); + coordField = static_cast(meta->coordinate_field()); EXPECT_TRUE(coordField != nullptr); } stk::mesh::MetaData* meta; std::shared_ptr bulk; stk::mesh::PartVector partVec; - const sierra::nalu::VectorFieldType* coordField{nullptr}; - sierra::nalu::ScalarFieldType* density{nullptr}; - sierra::nalu::ScalarFieldType* pressure{nullptr}; - sierra::nalu::VectorFieldType* velocity{nullptr}; - sierra::nalu::ScalarFieldType* mdotEdge{nullptr}; - sierra::nalu::GenericFieldType* massFlowRate{nullptr}; + const VectorFieldType* coordField{nullptr}; + ScalarFieldType* density{nullptr}; + ScalarFieldType* pressure{nullptr}; + VectorFieldType* velocity{nullptr}; + ScalarFieldType* mdotEdge{nullptr}; + GenericFieldType* massFlowRate{nullptr}; }; void -basic_node_loop( - const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) +basic_node_loop(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; const double presSet = 4.0; @@ -119,8 +115,7 @@ basic_node_loop( } void -basic_node_reduce( - const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) +basic_node_reduce(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; const double presSet = 4.0; @@ -275,9 +270,7 @@ basic_node_reduce_minmaxsum( void basic_node_reduce_array( - const stk::mesh::BulkData& bulk, - sierra::nalu::ScalarFieldType& pressure, - int num_nodes) + const stk::mesh::BulkData& bulk, ScalarFieldType& pressure, int num_nodes) { using MeshIndex = sierra::nalu::nalu_ngp::NGPMeshTraits::MeshIndex; @@ -311,8 +304,8 @@ basic_node_reduce_array( void basic_elem_loop( const stk::mesh::BulkData& bulk, - sierra::nalu::ScalarFieldType& pressure, - sierra::nalu::GenericFieldType& massFlowRate) + ScalarFieldType& pressure, + GenericFieldType& massFlowRate) { const double flowRate = 4.0; const double presSet = 10.0; @@ -365,8 +358,8 @@ basic_elem_loop( void basic_edge_loop( const stk::mesh::BulkData& bulk, - sierra::nalu::ScalarFieldType& pressure, - sierra::nalu::ScalarFieldType& mdotEdge) + ScalarFieldType& pressure, + ScalarFieldType& mdotEdge) { const double flowRate = 4.0; const double presSet = 10.0; @@ -419,8 +412,8 @@ basic_edge_loop( void elem_loop_scratch_views( const stk::mesh::BulkData& bulk, - sierra::nalu::ScalarFieldType& pressure, - sierra::nalu::VectorFieldType& velocity) + ScalarFieldType& pressure, + VectorFieldType& velocity) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Hex8Traits = sierra::nalu::AlgTraitsHex8; @@ -523,9 +516,9 @@ elem_loop_scratch_views( void calc_mdot_elem_loop( const stk::mesh::BulkData& bulk, - sierra::nalu::ScalarFieldType& density, - sierra::nalu::VectorFieldType& velocity, - sierra::nalu::GenericFieldType& massFlowRate) + ScalarFieldType& density, + VectorFieldType& velocity, + GenericFieldType& massFlowRate) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Hex8Traits = sierra::nalu::AlgTraitsHex8; @@ -610,10 +603,10 @@ calc_mdot_elem_loop( void basic_face_elem_loop( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordField, - const sierra::nalu::GenericFieldType& exposedArea, - sierra::nalu::ScalarFieldType& wallArea, - sierra::nalu::ScalarFieldType& wallNormDist) + const VectorFieldType& coordField, + const GenericFieldType& exposedArea, + ScalarFieldType& wallArea, + ScalarFieldType& wallNormDist) { using MeshIndex = sierra::nalu::nalu_ngp::NGPMeshTraits::MeshIndex; @@ -723,8 +716,7 @@ basic_face_elem_loop( } void -elem_loop_par_reduce( - const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) +elem_loop_par_reduce(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) { using Hex8Traits = sierra::nalu::AlgTraitsHex8; using ElemSimdData = sierra::nalu::nalu_ngp::ElemSimdData; @@ -785,8 +777,8 @@ elem_loop_par_reduce( void basic_face_elem_reduce( const stk::mesh::BulkData& bulk, - const sierra::nalu::VectorFieldType& coordField, - const sierra::nalu::GenericFieldType& exposedArea) + const VectorFieldType& coordField, + const GenericFieldType& exposedArea) { using FaceTraits = sierra::nalu::AlgTraitsQuad4Hex8; using FaceSimdData = @@ -937,19 +929,20 @@ TEST_F(NgpLoopTest, NGP_basic_face_elem_loop) if (bulk->parallel_size() > 1) return; - auto& exposedAreaVec = - meta->declare_field(meta->side_rank(), "exposed_area_vector"); + auto& exposedAreaVec = meta->declare_field( + meta->side_rank(), "exposed_area_vector"); auto& wallArea = - meta->declare_field(stk::topology::NODE_RANK, "wall_area"); - auto& wallNormDist = - meta->declare_field(stk::topology::NODE_RANK, "wall_normal_dist"); + meta->declare_field(stk::topology::NODE_RANK, "wall_area"); + auto& wallNormDist = meta->declare_field( + stk::topology::NODE_RANK, "wall_normal_dist"); stk::mesh::put_field_on_mesh( exposedAreaVec, meta->universal_part(), meta->spatial_dimension() * sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); - stk::mesh::put_field_on_mesh(wallArea, meta->universal_part(), nullptr); - stk::mesh::put_field_on_mesh(wallNormDist, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(wallArea, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh( + wallNormDist, meta->universal_part(), 1, nullptr); fill_mesh_and_init_fields("generated:4x4x1|sideset:xXyYzZ"); unit_test_kernel_utils::calc_exposed_area_vec( @@ -964,8 +957,8 @@ TEST_F(NgpLoopTest, NGP_basic_face_elem_reduce) if (bulk->parallel_size() > 1) return; - auto& exposedAreaVec = - meta->declare_field(meta->side_rank(), "exposed_area_vector"); + auto& exposedAreaVec = meta->declare_field( + meta->side_rank(), "exposed_area_vector"); stk::mesh::put_field_on_mesh( exposedAreaVec, meta->universal_part(), meta->spatial_dimension() * sierra::nalu::AlgTraitsQuad4::numScsIp_, diff --git a/unit_tests/utils/UnitTestComputeVectorDivergence.C b/unit_tests/utils/UnitTestComputeVectorDivergence.C index c1e50dce6..4836f09d6 100644 --- a/unit_tests/utils/UnitTestComputeVectorDivergence.C +++ b/unit_tests/utils/UnitTestComputeVectorDivergence.C @@ -41,46 +41,40 @@ TEST(utils, compute_vector_divergence) // declare relevant fields int nDim = realm.meta_data().spatial_dimension(); - sierra::nalu::ScalarFieldType* duaNdlVol = - &(realm.meta_data().declare_field( + ScalarFieldType* duaNdlVol = + &(realm.meta_data().declare_field( stk::topology::NODE_RANK, "dual_nodal_volume")); stk::mesh::put_field_on_mesh( *duaNdlVol, realm.meta_data().universal_part(), nullptr); - sierra::nalu::ScalarFieldType& elemVol = - realm.meta_data().declare_field( - stk::topology::ELEMENT_RANK, "element_volume"); + ScalarFieldType& elemVol = realm.meta_data().declare_field( + stk::topology::ELEMENT_RANK, "element_volume"); stk::mesh::put_field_on_mesh( elemVol, realm.meta_data().universal_part(), nullptr); - auto& edgeAreaVec = realm.meta_data().declare_field( + auto& edgeAreaVec = realm.meta_data().declare_field( stk::topology::EDGE_RANK, "edge_area_vector"); stk::mesh::put_field_on_mesh( edgeAreaVec, realm.meta_data().universal_part(), nDim, nullptr); - stk::io::set_field_output_type( - edgeAreaVec, stk::io::FieldOutputType::VECTOR_3D); - sierra::nalu::VectorFieldType* meshVec = - &(realm.meta_data().declare_field( - stk::topology::NODE_RANK, "mesh_vector")); + VectorFieldType* meshVec = &(realm.meta_data().declare_field( + stk::topology::NODE_RANK, "mesh_vector")); stk::mesh::put_field_on_mesh( *meshVec, realm.meta_data().universal_part(), nDim, nullptr); - stk::io::set_field_output_type(*meshVec, stk::io::FieldOutputType::VECTOR_3D); const sierra::nalu::MasterElement* meFC = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::QUAD_4); const int numScsIp = meFC->num_integration_points(); - sierra::nalu::GenericFieldType* exposedAreaVec = - &(realm.meta_data().declare_field( + GenericFieldType* exposedAreaVec = + &(realm.meta_data().declare_field( realm.meta_data().side_rank(), "exposed_area_vector")); stk::mesh::put_field_on_mesh( *exposedAreaVec, realm.meta_data().universal_part(), nDim * numScsIp, nullptr); - sierra::nalu::ScalarFieldType* divV = - &(realm.meta_data().declare_field( - stk::topology::NODE_RANK, "div_mesh_vector")); + ScalarFieldType* divV = &(realm.meta_data().declare_field( + stk::topology::NODE_RANK, "div_mesh_vector")); stk::mesh::put_field_on_mesh( *divV, realm.meta_data().universal_part(), nullptr); @@ -97,9 +91,8 @@ TEST(utils, compute_vector_divergence) geomAlgDriver.execute(); // get coordinate field - sierra::nalu::VectorFieldType* modelCoords = - realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + VectorFieldType* modelCoords = realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // get the universal part stk::mesh::Selector sel = diff --git a/wind-utils b/wind-utils index fc9710c41..a055d9438 160000 --- a/wind-utils +++ b/wind-utils @@ -1 +1 @@ -Subproject commit fc9710c419111f5476d50586fd1a8e12db52b713 +Subproject commit a055d9438f1348f8bdeb5d320343c83c469de220