Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated AMS models #1020

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
13 changes: 12 additions & 1 deletion include/AMSAlgDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#include "ngp_algorithms/NgpAlgDriver.h"
#include "ngp_algorithms/FieldUpdateAlgDriver.h"
#include "ngp_algorithms/AMSAvgMdotEdgeAlg.h"
#include "ngp_algorithms/AMSAveragesAlg.h"
#include "ngp_algorithms/SSTAMSAveragesAlg.h"
#include "ngp_algorithms/SSTLRAMSAveragesAlg.h"
#include "ngp_algorithms/KEAMSAveragesAlg.h"
#include "ngp_algorithms/KOAMSAveragesAlg.h"

namespace stk {
struct topology;
Expand Down Expand Up @@ -62,8 +66,15 @@ class AMSAlgDriver
ScalarFieldType* avgMdot_;
VectorFieldType* forcingComp_;

ScalarFieldType* magPM_;
ScalarFieldType* PMmax_;
ScalarFieldType* PM1_;
ScalarFieldType* PM2_;
ScalarFieldType* PM3_;

FieldUpdateAlgDriver metricTensorAlgDriver_;
std::unique_ptr<SSTAMSAveragesAlg> avgAlg_;
std::unique_ptr<AMSAveragesAlg> avgAlg_;

NgpAlgDriver avgMdotAlg_;

const TurbulenceModel turbulenceModel_;
Expand Down
37 changes: 23 additions & 14 deletions include/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,19 @@ enum class TurbulenceModel {
SSTLR,
SST_DES,
SST_AMS,
SSTLR_AMS,
SST_IDDES,
KE,
KE_AMS,
KO,
KO_AMS,
TurbulenceModel_END
};

// matching string name index into above enums (must match PERFECTLY)
static const std::string TurbulenceModelNames[] = {
"laminar", "ksgs", "smagorinsky", "wale", "sst", "sstlr",
"sst_des", "sst_ams", "sst_iddes", "ke", "ko"};
"laminar", "ksgs", "smagorinsky", "wale", "sst", "sstlr", "sst_des",
"sst_ams", "sstlr_ams", "sst_iddes", "ke", "ke_ams", "ko", "ko_ams"};

enum TurbulenceModelConstant {
TM_cMu = 0,
Expand Down Expand Up @@ -238,18 +241,21 @@ enum TurbulenceModelConstant {
TM_fOne = 57,
TM_sigmaK = 58,
TM_sigmaEps = 59,
TM_sstLRDestruct = 60,
TM_sstLRProd = 61,
TM_tkeAmb = 62,
TM_sdrAmb = 63,
TM_avgTimeCoeff = 64,
TM_alphaInf = 65,
TM_caOne = 66,
TM_caTwo = 67,
TM_ceOne = 68,
TM_ceTwo = 69,
TM_c0t = 70,
TM_END = 71
TM_alphaPow = 60,
TM_alphaScaPow = 61,
TM_coeffR = 62,
TM_sstLRDestruct = 63,
TM_sstLRProd = 64,
TM_tkeAmb = 65,
TM_sdrAmb = 66,
TM_avgTimeCoeff = 67,
TM_alphaInf = 68,
TM_caOne = 69,
TM_caTwo = 70,
TM_ceOne = 71,
TM_ceTwo = 72,
TM_c0t = 73,
TM_END = 74
};

static const std::string TurbulenceModelConstantNames[] = {
Expand Down Expand Up @@ -313,6 +319,9 @@ static const std::string TurbulenceModelConstantNames[] = {
"fOne",
"sigmaK",
"sigmaEps",
"alphaPow",
"alphaScaPow",
"coeffR",
"sstLRDestruct",
"sstLRProd",
"tke_amb",
Expand Down
2 changes: 2 additions & 0 deletions include/Realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ class Realm
bool is_turbulent();
void is_turbulent(bool isIt);

bool is_ams_model();

bool needs_enthalpy();
void needs_enthalpy(bool needsEnthalpy);

Expand Down
1 change: 1 addition & 0 deletions include/SolutionOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class SolutionOptions
bool mdotInterpRhoUTogether_;
bool solveIncompressibleContinuity_;
bool isTurbulent_;
bool isAMSModel_;
TurbulenceModel turbulenceModel_;
bool meshMotion_;
bool meshTransformation_;
Expand Down
90 changes: 90 additions & 0 deletions include/edge_kernels/MomentumKEAMSDiffEdgeKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// 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 MOMENTUMKEAMSDIFFEDGEKERNEL_H
#define MOMENTUMKEAMSDIFFEDGEKERNEL_H

#include "edge_kernels/EdgeKernel.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 MomentumKEAMSDiffEdgeKernel
: public NGPEdgeKernel<MomentumKEAMSDiffEdgeKernel>
{
public:
MomentumKEAMSDiffEdgeKernel(
const stk::mesh::BulkData&, const SolutionOptions&);

MomentumKEAMSDiffEdgeKernel() = delete;

KOKKOS_DEFAULTED_FUNCTION
virtual ~MomentumKEAMSDiffEdgeKernel() = default;

virtual void setup(Realm&) override;

KOKKOS_FUNCTION
virtual void execute(
EdgeKernelTraits::ShmemDataType&,
const stk::mesh::FastMeshIndex&,
const stk::mesh::FastMeshIndex&,
const stk::mesh::FastMeshIndex&) override;

private:
stk::mesh::NgpField<double> edgeAreaVec_;

stk::mesh::NgpField<double> coordinates_;
stk::mesh::NgpField<double> velocity_;
stk::mesh::NgpField<double> tvisc_;
stk::mesh::NgpField<double> density_;
stk::mesh::NgpField<double> tdr_;
stk::mesh::NgpField<double> beta_;
stk::mesh::NgpField<double> nodalMij_;
stk::mesh::NgpField<double> dudx_;
stk::mesh::NgpField<double> avgVelocity_;
stk::mesh::NgpField<double> avgDudx_;
stk::mesh::NgpField<double> avgResAdeq_;

unsigned edgeAreaVecID_{stk::mesh::InvalidOrdinal};
unsigned coordinatesID_{stk::mesh::InvalidOrdinal};
unsigned velocityID_{stk::mesh::InvalidOrdinal};
unsigned turbViscID_{stk::mesh::InvalidOrdinal};
unsigned densityNp1ID_{stk::mesh::InvalidOrdinal};
unsigned tdrNp1ID_{stk::mesh::InvalidOrdinal};
unsigned betaID_{stk::mesh::InvalidOrdinal};
unsigned MijID_{stk::mesh::InvalidOrdinal};
unsigned dudxID_{stk::mesh::InvalidOrdinal};
unsigned avgVelocityID_{stk::mesh::InvalidOrdinal};
unsigned avgDudxID_{stk::mesh::InvalidOrdinal};
unsigned avgResAdeqID_{stk::mesh::InvalidOrdinal};

const double includeDivU_;

const double betaStar_;
const double CMdeg_;
const double aspectRatioSwitch_;
const double alphaPow_;
const double alphaScaPow_;

const int nDim_;

double relaxFacU_{1.0};
};

} // namespace nalu
} // namespace sierra

#endif /* MOMENTUMKEAMSDIFFEDGEKERNEL_H */
94 changes: 94 additions & 0 deletions include/edge_kernels/MomentumKOAMSDiffEdgeKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// 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 MOMENTUMKOAMSDIFFEDGEKERNEL_H
#define MOMENTUMKOAMSDIFFEDGEKERNEL_H

#include "edge_kernels/EdgeKernel.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 MomentumKOAMSDiffEdgeKernel
: public NGPEdgeKernel<MomentumKOAMSDiffEdgeKernel>
{
public:
MomentumKOAMSDiffEdgeKernel(
const stk::mesh::BulkData&, const SolutionOptions&);

MomentumKOAMSDiffEdgeKernel() = delete;

KOKKOS_DEFAULTED_FUNCTION
virtual ~MomentumKOAMSDiffEdgeKernel() = default;

virtual void setup(Realm&) override;

KOKKOS_FUNCTION
virtual void execute(
EdgeKernelTraits::ShmemDataType&,
const stk::mesh::FastMeshIndex&,
const stk::mesh::FastMeshIndex&,
const stk::mesh::FastMeshIndex&) override;

private:
stk::mesh::NgpField<double> edgeAreaVec_;

stk::mesh::NgpField<double> coordinates_;
stk::mesh::NgpField<double> velocity_;
stk::mesh::NgpField<double> tvisc_;
stk::mesh::NgpField<double> visc_;
stk::mesh::NgpField<double> density_;
stk::mesh::NgpField<double> tke_;
stk::mesh::NgpField<double> sdr_;
stk::mesh::NgpField<double> beta_;
stk::mesh::NgpField<double> nodalMij_;
stk::mesh::NgpField<double> dudx_;
stk::mesh::NgpField<double> avgVelocity_;
stk::mesh::NgpField<double> avgDudx_;
stk::mesh::NgpField<double> avgResAdeq_;

unsigned edgeAreaVecID_{stk::mesh::InvalidOrdinal};
unsigned coordinatesID_{stk::mesh::InvalidOrdinal};
unsigned velocityID_{stk::mesh::InvalidOrdinal};
unsigned turbViscID_{stk::mesh::InvalidOrdinal};
unsigned viscID_{stk::mesh::InvalidOrdinal};
unsigned densityNp1ID_{stk::mesh::InvalidOrdinal};
unsigned tkeNp1ID_{stk::mesh::InvalidOrdinal};
unsigned sdrNp1ID_{stk::mesh::InvalidOrdinal};
unsigned betaID_{stk::mesh::InvalidOrdinal};
unsigned MijID_{stk::mesh::InvalidOrdinal};
unsigned dudxID_{stk::mesh::InvalidOrdinal};
unsigned avgVelocityID_{stk::mesh::InvalidOrdinal};
unsigned avgDudxID_{stk::mesh::InvalidOrdinal};
unsigned avgResAdeqID_{stk::mesh::InvalidOrdinal};

const double includeDivU_;

const double betaStar_;
const double CMdeg_;
const double aspectRatioSwitch_;
const double alphaPow_;
const double alphaScaPow_;

const int nDim_;

double relaxFacU_{1.0};
};

} // namespace nalu
} // namespace sierra

#endif /* MOMENTUMKOAMSDIFFEDGEKERNEL_H */
2 changes: 2 additions & 0 deletions include/edge_kernels/MomentumSSTAMSDiffEdgeKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class MomentumSSTAMSDiffEdgeKernel
const double betaStar_;
const double CMdeg_;
const double aspectRatioSwitch_;
const double alphaPow_;
const double alphaScaPow_;

const int nDim_;

Expand Down
Loading
Loading