From 5015a1ce2918f3f2cae6bdc35c8813114f34f862 Mon Sep 17 00:00:00 2001 From: djglaze <44038705+djglaze@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:22:20 -0700 Subject: [PATCH] Converted to the new STK simple_fields workflow STK is migrating to a new strategy for registering and managing Fields, where sizing information is purely specified at run-time instead of the previous technique of specifying it in a confusing blend of both compile-time and run-time information. The compile-time specification was just a suggestion, as it could be overridden (possibly inconsistently) at run-time to support variable-length Fields. This made it unclear what the true size of a Field was and where it should be specified. As an example, registering a vector field on the entire mesh previously looked like this: using VectorField = stk::mesh::Field; VectorField & field = meta.declare_field(stk::topology::NODE_RANK, "velocity"); stk::mesh::put_field_on_mesh(field, meta.universal_part(), 3, nullptr); and now, it looks like this: using VectorField = stk::mesh::Field; VectorField & field = meta.declare_field(stk::topology::NODE_RANK, "velocity"); stk::mesh::put_field_on_mesh(field, meta.universal_part(), 3, nullptr); stk::io::set_field_output_type(field, stk::io::FieldOutputType::VECTOR_3D); // Optional The only template parameter for a Field is now the datatype parameter. Sizing information now exclusively comes from put_field_on_mesh() calls. The optional set_field_output_type() function call registers with the IO sub-system how a multi-component Field should be subscripted in Exodus files. If this call is left off, you will get the default [_1, _2, _3] subscripting. With the above call, you will instead get [_x, _y, _z] subscripting. The MetaData::use_simple_fields() flag is set everywhere possible in the code to prevent accidental regressions before the old behavior is formally deprecated and removed. This will yield a run-time error if the old-style extra template parameters are used anywhere. These calls to use_simple_fields() can be removed in the future once the STK Mesh back-end has removed support for the old behavior. This wasn't a completely straightforward conversion due to nalu-wind making heavy use of various algorithm selections based on the templated Field type. The ScalarFieldType, VectorFieldType, TensorFieldType, and GenericFieldType types are now all identical, so different techniques had to be used to switch behaviors. --- docs/source/theory/codeAbstractions.rst | 43 +- include/FieldDefinitions.h | 62 +- include/FieldManager.h | 22 +- include/FieldTypeDef.h | 44 +- include/MatrixFreeHeatCondEquationSystem.h | 1 - .../ProjectedNodalGradientEquationSystem.h | 1 - include/SmartField.h | 5 +- .../actuator/ActuatorGenericSearchFunctor.h | 41 +- include/aero/fsi/FSIturbine.h | 11 +- include/element_promotion/PromoteElement.h | 3 +- .../element_promotion/PromoteElementImpl.h | 3 +- include/element_promotion/PromotedElementIO.h | 7 +- include/mesh_motion/FrameBase.h | 1 - include/ngp_algorithms/NodalGradAlgDriver.h | 3 +- .../ngp_algorithms/NodalGradBndryElemAlg.h | 50 +- include/ngp_algorithms/NodalGradEdgeAlg.h | 9 - include/ngp_algorithms/NodalGradElemAlg.h | 52 +- include/ngp_algorithms/ViewHelper.h | 21 +- include/ngp_utils/NgpFieldBLAS.h | 8 +- include/overset/TiogaBlock.h | 6 +- include/overset/TiogaSTKIface.h | 1 - include/utils/StkHelpers.h | 5 + include/xfer/FromMesh.h | 2 +- include/xfer/LocalVolumeSearch.h | 9 +- include/xfer/ToMesh.h | 2 +- src/AMSAlgDriver.C | 40 +- ...bleContinuityNonConformalSolverAlgorithm.C | 24 +- src/AssembleMomentumEdgeABLTopBC.C | 11 +- ...eMomentumEdgeWallFunctionSolverAlgorithm.C | 20 +- ...embleMomentumNonConformalSolverAlgorithm.C | 10 +- src/AssembleNodalGradNonConformalAlgorithm.C | 8 +- src/AssembleNodalGradUNonConformalAlgorithm.C | 8 +- src/AssemblePNGBoundarySolverAlgorithm.C | 8 +- src/AssemblePNGElemSolverAlgorithm.C | 9 +- src/AssemblePNGNonConformalSolverAlgorithm.C | 13 +- src/AssembleScalarEigenEdgeSolverAlgorithm.C | 31 +- ...ssembleScalarNonConformalSolverAlgorithm.C | 10 +- src/AssembleWallDistNonConformalAlgorithm.C | 4 +- src/AssembleWallHeatTransferAlgorithmDriver.C | 16 +- src/AuxFunctionAlgorithm.C | 2 +- src/ChienKEpsilonEquationSystem.C | 26 +- src/ComputeHeatTransferEdgeWallAlgorithm.C | 34 +- src/ComputeMdotNonConformalAlgorithm.C | 28 +- src/ComputeSSTMaxLengthScaleElemAlgorithm.C | 4 +- src/ComputeWallFrictionVelocityAlgorithm.C | 30 +- ...ontinuityLowSpeedCompressibleNodeSuppAlg.C | 9 +- src/DataProbePostProcessing.C | 26 +- src/EnthalpyEquationSystem.C | 89 +- src/EnthalpyLowSpeedCompressibleNodeSuppAlg.C | 10 +- src/EnthalpyPmrSrcNodeSuppAlg.C | 6 +- src/EnthalpyPressureWorkNodeSuppAlg.C | 10 +- src/EnthalpyViscousWorkNodeSuppAlg.C | 10 +- src/EquationSystems.C | 4 +- src/FieldManager.C | 17 +- src/FieldRegistry.C | 30 +- src/FixPressureAtNodeAlgorithm.C | 5 +- src/GammaEquationSystem.C | 26 +- src/InputOutputRealm.C | 14 +- src/LowMachEquationSystem.C | 259 ++--- src/MatrixFreeHeatCondEquationSystem.C | 37 +- src/MatrixFreeLowMachEquationSystem.C | 42 +- src/MomentumBoussinesqRASrcNodeSuppAlg.C | 10 +- src/MomentumBuoyancySrcNodeSuppAlg.C | 6 +- src/NonConformalInfo.C | 8 +- src/NonConformalManager.C | 2 +- src/PeriodicManager.C | 4 +- src/ProjectedNodalGradientEquationSystem.C | 11 +- src/Realm.C | 93 +- src/ShearStressTransportEquationSystem.C | 40 +- src/SideWriter.C | 7 +- src/SmartField.C | 14 +- src/SolutionNormPostProcessing.C | 4 +- src/SolverAlgorithm.C | 2 +- src/SpecificDissipationRateEquationSystem.C | 36 +- src/SurfaceForceAndMomentAlgorithm.C | 38 +- src/SurfaceForceAndMomentAlgorithmDriver.C | 40 +- ...rfaceForceAndMomentWallFunctionAlgorithm.C | 41 +- src/TotalDissipationRateEquationSystem.C | 36 +- src/TpetraLinearSystem.C | 2 +- src/TpetraSegregatedLinearSystem.C | 2 +- src/TurbKineticEnergyEquationSystem.C | 40 +- src/TurbViscSmagorinskyAlgorithm.C | 12 +- src/TurbViscWaleAlgorithm.C | 12 +- src/TurbulenceAveragingPostProcessing.C | 31 +- src/VolumeOfFluidEquationSystem.C | 27 +- src/WallDistEquationSystem.C | 32 +- src/WilcoxKOmegaEquationSystem.C | 24 +- src/aero/AeroContainer.C | 11 +- src/aero/actuator/ActuatorBulk.C | 12 +- src/aero/actuator/ActuatorFunctors.C | 4 +- src/aero/actuator/ActuatorFunctorsSimple.C | 4 +- src/aero/actuator/ActuatorSearch.C | 4 +- src/aero/fsi/CalcLoads.C | 23 +- src/aero/fsi/FSIturbine.C | 114 +-- src/aero/fsi/OpenfastFSI.C | 18 +- src/edge_kernels/MomentumEdgePecletAlg.C | 12 +- src/gcl/MeshVelocityAlg.C | 1 - src/gcl/MeshVelocityEdgeAlg.C | 1 - src/mesh_motion/FrameBase.C | 2 +- src/mesh_motion/FrameMoving.C | 18 +- src/mesh_motion/FrameReference.C | 2 +- .../MotionDeformingInteriorKernel.C | 4 +- src/mesh_motion/MotionScalingKernel.C | 2 +- src/mesh_motion/MotionWavesKernel.C | 4 +- src/mesh_motion/TurbineSurrogateKernel.C | 4 +- src/ngp_algorithms/CourantReAlg.C | 1 - src/ngp_algorithms/FieldUpdateAlgDriver.C | 2 +- src/ngp_algorithms/GeometryAlgDriver.C | 14 +- src/ngp_algorithms/GeometryBoundaryAlg.C | 1 - src/ngp_algorithms/GeometryInteriorAlg.C | 1 - src/ngp_algorithms/MdotAlgDriver.C | 2 +- src/ngp_algorithms/MdotDensityAccumAlg.C | 6 +- src/ngp_algorithms/MetricTensorElemAlg.C | 1 - src/ngp_algorithms/NodalGradAlgDriver.C | 19 +- src/ngp_algorithms/NodalGradBndryElemAlg.C | 76 +- src/ngp_algorithms/NodalGradEdgeAlg.C | 29 +- src/ngp_algorithms/NodalGradElemAlg.C | 70 +- src/ngp_algorithms/SSTMaxLengthScaleAlg.C | 1 - src/ngp_algorithms/SSTMaxLengthScaleDriver.C | 4 +- src/node_kernels/ContinuityGclNodeKernel.C | 2 +- .../ContinuityMassBDFNodeKernel.C | 2 +- .../MomentumBodyForceBoxNodeKernel.C | 2 +- src/node_kernels/MomentumGclNodeKernel.C | 6 +- src/node_kernels/MomentumMassBDFNodeKernel.C | 2 +- src/node_kernels/ScalarGclNodeKernel.C | 2 +- .../AssembleOversetPressureAlgorithm.C | 3 +- src/overset/OversetConstraintBase.C | 2 +- src/overset/TiogaBlock.C | 58 +- src/overset/TiogaSTKIface.C | 34 +- .../EnthalpyPropertyEvaluator.C | 8 +- .../IdealGasPropertyEvaluator.C | 11 +- .../InverseDualVolumePropAlgorithm.C | 4 +- .../SpecificHeatPropertyEvaluator.C | 8 +- .../SutherlandsPropertyEvaluator.C | 4 +- .../TemperaturePropAlgorithm.C | 2 +- .../BoussinesqNonIsoEnthalpySrcNodeSuppAlg.C | 6 +- .../BoussinesqNonIsoMomentumSrcNodeSuppAlg.C | 6 +- ...SteadyTaylorVortexMomentumSrcNodeSuppAlg.C | 6 +- .../VariableDensityContinuitySrcNodeSuppAlg.C | 6 +- .../VariableDensityMixFracSrcNodeSuppAlg.C | 6 +- .../VariableDensityMomentumSrcNodeSuppAlg.C | 6 +- ...bleDensityNonIsoContinuitySrcNodeSuppAlg.C | 6 +- ...iableDensityNonIsoEnthalpySrcNodeSuppAlg.C | 6 +- ...iableDensityNonIsoMomentumSrcNodeSuppAlg.C | 6 +- src/utils/ComputeVectorDivergence.C | 8 +- src/utils/FieldHelpers.C | 6 +- src/utils/StkHelpers.C | 28 + src/wind_energy/BdyHeightAlgorithm.C | 2 +- src/wind_energy/BdyLayerStatistics.C | 2 +- src/wind_energy/SyntheticLidar.C | 24 +- src/xfer/LocalVolumeSearch.C | 10 +- unit_tests/UnitTest1ElemCoordCheck.C | 6 +- unit_tests/UnitTestEigenDecomposition.C | 1 - unit_tests/UnitTestElemSuppAlg.C | 15 +- unit_tests/UnitTestFieldManager.C | 15 +- unit_tests/UnitTestFieldRegistry.C | 9 +- unit_tests/UnitTestFieldUtils.C | 2 +- unit_tests/UnitTestFieldUtils.h | 2 +- unit_tests/UnitTestHexElementPromotion.C | 27 +- unit_tests/UnitTestHexMasterElements.C | 1 + unit_tests/UnitTestHexSCVDeterminant.C | 9 +- unit_tests/UnitTestKokkosME.h | 7 +- unit_tests/UnitTestKokkosMEBC.h | 7 +- unit_tests/UnitTestKokkosViews.C | 43 +- unit_tests/UnitTestLidarLOS.C | 10 +- unit_tests/UnitTestMasterElements.C | 4 +- unit_tests/UnitTestMetricTensor.C | 5 +- unit_tests/UnitTestMijTensor.C | 5 +- unit_tests/UnitTestMovingAverage.C | 12 +- unit_tests/UnitTestNgpMesh1.C | 14 +- unit_tests/UnitTestRealm.C | 7 +- unit_tests/UnitTestSideIsInElement.C | 4 +- unit_tests/UnitTestSidePCoords.C | 4 +- unit_tests/UnitTestSideWriter.C | 16 +- unit_tests/UnitTestSingleHexPromotion.C | 14 +- unit_tests/UnitTestSmartField.C | 4 +- unit_tests/UnitTestSpinnerLidarPattern.C | 8 +- unit_tests/UnitTestSuppAlgDataSharing.C | 38 +- unit_tests/UnitTestUtils.C | 47 +- unit_tests/UnitTestUtils.h | 301 +++--- .../actuator/UnitTestActuatorFunctors.C | 30 +- unit_tests/actuator/UnitTestActuatorSearch.C | 8 +- unit_tests/aero/UnitTestFSIturbine.C | 10 +- unit_tests/algorithms/UnitTestAlgorithm.C | 32 +- unit_tests/algorithms/UnitTestAlgorithm.h | 43 +- ...UnitTestMomentumBoussinesqSrcNodeSuppAlg.C | 31 +- .../edge_kernels/UnitTestScalarAdvDiffEdge.C | 6 +- unit_tests/gcl/UnitTestGCL.h | 82 +- unit_tests/gcl/UnitTestMeshVelocityAlg.C | 81 +- unit_tests/kernels/UnitTestFaceBasic.C | 4 +- unit_tests/kernels/UnitTestKernelUtils.C | 128 +-- unit_tests/kernels/UnitTestKernelUtils.h | 922 +++++++++--------- unit_tests/matrix_free/StkConductionFixture.C | 62 +- unit_tests/matrix_free/StkConductionFixture.h | 7 +- unit_tests/matrix_free/StkGradientFixture.C | 30 +- unit_tests/matrix_free/StkGradientFixture.h | 6 +- unit_tests/matrix_free/StkLowMachFixture.C | 53 +- unit_tests/matrix_free/StkLowMachFixture.h | 14 +- .../matrix_free/UnitTestConductionFields.C | 23 +- .../UnitTestConductionGatheredFieldManager.C | 3 +- .../UnitTestConductionSolutionUpdate.C | 8 +- .../matrix_free/UnitTestConductionUpdate.C | 1 - .../matrix_free/UnitTestContinuityOperator.C | 1 - .../UnitTestContinuitySolutionUpdate.C | 2 - .../matrix_free/UnitTestGreenGaussGradient.C | 1 - .../UnitTestGreenGaussGradientOperator.C | 1 - .../UnitTestLowMachGatheredFieldManager.C | 3 +- .../matrix_free/UnitTestMatrixFreeSolver.C | 1 - .../UnitTestMomentumJacobiOperator.C | 1 - .../matrix_free/UnitTestMomentumOperator.C | 1 - .../UnitTestMomentumSolutionUpdate.C | 2 - .../UnitTestStkSimdConnectivityMap.C | 17 +- .../UnitTestStkSimdFaceConnectivityMap.C | 13 +- .../UnitTestStkSimdGatheredElementData.C | 16 +- .../UnitTestStkSimdNodeConnectivityMap.C | 13 +- .../matrix_free/UnitTestStkToTpetraMap.C | 6 +- .../mesh_motion/UnitTestCompositeFrames.C | 47 +- .../mesh_motion/UnitTestComputeCentroid.C | 11 +- unit_tests/ngp_algorithms/UnitTestCFLReAlg.C | 14 +- .../ngp_algorithms/UnitTestNgpAlgUtils.C | 52 +- .../ngp_algorithms/UnitTestNgpAlgUtils.h | 12 +- .../ngp_algorithms/UnitTestNodalGradAlg.C | 27 +- .../UnitTestNodalGradPOpenBoundary.C | 53 +- unit_tests/ngp_kernels/UnitTestNgpLoops.C | 105 +- .../utils/UnitTestComputeVectorDivergence.C | 33 +- wind-utils | 2 +- 226 files changed, 2683 insertions(+), 2639 deletions(-) diff --git a/docs/source/theory/codeAbstractions.rst b/docs/source/theory/codeAbstractions.rst index 3c75e8a9b..aa69da022 100644 --- a/docs/source/theory/codeAbstractions.rst +++ b/docs/source/theory/codeAbstractions.rst @@ -259,12 +259,11 @@ 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(*density_, *part); + stk::mesh::put_field_on_mesh(*density_, *part, nullptr); } :math:`\bullet` edge field registration: @@ -277,9 +276,11 @@ 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(*edgeAreaVec_, *part, nDim); + = &(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); } :math:`\bullet` side/face field registration: @@ -297,9 +298,10 @@ 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(*wallFrictionVelocityBip, *part, numIp); + stk::mesh::put_field_on_mesh(*wallFrictionVelocityBip, *part, numIp, + nullptr); } } @@ -317,23 +319,21 @@ 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,8 +346,7 @@ 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 45f2e1f1e..aba827f36 100644 --- a/include/FieldDefinitions.h +++ b/include/FieldDefinitions.h @@ -15,30 +15,33 @@ namespace sierra { namespace nalu { -template +enum class FieldLayout { SCALAR, VECTOR, TENSOR, ARRAY }; + +template struct FieldDefinition { - using FieldType = T; + using DataType = 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, @@ -61,29 +64,22 @@ using FieldDefTypes = std::conditional< FieldDefScalarInt, FieldDefHypreId>>::type; +// Trouble! using FieldPointerTypes = std::conditional< - std::is_same_v, + std::is_same_v, std::variant< - ScalarFieldType*, - VectorFieldType*, - TensorFieldType*, - GenericFieldType*, - GenericIntFieldType*, - TpetIDFieldType*, - LocalIdFieldType*, - GlobalIdFieldType*, - ScalarIntFieldType*>, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*>, std::variant< - ScalarFieldType*, - VectorFieldType*, - TensorFieldType*, - GenericFieldType*, - GenericIntFieldType*, - TpetIDFieldType*, - LocalIdFieldType*, - GlobalIdFieldType*, - ScalarIntFieldType*, - HypreIDFieldType*>>::type; + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*>>::type; } // namespace nalu } // namespace sierra diff --git a/include/FieldManager.h b/include/FieldManager.h index d8727524e..e612ec099 100644 --- a/include/FieldManager.h +++ b/include/FieldManager.h @@ -57,7 +57,7 @@ class FieldManager /// ScalarFieldType* and so on. /// template - T* register_field( + stk::mesh::Field* 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 - T* get_field_ptr( + stk::mesh::Field* get_field_ptr( const std::string& name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { @@ -102,12 +102,10 @@ 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 @@ -139,9 +137,7 @@ 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); @@ -154,16 +150,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 get_legacy_smart_field( + SmartField, tags::LEGACY, ACCESS> 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 9b436ae11..f13818fb1 100644 --- a/include/FieldTypeDef.h +++ b/include/FieldTypeDef.h @@ -11,7 +11,6 @@ #define FieldTypeDef_h #include -#include #include #include @@ -27,43 +26,38 @@ namespace sierra { namespace nalu { -// 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 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 vector field typedef; however, what is the value of Cartesian? -typedef stk::mesh::Field VectorFieldType; -typedef stk::mesh::Field TensorFieldType; +using VectorFieldType = stk::mesh::Field; +using TensorFieldType = stk::mesh::Field; -// define generic -typedef stk::mesh::Field GenericFieldType; +using GenericFieldType = stk::mesh::Field; -typedef stk::mesh::Field GenericIntFieldType; +using GenericIntFieldType = stk::mesh::Field; -// field type for local ids -typedef unsigned LocalId; -typedef stk::mesh::Field LocalIdFieldType; +using LocalId = unsigned; +using LocalIdFieldType = stk::mesh::Field; -// Hypre Integer types #ifdef NALU_USES_HYPRE -typedef HYPRE_Int HypreIntType; +using HypreIntType = HYPRE_Int; #else -typedef int HypreIntType; +using HypreIntType = int; #endif #ifdef NALU_USES_TRILINOS_SOLVERS -typedef stk::mesh::Field - TpetIDFieldType; +using TpetIdType = Tpetra::Details::DefaultTypes::global_ordinal_type; #else -typedef stk::mesh::Field TpetIDFieldType; +using TpetIdType = int64_t; #endif -typedef stk::mesh::Field HypreIDFieldType; -typedef stk::mesh::NgpField NGPHypreIDFieldType; +using TpetIDFieldType = stk::mesh::Field; +using HypreIDFieldType = stk::mesh::Field; +using NGPHypreIDFieldType = stk::mesh::NgpField; } // namespace nalu } // namespace sierra diff --git a/include/MatrixFreeHeatCondEquationSystem.h b/include/MatrixFreeHeatCondEquationSystem.h index d92fdcd21..1df84b120 100644 --- a/include/MatrixFreeHeatCondEquationSystem.h +++ b/include/MatrixFreeHeatCondEquationSystem.h @@ -16,7 +16,6 @@ #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 e728b7001..1748c6729 100644 --- a/include/ProjectedNodalGradientEquationSystem.h +++ b/include/ProjectedNodalGradientEquationSystem.h @@ -16,7 +16,6 @@ #include #include -#include namespace stk { struct topology; diff --git a/include/SmartField.h b/include/SmartField.h index a21252c37..937d9ea62 100644 --- a/include/SmartField.h +++ b/include/SmartField.h @@ -401,9 +401,10 @@ struct MakeSmartField { // use pointer since that is the common access type for stk::mesh::Field template - SmartField operator()(T* field) + SmartField, LEGACY, ACCESS> + operator()(stk::mesh::Field* field) { - return SmartField(*field); + return SmartField, LEGACY, ACCESS>(*field); } }; diff --git a/include/aero/actuator/ActuatorGenericSearchFunctor.h b/include/aero/actuator/ActuatorGenericSearchFunctor.h index dd68cace8..c1941d606 100644 --- a/include/aero/actuator/ActuatorGenericSearchFunctor.h +++ b/include/aero/actuator/ActuatorGenericSearchFunctor.h @@ -35,15 +35,12 @@ 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(); @@ -58,15 +55,12 @@ 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(); @@ -101,7 +95,7 @@ struct GenericLoopOverCoarseSearchResults for (unsigned i = 0; i < numNodes; i++) { const double* coords = - (double*)stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); + stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); for (int j = 0; j < 3; j++) { elemCoords(i, j) = coords[j]; } @@ -114,12 +108,9 @@ 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 = - (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); + 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); // 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 c4b0feaa4..473ace420 100644 --- a/include/aero/fsi/FSIturbine.h +++ b/include/aero/fsi/FSIturbine.h @@ -16,7 +16,6 @@ #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 @@ -53,10 +52,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); @@ -67,12 +66,10 @@ 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 5a92bd0ce..2f3b8faa1 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,7 +30,6 @@ 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 cb75d55ac..496095ced 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,7 +60,6 @@ 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 3d802ac31..d0aad823c 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,11 +39,6 @@ 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 8b43b5e6b..fb785bb47 100644 --- a/include/mesh_motion/FrameBase.h +++ b/include/mesh_motion/FrameBase.h @@ -4,7 +4,6 @@ #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 6d0d52028..e29d409a6 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&); + NodalGradAlgDriver(Realm&, const std::string&, const std::string&); virtual ~NodalGradAlgDriver() = default; @@ -38,6 +38,7 @@ 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 d696a89c4..eb5bcb14d 100644 --- a/include/ngp_algorithms/NodalGradBndryElemAlg.h +++ b/include/ngp_algorithms/NodalGradBndryElemAlg.h @@ -13,7 +13,8 @@ #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 { @@ -21,21 +22,17 @@ namespace nalu { class MasterElement; -template +using NodalGradBndryElemSimdDataType = + sierra::nalu::nalu_ngp::ElemSimdData; + +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> 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*, @@ -54,25 +51,34 @@ 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; +using ScalarNodalGradBndryElemAlg = NodalGradBndryElemAlg< + AlgTraits, + ScalarFieldType, + VectorFieldType, + nalu_ngp::ScalarViewHelper>; template -using VectorNodalGradBndryElemAlg = - NodalGradBndryElemAlg; +using VectorNodalGradBndryElemAlg = NodalGradBndryElemAlg< + AlgTraits, + VectorFieldType, + GenericFieldType, + nalu_ngp::VectorViewHelper>; + template -using TensorNodalGradBndryElemAlg = - NodalGradBndryElemAlg; +using TensorNodalGradBndryElemAlg = NodalGradBndryElemAlg< + AlgTraits, + VectorFieldType, + TensorFieldType, + nalu_ngp::VectorViewHelper>; } // namespace nalu } // namespace sierra diff --git a/include/ngp_algorithms/NodalGradEdgeAlg.h b/include/ngp_algorithms/NodalGradEdgeAlg.h index 46771b49f..da92d00bc 100644 --- a/include/ngp_algorithms/NodalGradEdgeAlg.h +++ b/include/ngp_algorithms/NodalGradEdgeAlg.h @@ -21,15 +21,6 @@ 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 4ac340409..5f0588f26 100644 --- a/include/ngp_algorithms/NodalGradElemAlg.h +++ b/include/ngp_algorithms/NodalGradElemAlg.h @@ -13,7 +13,8 @@ #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 { @@ -21,21 +22,17 @@ namespace nalu { class MasterElement; -template +using NodalGradElemSimdDataType = + sierra::nalu::nalu_ngp::ElemSimdData; + +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> 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*, @@ -53,27 +50,34 @@ 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; +using ScalarNodalGradElemAlg = NodalGradElemAlg< + AlgTraits, + ScalarFieldType, + VectorFieldType, + nalu_ngp::ScalarViewHelper>; template -using VectorNodalGradElemAlg = - NodalGradElemAlg; +using VectorNodalGradElemAlg = NodalGradElemAlg< + AlgTraits, + VectorFieldType, + GenericFieldType, + nalu_ngp::VectorViewHelper>; + template -using TensorNodalGradElemAlg = - NodalGradElemAlg; +using TensorNodalGradElemAlg = NodalGradElemAlg< + AlgTraits, + VectorFieldType, + TensorFieldType, + nalu_ngp::VectorViewHelper>; } // namespace nalu } // namespace sierra diff --git a/include/ngp_algorithms/ViewHelper.h b/include/ngp_algorithms/ViewHelper.h index b683a2186..c7fc73c1b 100644 --- a/include/ngp_algorithms/ViewHelper.h +++ b/include/ngp_algorithms/ViewHelper.h @@ -20,12 +20,10 @@ namespace nalu { namespace nalu_ngp { -template -struct ViewHelper; - -template -struct ViewHelper +template +struct ScalarViewHelper { + using SimdDataType = ElemSimdDataType; using ViewDataType = SharedMemView; using ScratchViewsType = ScratchViews< @@ -34,13 +32,13 @@ struct ViewHelper typename ElemSimdDataType::ShmemType>; KOKKOS_INLINE_FUNCTION - ViewHelper(ScratchViewsType& scrView, unsigned phiID) + ScalarViewHelper(ScratchViewsType& scrView, unsigned phiID) : v_phi_(scrView.get_scratch_view_1D(phiID)) { } KOKKOS_DEFAULTED_FUNCTION - ~ViewHelper() = default; + ~ScalarViewHelper() = default; KOKKOS_INLINE_FUNCTION DoubleType operator()(int ni, int) const { return v_phi_(ni); } @@ -48,9 +46,10 @@ struct ViewHelper const ViewDataType& v_phi_; }; -template -struct ViewHelper +template +struct VectorViewHelper { + using SimdDataType = ElemSimdDataType; using ViewDataType = SharedMemView; using ScratchViewsType = ScratchViews< @@ -59,13 +58,13 @@ struct ViewHelper typename ElemSimdDataType::ShmemType>; KOKKOS_INLINE_FUNCTION - ViewHelper(ScratchViewsType& scrView, unsigned phiID) + VectorViewHelper(ScratchViewsType& scrView, unsigned phiID) : v_phi_(scrView.get_scratch_view_2D(phiID)) { } KOKKOS_DEFAULTED_FUNCTION - ~ViewHelper() = default; + ~VectorViewHelper() = 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 e76bbeae3..577bbd140 100644 --- a/include/ngp_utils/NgpFieldBLAS.h +++ b/include/ngp_utils/NgpFieldBLAS.h @@ -137,13 +137,13 @@ field_axpby( template inline void -field_axpby( +scalar_field_axpby( const MeshInfoType& meshInfo, const stk::mesh::Selector& sel, const double alpha, - const ScalarFieldType& xField, + const stk::mesh::FieldBase& xField, const double beta, - ScalarFieldType& yField, + stk::mesh::FieldBase& yField, const stk::topology::rank_t rank = stk::topology::NODE_RANK) { constexpr unsigned nComp = 1; @@ -152,7 +152,7 @@ field_axpby( template inline void -field_axpby( +vector_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 352aaa50c..d614eb471 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,10 +22,6 @@ 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 f851063ee..86a60050b 100644 --- a/include/overset/TiogaSTKIface.h +++ b/include/overset/TiogaSTKIface.h @@ -5,7 +5,6 @@ #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 e200d70ea..394c20f7a 100644 --- a/include/utils/StkHelpers.h +++ b/include/utils/StkHelpers.h @@ -99,6 +99,11 @@ 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 3035170c2..40ed7ba93 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 90eb09e70..0f8d0a9a0 100644 --- a/include/xfer/LocalVolumeSearch.h +++ b/include/xfer/LocalVolumeSearch.h @@ -11,7 +11,6 @@ #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" @@ -56,13 +55,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 \ No newline at end of file +#endif diff --git a/include/xfer/ToMesh.h b/include/xfer/ToMesh.h index 1e72ab998..07e8929ad 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 f407d11a5..f8f79e0a7 100644 --- a/src/AMSAlgDriver.C +++ b/src/AMSAlgDriver.C @@ -21,6 +21,7 @@ #include #include #include +#include // stk_mesh/base/fem #include @@ -71,58 +72,63 @@ 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 @@ -132,7 +138,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"); @@ -323,8 +329,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 41d417a38..80a5ca7b3 100644 --- a/src/AssembleContinuityNonConformalSolverAlgorithm.C +++ b/src/AssembleContinuityNonConformalSolverAlgorithm.C @@ -63,24 +63,22 @@ 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_); @@ -197,8 +195,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 d79cca999..fe77dde09 100644 --- a/src/AssembleMomentumEdgeABLTopBC.C +++ b/src/AssembleMomentumEdgeABLTopBC.C @@ -71,10 +71,9 @@ 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() @@ -241,8 +240,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 99ad0f7c5..8d45ede2f 100644 --- a/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C +++ b/src/AssembleMomentumEdgeWallFunctionSolverAlgorithm.C @@ -50,19 +50,17 @@ 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 7954fcbe9..029802a11 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 ba5e11173..e26a41ab8 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 043881d9d..9a8bbab99 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 fe3fbd8e7..428d66c95 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 29fe245ff..191815538 100644 --- a/src/AssemblePNGElemSolverAlgorithm.C +++ b/src/AssemblePNGElemSolverAlgorithm.C @@ -49,11 +49,10 @@ 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 f7a8cdbb0..8d326548e 100644 --- a/src/AssemblePNGNonConformalSolverAlgorithm.C +++ b/src/AssemblePNGNonConformalSolverAlgorithm.C @@ -53,14 +53,13 @@ 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 318ec745d..00321b85f 100644 --- a/src/AssembleScalarEigenEdgeSolverAlgorithm.C +++ b/src/AssembleScalarEigenEdgeSolverAlgorithm.C @@ -73,27 +73,24 @@ 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 119b60cfa..f970044ce 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 4a324bc65..35b113009 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 49413126b..e711167b4 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 c40fd05c4..bf34b2fb4 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 4012aef95..8506e79d7 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,10 +265,8 @@ 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); @@ -299,8 +297,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 ec1f429fc..b2e61bc17 100644 --- a/src/ComputeHeatTransferEdgeWallAlgorithm.C +++ b/src/ComputeHeatTransferEdgeWallAlgorithm.C @@ -56,29 +56,27 @@ 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 b5d8396f0..c09ceedfa 100644 --- a/src/ComputeMdotNonConformalAlgorithm.C +++ b/src/ComputeMdotNonConformalAlgorithm.C @@ -58,26 +58,24 @@ 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_); @@ -169,8 +167,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 e1710e8b7..5534d0fbe 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 078daa325..f089acf6d 100644 --- a/src/ComputeWallFrictionVelocityAlgorithm.C +++ b/src/ComputeWallFrictionVelocityAlgorithm.C @@ -66,30 +66,28 @@ 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 ceb8589c0..dceaf5df3 100644 --- a/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C +++ b/src/ContinuityLowSpeedCompressibleNodeSuppAlg.C @@ -42,12 +42,11 @@ 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 f46a93e4d..747ef74eb 100644 --- a/src/DataProbePostProcessing.C +++ b/src/DataProbePostProcessing.C @@ -576,10 +576,11 @@ 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) { @@ -689,8 +690,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) { @@ -827,9 +828,8 @@ 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,8 +1060,7 @@ 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 = - (double*)stk::mesh::field_data(*coordinates, node); + double* theCoord = stk::mesh::field_data(*coordinates, node); // always output time and coordinates myfile << std::left << std::setw(w_) @@ -1268,8 +1267,7 @@ DataProbePostProcessing::provide_output_txt(const double currentTime) stk::mesh::Entity node = nodeVec[inv]; // only output coordinates if required if (printcoords) { - double* theCoord = - (double*)stk::mesh::field_data(*coordinates, node); + double* theCoord = 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 359b243d6..01cbffbb9 100644 --- a/src/EnthalpyEquationSystem.C +++ b/src/EnthalpyEquationSystem.C @@ -98,7 +98,6 @@ #include #include #include -#include #include // stk_io @@ -145,7 +144,7 @@ EnthalpyEquationSystem::EnthalpyEquationSystem( specHeat_(NULL), divQ_(NULL), pOld_(NULL), - nodalGradAlgDriver_(realm_, "dhdx"), + nodalGradAlgDriver_(realm_, "enthalpy", "dhdx"), assembleWallHeatTransferAlgDriver_(NULL), pmrCouplingActive_(false), lowSpeedCompressActive_(false), @@ -258,28 +257,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 @@ -287,7 +286,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); @@ -310,25 +309,24 @@ 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); } @@ -336,7 +334,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); } @@ -552,11 +550,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); @@ -607,10 +605,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( @@ -686,11 +684,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); @@ -709,25 +707,20 @@ 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 @@ -759,7 +752,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); @@ -802,7 +795,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_; @@ -887,7 +880,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); @@ -1090,7 +1083,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(); @@ -1160,7 +1153,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(); @@ -1351,8 +1344,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 c1288912e..f94c728fc 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 8f03b304e..758cf1951 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 1ee920806..f656de0e4 100644 --- a/src/EnthalpyPressureWorkNodeSuppAlg.C +++ b/src/EnthalpyPressureWorkNodeSuppAlg.C @@ -39,12 +39,10 @@ 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 c0ed8871c..720b284f9 100644 --- a/src/EnthalpyViscousWorkNodeSuppAlg.C +++ b/src/EnthalpyViscousWorkNodeSuppAlg.C @@ -40,14 +40,12 @@ 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 dddf47078..9deac309c 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, 1, nullptr); + stk::mesh::put_field_on_mesh(elemVolume, selector, nullptr); } //-------------------------------------------------------------------------- diff --git a/src/FieldManager.C b/src/FieldManager.C index 1e30e7263..7bb993620 100644 --- a/src/FieldManager.C +++ b/src/FieldManager.C @@ -8,6 +8,7 @@ // #include "FieldManager.h" #include "stk_mesh/base/MetaData.hpp" +#include "stk_io/IossBridge.hpp" namespace sierra { namespace nalu { @@ -24,7 +25,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); @@ -42,16 +43,24 @@ FieldManager::register_field( return std::visit( [&](auto def) -> FieldPointerTypes { - using field_type = typename decltype(def)::FieldType; - using val_type = typename stk::mesh::FieldTraits::data_type; + using val_type = typename decltype(def)::DataType; 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 c6db47e8a..6459181a4 100644 --- a/src/FieldRegistry.C +++ b/src/FieldRegistry.C @@ -21,25 +21,25 @@ const std::map& Registry() { // clang-format off - FieldDefGeneric SingleStateElemGeneric = {stk::topology::ELEM_RANK}; - FieldDefGeneric SingleStateEdgeGeneric = {stk::topology::EDGE_RANK}; - FieldDefGeneric SingleStateNodeGeneric = {stk::topology::NODE_RANK}; + FieldDefGeneric SingleStateElemGeneric = FieldDefGeneric{stk::topology::ELEM_RANK}; + FieldDefGeneric SingleStateEdgeGeneric = FieldDefGeneric{stk::topology::EDGE_RANK}; + FieldDefGeneric SingleStateNodeGeneric = FieldDefGeneric{stk::topology::NODE_RANK}; - 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}; + 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}; - 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}; + 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}; - FieldDefTensor SingleStateNodalTensor = {stk::topology::NODE_RANK, 1, NUM_DIM*NUM_DIM}; + FieldDefTensor SingleStateNodalTensor = FieldDefTensor{stk::topology::NODE_RANK, 1, NUM_DIM*NUM_DIM}; - FieldDefTpetraId TpetraId = {stk::topology::NODE_RANK}; - FieldDefGlobalId GlobalId = {stk::topology::NODE_RANK}; - FieldDefHypreId HypreId = {stk::topology::NODE_RANK}; - FieldDefScalarInt NodalScalarInt = {stk::topology::NODE_RANK}; + 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}; static const std::map registry = { {"average_dudx" , SingleStateNodalTensor}, diff --git a/src/FixPressureAtNodeAlgorithm.C b/src/FixPressureAtNodeAlgorithm.C index 4a9ef8c8b..2cb5ca2ab 100644 --- a/src/FixPressureAtNodeAlgorithm.C +++ b/src/FixPressureAtNodeAlgorithm.C @@ -36,10 +36,9 @@ 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 38bebb68a..b6a198a37 100644 --- a/src/GammaEquationSystem.C +++ b/src/GammaEquationSystem.C @@ -69,7 +69,6 @@ #include #include #include -#include #include // stk_io @@ -102,7 +101,7 @@ GammaEquationSystem::GammaEquationSystem(EquationSystems& eqSystems) visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "dgamdx") + nodalGradAlgDriver_(realm_, "gamma_transition", "dgamdx") { dofName_ = "gamma_transition"; @@ -148,29 +147,30 @@ 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 723a09f27..9b42c3092 100644 --- a/src/InputOutputRealm.C +++ b/src/InputOutputRealm.C @@ -107,17 +107,15 @@ 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::mesh::Field>( - stk::topology::NODE_RANK, fieldName)); + stk::mesh::FieldBase* theField = &(meta_data().declare_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 75e5ca98e..fcfec16fd 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,28 +367,26 @@ 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, 1, nullptr); - GenericFieldType* elemCourant = &(meta_data.declare_field( + stk::mesh::put_field_on_mesh(*elemReynolds, selector, nullptr); + GenericFieldType* elemCourant = &(meta_data.declare_field( stk::topology::ELEMENT_RANK, "element_courant")); - stk::mesh::put_field_on_mesh(*elemCourant, selector, 1, nullptr); + stk::mesh::put_field_on_mesh(*elemCourant, selector, nullptr); } //-------------------------------------------------------------------------- @@ -402,9 +400,11 @@ 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,9 +423,11 @@ 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_; @@ -447,8 +449,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_; @@ -476,12 +478,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); @@ -499,27 +501,33 @@ 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); - VectorFieldType* viscousForce = &(meta_data.declare_field( - stk::topology::NODE_RANK, "viscous_force")); + stk::io::set_field_output_type( + *pressureForce, stk::io::FieldOutputType::VECTOR_3D); + 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); - VectorFieldType* tauWallVector = &(meta_data.declare_field( + stk::io::set_field_output_type( + *viscousForce, stk::io::FieldOutputType::VECTOR_3D); + 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); - ScalarFieldType* tauWall = &(meta_data.declare_field( - stk::topology::NODE_RANK, "tau_wall")); + stk::io::set_field_output_type( + *tauWallVector, stk::io::FieldOutputType::VECTOR_3D); + 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); @@ -537,7 +545,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); @@ -555,7 +563,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); @@ -591,8 +599,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; @@ -1031,7 +1039,7 @@ MomentumEquationSystem::MomentumEquationSystem(EquationSystems& eqSystems) visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "dudx"), + nodalGradAlgDriver_(realm_, "velocity", "dudx"), wallFuncAlgDriver_(realm_), dynPressAlgDriver_(realm_), cflReAlgDriver_(realm_), @@ -1142,33 +1150,38 @@ 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); @@ -1177,25 +1190,24 @@ 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"); @@ -1216,9 +1228,10 @@ 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 @@ -1228,11 +1241,10 @@ 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, 1, &one); + stk::mesh::put_field_on_mesh(node_mask, selector, &one); } //-------------------------------------------------------------------------- @@ -1253,13 +1265,11 @@ 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); @@ -1563,9 +1573,11 @@ 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_; @@ -1675,9 +1687,11 @@ 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_; @@ -1775,9 +1789,11 @@ 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()) { @@ -1787,8 +1803,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( @@ -1873,13 +1889,12 @@ 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); @@ -1892,15 +1907,13 @@ 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); @@ -1916,8 +1929,7 @@ 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); @@ -1928,9 +1940,8 @@ 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, @@ -1944,8 +1955,7 @@ 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); @@ -2127,10 +2137,8 @@ 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_); } @@ -2181,9 +2189,11 @@ 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; @@ -2255,9 +2265,11 @@ 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()) { @@ -2291,10 +2303,8 @@ 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_); // } @@ -2332,7 +2342,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 @@ -2501,10 +2511,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(); @@ -2593,7 +2603,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 = (double*)stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = stk::mesh::field_data(*Udiag_, mnode); diagVal[0] += lhs[ix]; } } @@ -2614,7 +2624,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 = (double*)stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = stk::mesh::field_data(*Udiag_, mnode); if (forceAtomic) Kokkos::atomic_add(diagVal, lhs(ix, ix)); else @@ -2639,7 +2649,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 = (double*)stk::mesh::field_data(*Udiag_, mnode); + double* diagVal = stk::mesh::field_data(*Udiag_, mnode); if (forceAtomic) Kokkos::atomic_add(diagVal, lhs(ix, ix)); else @@ -2683,10 +2693,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"; @@ -2779,7 +2789,7 @@ ContinuityEquationSystem::ContinuityEquationSystem( massFlowRate_(NULL), coordinates_(NULL), pTmp_(NULL), - nodalGradAlgDriver_(realm_, "dpdx"), + nodalGradAlgDriver_(realm_, "pressure", "dpdx"), mdotAlgDriver_(new MdotAlgDriver(realm_, elementContinuityEqs)), projectedNodalGradEqs_(NULL) { @@ -2838,23 +2848,24 @@ 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); } //-------------------------------------------------------------------------- @@ -2877,7 +2888,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); } @@ -3027,9 +3038,11 @@ 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 @@ -3156,8 +3169,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); } @@ -3340,7 +3353,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 ac6a54db2..978aebc1d 100644 --- a/src/MatrixFreeHeatCondEquationSystem.C +++ b/src/MatrixFreeHeatCondEquationSystem.C @@ -25,6 +25,7 @@ #include #include #include +#include namespace sierra { namespace nalu { @@ -70,32 +71,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); } @@ -103,20 +104,21 @@ 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)); } @@ -145,13 +147,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; @@ -346,12 +348,9 @@ 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::delta), - 1.0, - meta_ - .get_field( - stk::topology::NODE_RANK, names::temperature) + 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 7b7bd49f3..b068bd19e 100644 --- a/src/MatrixFreeLowMachEquationSystem.C +++ b/src/MatrixFreeLowMachEquationSystem.C @@ -50,6 +50,7 @@ #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 @@ -151,56 +152,60 @@ 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); } } @@ -228,9 +233,10 @@ 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); @@ -324,16 +330,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( @@ -342,8 +348,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 4d8cc35c2..c8b880253 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 70e7715d2..4bb8f96c3 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 78879c31d..bc9e1349c 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 7e098377f..2c0e58163 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 ce8c7deaf..c91b82cca 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 744c912a6..2d383f364 100644 --- a/src/ProjectedNodalGradientEquationSystem.C +++ b/src/ProjectedNodalGradientEquationSystem.C @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -137,14 +136,16 @@ 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 f96f62fbd..9391d2925 100644 --- a/src/Realm.C +++ b/src/Realm.C @@ -118,7 +118,6 @@ #include #include #include -#include #include #include #include @@ -521,8 +520,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_) @@ -927,7 +926,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 @@ -935,10 +934,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 @@ -976,10 +975,9 @@ 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; @@ -1473,7 +1471,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 @@ -1496,7 +1494,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 @@ -2055,6 +2053,7 @@ 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_); @@ -2561,11 +2560,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(); @@ -2625,8 +2624,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); @@ -2648,11 +2647,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(); @@ -2808,10 +2807,9 @@ 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); @@ -2844,10 +2842,9 @@ 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); @@ -2880,10 +2877,9 @@ 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); @@ -2915,10 +2911,9 @@ 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); @@ -3008,10 +3003,9 @@ 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); @@ -3033,10 +3027,9 @@ 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); @@ -4779,8 +4772,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 = @@ -4820,8 +4813,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 a67b5fc56..24aa93354 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,10 +364,8 @@ 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); @@ -381,7 +379,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()); @@ -410,8 +408,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()) & @@ -451,8 +449,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()) & @@ -656,8 +654,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 c26971bad..a32a3d138 100644 --- a/src/SideWriter.C +++ b/src/SideWriter.C @@ -71,12 +71,11 @@ 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 6b1b48d1c..39ca4eaa6 100644 --- a/src/SmartField.C +++ b/src/SmartField.C @@ -38,14 +38,10 @@ EXPLICIT_TYPE_INSTANTIATOR_NGP(stk::mesh::EntityId); /* EXPLICIT_TYPE_INSTANTIATOR_LEGACY(HypreIDFieldType); */ /* #endif */ -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); +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); } // namespace sierra::nalu diff --git a/src/SolutionNormPostProcessing.C b/src/SolutionNormPostProcessing.C index 78209026e..9d70f7dda 100644 --- a/src/SolutionNormPostProcessing.C +++ b/src/SolutionNormPostProcessing.C @@ -193,9 +193,7 @@ 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 9ff897571..041acd91a 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 442383f2d..edf466847 100644 --- a/src/SpecificDissipationRateEquationSystem.C +++ b/src/SpecificDissipationRateEquationSystem.C @@ -79,7 +79,6 @@ #include #include #include -#include #include // stk_io @@ -116,7 +115,7 @@ SpecificDissipationRateEquationSystem::SpecificDissipationRateEquationSystem( sdrWallBc_(NULL), assembledWallSdr_(NULL), assembledWallArea_(NULL), - nodalGradAlgDriver_(realm_, "dwdx") + nodalGradAlgDriver_(realm_, "specific_dissipation_rate", "dwdx") { dofName_ = "specific_dissipation_rate"; @@ -163,29 +162,28 @@ 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); @@ -344,8 +342,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 @@ -410,8 +408,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 @@ -473,17 +471,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 c9c842b91..c685cd151 100644 --- a/src/SurfaceForceAndMomentAlgorithm.C +++ b/src/SurfaceForceAndMomentAlgorithm.C @@ -75,32 +75,26 @@ 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 d132baa0a..6e3ab8e0f 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 e2c3d2f2d..dd5fa7f80 100644 --- a/src/SurfaceForceAndMomentWallFunctionAlgorithm.C +++ b/src/SurfaceForceAndMomentWallFunctionAlgorithm.C @@ -80,33 +80,28 @@ 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 1a7d37306..723898465 100644 --- a/src/TotalDissipationRateEquationSystem.C +++ b/src/TotalDissipationRateEquationSystem.C @@ -69,7 +69,6 @@ #include #include #include -#include #include // stk_io @@ -105,7 +104,7 @@ TotalDissipationRateEquationSystem::TotalDissipationRateEquationSystem( tdrWallBc_(NULL), assembledWallTdr_(NULL), assembledWallArea_(NULL), - nodalGradAlgDriver_(realm_, "dedx") + nodalGradAlgDriver_(realm_, "total_dissipation_rate", "dedx") { dofName_ = "total_dissipation_rate"; @@ -152,29 +151,28 @@ 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); @@ -303,8 +301,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 @@ -369,8 +367,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 @@ -432,17 +430,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 204c195c1..17236a5fa 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 c8be4266e..023388ada 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 3452d2f9e..1075c3242 100644 --- a/src/TurbKineticEnergyEquationSystem.C +++ b/src/TurbKineticEnergyEquationSystem.C @@ -87,7 +87,6 @@ #include #include #include -#include #include #include @@ -124,7 +123,7 @@ TurbKineticEnergyEquationSystem::TurbKineticEnergyEquationSystem( visc_(NULL), tvisc_(NULL), evisc_(NULL), - nodalGradAlgDriver_(realm_, "dkdx"), + nodalGradAlgDriver_(realm_, "turbulent_ke", "dkdx"), turbulenceModel_(realm_.solutionOptions_->turbulenceModel_), projectedNodalGradEqs_(NULL), isInit_(true) @@ -194,29 +193,28 @@ 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); @@ -409,8 +407,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 @@ -477,8 +475,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 @@ -542,8 +540,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 @@ -565,9 +563,8 @@ 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_) @@ -841,8 +838,7 @@ 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 9e0dea48e..e247c535b 100644 --- a/src/TurbViscSmagorinskyAlgorithm.C +++ b/src/TurbViscSmagorinskyAlgorithm.C @@ -44,14 +44,12 @@ 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 b673ba662..8c4b1f399 100644 --- a/src/TurbViscWaleAlgorithm.C +++ b/src/TurbViscWaleAlgorithm.C @@ -44,14 +44,12 @@ 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 63601fa57..f33872491 100644 --- a/src/TurbulenceAveragingPostProcessing.C +++ b/src/TurbulenceAveragingPostProcessing.C @@ -34,6 +34,7 @@ #include #include #include +#include // basic c++ #include @@ -293,8 +294,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); @@ -347,10 +348,12 @@ 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_) { @@ -408,9 +411,8 @@ 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 @@ -526,15 +528,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); } @@ -581,9 +583,8 @@ 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); @@ -1434,7 +1435,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 7e5723e81..846447589 100644 --- a/src/VolumeOfFluidEquationSystem.C +++ b/src/VolumeOfFluidEquationSystem.C @@ -46,6 +46,7 @@ #include "ngp_utils/NgpFieldBLAS.h" #include "ngp_utils/NgpLoopUtils.h" #include "ngp_utils/NgpFieldUtils.h" +#include "stk_io/IossBridge.hpp" namespace sierra { namespace nalu { @@ -65,7 +66,7 @@ VolumeOfFluidEquationSystem::VolumeOfFluidEquationSystem( volumeOfFluid_(NULL), dvolumeOfFluiddx_(NULL), vofTmp_(NULL), - nodalGradAlgDriver_(realm_, "dvolume_of_fluiddx"), + nodalGradAlgDriver_(realm_, "volume_of_fluid", "dvolume_of_fluiddx"), projectedNodalGradEqs_(NULL), isInit_(false) { @@ -117,7 +118,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"); @@ -125,14 +126,16 @@ 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_ = @@ -172,7 +175,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); } @@ -268,8 +271,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 @@ -484,9 +487,8 @@ 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); @@ -505,9 +507,8 @@ 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 1a72feec1..7e4740c06 100644 --- a/src/WallDistEquationSystem.C +++ b/src/WallDistEquationSystem.C @@ -59,6 +59,7 @@ #include "stk_mesh/base/Field.hpp" #include "stk_mesh/base/FieldParallel.hpp" #include "stk_topology/topology.hpp" +#include "stk_io/IossBridge.hpp" #include @@ -67,7 +68,7 @@ namespace nalu { WallDistEquationSystem::WallDistEquationSystem(EquationSystems& eqSystems) : EquationSystem(eqSystems, "WallDistEQS", "ndtw"), - nodalGradAlgDriver_(realm_, "dwalldistdx"), + nodalGradAlgDriver_(realm_, "wall_distance_phi", "dwalldistdx"), managePNG_(realm_.get_consistent_mass_matrix_png("ndtw")) { if (managePNG_) @@ -119,25 +120,28 @@ 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); } @@ -151,9 +155,11 @@ 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); } } @@ -164,9 +170,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, 1, nullptr); + stk::mesh::put_field_on_mesh(intersectedElement, selector, nullptr); } } @@ -272,7 +278,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 3732f01a0..32a116544 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,10 +261,8 @@ 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); @@ -295,8 +293,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 ce7f7d73e..dbefe85f7 100644 --- a/src/aero/AeroContainer.C +++ b/src/aero/AeroContainer.C @@ -13,6 +13,7 @@ #include "aero/fsi/OpenfastFSI.h" #endif #include +#include namespace sierra { namespace nalu { @@ -67,12 +68,16 @@ 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 3e1f59988..69b4c8028 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 8bc6c17c9..ca55f0003 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 8914089f0..0b9835412 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 6b20fc383..168f4aee1 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 e6c8c518b..0119860d3 100644 --- a/src/aero/fsi/CalcLoads.C +++ b/src/aero/fsi/CalcLoads.C @@ -66,24 +66,21 @@ 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 f49dd20b5..72b27de7f 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, 1, nullptr); - stk::mesh::put_field_on_mesh(*dispMapInterp_, *part, 1, nullptr); - stk::mesh::put_field_on_mesh(*deflectionRamp_, *part, 1, nullptr); + 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); } } @@ -247,59 +247,53 @@ 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(), 1, nullptr); + stk::mesh::put_field_on_mesh(*div_mesh_vel, meta.universal_part(), nullptr); populateParts(twrPartNames_, twrParts_, partVec_, "Tower"); populateParts(nacellePartNames_, nacelleParts_, partVec_, "Nacelle"); @@ -917,9 +911,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( @@ -950,15 +944,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); @@ -1238,11 +1232,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(); @@ -1377,14 +1371,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(); @@ -1662,7 +1656,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(); @@ -1847,7 +1841,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(); @@ -2126,11 +2120,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 9a6a882a4..38ed14a69 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 d046901cf..1c68d2a8a 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 36fa64869..947595c73 100644 --- a/src/gcl/MeshVelocityAlg.C +++ b/src/gcl/MeshVelocityAlg.C @@ -12,7 +12,6 @@ #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 39d715ebd..ae7794763 100644 --- a/src/gcl/MeshVelocityEdgeAlg.C +++ b/src/gcl/MeshVelocityEdgeAlg.C @@ -12,7 +12,6 @@ #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 a303a78ff..00b05d1e6 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 88250ac2a..784cac92b 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 f12beaae5..953c1e4f8 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 54c88f8be..6869ad208 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 d96d58026..a422b1b5e 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 c6542abfb..2706b2da3 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 4dcd88e60..fbbc9c7d8 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 9819ac62b..4f619ef8f 100644 --- a/src/ngp_algorithms/CourantReAlg.C +++ b/src/ngp_algorithms/CourantReAlg.C @@ -13,7 +13,6 @@ #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 ff23df5b1..30192da3b 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 3e389ea4f..e9a810bf8 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 2371c3dba..d5a305a75 100644 --- a/src/ngp_algorithms/GeometryBoundaryAlg.C +++ b/src/ngp_algorithms/GeometryBoundaryAlg.C @@ -11,7 +11,6 @@ #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 4e84cfaf8..1144cac3e 100644 --- a/src/ngp_algorithms/GeometryInteriorAlg.C +++ b/src/ngp_algorithms/GeometryInteriorAlg.C @@ -11,7 +11,6 @@ #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 3cfa5abd6..aba99f221 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 e2368c863..1fba7291e 100644 --- a/src/ngp_algorithms/MdotDensityAccumAlg.C +++ b/src/ngp_algorithms/MdotDensityAccumAlg.C @@ -11,7 +11,6 @@ #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" @@ -86,9 +85,8 @@ 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 a20158547..903d18c84 100644 --- a/src/ngp_algorithms/MetricTensorElemAlg.C +++ b/src/ngp_algorithms/MetricTensorElemAlg.C @@ -12,7 +12,6 @@ #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 f133de5b9..692eb1b82 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& gradPhiName) - : NgpAlgDriver(realm), gradPhiName_(gradPhiName) + Realm& realm, const std::string& phiName, const std::string& gradPhiName) + : NgpAlgDriver(realm), phiName_(phiName), 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,8 +57,11 @@ NodalGradAlgDriver::post_work() const auto& bulk = realm_.bulk_data(); const auto& meshInfo = realm_.mesh_info(); - auto* gradPhi = meta.template get_field( - stk::topology::NODE_RANK, gradPhiName_); + auto* phi = + meta.template get_field(stk::topology::NODE_RANK, phiName_); + + auto* gradPhi = + meta.template get_field(stk::topology::NODE_RANK, gradPhiName_); auto& ngpGradPhi = nalu_ngp::get_ngp_field(meshInfo, gradPhiName_); ngpGradPhi.sync_to_host(); @@ -67,7 +70,7 @@ NodalGradAlgDriver::post_work() stk::mesh::parallel_sum(bulk, fVec, doFinalSyncToDevice); const int dim2 = meta.spatial_dimension(); - const int dim1 = std::is_same::value ? 1 : dim2; + const int dim1 = max_extent(*phi, 0); if (realm_.hasPeriodic_) { realm_.periodic_field_update(gradPhi, dim2 * dim1); @@ -82,8 +85,6 @@ 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 b0ba724e9..60207bdad 100644 --- a/src/ngp_algorithms/NodalGradBndryElemAlg.C +++ b/src/ngp_algorithms/NodalGradBndryElemAlg.C @@ -12,7 +12,6 @@ #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" @@ -21,17 +20,23 @@ #include "SolutionOptions.h" #include "utils/StkHelpers.h" #include "stk_mesh/base/NgpMesh.hpp" +#include "stk_mesh/base/FieldRestriction.hpp" namespace sierra { namespace nalu { -template -NodalGradBndryElemAlg::NodalGradBndryElemAlg( - Realm& realm, - stk::mesh::Part* part, - PhiType* phi, - GradPhiType* gradPhi, - bool useShifted) +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> +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()), @@ -41,17 +46,42 @@ NodalGradBndryElemAlg::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_, NumComp); + dataNeeded_.add_gathered_nodal_field(phi_, phiSize_); dataNeeded_.add_gathered_nodal_field(dualNodalVol_, 1); dataNeeded_.add_face_field( exposedAreaVec_, AlgTraits::numFaceIp_, AlgTraits::nDim_); @@ -60,14 +90,15 @@ NodalGradBndryElemAlg::NodalGradBndryElemAlg( dataNeeded_.add_master_element_call(shpfcn, CURRENT_COORDINATES); } -template +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> 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(); @@ -81,6 +112,7 @@ NodalGradBndryElemAlg::execute() const auto dnvID = dualNodalVol_; const auto exposedAreaID = exposedAreaVec_; const auto phiID = phi_; + const auto phiSize = phiSize_; auto* meFC = meFC_; gradPhi.sync_to_device(); @@ -92,7 +124,7 @@ NodalGradBndryElemAlg::execute() std::to_string(AlgTraits::topo_)); nalu_ngp::run_elem_algorithm( algName, meshInfo, meta.side_rank(), dataNeeded_, sel, - KOKKOS_LAMBDA(ElemSimdDataType & edata) { + KOKKOS_LAMBDA(typename ViewHelperType::SimdDataType & edata) { const int* ipNodeMap = meFC->ipNodeMap(); auto& scrView = edata.simdScrView; @@ -104,7 +136,7 @@ NodalGradBndryElemAlg::execute() const auto& v_shape_fcn = useShifted ? meViews.fc_shifted_shape_fcn : meViews.fc_shape_fcn; - for (int di = 0; di < NumComp; ++di) { + for (int di = 0; di < phiSize; ++di) { for (int ip = 0; ip < AlgTraits::numFaceIp_; ++ip) { DoubleType qIp = 0.0; for (int n = 0; n < AlgTraits::nodesPerFace_; ++n) { @@ -127,11 +159,13 @@ NodalGradBndryElemAlg::execute() // NOTE: Can't use BuildTemplates here because of additional template arguments #define INSTANTIATE_ALG(AlgTraits) \ template class NodalGradBndryElemAlg< \ - AlgTraits, ScalarFieldType, VectorFieldType>; \ - template class NodalGradBndryElemAlg< \ - AlgTraits, VectorFieldType, GenericFieldType>; \ + AlgTraits, ScalarFieldType, VectorFieldType, \ + nalu_ngp::ScalarViewHelper< \ + NodalGradBndryElemSimdDataType, ScalarFieldType>>; \ template class NodalGradBndryElemAlg< \ - AlgTraits, VectorFieldType, TensorFieldType> + AlgTraits, VectorFieldType, TensorFieldType, \ + nalu_ngp::VectorViewHelper< \ + NodalGradBndryElemSimdDataType, VectorFieldType>> INSTANTIATE_ALG(AlgTraitsTri3); INSTANTIATE_ALG(AlgTraitsQuad4); diff --git a/src/ngp_algorithms/NodalGradEdgeAlg.C b/src/ngp_algorithms/NodalGradEdgeAlg.C index bca6dab33..7a53cfcf5 100644 --- a/src/ngp_algorithms/NodalGradEdgeAlg.C +++ b/src/ngp_algorithms/NodalGradEdgeAlg.C @@ -27,11 +27,32 @@ 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_( - std::is_same::value ? 1 - : realm_.spatialDimension_), + dim1_(max_extent(*phi, 0)), 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 @@ -90,8 +111,6 @@ 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 1d9345e92..bdcd702d4 100644 --- a/src/ngp_algorithms/NodalGradElemAlg.C +++ b/src/ngp_algorithms/NodalGradElemAlg.C @@ -25,29 +25,59 @@ namespace sierra { namespace nalu { -template -NodalGradElemAlg::NodalGradElemAlg( - Realm& realm, - stk::mesh::Part* part, - PhiType* phi, - GradPhiType* gradPhi, - bool useShifted) +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> +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_, NumComp); + dataNeeded_.add_gathered_nodal_field(phi_, phiSize_); dataNeeded_.add_gathered_nodal_field(dualNodalVol_, 1); dataNeeded_.add_master_element_call(SCS_AREAV, CURRENT_COORDINATES); @@ -55,14 +85,14 @@ NodalGradElemAlg::NodalGradElemAlg( dataNeeded_.add_master_element_call(shpfcn, CURRENT_COORDINATES); } -template +template < + typename AlgTraits, + typename PhiType, + typename GradPhiType, + typename ViewHelperType> 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(); @@ -75,6 +105,7 @@ 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(); @@ -88,7 +119,7 @@ NodalGradElemAlg::execute() std::to_string(AlgTraits::topo_)); nalu_ngp::run_elem_algorithm( algName, meshInfo, stk::topology::ELEM_RANK, dataNeeded_, sel, - KOKKOS_LAMBDA(ElemSimdDataType & edata) { + KOKKOS_LAMBDA(typename ViewHelperType::SimdDataType & edata) { const int* lrscv = meSCS->adjacentNodes(); auto& scrView = edata.simdScrView; @@ -100,7 +131,7 @@ NodalGradElemAlg::execute() const auto& v_shape_fcn = useShifted ? meViews.scs_shifted_shape_fcn : meViews.scs_shape_fcn; - for (int di = 0; di < NumComp; ++di) { + for (int di = 0; di < phiSize; ++di) { for (int ip = 0; ip < AlgTraits::numScsIp_; ++ip) { DoubleType qIp = 0.0; for (int n = 0; n < AlgTraits::nodesPerElement_; ++n) { @@ -128,10 +159,11 @@ NodalGradElemAlg::execute() // NOTE: Can't use BuildTemplates here because of additional template arguments #define INSTANTIATE_ALG(AlgTraits) \ template class NodalGradElemAlg< \ - AlgTraits, ScalarFieldType, VectorFieldType>; \ + AlgTraits, ScalarFieldType, VectorFieldType, \ + nalu_ngp::ScalarViewHelper>; \ template class NodalGradElemAlg< \ - AlgTraits, VectorFieldType, GenericFieldType>; \ - template class NodalGradElemAlg + AlgTraits, VectorFieldType, TensorFieldType, \ + nalu_ngp::VectorViewHelper> INSTANTIATE_ALG(AlgTraitsHex8); INSTANTIATE_ALG(AlgTraitsTet4); diff --git a/src/ngp_algorithms/SSTMaxLengthScaleAlg.C b/src/ngp_algorithms/SSTMaxLengthScaleAlg.C index 2fe6c512c..4423ec536 100644 --- a/src/ngp_algorithms/SSTMaxLengthScaleAlg.C +++ b/src/ngp_algorithms/SSTMaxLengthScaleAlg.C @@ -11,7 +11,6 @@ #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 148ff8e8e..67a7cae49 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 fd055fdf2..115df77f2 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 f692633ca..077b527d6 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 1ddea3463..39df5ef3a 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 817952bea..01fc53976 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 778731ea5..f53b69b9e 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 307c93a06..e2e715271 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 383823d7d..28801672e 100644 --- a/src/overset/AssembleOversetPressureAlgorithm.C +++ b/src/overset/AssembleOversetPressureAlgorithm.C @@ -39,8 +39,7 @@ 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 eac34ae76..8ac2fdc1c 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 f932f7fd8..ebd5540ea 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_); - ScalarIntFieldType& ibf = - meta_.declare_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType& ibf = + meta_.declare_field(stk::topology::NODE_RANK, "iblank"); - ScalarIntFieldType& ibcell = meta_.declare_field( - stk::topology::ELEM_RANK, "iblank_cell"); + sierra::nalu::ScalarIntFieldType& ibcell = + meta_.declare_field(stk::topology::ELEM_RANK, "iblank_cell"); - ScalarFieldType& nVol = meta_.declare_field( - stk::topology::NODE_RANK, "tioga_nodal_volume"); + sierra::nalu::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); - VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coords_name_); - ScalarFieldType* nodeVol = meta_.get_field( - stk::topology::NODE_RANK, "dual_nodal_volume"); + 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"); #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); - ScalarFieldType* elemVolume = meta_.get_field( - stk::topology::ELEMENT_RANK, "element_volume"); + sierra::nalu::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; @@ -226,8 +226,8 @@ TiogaBlock::update_connectivity() void TiogaBlock::update_iblanks() { - ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = @@ -248,15 +248,13 @@ TiogaBlock::update_fringe_and_hole_nodes( std::vector& holeNodes, std::vector& fringeNodes) { - ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); - auto& ibnode = bdata_.iblank_.h_view; - int ip = 0; for (auto b : mbkts) { int* ib = stk::mesh::field_data(*ibf, *b); for (size_t in = 0; in < b->size(); in++) { @@ -272,8 +270,8 @@ TiogaBlock::update_fringe_and_hole_nodes( void TiogaBlock::update_tioga_iblanks() { - ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); const stk::mesh::BucketVector& mbkts = @@ -292,8 +290,8 @@ TiogaBlock::update_tioga_iblanks() void TiogaBlock::update_iblank_cell() { - ScalarIntFieldType* ibf = meta_.get_field( - stk::topology::ELEM_RANK, "iblank_cell"); + sierra::nalu::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 = @@ -320,8 +318,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; @@ -355,8 +353,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); - ScalarFieldType* nodeVol = meta_.get_field( - stk::topology::NODE_RANK, "tioga_nodal_volume"); + sierra::nalu::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; @@ -467,10 +465,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); - VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coords_name_); - ScalarFieldType* nodeVol = meta_.get_field( - stk::topology::NODE_RANK, "dual_nodal_volume"); + 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"); int ncount = 0; for (auto b : mbkts) diff --git a/src/overset/TiogaSTKIface.C b/src/overset/TiogaSTKIface.C index df9b82c1f..7667ab211 100644 --- a/src/overset/TiogaSTKIface.C +++ b/src/overset/TiogaSTKIface.C @@ -174,8 +174,8 @@ TiogaSTKIface::post_connectivity_work(const bool isDecoupled) } // Synchronize IBLANK data for shared nodes - ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); std::vector pvec{ibf}; stk::mesh::parallel_min(bulk_, {ibf}); @@ -253,8 +253,8 @@ TiogaSTKIface::update_ghosting() // Communicate coordinates field when populating oversetInfoVec if (oversetManager_.oversetGhosting_ != nullptr) { - VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coordsName_); + sierra::nalu::VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coordsName_); std::vector fVec = {coords}; stk::mesh::communicate_field_data(*oversetManager_.oversetGhosting_, fVec); } @@ -263,8 +263,8 @@ TiogaSTKIface::update_ghosting() void TiogaSTKIface::get_receptor_info() { - ScalarIntFieldType* ibf = - meta_.get_field(stk::topology::NODE_RANK, "iblank"); + sierra::nalu::ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); std::vector nodesToReset; @@ -397,8 +397,8 @@ TiogaSTKIface::populate_overset_info() // Ensure that the oversetInfoVec has been cleared out ThrowAssert(osetInfo.size() == 0); - VectorFieldType* coords = - meta_.get_field(stk::topology::NODE_RANK, coordsName_); + sierra::nalu::VectorFieldType* coords = + meta_.get_field(stk::topology::NODE_RANK, coordsName_); size_t numReceptors = receptorIDs_.size(); for (size_t i = 0; i < numReceptors; i++) { @@ -568,12 +568,11 @@ 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(); @@ -590,10 +589,9 @@ 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 88ea9502b..126de8e8e 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 d8b91baff..5b1852118 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,8 +145,7 @@ 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; @@ -206,8 +205,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 454e4336b..8dc1f8e68 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 3b485c893..299937e7e 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 4b76d5845..7cb4db028 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 67c05bf12..d68e04b16 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 8f44f9181..9ca68cf59 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 63127ab2c..6f0ed4b07 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 e257b1435..028c08c43 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 a5ef54bb3..312f0925b 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 e3fdea104..2454973fd 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 6f2ffbf1b..08f23b9fe 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 92ed11c57..144850a96 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 642df088a..ba0e064d4 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 113ff4112..abb0c8b59 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 631c0c9e1..0478792d5 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 bcee4cbb3..57e74af77 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 \ No newline at end of file +} // namespace sierra diff --git a/src/utils/StkHelpers.C b/src/utils/StkHelpers.C index c942c2eea..379bf9350 100644 --- a/src/utils/StkHelpers.C +++ b/src/utils/StkHelpers.C @@ -215,5 +215,33 @@ 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 83b49b0cf..9f435d40e 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 58c2fcffc..d23648363 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 357369cce..7c2b25cad 100644 --- a/src/wind_energy/SyntheticLidar.C +++ b/src/wind_energy/SyntheticLidar.C @@ -344,21 +344,17 @@ 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; @@ -562,21 +558,17 @@ 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 58c5d314e..a84c07f73 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 \ No newline at end of file +} // namespace sierra diff --git a/unit_tests/UnitTest1ElemCoordCheck.C b/unit_tests/UnitTest1ElemCoordCheck.C index eda102baa..2cb94cd37 100644 --- a/unit_tests/UnitTest1ElemCoordCheck.C +++ b/unit_tests/UnitTest1ElemCoordCheck.C @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -25,8 +24,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); @@ -66,6 +65,7 @@ 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 6cf5f8b39..24236083a 100644 --- a/unit_tests/UnitTestEigenDecomposition.C +++ b/unit_tests/UnitTestEigenDecomposition.C @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/unit_tests/UnitTestElemSuppAlg.C b/unit_tests/UnitTestElemSuppAlg.C index de9f5dba6..e2007d3d3 100644 --- a/unit_tests/UnitTestElemSuppAlg.C +++ b/unit_tests/UnitTestElemSuppAlg.C @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -28,8 +27,8 @@ namespace { void element_discrete_laplacian_kernel_3d( sierra::nalu::MasterElement& meSCS, - const ScalarFieldType* discreteLaplacianOfPressure, - const ScalarFieldType* nodalPressureField, + const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, + const sierra::nalu::ScalarFieldType* nodalPressureField, sierra::nalu::ScratchViews& elemData) { const int nDim = 3; @@ -84,9 +83,9 @@ class DiscreteLaplacianSuppAlg : public SuppAlg public: DiscreteLaplacianSuppAlg( sierra::nalu::ElemDataRequests& dataNeeded, - const VectorFieldType* coordField, - const ScalarFieldType* discreteLaplacianOfPressure, - const ScalarFieldType* nodalPressureField, + const sierra::nalu::VectorFieldType* coordField, + const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, + const sierra::nalu::ScalarFieldType* nodalPressureField, const stk::topology& topo) : discreteLaplacianOfPressure_(discreteLaplacianOfPressure), nodalPressureField_(nodalPressureField) @@ -119,8 +118,8 @@ public: } private: - const ScalarFieldType* discreteLaplacianOfPressure_; - const ScalarFieldType* nodalPressureField_; + const sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure_; + const sierra::nalu::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 1baaa9843..018c5d090 100644 --- a/unit_tests/UnitTestFieldManager.C +++ b/unit_tests/UnitTestFieldManager.C @@ -26,6 +26,7 @@ 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()); } @@ -44,11 +45,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); } @@ -103,9 +104,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); @@ -121,7 +122,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()); } @@ -141,7 +142,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 63a3f0b54..18cb11223 100644 --- a/unit_tests/UnitTestFieldRegistry.C +++ b/unit_tests/UnitTestFieldRegistry.C @@ -24,6 +24,7 @@ protected: { stk::mesh::MeshBuilder builder(MPI_COMM_WORLD); meta_ = builder.create_meta_data(); + meta_->use_simple_fields(); key_ = "velocity"; } std::shared_ptr meta_; @@ -38,13 +39,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); } @@ -59,7 +60,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); }, @@ -69,7 +70,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 1ccd412e6..17459b672 100644 --- a/unit_tests/UnitTestFieldUtils.C +++ b/unit_tests/UnitTestFieldUtils.C @@ -13,7 +13,7 @@ namespace unit_test_utils { double field_norm( - const ScalarFieldType& field, + const sierra::nalu::ScalarFieldType& field, const stk::mesh::BulkData& bulk, stk::mesh::Selector selector) { diff --git a/unit_tests/UnitTestFieldUtils.h b/unit_tests/UnitTestFieldUtils.h index fc4dfdb52..7c1bcc803 100644 --- a/unit_tests/UnitTestFieldUtils.h +++ b/unit_tests/UnitTestFieldUtils.h @@ -17,7 +17,7 @@ namespace unit_test_utils { double field_norm( - const ScalarFieldType& field, + const sierra::nalu::ScalarFieldType& field, const stk::mesh::BulkData& bulk, stk::mesh::Selector selector); diff --git a/unit_tests/UnitTestHexElementPromotion.C b/unit_tests/UnitTestHexElementPromotion.C index 0fbc056de..8ecebbbca 100644 --- a/unit_tests/UnitTestHexElementPromotion.C +++ b/unit_tests/UnitTestHexElementPromotion.C @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include +#include #include #include @@ -32,10 +32,6 @@ 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) @@ -57,8 +53,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; @@ -67,9 +63,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; @@ -88,8 +84,9 @@ protected: stk::mesh::put_field_on_entire_mesh(*intField); fixture->m_meta.commit(); - fixture->generate_mesh(stk::mesh::fixtures::FixedCartesianCoordinateMapping( - nx, ny, nz, nx, ny, nz)); + fixture->generate_mesh( + stk::mesh::fixtures::simple_fields::FixedCartesianCoordinateMapping( + nx, ny, nz, nx, ny, nz)); stk::mesh::PartVector surfParts = {surfSubPart}; stk::mesh::skin_mesh(*bulk, surfParts); } @@ -150,7 +147,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; @@ -163,8 +160,8 @@ protected: stk::mesh::Part* edgePart; stk::mesh::Part* facePart; std::unique_ptr io; - VectorFieldType* coordField; - ScalarIntFieldType* intField; + sierra::nalu::VectorFieldType* coordField; + sierra::nalu::ScalarIntFieldType* intField; }; TEST_F(PromoteElementHexTest, node_count) diff --git a/unit_tests/UnitTestHexMasterElements.C b/unit_tests/UnitTestHexMasterElements.C index 6f5bd728f..2b51783e4 100644 --- a/unit_tests/UnitTestHexMasterElements.C +++ b/unit_tests/UnitTestHexMasterElements.C @@ -264,6 +264,7 @@ 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 6e44ca64c..4a733b293 100644 --- a/unit_tests/UnitTestHexSCVDeterminant.C +++ b/unit_tests/UnitTestHexSCVDeterminant.C @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -43,8 +42,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); @@ -98,6 +97,7 @@ 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,9 +112,10 @@ 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 df8387d2b..4e418f033 100644 --- a/unit_tests/UnitTestKokkosME.h +++ b/unit_tests/UnitTestKokkosME.h @@ -36,6 +36,7 @@ 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); } @@ -58,8 +59,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); @@ -136,7 +137,7 @@ class KokkosMEViews stk::mesh::MetaData* meta_; std::shared_ptr bulk_; stk::mesh::PartVector partVec_; - const VectorFieldType* coordinates_{nullptr}; + const sierra::nalu::VectorFieldType* coordinates_{nullptr}; std::unique_ptr helperObjs_{nullptr}; diff --git a/unit_tests/UnitTestKokkosMEBC.h b/unit_tests/UnitTestKokkosMEBC.h index 2740d1961..efd51262f 100644 --- a/unit_tests/UnitTestKokkosMEBC.h +++ b/unit_tests/UnitTestKokkosMEBC.h @@ -37,6 +37,7 @@ 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); } @@ -61,8 +62,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); @@ -124,7 +125,7 @@ class KokkosMEBC std::shared_ptr bulk_; int faceOrdinal_; stk::mesh::PartVector partVec_; - const VectorFieldType* coordinates_{nullptr}; + const sierra::nalu::VectorFieldType* coordinates_{nullptr}; std::unique_ptr helperObjs_; diff --git a/unit_tests/UnitTestKokkosViews.C b/unit_tests/UnitTestKokkosViews.C index 0cb8ce381..6effdd335 100644 --- a/unit_tests/UnitTestKokkosViews.C +++ b/unit_tests/UnitTestKokkosViews.C @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -50,9 +49,9 @@ class TestElemAlgorithmWithVectors public: TestElemAlgorithmWithVectors( stk::mesh::BulkData& bulk, - const VectorFieldType* coord, - ScalarFieldType* discreteLaplacian, - ScalarFieldType* nodalPressure) + const sierra::nalu::VectorFieldType* coord, + sierra::nalu::ScalarFieldType* discreteLaplacian, + sierra::nalu::ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -156,9 +155,9 @@ public: private: stk::mesh::BulkData& bulkData_; - ScalarFieldType* discreteLaplacianOfPressure; - ScalarFieldType* nodalPressureField; - const VectorFieldType* coordField; + sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; + sierra::nalu::ScalarFieldType* nodalPressureField; + const sierra::nalu::VectorFieldType* coordField; }; //======= templated element kernel function ================== @@ -169,9 +168,9 @@ element_discrete_laplacian_kernel_3d( stk::mesh::BulkData& bulkData, stk::mesh::Entity elem, sierra::nalu::MasterElement& meSCS, - ScalarFieldType* discreteLaplacianOfPressure, - ScalarFieldType* nodalPressureField, - const VectorFieldType* coordField) + sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure, + sierra::nalu::ScalarFieldType* nodalPressureField, + const sierra::nalu::VectorFieldType* coordField) { const int nDim = 3; const stk::mesh::Entity* elemNodes = bulkData.begin_nodes(elem); @@ -234,9 +233,9 @@ class TestElemAlgorithmWithTemplate public: TestElemAlgorithmWithTemplate( stk::mesh::BulkData& bulk, - const VectorFieldType* coord, - ScalarFieldType* discreteLaplacian, - ScalarFieldType* nodalPressure) + const sierra::nalu::VectorFieldType* coord, + sierra::nalu::ScalarFieldType* discreteLaplacian, + sierra::nalu::ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -292,9 +291,9 @@ public: private: stk::mesh::BulkData& bulkData_; - ScalarFieldType* discreteLaplacianOfPressure; - ScalarFieldType* nodalPressureField; - const VectorFieldType* coordField; + sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; + sierra::nalu::ScalarFieldType* nodalPressureField; + const sierra::nalu::VectorFieldType* coordField; }; //=========== Test class that mimics an element algorithm ============== @@ -305,9 +304,9 @@ class TestElemAlgorithmWithViews public: TestElemAlgorithmWithViews( stk::mesh::BulkData& bulk, - const VectorFieldType* coord, - ScalarFieldType* discreteLaplacian, - ScalarFieldType* nodalPressure) + const sierra::nalu::VectorFieldType* coord, + sierra::nalu::ScalarFieldType* discreteLaplacian, + sierra::nalu::ScalarFieldType* nodalPressure) : bulkData_(bulk), discreteLaplacianOfPressure(discreteLaplacian), nodalPressureField(nodalPressure), @@ -413,9 +412,9 @@ public: private: stk::mesh::BulkData& bulkData_; - ScalarFieldType* discreteLaplacianOfPressure; - ScalarFieldType* nodalPressureField; - const VectorFieldType* coordField; + sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; + sierra::nalu::ScalarFieldType* nodalPressureField; + const sierra::nalu::VectorFieldType* coordField; }; //========= below are the test 'main's... =============== diff --git a/unit_tests/UnitTestLidarLOS.C b/unit_tests/UnitTestLidarLOS.C index ca90aaa06..e459963b7 100644 --- a/unit_tests/UnitTestLidarLOS.C +++ b/unit_tests/UnitTestLidarLOS.C @@ -94,6 +94,7 @@ public: bulk(*bulkptr), meta(bulk.mesh_meta_data()) { + meta.use_simple_fields(); stk::io::StkMeshIoBroker io(bulk.parallel()); io.set_bulk_data(bulk); @@ -106,11 +107,12 @@ 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); + 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); 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 cd5b34e13..75585916e 100644 --- a/unit_tests/UnitTestMasterElements.C +++ b/unit_tests/UnitTestMasterElements.C @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -36,7 +35,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) @@ -562,6 +561,7 @@ 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 e9918277e..acac3dbc4 100644 --- a/unit_tests/UnitTestMetricTensor.C +++ b/unit_tests/UnitTestMetricTensor.C @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -60,7 +59,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) @@ -71,6 +70,7 @@ 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,6 +136,7 @@ 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 f149674f1..8dc820f86 100644 --- a/unit_tests/UnitTestMijTensor.C +++ b/unit_tests/UnitTestMijTensor.C @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -53,7 +52,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) @@ -65,6 +64,7 @@ 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,6 +132,7 @@ 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 ecb7834de..29d5fed73 100644 --- a/unit_tests/UnitTestMovingAverage.C +++ b/unit_tests/UnitTestMovingAverage.C @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -33,11 +32,12 @@ 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; - ScalarFieldType* temperature_; - ScalarFieldType* raTemperature_; + sierra::nalu::ScalarFieldType* temperature_; + sierra::nalu::ScalarFieldType* raTemperature_; }; } // namespace diff --git a/unit_tests/UnitTestNgpMesh1.C b/unit_tests/UnitTestNgpMesh1.C index a01fb27b2..040b54e11 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, - VectorFieldType* velocity, - GenericFieldType* massFlowRate) + sierra::nalu::VectorFieldType* velocity, + sierra::nalu::GenericFieldType* massFlowRate) { const stk::mesh::MetaData& meta = bulk.mesh_meta_data(); stk::mesh::Selector all_local = @@ -156,14 +156,10 @@ 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 09bd83e3e..a9c043902 100644 --- a/unit_tests/UnitTestRealm.C +++ b/unit_tests/UnitTestRealm.C @@ -187,6 +187,7 @@ 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); @@ -196,7 +197,7 @@ NaluTest::create_realm( void verify_field_values( double expectedValue, - ScalarFieldType* maxLengthScaleField, + sierra::nalu::ScalarFieldType* maxLengthScaleField, const stk::mesh::BulkData& mesh) { const stk::mesh::BucketVector& nodeBuckets = @@ -229,8 +230,8 @@ TEST(NaluMock, test_nalu_mock) sierra::nalu::Realm& realm = naluObj.create_realm(realm_node); // 4. Create necessary fields... - ScalarFieldType& maxLengthScaleField = - realm.meta_data().declare_field( + sierra::nalu::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 c9649ab15..45a2b2ca4 100644 --- a/unit_tests/UnitTestSideIsInElement.C +++ b/unit_tests/UnitTestSideIsInElement.C @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -24,7 +23,7 @@ #include "UnitTestUtils.h" namespace { -using VectorFieldType = stk::mesh::Field; +using VectorFieldType = stk::mesh::Field; void randomly_perturb_element_coords( @@ -77,6 +76,7 @@ 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 aa1d179df..e258cf904 100644 --- a/unit_tests/UnitTestSidePCoords.C +++ b/unit_tests/UnitTestSidePCoords.C @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -41,13 +40,14 @@ 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 b9da728e3..eee3d6651 100644 --- a/unit_tests/UnitTestSideWriter.C +++ b/unit_tests/UnitTestSideWriter.C @@ -20,13 +20,12 @@ 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( @@ -34,6 +33,8 @@ 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); @@ -47,7 +48,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) @@ -59,8 +60,7 @@ 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 \ No newline at end of file +} // namespace sierra diff --git a/unit_tests/UnitTestSingleHexPromotion.C b/unit_tests/UnitTestSingleHexPromotion.C index 8a5aab6f4..aff775d99 100644 --- a/unit_tests/UnitTestSingleHexPromotion.C +++ b/unit_tests/UnitTestSingleHexPromotion.C @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -72,8 +71,8 @@ fill_and_promote_hex_mesh( io.populate_bulk_data(); stk::mesh::create_exposed_block_boundary_sides(bulk, *blockPart, {surfPart}); - VectorFieldType* coords = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::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) { @@ -91,8 +90,8 @@ dump_promoted_mesh_file(stk::mesh::BulkData& bulk, int polyOrder) std::string fileName = "out.e"; auto desc = sierra::nalu::HexNElementDescription(polyOrder); - VectorFieldType* coordField = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::VectorFieldType* coordField = + meta.get_field(stk::topology::NODE_RANK, "coordinates"); sierra::nalu::PromotedElementIO io( polyOrder, meta, bulk, outParts, fileName, *coordField); @@ -127,6 +126,7 @@ 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); - VectorFieldType* coordField = - meta.get_field(stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::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 7a0d10b75..c44a1c502 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 0fd418478..fa689db5b 100644 --- a/unit_tests/UnitTestSpinnerLidarPattern.C +++ b/unit_tests/UnitTestSpinnerLidarPattern.C @@ -70,6 +70,7 @@ 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); @@ -82,11 +83,10 @@ 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); + auto& vel_field = meta.declare_field(node_rank, "velocity", 2); + stk::mesh::put_field_on_entire_mesh(vel_field, meta.spatial_dimension()); 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 0ae19590d..7503b6827 100644 --- a/unit_tests/UnitTestSuppAlgDataSharing.C +++ b/unit_tests/UnitTestSuppAlgDataSharing.C @@ -4,7 +4,6 @@ #include #include -#include #include #include #include @@ -49,14 +48,11 @@ 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 = @@ -106,12 +102,12 @@ public: } private: - const ScalarFieldType* nodalScalarField; - const GenericFieldType* nodalVectorField; - const TensorFieldType* nodalTensorField; - const ScalarFieldType* elemScalarField; - const GenericFieldType* elemVectorField; - const GenericFieldType* elemTensorField; + 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; }; //=========== Test class that mimics an alg with supplemental algs ======== @@ -206,14 +202,14 @@ TEST_F(Hex8Mesh, supp_alg_data_sharing) TEST_F(Hex8Mesh, inconsistent_field_requests) { - 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"); + 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"); const stk::mesh::Part& wholemesh = meta->universal_part(); diff --git a/unit_tests/UnitTestUtils.C b/unit_tests/UnitTestUtils.C index 28ee4864b..d70b28a45 100644 --- a/unit_tests/UnitTestUtils.C +++ b/unit_tests/UnitTestUtils.C @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -58,8 +57,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 VectorFieldType* coordField = - dynamic_cast(meta.coordinate_field()); + const sierra::nalu::VectorFieldType* coordField = + dynamic_cast(meta.coordinate_field()); ThrowRequire(coordField != nullptr); for (const auto* ib : @@ -138,12 +137,13 @@ create_one_element( } // set a coordinate field - 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); + auto& coordField = + meta.declare_field(stk::topology::NODE_RANK, "coordinates"); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, block_1, meta.spatial_dimension(), nullptr); + stk::mesh::put_field_on_mesh( + coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), + 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 VectorFieldType& coordField, - const ScalarFieldType& qField) + const sierra::nalu::VectorFieldType& coordField, + const sierra::nalu::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 VectorFieldType& coordField, - const ScalarFieldType& qField) + const sierra::nalu::VectorFieldType& coordField, + const sierra::nalu::ScalarFieldType& qField) { // q = a + b^T x + 1/2 x^T H x std::mt19937 rng; @@ -588,24 +588,21 @@ 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 a9b6d927f..d2cd03ac2 100644 --- a/unit_tests/UnitTestUtils.h +++ b/unit_tests/UnitTestUtils.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include @@ -29,14 +29,7 @@ #include -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; +using IdFieldType = sierra::nalu::ScalarFieldType; namespace unit_test_utils { @@ -70,8 +63,8 @@ double global_norm( double initialize_quadratic_scalar_field( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordField, - const ScalarFieldType& qField); + const sierra::nalu::VectorFieldType& coordField, + const sierra::nalu::ScalarFieldType& qField); std::array random_rotation_matrix(int dim, std::mt19937& rng); std::array @@ -97,24 +90,23 @@ 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() {} @@ -135,7 +127,8 @@ 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( @@ -153,14 +146,14 @@ class Hex8Mesh : public ::testing::Test std::shared_ptr bulk; std::shared_ptr fieldManager; stk::topology topo; - VectorFieldType* elemCentroidField; - ScalarFieldType* nodalPressureField; - ScalarFieldType* discreteLaplacianOfPressure; - ScalarFieldType* scalarQ; - ScalarFieldType* diffFluxCoeff; + sierra::nalu::VectorFieldType* elemCentroidField; + sierra::nalu::ScalarFieldType* nodalPressureField; + sierra::nalu::ScalarFieldType* discreteLaplacianOfPressure; + sierra::nalu::ScalarFieldType* scalarQ; + sierra::nalu::ScalarFieldType* diffFluxCoeff; IdFieldType* idField; stk::mesh::PartVector partVec; - const VectorFieldType* coordField; + const sierra::nalu::VectorFieldType* coordField; double exactLaplacian; }; @@ -169,16 +162,16 @@ class Hex8MeshWithNSOFields : public Hex8Mesh protected: Hex8MeshWithNSOFields(); - GenericFieldType* massFlowRate; - GenericFieldType* Gju; - VectorFieldType* velocity; - VectorFieldType* dpdx; - GenericFieldType* exposedAreaVec; - ScalarFieldType* density; - ScalarFieldType* viscosity; - ScalarFieldType* pressure; - ScalarFieldType* udiag; - ScalarFieldType* dnvField; + 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; }; class Hex8ElementWithBCFields : public ::testing::Test @@ -197,48 +190,49 @@ 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::mesh::put_field_on_mesh(*density, meta->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh(*viscosity, meta->universal_part(), 1, &one); + 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( - *bcHeatFlux, meta->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh( - *specificHeat, meta->universal_part(), 1, nullptr); + *specificHeat, meta->universal_part(), nullptr); const sierra::nalu::MasterElement* meFC = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( @@ -255,14 +249,19 @@ 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(), 1, &one); - stk::mesh::put_field_on_mesh(*bcScalarQ, meta->universal_part(), 1, &one); + 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(*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); @@ -272,21 +271,21 @@ class Hex8ElementWithBCFields : public ::testing::Test stk::mesh::MetaData* meta; std::shared_ptr bulk; - 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; + 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; }; class CylinderMesh : public ::testing::Test @@ -306,71 +305,78 @@ 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(), 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); + *deflectionRamp_, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*dispMap_, meta->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *loadMapInterp_, meta->universal_part(), 1, nullptr); + *dispMapInterp_, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*loadMap_, meta->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *tforceSCS_, meta->universal_part(), 1, nullptr); + *loadMapInterp_, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*tforceSCS_, meta->universal_part(), 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(), 1, nullptr); + *div_mesh_velocity_, meta->universal_part(), nullptr); constexpr double one = 1.0; - 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); + 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); const sierra::nalu::MasterElement* meFC = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::QUAD_4); @@ -412,7 +418,8 @@ 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); @@ -435,7 +442,7 @@ class CylinderMesh : public ::testing::Test const double yfac = 2 * M_PI / yMax; auto nodeCoord = sierra::nalu::MakeSmartField()( - coordField); + const_cast(coordField)); for (const stk::mesh::Bucket* bptr : bkts) { for (stk::mesh::Entity node : *bptr) { @@ -453,25 +460,25 @@ class CylinderMesh : public ::testing::Test stk::mesh::MetaData* meta; std::shared_ptr bulk; stk::topology topo; - 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_; + 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_; }; class ABLWallFunctionHex8ElementWithBCFields : public Hex8ElementWithBCFields diff --git a/unit_tests/actuator/UnitTestActuatorFunctors.C b/unit_tests/actuator/UnitTestActuatorFunctors.C index cad2a3aee..749cd98d6 100644 --- a/unit_tests/actuator/UnitTestActuatorFunctors.C +++ b/unit_tests/actuator/UnitTestActuatorFunctors.C @@ -17,7 +17,6 @@ namespace sierra { namespace nalu { -using VectorFieldType = stk::mesh::Field; //----------------------------------------------------------------- @@ -157,10 +156,10 @@ protected: stk::mesh::MetaData* stkMeta_; std::shared_ptr stkBulk_; const double tol_; - const VectorFieldType* coordinates_{nullptr}; - VectorFieldType* velocity_{nullptr}; - VectorFieldType* actuatorForce_{nullptr}; - ScalarFieldType* dualNodalVolume_{nullptr}; + const sierra::nalu::VectorFieldType* coordinates_{nullptr}; + sierra::nalu::VectorFieldType* velocity_{nullptr}; + sierra::nalu::VectorFieldType* actuatorForce_{nullptr}; + sierra::nalu::ScalarFieldType* dualNodalVolume_{nullptr}; ActuatorFunctorTests() : tol_(1e-8), coordinates_(nullptr) { @@ -168,20 +167,25 @@ 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(), 1, nullptr); + *dualNodalVolume_, stkMeta_->universal_part(), nullptr); stk::mesh::field_fill(1.0, *dualNodalVolume_); } @@ -189,8 +193,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 = @@ -279,7 +283,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 = (double*)stk::mesh::field_data(*actuatorForce_, node); + double* actSource = 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 d5503fa58..2895b4828 100644 --- a/unit_tests/actuator/UnitTestActuatorSearch.C +++ b/unit_tests/actuator/UnitTestActuatorSearch.C @@ -38,6 +38,7 @@ public: nx("nx"), slabSize(4) { + ioBroker.use_simple_fields(); } void SetUp() @@ -99,10 +100,9 @@ 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 04d9948d7..c5b8e9e99 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 = reinterpret_cast( - stk::mesh::field_data(*nodeCoordField, *bptr)); + const double* nodeCoords = + static_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 stk::mesh::FieldTraits::data_type; + using DataType = typename FieldType::value_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 stk::mesh::FieldTraits::data_type scalar) + typename FieldType::value_type scalar) { - using DataType = typename stk::mesh::FieldTraits::data_type; + using DataType = typename FieldType::value_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 612732a9c..3eaabf3a0 100644 --- a/unit_tests/algorithms/UnitTestAlgorithm.C +++ b/unit_tests/algorithms/UnitTestAlgorithm.C @@ -23,13 +23,14 @@ 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 ScalarFieldType& field, stk::mesh::Selector* selector) + const sierra::nalu::ScalarFieldType& field, stk::mesh::Selector* selector) { auto& meta = this->meta(); @@ -53,11 +54,8 @@ 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_ }, @@ -82,21 +80,17 @@ 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 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); + [&](auto fld) { + using from_field = decltype(fld); + if constexpr (std::is_same_v) { + *Field.second = fld; + } }, - Field.second); + new_field); } } diff --git a/unit_tests/algorithms/UnitTestAlgorithm.h b/unit_tests/algorithms/UnitTestAlgorithm.h index f2e1dd815..54f87c163 100644 --- a/unit_tests/algorithms/UnitTestAlgorithm.h +++ b/unit_tests/algorithms/UnitTestAlgorithm.h @@ -60,7 +60,8 @@ class TestAlgorithm : public ::testing::Test inline stk::mesh::BulkData& bulk() const { return realm().bulk_data(); } double field_norm( - const ScalarFieldType& field, stk::mesh::Selector* selector = nullptr); + const sierra::nalu::ScalarFieldType& field, + stk::mesh::Selector* selector = nullptr); //! Reference to test Nalu instance used to hold Simulation and Realm std::unique_ptr naluObj_; @@ -69,7 +70,7 @@ class TestAlgorithm : public ::testing::Test sierra::nalu::Realm* realm_{nullptr}; stk::mesh::Part* meshPart_{nullptr}; - const VectorFieldType* coordinates_{nullptr}; + const sierra::nalu::VectorFieldType* coordinates_{nullptr}; stk::ParallelMachine comm_; }; @@ -85,25 +86,25 @@ class TestTurbulenceAlgorithm : public TestAlgorithm virtual void fill_mesh_and_init_fields(const std::string mesh_spec = "generated:10x10x10"); - 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}; + 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}; }; struct NodeSuppHelper diff --git a/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C b/unit_tests/algorithms/UnitTestMomentumBoussinesqSrcNodeSuppAlg.C index 0a902fbb8..b0dcccfa6 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(), 1, nullptr); + auto& dnv = + meta.declare_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + stk::mesh::put_field_on_mesh(dnv, 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); + auto& temperature = + meta.declare_field(stk::topology::NODE_RANK, "temperature"); + stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), nullptr); meta.commit(); @@ -83,21 +83,20 @@ 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(), 1, nullptr); + auto& dnv = + meta.declare_field(stk::topology::NODE_RANK, "dual_nodal_volume"); + stk::mesh::put_field_on_mesh(dnv, 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); + auto& temperature = + meta.declare_field(stk::topology::NODE_RANK, "temperature"); + stk::mesh::put_field_on_mesh(temperature, meta.universal_part(), 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(), 1, nullptr); + auto& raTemperature = + meta.declare_field(stk::topology::NODE_RANK, avgTempFieldName); + stk::mesh::put_field_on_mesh(raTemperature, meta.universal_part(), nullptr); meta.commit(); diff --git a/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C b/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C index f38051bb9..a0b36252b 100644 --- a/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C +++ b/unit_tests/edge_kernels/UnitTestScalarAdvDiffEdge.C @@ -219,10 +219,8 @@ 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 = - static_cast(stk::mesh::field_data(*viscosity_, node)); - const double* data2 = - static_cast(stk::mesh::field_data(*mixFraction_, node)); + const double* data1 = stk::mesh::field_data(*viscosity_, node); + const double* data2 = 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 7c9acbc85..a6c728226 100644 --- a/unit_tests/gcl/UnitTestGCL.h +++ b/unit_tests/gcl/UnitTestGCL.h @@ -34,47 +34,54 @@ 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::mesh::put_field_on_mesh(*dualVol_, meta_.universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh(*elemVol_, meta_.universal_part(), 1, 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( *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); @@ -82,12 +89,11 @@ class GCLTest : public ::testing::Test *faceVelMag_, meta_.universal_part(), sierra::nalu::AlgTraitsHex8::numScsIp_, nullptr); stk::mesh::put_field_on_mesh( - *edgeSweptVol_, meta_.universal_part(), 1, nullptr); + *edgeSweptVol_, meta_.universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *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); + *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); } virtual ~GCLTest() = default; @@ -105,8 +111,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()); @@ -289,20 +295,20 @@ class GCLTest : public ::testing::Test stk::mesh::PartVector partVec_; stk::mesh::PartVector bndyPartVec_; - 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}; + 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}; }; } // namespace diff --git a/unit_tests/gcl/UnitTestMeshVelocityAlg.C b/unit_tests/gcl/UnitTestMeshVelocityAlg.C index 6c7a455d2..18b929eae 100644 --- a/unit_tests/gcl/UnitTestMeshVelocityAlg.C +++ b/unit_tests/gcl/UnitTestMeshVelocityAlg.C @@ -76,28 +76,34 @@ 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); - VectorFieldType* meshDisp_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); + 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); - VectorFieldType* cCoords_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); + 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); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - GenericFieldType* sweptVolume_ = &(meta_->declare_field( + sierra::nalu::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); - GenericFieldType* faceVelMag_ = &(meta_->declare_field( + sierra::nalu::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(), @@ -134,10 +140,11 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_x_rot) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - VectorFieldType* meshDispNp1 = + sierra::nalu::VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); - VectorFieldType* meshDispNm1 = + sierra::nalu::VectorFieldType* meshDispN = + &(meshDisp_->field_of_state(stk::mesh::StateN)); + sierra::nalu::VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { @@ -209,28 +216,34 @@ 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); - VectorFieldType* meshDisp_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); + 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); - VectorFieldType* cCoords_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); + 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); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - GenericFieldType* sweptVolume_ = &(meta_->declare_field( + sierra::nalu::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); - GenericFieldType* faceVelMag_ = &(meta_->declare_field( + sierra::nalu::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(), @@ -267,10 +280,11 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - VectorFieldType* meshDispNp1 = + sierra::nalu::VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); - VectorFieldType* meshDispNm1 = + sierra::nalu::VectorFieldType* meshDispN = + &(meshDisp_->field_of_state(stk::mesh::StateN)); + sierra::nalu::VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { @@ -342,28 +356,34 @@ 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); - VectorFieldType* meshDisp_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* meshDisp_ = &(meta_->declare_field( stk::topology::NODE_RANK, "mesh_displacement", 3)); - stk::mesh::put_field_on_mesh(*meshDisp_, meta_->universal_part(), nullptr); + 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); - VectorFieldType* cCoords_ = &(meta_->declare_field( + sierra::nalu::VectorFieldType* cCoords_ = &(meta_->declare_field( stk::topology::NODE_RANK, "current_coordinates")); - stk::mesh::put_field_on_mesh(*cCoords_, meta_->universal_part(), nullptr); + 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); const auto& meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element_on_host( stk::topology::HEX_8); - GenericFieldType* sweptVolume_ = &(meta_->declare_field( + sierra::nalu::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); - GenericFieldType* faceVelMag_ = &(meta_->declare_field( + sierra::nalu::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(), @@ -400,10 +420,11 @@ TEST_F(TestKernelHex8Mesh, mesh_velocity_y_rot_scs_center) YAML::Node rotNode = YAML::Load(rotInfo); sierra::nalu::MotionRotationKernel rotClass(rotNode); - VectorFieldType* meshDispNp1 = + sierra::nalu::VectorFieldType* meshDispNp1 = &(meshDisp_->field_of_state(stk::mesh::StateNP1)); - VectorFieldType* meshDispN = &(meshDisp_->field_of_state(stk::mesh::StateN)); - VectorFieldType* meshDispNm1 = + sierra::nalu::VectorFieldType* meshDispN = + &(meshDisp_->field_of_state(stk::mesh::StateN)); + sierra::nalu::VectorFieldType* meshDispNm1 = &(meshDisp_->field_of_state(stk::mesh::StateNM1)); { diff --git a/unit_tests/kernels/UnitTestFaceBasic.C b/unit_tests/kernels/UnitTestFaceBasic.C index b9e7cbf23..d9a7b036b 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, - ScalarFieldType* scalarQ, + sierra::nalu::ScalarFieldType* scalarQ, sierra::nalu::ElemDataRequests& dataNeeded) : numTimesExecuted_(0), topo_(topo), scalarQ_(scalarQ) { @@ -37,7 +37,7 @@ public: private: stk::topology topo_; - ScalarFieldType* scalarQ_; + sierra::nalu::ScalarFieldType* scalarQ_; }; #ifndef KOKKOS_ENABLE_GPU diff --git a/unit_tests/kernels/UnitTestKernelUtils.C b/unit_tests/kernels/UnitTestKernelUtils.C index 9e6b3d70e..0b96c4dcf 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 VectorFieldType& coordinates, + const sierra::nalu::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 VectorFieldType& coordinates, - VectorFieldType& velocity) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - TensorFieldType& dudx) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& pressure) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - VectorFieldType& dpdx) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& temperature) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& density) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& tke) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& alpha) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - VectorFieldType& dkdx) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& sdr) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& tdr) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - VectorFieldType& dwdx) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& turbulent_viscosity) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - GenericFieldType& mutij) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& sst_f_one_blending) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& iddes_rans_indicator) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& minimum_distance_to_wall) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& coordinates, - ScalarFieldType& dplus) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 ScalarFieldType& mixFraction, - ScalarFieldType& property, + const sierra::nalu::ScalarFieldType& mixFraction, + sierra::nalu::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 ScalarFieldType& mixFraction, - ScalarFieldType& property, + const sierra::nalu::ScalarFieldType& mixFraction, + sierra::nalu::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 VectorFieldType& coordinates, - const ScalarFieldType& mixtureFrac, + const sierra::nalu::VectorFieldType& coordinates, + const sierra::nalu::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 VectorFieldType& coordinates, - VectorFieldType& dhdx) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::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 VectorFieldType& velocity, - const ScalarFieldType& density, - const VectorFieldType& edgeAreaVec, - ScalarFieldType& massFlowRate) + const sierra::nalu::VectorFieldType& velocity, + const sierra::nalu::ScalarFieldType& density, + const sierra::nalu::VectorFieldType& edgeAreaVec, + sierra::nalu::ScalarFieldType& massFlowRate) { const auto& meta = bulk.mesh_meta_data(); const int ndim = meta.spatial_dimension(); EXPECT_EQ(ndim, 3); - const ScalarFieldType& densityNp1 = + const sierra::nalu::ScalarFieldType& densityNp1 = density.field_of_state(stk::mesh::StateNP1); - const VectorFieldType& velocityNp1 = + const sierra::nalu::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 VectorFieldType& coordinates, - const ScalarFieldType& density, - const VectorFieldType& velocity, - const GenericFieldType& massFlowRate) + const sierra::nalu::VectorFieldType& coordinates, + const sierra::nalu::ScalarFieldType& density, + const sierra::nalu::VectorFieldType& velocity, + const sierra::nalu::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 VectorFieldType& coordinates, - const ScalarFieldType& density, - const VectorFieldType& velocity, - const GenericFieldType& exposedAreaVec, - const GenericFieldType& massFlowRate) + 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) { 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 VectorFieldType& coordinates, - const VectorFieldType& edgeAreaVec) + const sierra::nalu::VectorFieldType& coordinates, + const sierra::nalu::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 VectorFieldType& coordinates, - GenericFieldType& exposedAreaVec) + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::GenericFieldType& exposedAreaVec) { using Quad4Traits = sierra::nalu::AlgTraitsQuad4; using ElemSimdDataType = diff --git a/unit_tests/kernels/UnitTestKernelUtils.h b/unit_tests/kernels/UnitTestKernelUtils.h index 455570ecc..6ad10f321 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 VectorFieldType& coordinates, - VectorFieldType& velocity); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::VectorFieldType& velocity); void dudx_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - TensorFieldType& dudx); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::TensorFieldType& dudx); void pressure_test_function( const stk::mesh::BulkData&, - const VectorFieldType& coordinates, - ScalarFieldType& pressure); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& pressure); void dpdx_test_function( const stk::mesh::BulkData&, - const VectorFieldType& coordinates, - VectorFieldType& dpdx); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::VectorFieldType& dpdx); void temperature_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& temperature); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& temperature); void density_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& density); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& density); void tke_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& tke); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& tke); void alpha_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& alpha); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& alpha); void dkdx_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - VectorFieldType& dkdx); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::VectorFieldType& dkdx); void sdr_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& sdr); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& sdr); void tdr_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& tdr); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& tdr); void dwdx_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - VectorFieldType& dwdx); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::VectorFieldType& dwdx); void turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& turbulent_viscosity); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& turbulent_viscosity); void tensor_turbulent_viscosity_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - GenericFieldType& mutij); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::GenericFieldType& mutij); void sst_f_one_blending_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& sst_f_one_blending); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& sst_f_one_blending); void iddes_rans_indicator_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& iddes_rans_indicator); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& iddes_rans_indicator); void minimum_distance_to_wall_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& minimum_distance_to_wall); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& minimum_distance_to_wall); void dplus_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - ScalarFieldType& dplus); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::ScalarFieldType& dplus); void property_from_mixture_fraction_test_function( const stk::mesh::BulkData&, - const ScalarFieldType& mixFraction, - ScalarFieldType& property, + const sierra::nalu::ScalarFieldType& mixFraction, + sierra::nalu::ScalarFieldType& property, const double primary, const double secondary); void inverse_property_from_mixture_fraction_test_function( const stk::mesh::BulkData&, - const ScalarFieldType& mixFraction, - ScalarFieldType& property, + const sierra::nalu::ScalarFieldType& mixFraction, + sierra::nalu::ScalarFieldType& property, const double primary, const double secondary); void mixture_fraction_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - const ScalarFieldType& mixFrac, + const sierra::nalu::VectorFieldType& coordinates, + const sierra::nalu::ScalarFieldType& mixFrac, const double znot, const double amf); void dhdx_test_function( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordinates, - VectorFieldType& dhdx); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::VectorFieldType& dhdx); void calc_edge_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const VectorFieldType& coordinates, - const VectorFieldType& edgeAreaVec); + const sierra::nalu::VectorFieldType& coordinates, + const sierra::nalu::VectorFieldType& edgeAreaVec); void calc_exposed_area_vec( const stk::mesh::BulkData& bulk, const stk::topology& topo, - const VectorFieldType& coordinates, - GenericFieldType& exposedAreaVec); + const sierra::nalu::VectorFieldType& coordinates, + sierra::nalu::GenericFieldType& exposedAreaVec); void calc_mass_flow_rate( const stk::mesh::BulkData&, - const VectorFieldType&, - const ScalarFieldType&, - const VectorFieldType&, - ScalarFieldType&); + const sierra::nalu::VectorFieldType&, + const sierra::nalu::ScalarFieldType&, + const sierra::nalu::VectorFieldType&, + sierra::nalu::ScalarFieldType&); void calc_mass_flow_rate_scs( stk::mesh::BulkData&, const stk::topology&, - const VectorFieldType&, - const ScalarFieldType&, - const VectorFieldType&, - const GenericFieldType&); + const sierra::nalu::VectorFieldType&, + const sierra::nalu::ScalarFieldType&, + const sierra::nalu::VectorFieldType&, + const sierra::nalu::GenericFieldType&); void calc_open_mass_flow_rate( stk::mesh::BulkData& bulk, const stk::topology& topo, - const VectorFieldType& coordinates, - const ScalarFieldType& density, - const VectorFieldType& velocity, - const GenericFieldType& exposedAreaVec, - const GenericFieldType& massFlowRate); + 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); void expect_all_near( const Kokkos::View& calcValue, @@ -260,34 +260,36 @@ 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(), 1, nullptr); + *naluGlobalId_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *tpetGlobalId_, meta_->universal_part(), 1, nullptr); + *tpetGlobalId_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*dnvField_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *dnvField_, meta_->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh( - *divMeshVelField_, meta_->universal_part(), 1, nullptr); + *divMeshVelField_, meta_->universal_part(), 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(), 1, nullptr); + *elementVolume_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *exposedAreaVec_, meta_->universal_part(), spatialDim_ * sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -309,8 +311,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); @@ -337,14 +339,14 @@ class TestKernelHex8Mesh : public ::testing::Test #endif using TpetIDFieldType = stk::mesh::Field; - const VectorFieldType* coordinates_{nullptr}; - GlobalIdFieldType* naluGlobalId_{nullptr}; + const sierra::nalu::VectorFieldType* coordinates_{nullptr}; + sierra::nalu::GlobalIdFieldType* naluGlobalId_{nullptr}; TpetIDFieldType* tpetGlobalId_{nullptr}; - ScalarFieldType* dnvField_{nullptr}; - ScalarFieldType* divMeshVelField_{nullptr}; - VectorFieldType* edgeAreaVec_{nullptr}; - ScalarFieldType* elementVolume_{nullptr}; - GenericFieldType* exposedAreaVec_{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}; }; /** Test Fixture for Low-Mach Kernels @@ -360,32 +362,34 @@ 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::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::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( *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); @@ -410,13 +414,13 @@ class LowMachKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *coordinates_, *velocityBC_); } - VectorFieldType* velocity_{nullptr}; - VectorFieldType* dpdx_{nullptr}; - ScalarFieldType* density_{nullptr}; - ScalarFieldType* pressure_{nullptr}; - ScalarFieldType* Udiag_{nullptr}; - VectorFieldType* velocityBC_{nullptr}; - GenericFieldType* dynP_{nullptr}; + 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}; }; class ContinuityKernelHex8Mesh : public LowMachKernelHex8Mesh @@ -424,13 +428,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(), 1, nullptr); + *pressureBC_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *dynP_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -448,8 +452,8 @@ class ContinuityKernelHex8Mesh : public LowMachKernelHex8Mesh } private: - ScalarFieldType* pressureBC_{nullptr}; - GenericFieldType* dynP_{nullptr}; + sierra::nalu::ScalarFieldType* pressureBC_{nullptr}; + sierra::nalu::GenericFieldType* dynP_{nullptr}; }; // Provide separate namespace for Edge kernel tests @@ -466,19 +470,18 @@ 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 = @@ -487,12 +490,13 @@ 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(), 1, nullptr); + stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), 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(), 1, nullptr); + *temperature_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *openMassFlowRate_, meta_->universal_part(), sierra::nalu::AlgTraitsQuad4::numScsIp_, nullptr); @@ -501,6 +505,8 @@ 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() {} @@ -522,13 +528,13 @@ class MomentumKernelHex8Mesh : public LowMachKernelHex8Mesh *exposedAreaVec_, *openMassFlowRate_); } - GenericFieldType* massFlowRate_{nullptr}; - ScalarFieldType* viscosity_{nullptr}; - TensorFieldType* dudx_{nullptr}; - ScalarFieldType* temperature_{nullptr}; - GenericFieldType* openMassFlowRate_{nullptr}; - GenericFieldType* dynP_{nullptr}; - VectorFieldType* openVelocityBC_{nullptr}; + 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}; }; // Provide separate namespace for Edge kernel tests @@ -537,19 +543,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(), 1, nullptr); + *pecletFactor_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *ablWallNodeMask_, meta_->universal_part(), 1, nullptr); + *ablWallNodeMask_, meta_->universal_part(), nullptr); } virtual ~MomentumEdgeHex8Mesh() = default; @@ -566,10 +572,10 @@ class MomentumEdgeHex8Mesh : public MomentumKernelHex8Mesh ablWallNodeMask_->sync_to_device(); } - ScalarFieldType* massFlowRateEdge_{nullptr}; - ScalarFieldType* pecletFactor_{nullptr}; - ScalarFieldType* maxPecletFactor_{nullptr}; - ScalarFieldType* ablWallNodeMask_{nullptr}; + sierra::nalu::ScalarFieldType* massFlowRateEdge_{nullptr}; + sierra::nalu::ScalarFieldType* pecletFactor_{nullptr}; + sierra::nalu::ScalarFieldType* maxPecletFactor_{nullptr}; + sierra::nalu::ScalarFieldType* ablWallNodeMask_{nullptr}; }; class MomentumABLKernelHex8Mesh : public MomentumKernelHex8Mesh @@ -577,33 +583,34 @@ 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(), 1, nullptr); + *bcHeatFlux_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *specificHeat_, meta_->universal_part(), 1, nullptr); + *specificHeat_, meta_->universal_part(), 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(), 1, nullptr); + stk::mesh::put_field_on_mesh(*tGradBC_, meta_->universal_part(), nullptr); } virtual ~MomentumABLKernelHex8Mesh() = default; @@ -644,12 +651,12 @@ class MomentumABLKernelHex8Mesh : public MomentumKernelHex8Mesh tGradBC_->sync_to_device(); } - VectorFieldType* wallVelocityBC_{nullptr}; - ScalarFieldType* bcHeatFlux_{nullptr}; - ScalarFieldType* specificHeat_{nullptr}; - ScalarFieldType* wallFricVel_{nullptr}; - ScalarFieldType* wallNormDist_{nullptr}; - ScalarFieldType* tGradBC_{nullptr}; + 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}; const double z0_{0.1}; const double zh_{0.25}; @@ -669,21 +676,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(), 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); + *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); stk::mesh::put_field_on_mesh( - *heatFluxBC_, meta_->universal_part(), 1, nullptr); + *heatFluxBC_, meta_->universal_part(), nullptr); } virtual ~EnthalpyABLKernelHex8Mesh() {} @@ -699,10 +706,10 @@ class EnthalpyABLKernelHex8Mesh : public MomentumABLKernelHex8Mesh stk::mesh::field_fill(100.0, *heatFluxBC_); } - ScalarFieldType* thermalCond_{nullptr}; - ScalarFieldType* evisc_{nullptr}; - ScalarFieldType* tvisc_{nullptr}; - ScalarFieldType* heatFluxBC_{nullptr}; + sierra::nalu::ScalarFieldType* thermalCond_{nullptr}; + sierra::nalu::ScalarFieldType* evisc_{nullptr}; + sierra::nalu::ScalarFieldType* tvisc_{nullptr}; + sierra::nalu::ScalarFieldType* heatFluxBC_{nullptr}; }; /** Test Fixture for the SST Kernels @@ -713,63 +720,62 @@ 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(), 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(*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( - *maxLengthScale_, meta_->universal_part(), 1, nullptr); + *maxLengthScale_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *minDistance_, meta_->universal_part(), 1, nullptr); + *minDistance_, meta_->universal_part(), 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( - *iddes_rans_indicator_, meta_->universal_part(), 1, nullptr); + *iddes_rans_indicator_, meta_->universal_part(), 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; @@ -778,14 +784,13 @@ 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( - *sdrWallbc_, meta_->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh( - *sdrWallArea_, meta_->universal_part(), 1, nullptr); + *sdrWallArea_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *wallFricVel_, meta_->universal_part(), 4, nullptr); stk::mesh::put_field_on_mesh( - *pecletFactor_, meta_->universal_part(), 1, nullptr); + *pecletFactor_, meta_->universal_part(), nullptr); } virtual ~SSTKernelHex8Mesh() {} @@ -814,25 +819,25 @@ class SSTKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *pecletFactor_); } - 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}; + 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}; }; /** Test Fixture for the KE Kernels @@ -843,30 +848,31 @@ 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(), 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(*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( - *minDistance_, meta_->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh(*dplus_, meta_->universal_part(), 1, nullptr); + *minDistance_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*dplus_, meta_->universal_part(), 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() {} @@ -888,13 +894,13 @@ class KEKernelHex8Mesh : public LowMachKernelHex8Mesh unit_test_kernel_utils::dudx_test_function(*bulk_, *coordinates_, *dudx_); } - ScalarFieldType* tke_{nullptr}; - ScalarFieldType* tdr_{nullptr}; - ScalarFieldType* visc_{nullptr}; - ScalarFieldType* tvisc_{nullptr}; - ScalarFieldType* minDistance_{nullptr}; - ScalarFieldType* dplus_{nullptr}; - TensorFieldType* dudx_{nullptr}; + 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}; }; /** Test Fixture for the KO Kernels @@ -905,35 +911,36 @@ 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(), 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(*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( - *minDistance_, meta_->universal_part(), 1, nullptr); + *minDistance_, meta_->universal_part(), 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() {} @@ -956,14 +963,14 @@ class KOKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *dwdx_); } - ScalarFieldType* tke_{nullptr}; - ScalarFieldType* sdr_{nullptr}; - ScalarFieldType* visc_{nullptr}; - ScalarFieldType* tvisc_{nullptr}; - ScalarFieldType* minDistance_{nullptr}; - TensorFieldType* dudx_{nullptr}; - VectorFieldType* dkdx_{nullptr}; - VectorFieldType* dwdx_{nullptr}; + 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}; }; /** Test Fixture for the Turbulence Kernels @@ -974,72 +981,70 @@ 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( - *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); + *minDistance_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *dudx_, meta_->universal_part(), spatialDim_ * spatialDim_, 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::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( - *fOneBlend_, meta_->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh(*evisc_, meta_->universal_part(), 1, nullptr); + *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); stk::mesh::put_field_on_mesh( - *dualNodalVolume_, meta_->universal_part(), 1, nullptr); + *dualNodalVolume_, meta_->universal_part(), 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(), 1, nullptr); + *specificHeat_, meta_->universal_part(), 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( - *wallArea_, meta_->universal_part(), 1, nullptr); - stk::mesh::put_field_on_mesh( - *wallNormDist_, meta_->universal_part(), 1, nullptr); + *wallNormDist_, meta_->universal_part(), nullptr); } virtual ~KsgsKernelHex8Mesh() = default; @@ -1077,23 +1082,23 @@ class KsgsKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(1000.0, *specificHeat_); } - 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}; + 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}; }; /** Test Fixture for the AMS Kernels @@ -1104,70 +1109,73 @@ 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(), 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(*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( *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(), 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); + *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); stk::mesh::put_field_on_mesh( *Mij_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); - stk::mesh::put_field_on_mesh( - *fOneBlend_, meta_->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(*fOneBlend_, meta_->universal_part(), 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() {} @@ -1199,23 +1207,23 @@ class AMSKernelHex8Mesh : public LowMachKernelHex8Mesh stk::mesh::field_fill(0.0, *forcingComp_); } - 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}; + 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}; }; /** Test Fixture for the hybrid turbulence Kernels @@ -1226,15 +1234,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(), 1, nullptr); - stk::mesh::put_field_on_mesh(*alpha_, meta_->universal_part(), 1, nullptr); + 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( *mutij_, meta_->universal_part(), spatialDim_ * spatialDim_, nullptr); } @@ -1256,9 +1264,9 @@ class HybridTurbKernelHex8Mesh : public LowMachKernelHex8Mesh * *alpha_); */ } - ScalarFieldType* tke_{nullptr}; - ScalarFieldType* alpha_{nullptr}; - GenericFieldType* mutij_{nullptr}; + sierra::nalu::ScalarFieldType* tke_{nullptr}; + sierra::nalu::ScalarFieldType* alpha_{nullptr}; + sierra::nalu::GenericFieldType* mutij_{nullptr}; }; /** Text fixture for heat conduction equation kernels @@ -1274,15 +1282,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(), 1, nullptr); + *temperature_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *thermalCond_, meta_->universal_part(), 1, nullptr); + *thermalCond_, meta_->universal_part(), nullptr); } virtual void fill_mesh_and_init_fields( @@ -1295,8 +1303,8 @@ class HeatCondKernelHex8Mesh : public TestKernelHex8Mesh stk::mesh::field_fill(1.0, *thermalCond_); } - ScalarFieldType* temperature_{nullptr}; - ScalarFieldType* thermalCond_{nullptr}; + sierra::nalu::ScalarFieldType* temperature_{nullptr}; + sierra::nalu::ScalarFieldType* thermalCond_{nullptr}; }; /** Text fixture for mixture fraction equation kernels @@ -1312,25 +1320,23 @@ 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), @@ -1345,13 +1351,11 @@ 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(), 1, nullptr); + *mixFraction_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *velocity_, meta_->universal_part(), spatialDim_, 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(*density_, meta_->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(*viscosity_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( *massFlowRate_, meta_->universal_part(), meSCS->num_integration_points(), nullptr); @@ -1391,16 +1395,16 @@ class MixtureFractionKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *velocity_, *density_, *edgeAreaVec_, *massFlowRateEdge_); } - 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}; + 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}; const double znot_; const double amf_; @@ -1425,17 +1429,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), @@ -1448,17 +1452,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(), 1, nullptr); + *volumeOfFluid_, meta_->universal_part(), nullptr); stk::mesh::put_field_on_mesh( - *dvolumeOfFluidDx_, meta_->universal_part(), 1, nullptr); + *dvolumeOfFluidDx_, meta_->universal_part(), 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( - *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); + *massFlowRateEdge_, meta_->universal_part(), nullptr); } virtual ~VOFKernelHex8Mesh() {} @@ -1481,12 +1485,12 @@ class VOFKernelHex8Mesh : public TestKernelHex8Mesh *bulk_, *velocity_, *density_, *edgeAreaVec_, *massFlowRateEdge_); } - ScalarFieldType* volumeOfFluid_{nullptr}; - VectorFieldType* dvolumeOfFluidDx_{nullptr}; - VectorFieldType* velocity_{nullptr}; - ScalarFieldType* density_{nullptr}; - ScalarFieldType* viscosity_{nullptr}; - ScalarFieldType* massFlowRateEdge_{nullptr}; + 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}; const double znot_; const double amf_; const double rhoPrimary_; @@ -1507,15 +1511,19 @@ 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() {} @@ -1537,8 +1545,8 @@ class ActuatorSourceKernelHex8Mesh : public TestKernelHex8Mesh act_source_lhs.data(), *actuator_source_lhs_); } - VectorFieldType* actuator_source_{nullptr}; - VectorFieldType* actuator_source_lhs_{nullptr}; + sierra::nalu::VectorFieldType* actuator_source_{nullptr}; + sierra::nalu::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 3b457be46..d17a7b346 100644 --- a/unit_tests/matrix_free/StkConductionFixture.C +++ b/unit_tests/matrix_free/StkConductionFixture.C @@ -13,7 +13,6 @@ #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" @@ -40,37 +39,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< - stk::mesh::Field::global_ordinal_type>>( + gid_field(meta.declare_field::global_ordinal_type>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::gid_name)) { - 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); + 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); const std::string nx_s = std::to_string(nx); const std::string name = @@ -112,11 +111,10 @@ 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) @@ -124,22 +122,21 @@ 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< - stk::mesh::Field::global_ordinal_type>>( + gid_field(meta.declare_field::global_ordinal_type>( stk::topology::NODE_RANK, sierra::nalu::matrix_free::conduction_info::gid_name)) { @@ -147,11 +144,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(), 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); + 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); fixture.generate_mesh(); auto& coordField = coordinate_field(); @@ -186,9 +183,8 @@ 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 fc108e0bb..8118fe812 100644 --- a/unit_tests/matrix_free/StkConductionFixture.h +++ b/unit_tests/matrix_free/StkConductionFixture.h @@ -17,7 +17,6 @@ #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" @@ -40,7 +39,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; @@ -63,8 +62,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::Hex27Fixture fixture; + stk::mesh::Field& coordinate_field(); + stk::mesh::fixtures::simple_fields::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 3132cf95d..957d9d44d 100644 --- a/unit_tests/matrix_free/StkGradientFixture.C +++ b/unit_tests/matrix_free/StkGradientFixture.C @@ -19,7 +19,6 @@ #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" @@ -47,24 +46,29 @@ 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)) { - 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); + 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(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 = @@ -106,4 +110,4 @@ GradientFixture::GradientFixture(int nx, double scale) } } // namespace matrix_free } // namespace nalu -} // namespace sierra \ No newline at end of file +} // namespace sierra diff --git a/unit_tests/matrix_free/StkGradientFixture.h b/unit_tests/matrix_free/StkGradientFixture.h index f8ab8e464..9d3d279cd 100644 --- a/unit_tests/matrix_free/StkGradientFixture.h +++ b/unit_tests/matrix_free/StkGradientFixture.h @@ -16,7 +16,6 @@ #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" @@ -44,10 +43,9 @@ 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 4187daadd..6caac68ba 100644 --- a/unit_tests/matrix_free/StkLowMachFixture.C +++ b/unit_tests/matrix_free/StkLowMachFixture.C @@ -19,7 +19,6 @@ #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" @@ -47,44 +46,46 @@ 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(), 1, nullptr); - stk::mesh::put_field_on_mesh(density_field, meta.universal_part(), 1, &one); + 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( velocity_field, meta.universal_part(), 3, 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::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(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 = @@ -146,4 +147,4 @@ LowMachFixture::LowMachFixture(int nx, double scale) } } // namespace matrix_free } // namespace nalu -} // namespace sierra \ No newline at end of file +} // namespace sierra diff --git a/unit_tests/matrix_free/StkLowMachFixture.h b/unit_tests/matrix_free/StkLowMachFixture.h index 3925ba377..ac99f05de 100644 --- a/unit_tests/matrix_free/StkLowMachFixture.h +++ b/unit_tests/matrix_free/StkLowMachFixture.h @@ -16,7 +16,6 @@ #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" @@ -44,10 +43,9 @@ 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); } @@ -63,15 +61,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 5e978d809..cc478d653 100644 --- a/unit_tests/matrix_free/UnitTestConductionFields.C +++ b/unit_tests/matrix_free/UnitTestConductionFields.C @@ -16,7 +16,6 @@ #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" @@ -44,12 +43,13 @@ 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,15 +69,14 @@ protected: } // set a coordinate field - 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); + 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); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), 3, 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 2e6cf5e40..df2f3b527 100644 --- a/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C +++ b/unit_tests/matrix_free/UnitTestConductionGatheredFieldManager.C @@ -38,8 +38,7 @@ 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 e58569d3e..c5e9f9039 100644 --- a/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestConductionSolutionUpdate.C @@ -26,12 +26,10 @@ #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" @@ -75,8 +73,7 @@ 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) { @@ -159,8 +156,7 @@ 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 fa0057f5e..4f4054f8e 100644 --- a/unit_tests/matrix_free/UnitTestConductionUpdate.C +++ b/unit_tests/matrix_free/UnitTestConductionUpdate.C @@ -26,7 +26,6 @@ #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 14617204f..4810bf7c2 100644 --- a/unit_tests/matrix_free/UnitTestContinuityOperator.C +++ b/unit_tests/matrix_free/UnitTestContinuityOperator.C @@ -39,7 +39,6 @@ #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 b5220126e..01611502f 100644 --- a/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestContinuitySolutionUpdate.C @@ -27,12 +27,10 @@ #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 b2a76b4fc..5fa16e406 100644 --- a/unit_tests/matrix_free/UnitTestGreenGaussGradient.C +++ b/unit_tests/matrix_free/UnitTestGreenGaussGradient.C @@ -34,7 +34,6 @@ #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 389fb99a8..6e27f2440 100644 --- a/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C +++ b/unit_tests/matrix_free/UnitTestGreenGaussGradientOperator.C @@ -32,7 +32,6 @@ #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 7e1b47420..704b8077a 100644 --- a/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C +++ b/unit_tests/matrix_free/UnitTestLowMachGatheredFieldManager.C @@ -37,8 +37,7 @@ 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 37993ebcb..cd51a5f69 100644 --- a/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C +++ b/unit_tests/matrix_free/UnitTestMatrixFreeSolver.C @@ -45,7 +45,6 @@ #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 fe2d953d0..72892b5f9 100644 --- a/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C +++ b/unit_tests/matrix_free/UnitTestMomentumJacobiOperator.C @@ -39,7 +39,6 @@ #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 db53f6ed9..ec7b2d297 100644 --- a/unit_tests/matrix_free/UnitTestMomentumOperator.C +++ b/unit_tests/matrix_free/UnitTestMomentumOperator.C @@ -39,7 +39,6 @@ #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 bbf7e2441..c4ef9c7c1 100644 --- a/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C +++ b/unit_tests/matrix_free/UnitTestMomentumSolutionUpdate.C @@ -27,12 +27,10 @@ #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 1fea6871d..3939b8754 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdConnectivityMap.C @@ -17,12 +17,10 @@ #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" @@ -51,6 +49,7 @@ 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); @@ -67,12 +66,13 @@ protected: } // set a coordinate field - 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); + auto& coordField = + meta.declare_field(stk::topology::NODE_RANK, "coordinates"); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, block_1, meta.spatial_dimension(), nullptr); + stk::mesh::put_field_on_mesh( + coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), + nullptr); meta.set_coordinate_field(&coordField); meta.commit(); @@ -163,8 +163,7 @@ 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 be3620e56..c79c020f2 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdFaceConnectivityMap.C @@ -21,7 +21,6 @@ #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" @@ -61,6 +60,7 @@ 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,12 +77,13 @@ protected: } // set a coordinate field - 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); + auto& coordField = + meta.declare_field(stk::topology::NODE_RANK, "coordinates"); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, block_1, meta.spatial_dimension(), nullptr); + stk::mesh::put_field_on_mesh( + coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), + 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 f2874b3da..6b77c4c85 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C +++ b/unit_tests/matrix_free/UnitTestStkSimdGatheredElementData.C @@ -25,7 +25,6 @@ #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" @@ -65,10 +64,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); @@ -84,13 +83,14 @@ protected: } // set a coordinate field - 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); + auto& coordField = + meta.declare_field(stk::topology::NODE_RANK, "coordinates"); + stk::mesh::put_field_on_mesh( + coordField, block_1, meta.spatial_dimension(), nullptr); stk::mesh::put_field_on_mesh(q_field, block_1, 1, nullptr); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), + 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 cb2765871..0f7a4d1f3 100644 --- a/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C +++ b/unit_tests/matrix_free/UnitTestStkSimdNodeConnectivityMap.C @@ -19,7 +19,6 @@ #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" @@ -46,6 +45,7 @@ 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,12 +62,13 @@ protected: } // set a coordinate field - 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); + auto& coordField = + meta.declare_field(stk::topology::NODE_RANK, "coordinates"); stk::mesh::put_field_on_mesh( - coordField, stk::mesh::selectUnion(allSurfaces), nullptr); + coordField, block_1, meta.spatial_dimension(), nullptr); + stk::mesh::put_field_on_mesh( + coordField, stk::mesh::selectUnion(allSurfaces), meta.spatial_dimension(), + 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 6eb601963..97e389577 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< - stk::mesh::Field::global_ordinal_type>>( + meta.declare_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, 1, nullptr); + stk::mesh::put_field_on_mesh(gid_field_h, active, 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 e2950e4ad..8ae4a35a3 100644 --- a/unit_tests/mesh_motion/UnitTestCompositeFrames.C +++ b/unit_tests/mesh_motion/UnitTestCompositeFrames.C @@ -158,11 +158,13 @@ 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(); - VectorFieldType* modelCoordsCopy = - &(realm.meta_data().declare_field( + sierra::nalu::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"); @@ -170,8 +172,9 @@ TEST(meshMotion, NGP_initialize) realm.init_current_coordinates(); // copy coordinates to copy coordinates - VectorFieldType* modelCoords = realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::VectorFieldType* modelCoords = + realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // get the parts in the current motion frame stk::mesh::Selector sel = @@ -217,15 +220,12 @@ 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,11 +271,13 @@ 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(); - VectorFieldType* modelCoordsCopy = - &(realm.meta_data().declare_field( + sierra::nalu::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"); @@ -283,8 +285,9 @@ TEST(meshMotion, NGP_execute) realm.init_current_coordinates(); // copy coordinates to copy coordinates - VectorFieldType* modelCoords = realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::VectorFieldType* modelCoords = + realm.meta_data().get_field( + stk::topology::NODE_RANK, "coordinates"); // get the parts in the current motion frame stk::mesh::Selector sel = @@ -327,10 +330,12 @@ TEST(meshMotion, NGP_execute) meshMotionAlg->execute(currTime); // get fields to be tested - 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"); + 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"); // 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 2f53f6774..4c96a473e 100644 --- a/unit_tests/mesh_motion/UnitTestComputeCentroid.C +++ b/unit_tests/mesh_motion/UnitTestComputeCentroid.C @@ -108,11 +108,13 @@ 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(); - VectorFieldType* modelCoordsGold = - &(realm.meta_data().declare_field( + sierra::nalu::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"); @@ -127,8 +129,9 @@ TEST(meshMotion, NGP_compute_centroid) realm.bulk_data().get_buckets(stk::topology::NODE_RANK, sel); // get model coordinate fields - VectorFieldType* modelCoords = realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::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 448772a8e..d3e89a48a 100644 --- a/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C +++ b/unit_tests/ngp_algorithms/UnitTestCFLReAlg.C @@ -19,14 +19,12 @@ 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(), 1, nullptr); - stk::mesh::put_field_on_mesh( - elemReynolds, meta_->universal_part(), 1, 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(), nullptr); + stk::mesh::put_field_on_mesh(elemReynolds, meta_->universal_part(), 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 a08d23dea..bfeaf94f1 100644 --- a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C +++ b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.C @@ -13,14 +13,15 @@ #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 VectorFieldType& coordinates, - ScalarFieldType& field, + const stk::mesh::Field& coordinates, + stk::mesh::Field& field, const double xCoeff, const double yCoeff, const double zCoeff) @@ -29,35 +30,26 @@ 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(); -} -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; + 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); } field.modify_on_host(); diff --git a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h index 393b5af2d..7eb4c9c7e 100644 --- a/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h +++ b/unit_tests/ngp_algorithms/UnitTestNgpAlgUtils.h @@ -16,21 +16,15 @@ #include "stk_mesh/base/BulkData.hpp" namespace unit_test_alg_utils { -void linear_scalar_field( - const stk::mesh::BulkData&, - 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 stk::mesh::Field&, + stk::mesh::Field&, 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 dae7fea19..939f4f44b 100644 --- a/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C +++ b/unit_tests/ngp_algorithms/UnitTestNodalGradAlg.C @@ -42,7 +42,8 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_edge) // helperObjs.realm, partVec_[0], tke_, dkdx_); // edgeAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver( + helperObjs.realm, tke_->name(), "dkdx"); algDriver.register_edge_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_); algDriver.execute(); @@ -94,7 +95,8 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_edge_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_); // edgeAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver( + helperObjs.realm, velocity_->name(), "dudx"); algDriver.register_edge_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_); algDriver.execute(); @@ -143,7 +145,8 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_elem) // helperObjs.realm, partVec_[0], tke_, dkdx_); // elemAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver( + helperObjs.realm, tke_->name(), "dkdx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_); algDriver.execute(); @@ -193,7 +196,8 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_elem_shifted) // helperObjs.realm, partVec_[0], tke_, dkdx_, useShifted); // elemAlg.execute(); - sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver( + helperObjs.realm, tke_->name(), "dkdx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -246,7 +250,8 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_elem_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_, useShifted); // elemAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver( + helperObjs.realm, velocity_->name(), "dudx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_, useShifted); @@ -301,7 +306,8 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_elem_shifted_vec) // helperObjs.realm, partVec_[0], velocity_, dudx_); // edgeAlg.execute(); - sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver( + helperObjs.realm, velocity_->name(), "dudx"); algDriver.register_elem_algorithm( sierra::nalu::INTERIOR, partVec_[0], "nodal_grad", velocity_, dudx_, useShifted); @@ -356,7 +362,8 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_bndry) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver( + helperObjs.realm, tke_->name(), "dkdx"); algDriver.register_face_algorithm( sierra::nalu::WALL, surfPart, "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -407,7 +414,8 @@ TEST_F(SSTKernelHex8Mesh, NGP_nodal_grad_bndry_shifted) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::ScalarNodalGradAlgDriver algDriver(helperObjs.realm, "dkdx"); + sierra::nalu::ScalarNodalGradAlgDriver algDriver( + helperObjs.realm, tke_->name(), "dkdx"); algDriver.register_face_algorithm( sierra::nalu::WALL, surfPart, "nodal_grad", tke_, dkdx_, useShifted); algDriver.execute(); @@ -462,7 +470,8 @@ TEST_F(MomentumKernelHex8Mesh, NGP_nodal_grad_bndry_elem_vec) // elemAlg.execute(); auto* surfPart = part->subsets()[0]; - sierra::nalu::TensorNodalGradAlgDriver algDriver(helperObjs.realm, "dudx"); + sierra::nalu::TensorNodalGradAlgDriver algDriver( + helperObjs.realm, velocity_->name(), "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 e9443e7f1..885b01c51 100644 --- a/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C +++ b/unit_tests/ngp_algorithms/UnitTestNodalGradPOpenBoundary.C @@ -65,33 +65,34 @@ 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, "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, 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); + } } - } - }; + }; 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 431f1ac1a..d649cceb4 100644 --- a/unit_tests/ngp_kernels/UnitTestNgpLoops.C +++ b/unit_tests/ngp_kernels/UnitTestNgpLoops.C @@ -32,29 +32,31 @@ public: meshBuilder.set_spatial_dimension(3); bulk = meshBuilder.create(); meta = &bulk->mesh_meta_data(); - - 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( + 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( 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(), 1, &ten); - stk::mesh::put_field_on_mesh(*pressure, meta->universal_part(), 1, &zero); + 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(*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(), 1, &zero); + stk::mesh::put_field_on_mesh(*mdotEdge, meta->universal_part(), &zero); } ~NgpLoopTest() = default; @@ -65,23 +67,25 @@ 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 VectorFieldType* coordField{nullptr}; - ScalarFieldType* density{nullptr}; - ScalarFieldType* pressure{nullptr}; - VectorFieldType* velocity{nullptr}; - ScalarFieldType* mdotEdge{nullptr}; - GenericFieldType* massFlowRate{nullptr}; + 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}; }; void -basic_node_loop(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) +basic_node_loop( + const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; const double presSet = 4.0; @@ -115,7 +119,8 @@ basic_node_loop(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) } void -basic_node_reduce(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) +basic_node_reduce( + const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; const double presSet = 4.0; @@ -270,7 +275,9 @@ basic_node_reduce_minmaxsum( void basic_node_reduce_array( - const stk::mesh::BulkData& bulk, ScalarFieldType& pressure, int num_nodes) + const stk::mesh::BulkData& bulk, + sierra::nalu::ScalarFieldType& pressure, + int num_nodes) { using MeshIndex = sierra::nalu::nalu_ngp::NGPMeshTraits::MeshIndex; @@ -304,8 +311,8 @@ basic_node_reduce_array( void basic_elem_loop( const stk::mesh::BulkData& bulk, - ScalarFieldType& pressure, - GenericFieldType& massFlowRate) + sierra::nalu::ScalarFieldType& pressure, + sierra::nalu::GenericFieldType& massFlowRate) { const double flowRate = 4.0; const double presSet = 10.0; @@ -358,8 +365,8 @@ basic_elem_loop( void basic_edge_loop( const stk::mesh::BulkData& bulk, - ScalarFieldType& pressure, - ScalarFieldType& mdotEdge) + sierra::nalu::ScalarFieldType& pressure, + sierra::nalu::ScalarFieldType& mdotEdge) { const double flowRate = 4.0; const double presSet = 10.0; @@ -412,8 +419,8 @@ basic_edge_loop( void elem_loop_scratch_views( const stk::mesh::BulkData& bulk, - ScalarFieldType& pressure, - VectorFieldType& velocity) + sierra::nalu::ScalarFieldType& pressure, + sierra::nalu::VectorFieldType& velocity) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Hex8Traits = sierra::nalu::AlgTraitsHex8; @@ -516,9 +523,9 @@ elem_loop_scratch_views( void calc_mdot_elem_loop( const stk::mesh::BulkData& bulk, - ScalarFieldType& density, - VectorFieldType& velocity, - GenericFieldType& massFlowRate) + sierra::nalu::ScalarFieldType& density, + sierra::nalu::VectorFieldType& velocity, + sierra::nalu::GenericFieldType& massFlowRate) { using Traits = sierra::nalu::nalu_ngp::NGPMeshTraits; using Hex8Traits = sierra::nalu::AlgTraitsHex8; @@ -603,10 +610,10 @@ calc_mdot_elem_loop( void basic_face_elem_loop( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordField, - const GenericFieldType& exposedArea, - ScalarFieldType& wallArea, - ScalarFieldType& wallNormDist) + const sierra::nalu::VectorFieldType& coordField, + const sierra::nalu::GenericFieldType& exposedArea, + sierra::nalu::ScalarFieldType& wallArea, + sierra::nalu::ScalarFieldType& wallNormDist) { using MeshIndex = sierra::nalu::nalu_ngp::NGPMeshTraits::MeshIndex; @@ -716,7 +723,8 @@ basic_face_elem_loop( } void -elem_loop_par_reduce(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) +elem_loop_par_reduce( + const stk::mesh::BulkData& bulk, sierra::nalu::ScalarFieldType& pressure) { using Hex8Traits = sierra::nalu::AlgTraitsHex8; using ElemSimdData = sierra::nalu::nalu_ngp::ElemSimdData; @@ -777,8 +785,8 @@ elem_loop_par_reduce(const stk::mesh::BulkData& bulk, ScalarFieldType& pressure) void basic_face_elem_reduce( const stk::mesh::BulkData& bulk, - const VectorFieldType& coordField, - const GenericFieldType& exposedArea) + const sierra::nalu::VectorFieldType& coordField, + const sierra::nalu::GenericFieldType& exposedArea) { using FaceTraits = sierra::nalu::AlgTraitsQuad4Hex8; using FaceSimdData = @@ -929,20 +937,19 @@ 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(), 1, nullptr); - stk::mesh::put_field_on_mesh( - wallNormDist, meta->universal_part(), 1, nullptr); + stk::mesh::put_field_on_mesh(wallArea, meta->universal_part(), nullptr); + stk::mesh::put_field_on_mesh(wallNormDist, meta->universal_part(), nullptr); fill_mesh_and_init_fields("generated:4x4x1|sideset:xXyYzZ"); unit_test_kernel_utils::calc_exposed_area_vec( @@ -957,8 +964,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 4836f09d6..c1e50dce6 100644 --- a/unit_tests/utils/UnitTestComputeVectorDivergence.C +++ b/unit_tests/utils/UnitTestComputeVectorDivergence.C @@ -41,40 +41,46 @@ TEST(utils, compute_vector_divergence) // declare relevant fields int nDim = realm.meta_data().spatial_dimension(); - ScalarFieldType* duaNdlVol = - &(realm.meta_data().declare_field( + sierra::nalu::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); - ScalarFieldType& elemVol = realm.meta_data().declare_field( - stk::topology::ELEMENT_RANK, "element_volume"); + sierra::nalu::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); - VectorFieldType* meshVec = &(realm.meta_data().declare_field( - stk::topology::NODE_RANK, "mesh_vector")); + sierra::nalu::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(); - GenericFieldType* exposedAreaVec = - &(realm.meta_data().declare_field( + sierra::nalu::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); - ScalarFieldType* divV = &(realm.meta_data().declare_field( - stk::topology::NODE_RANK, "div_mesh_vector")); + sierra::nalu::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); @@ -91,8 +97,9 @@ TEST(utils, compute_vector_divergence) geomAlgDriver.execute(); // get coordinate field - VectorFieldType* modelCoords = realm.meta_data().get_field( - stk::topology::NODE_RANK, "coordinates"); + sierra::nalu::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 a055d9438..fc9710c41 160000 --- a/wind-utils +++ b/wind-utils @@ -1 +1 @@ -Subproject commit a055d9438f1348f8bdeb5d320343c83c469de220 +Subproject commit fc9710c419111f5476d50586fd1a8e12db52b713