-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Exawind:master' into multiphase_upwinding
- Loading branch information
Showing
6 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC | ||
// (NTESS), National Renewable Energy Laboratory, University of Texas Austin, | ||
// Northwest Research Associates. Under the terms of Contract DE-NA0003525 | ||
// with NTESS, the U.S. Government retains certain rights in this software. | ||
// | ||
// This software is released under the BSD 3-clause license. See LICENSE file | ||
// for more details. | ||
// | ||
|
||
#ifndef MOMENTUMBUOYANCYNODEKERNEL_h | ||
#define MOMENTUMBUOYANCYNODEKERNEL_h | ||
|
||
#include "node_kernels/NodeKernel.h" | ||
|
||
#include "stk_mesh/base/BulkData.hpp" | ||
#include "stk_mesh/base/Ngp.hpp" | ||
#include "stk_mesh/base/NgpField.hpp" | ||
#include "stk_mesh/base/Types.hpp" | ||
|
||
namespace sierra { | ||
namespace nalu { | ||
|
||
class SolutionOptions; | ||
|
||
class MomentumBuoyancyNodeKernel | ||
: public NGPNodeKernel<MomentumBuoyancyNodeKernel> | ||
{ | ||
public: | ||
MomentumBuoyancyNodeKernel( | ||
const stk::mesh::BulkData&, const SolutionOptions&); | ||
|
||
MomentumBuoyancyNodeKernel() = delete; | ||
|
||
KOKKOS_DEFAULTED_FUNCTION | ||
virtual ~MomentumBuoyancyNodeKernel() = default; | ||
|
||
virtual void setup(Realm&) override; | ||
|
||
KOKKOS_FUNCTION | ||
virtual void execute( | ||
NodeKernelTraits::LhsType&, | ||
NodeKernelTraits::RhsType&, | ||
const stk::mesh::FastMeshIndex&) override; | ||
|
||
private: | ||
stk::mesh::NgpField<double> dualNodalVolume_; | ||
stk::mesh::NgpField<double> densityNp1_; | ||
const int nDim_; | ||
NodeKernelTraits::DblType rhoRef_; | ||
|
||
unsigned dualNodalVolumeID_{stk::mesh::InvalidOrdinal}; | ||
unsigned densityNp1ID_{stk::mesh::InvalidOrdinal}; | ||
|
||
NALU_ALIGNED NodeKernelTraits::DblType gravity_[NodeKernelTraits::NDimMax]; | ||
}; | ||
|
||
} // namespace nalu | ||
} // namespace sierra | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
2.67343413675555e-05 11 0.0001 | ||
6.859619665424383e-06 12 0.0002 | ||
3.313464463487743e-06 13 0.0003 | ||
2.673434136755543e-05 11 0.0001 | ||
6.859619665424398e-06 12 0.0002 | ||
3.313464463487801e-06 13 0.0003 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC | ||
// (NTESS), National Renewable Energy Laboratory, University of Texas Austin, | ||
// Northwest Research Associates. Under the terms of Contract DE-NA0003525 | ||
// with NTESS, the U.S. Government retains certain rights in this software. | ||
// | ||
// This software is released under the BSD 3-clause license. See LICENSE file | ||
// for more details. | ||
// | ||
|
||
#include "node_kernels/MomentumBuoyancyNodeKernel.h" | ||
#include "Realm.h" | ||
|
||
#include "stk_mesh/base/MetaData.hpp" | ||
#include "stk_mesh/base/Types.hpp" | ||
#include "utils/StkHelpers.h" | ||
|
||
#include "SolutionOptions.h" | ||
|
||
namespace sierra { | ||
namespace nalu { | ||
|
||
MomentumBuoyancyNodeKernel::MomentumBuoyancyNodeKernel( | ||
const stk::mesh::BulkData& bulk, const SolutionOptions& solnOpts) | ||
: NGPNodeKernel<MomentumBuoyancyNodeKernel>(), | ||
nDim_(bulk.mesh_meta_data().spatial_dimension()), | ||
rhoRef_(solnOpts.referenceDensity_) | ||
{ | ||
const auto& meta = bulk.mesh_meta_data(); | ||
|
||
dualNodalVolumeID_ = get_field_ordinal(meta, "dual_nodal_volume"); | ||
densityNp1ID_ = get_field_ordinal(meta, "density"); | ||
|
||
const std::vector<double>& solnOptsGravity = | ||
solnOpts.get_gravity_vector(nDim_); | ||
for (int i = 0; i < nDim_; i++) | ||
gravity_[i] = solnOptsGravity[i]; | ||
} | ||
|
||
void | ||
MomentumBuoyancyNodeKernel::setup(Realm& realm) | ||
{ | ||
const auto& fieldMgr = realm.ngp_field_manager(); | ||
dualNodalVolume_ = fieldMgr.get_field<double>(dualNodalVolumeID_); | ||
densityNp1_ = fieldMgr.get_field<double>(densityNp1ID_); | ||
} | ||
|
||
KOKKOS_FUNCTION | ||
void | ||
MomentumBuoyancyNodeKernel::execute( | ||
NodeKernelTraits::LhsType&, | ||
NodeKernelTraits::RhsType& rhs, | ||
const stk::mesh::FastMeshIndex& node) | ||
{ | ||
const NodeKernelTraits::DblType rhoNp1 = densityNp1_.get(node, 0); | ||
const NodeKernelTraits::DblType dualVolume = dualNodalVolume_.get(node, 0); | ||
const double fac = (rhoNp1 - rhoRef_) * dualVolume; | ||
|
||
for (int i = 0; i < nDim_; ++i) { | ||
rhs(i) += fac * gravity_[i]; | ||
} | ||
} | ||
|
||
} // namespace nalu | ||
} // namespace sierra |