MomentumNSOKeElemKernel<AlgTraits>::MomentumNSOKeElemKernel( const stk::mesh::BulkData& bulkData, const SolutionOptions& solnOpts, VectorFieldType* , GenericFieldType* Gju, const double fourthFac, ElemDataRequests& dataPreReqs) : Kernel(), Gju_(Gju), lrscv_(sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_)->adjacentNodes()), fourthFac_(fourthFac), shiftedGradOp_(solnOpts.get_shifted_grad_op("velocity")) { const stk::mesh::MetaData& metaData = bulkData.mesh_meta_data(); velocityNp1_ = metaData.get_field<VectorFieldType>( stk::topology::NODE_RANK, "velocity"); densityNp1_ = metaData.get_field<ScalarFieldType>( stk::topology::NODE_RANK, "density"); pressure_ = metaData.get_field<ScalarFieldType>( stk::topology::NODE_RANK, "pressure"); if (solnOpts.does_mesh_move()) velocityRTM_ = metaData.get_field<VectorFieldType>( stk::topology::NODE_RANK, "velocity_rtm"); else velocityRTM_ = metaData.get_field<VectorFieldType>( stk::topology::NODE_RANK, "velocity"); pressure_ = metaData.get_field<ScalarFieldType>( stk::topology::NODE_RANK, "pressure"); coordinates_ = metaData.get_field<VectorFieldType>( stk::topology::NODE_RANK, solnOpts.get_coordinates_name()); Gjp_ = metaData.get_field<VectorFieldType>(stk::topology::NODE_RANK, "dpdx"); MasterElement *meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_); get_scs_shape_fn_data<AlgTraits>([&](double* ptr){meSCS->shape_fcn(ptr);}, v_shape_function_); // add master elements dataPreReqs.add_cvfem_surface_me(meSCS); // fields dataPreReqs.add_gathered_nodal_field(*Gju_, AlgTraits::nDim_, AlgTraits::nDim_); dataPreReqs.add_coordinates_field(*coordinates_, AlgTraits::nDim_, CURRENT_COORDINATES); dataPreReqs.add_gathered_nodal_field(*velocityNp1_, AlgTraits::nDim_); dataPreReqs.add_gathered_nodal_field(*velocityRTM_, AlgTraits::nDim_); dataPreReqs.add_gathered_nodal_field(*Gjp_, AlgTraits::nDim_); dataPreReqs.add_gathered_nodal_field(*densityNp1_,1); dataPreReqs.add_gathered_nodal_field(*pressure_,1); // master element data dataPreReqs.add_master_element_call(SCS_AREAV, CURRENT_COORDINATES); if ( shiftedGradOp_ ) dataPreReqs.add_master_element_call(SCS_SHIFTED_GRAD_OP, CURRENT_COORDINATES); else dataPreReqs.add_master_element_call(SCS_GRAD_OP, CURRENT_COORDINATES); dataPreReqs.add_master_element_call(SCS_GIJ, CURRENT_COORDINATES); }
ScalarAdvDiffElemKernel<AlgTraits>::ScalarAdvDiffElemKernel( const stk::mesh::BulkData& bulkData, const SolutionOptions& solnOpts, ScalarFieldType* scalarQ, ScalarFieldType* diffFluxCoeff, ElemDataRequests& dataPreReqs) : Kernel(), scalarQ_(scalarQ), diffFluxCoeff_(diffFluxCoeff), lrscv_(sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_)->adjacentNodes()), shiftedGradOp_(solnOpts.get_shifted_grad_op(scalarQ->name())) { // Save of required fields const stk::mesh::MetaData& metaData = bulkData.mesh_meta_data(); coordinates_ = metaData.get_field<VectorFieldType>( stk::topology::NODE_RANK, solnOpts.get_coordinates_name()); massFlowRate_ = metaData.get_field<GenericFieldType>( stk::topology::ELEMENT_RANK, "mass_flow_rate_scs"); MasterElement *meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_); get_scs_shape_fn_data<AlgTraits>([&](double* ptr){meSCS->shape_fcn(ptr);}, v_shape_function_); const bool skewSymmetric = solnOpts.get_skew_symmetric(scalarQ->name()); get_scs_shape_fn_data<AlgTraits>([&](double* ptr){skewSymmetric ? meSCS->shifted_shape_fcn(ptr) : meSCS->shape_fcn(ptr);}, v_adv_shape_function_); dataPreReqs.add_cvfem_surface_me(meSCS); // fields and data dataPreReqs.add_coordinates_field(*coordinates_, AlgTraits::nDim_, CURRENT_COORDINATES); dataPreReqs.add_gathered_nodal_field(*scalarQ_, 1); dataPreReqs.add_gathered_nodal_field(*diffFluxCoeff_, 1); dataPreReqs.add_element_field(*massFlowRate_, AlgTraits::numScsIp_); dataPreReqs.add_master_element_call(SCS_AREAV, CURRENT_COORDINATES); if ( shiftedGradOp_ ) dataPreReqs.add_master_element_call(SCS_SHIFTED_GRAD_OP, CURRENT_COORDINATES); else dataPreReqs.add_master_element_call(SCS_GRAD_OP, CURRENT_COORDINATES); }