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

F/rayleigh damping #726

Draft
wants to merge 51 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
aed868f
First commit of a new branch for getting upgraded ABL wall BC into ma…
mchurchf May 7, 2020
ce8f4d4
Updating NaluParsing.
mchurchf May 7, 2020
2bb9346
The beginnings of the ABL wall fluxes computation in ngp_algorithms.
mchurchf May 8, 2020
b30f32d
Trying to get the ABLWallFluxes load method to compile.
mchurchf May 8, 2020
f2fe775
Basic framework for new ABL BC in place.
May 13, 2020
ab3af32
Connecting EnthalpyEquationSystem with the ABL wall model.
May 15, 2020
6f25cc9
Progress commit. Load function complete, fixed small issue in Scalar…
May 19, 2020
fcfabfb
Fixing a problem with the psi_h function for unstable conditions.
Jun 2, 2020
2194613
Adding a checkpoint commit for this upgraded wall bc.
Jun 2, 2020
1ae3cd3
Checkpoint commit.
Jun 12, 2020
dbe8b90
add in a rayleigh damping option
rcknaus Jun 19, 2020
f998eed
This ties all components together to do wall-modeling outlined by Bas…
Jun 22, 2020
6a24854
Merging with exawind/master
Jun 22, 2020
7b84771
Updating the ablNeutralEdge input file to reflect new BC input needs.
Jun 22, 2020
e50c065
Fixed a sign error on the applied wall shear stresses.
Jun 24, 2020
8c50b42
Fixes for the flux algorithms 1 and 2 to include L calculation each i…
Jun 25, 2020
a134dd0
Added logic to deal with zero divided by zero fluctuation stress/flux…
Jun 25, 2020
a9d758f
Merge remote-tracking branch 'exawind/master' into f/ABLWallBCUpgrade
Jun 25, 2020
85c3367
Merged with current state of exawind master.
Sep 4, 2020
5b02a36
Merge remote-tracking branch 'exawind/master' into f/ABLWallBCUpgrade
Sep 8, 2020
82c2e5a
Merge remote-tracking branch 'exawind/master' into f/ABLWallBCUpgrade
Sep 17, 2020
f5e40c2
Updated to give the option to use reference or surface temperature in…
Sep 21, 2020
1d6e196
Updating regression tests.
Sep 21, 2020
85221b9
Merge remote-tracking branch 'exawind/master' into f/ABLWallBCUpgrade
Sep 21, 2020
01e9efe
Fixed a syntax issue in NaluParsing.h
Sep 28, 2020
77d075e
Merge remote-tracking branch 'exawind/master' into f/ABLWallBCUpgrade
Sep 28, 2020
a776d1f
Updated the gold value of wall distance to be used by wall functions …
Sep 28, 2020
7a2794c
Update include/edge_kernels/MomentumABLWallShearStressEdgeKernel.h
mchurchf Oct 1, 2020
3714784
Update include/ngp_algorithms/WallFricVelAlgDriver.h
mchurchf Oct 1, 2020
69239ef
Update include/wind_energy/MoninObukhov.h
mchurchf Oct 1, 2020
2d1532b
Update src/ngp_algorithms/ABLWallFluxesAlg.C
mchurchf Oct 1, 2020
14f49a1
Update src/ngp_algorithms/ABLWallFluxesAlg.C
mchurchf Oct 1, 2020
b8d4ef5
Update src/ngp_algorithms/ABLWallFluxesAlg.C
mchurchf Oct 1, 2020
eb8a34f
Reduced redundant code by eliminating the two flux/stress functions a…
Oct 9, 2020
e57e892
Adding some Doxygen style comments to explain the code.
Oct 9, 2020
3fa16f4
Update to make the new flux/stress BC work for both element and edge …
Oct 9, 2020
4abd573
Small typo fix.
Oct 9, 2020
6e04ca0
Update src/LowMachEquationSystem.C
mchurchf Oct 9, 2020
8d2acc4
Update src/kernel/ScalarFaceFluxBCElemKernel.C
mchurchf Oct 9, 2020
199302d
Update src/ngp_algorithms/WallFuncGeometryAlg.C
mchurchf Oct 9, 2020
aab10b6
Update src/wind_energy/BdyLayerStatistics.C
mchurchf Oct 9, 2020
6fd4cbe
Update to WallFuncGeometryAlg to make distance from wall of velocity …
Oct 13, 2020
60277fd
Merging with changes made through github website pull request suggest…
Oct 13, 2020
c41ab95
Merging with current exawind/master
Oct 13, 2020
1321fc6
Merging Robert's Rayleigh damping with the updated lower BC code, whi…
Oct 13, 2020
f9a737b
Initial clean up to better match main exawind master.
Oct 14, 2020
52674bf
Small updates to better match upgraded ABL surface BC branch and master.
Oct 14, 2020
1d82f96
Clean up to integrate Robert's gravity wave implementation into new f…
Oct 15, 2020
6a18867
Generalized the capping inversion aux function to take user inputs in…
Oct 15, 2020
6b9c08c
Commit for updates to mesh
Oct 15, 2020
6bf95e9
Removing Rayleigh damping from ablNeutralEdge test case. Will add a …
Oct 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/NaluParsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct WallUserData : public UserData {

bool wallFunctionApproach_;
bool ablWallFunctionApproach_;
YAML::Node ablWallFunctionNode_;

bool isFsiInterface_;

Expand Down
7 changes: 7 additions & 0 deletions include/Realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class TensorProductQuadratureRule;
class LagrangeBasis;
class PromotedElementIO;

class ComputeDistanceToSurface;

/** Representation of a computational domain and physics equations solved on
* this domain.
*
Expand Down Expand Up @@ -135,6 +137,9 @@ class Realm {
void enforce_bc_on_exposed_faces();
void setup_initial_conditions();
void setup_property();
void register_surface_distance_fields();
void setup_surface_distance_calculations();
void perform_surface_distance_calculations();
void extract_universal_constant(
const std::string name, double &value, const bool useDefault);
void augment_property_map(
Expand Down Expand Up @@ -646,6 +651,8 @@ class Realm {
stk::mesh::PartVector allPeriodicInteractingParts_;
stk::mesh::PartVector allNonConformalInteractingParts_;

std::vector<std::shared_ptr<ComputeDistanceToSurface>> surfDists_;

bool isFinalOuterIter_{false};

/** The starting index (global) of the HYPRE linear system in this MPI rank
Expand Down
27 changes: 27 additions & 0 deletions include/SolutionOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <Enums.h>

#include <Kokkos_Core.hpp>

// standard c++
#include <string>
#include <map>
Expand Down Expand Up @@ -47,6 +49,13 @@ enum ProjTScaleType {
NUM_TSCALE_TYPES
};

struct RayleighDampingParameters
{
double cmax{1};
double width{1};
Kokkos::Array<double, 3> uref{{1,0,0}};
};

class SolutionOptions
{
public:
Expand Down Expand Up @@ -100,6 +109,22 @@ class SolutionOptions

bool has_set_boussinesq_time_scale();

RayleighDampingParameters get_rayleigh_damping_params(std::string name) const
{
return rdParams_.at(name);
}

std::map<std::string, RayleighDampingParameters> get_rayleigh_damping_params() const
{
return rdParams_;
}

bool has_rayleigh_damping_params() const
{
return !rdParams_.empty();
}


double hybridDefault_;
double alphaDefault_;
double alphaUpwDefault_;
Expand Down Expand Up @@ -215,6 +240,8 @@ class SolutionOptions
bool newHO_;

bool resetTAMSAverages_;

std::map<std::string, RayleighDampingParameters> rdParams_;
};

} // namespace nalu
Expand Down
53 changes: 52 additions & 1 deletion include/WallDistEquationSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EquationSystems;
class WallDistEquationSystem : public EquationSystem
{
public:
WallDistEquationSystem(EquationSystems&);
WallDistEquationSystem(EquationSystems&, std::string = "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this tested against SST? Looking at the code for default blade-resolved simulations, this will change the ndtw field to minimum_distance_to_ and RANS models are expecting the field minimum_distance_to_wall. This will break all existing restart files.

Suggested change
WallDistEquationSystem(EquationSystems&, std::string = "");
WallDistEquationSystem(EquationSystems&, std::string = "wall", bool addToEqSys = true);


virtual ~WallDistEquationSystem();

Expand Down Expand Up @@ -77,6 +77,28 @@ class WallDistEquationSystem : public EquationSystem

void compute_wall_distance();

static std::string min_wall_distance_name(std::string wallName)
{
return "minimum_distance_to_" + wallName;
}
static std::string wall_distance_phi_name(std::string wallName)
{
return wallName + "_distance_phi";
}

static std::string wall_distance_phi_bc_name(std::string wallName)
{
return wallName + "_distance_phi_bc";
}

static std::string dphidx_name(std::string wallName)
{
return "grad_" + wall_distance_phi_name(wallName);
}

void register_nodal_grad_algorithm_on_part(stk::mesh::Part* part);
void register_disting_surface(stk::mesh::Part* part, bool = false);

private:
WallDistEquationSystem() = delete;
WallDistEquationSystem(const WallDistEquationSystem&) = delete;
Expand All @@ -102,6 +124,35 @@ class WallDistEquationSystem : public EquationSystem

//! User option to force recomputation of wall distance on restart
bool forceInitOnRestart_{false};
std::string wallName_{""};
};

class ComputeDistanceToSurface
{
public:
ComputeDistanceToSurface(
Realm& realm,
std::string surface_name,
stk::mesh::PartVector interior,
stk::mesh::PartVector bc)
: meta_(*realm.metaData_),
eqsys(realm.equationSystems_, surface_name),
surface_name_(surface_name),
interior_(interior),
bc_(bc)
{
}

void register_fields();
void create_algorithms();
const ScalarFieldType& compute();
private:
stk::mesh::MetaData& meta_;
WallDistEquationSystem eqsys;
const std::string surface_name_;

stk::mesh::PartVector interior_;
stk::mesh::PartVector bc_;
};

} // nalu
Expand Down
65 changes: 65 additions & 0 deletions include/edge_kernels/MomentumABLWallShearStressEdgeKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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 MOMENTUMABLWALLSHEARSTRESSEDGEKERNEL_H
#define MOMENTUMABLWALLSHEARSTRESSEDGEKERNEL_H

#include "kernel/Kernel.h"
#include "KokkosInterface.h"
#include "FieldTypeDef.h"

#include "stk_mesh/base/MetaData.hpp"
#include "stk_mesh/base/Entity.hpp"

namespace sierra {
namespace nalu {


/**
* This class applies the computed wall shear stress field to the boundary.
*
*/
template<typename BcAlgTraits>
class MomentumABLWallShearStressEdgeKernel: public NGPKernel<MomentumABLWallShearStressEdgeKernel<BcAlgTraits>>
{
public:
MomentumABLWallShearStressEdgeKernel(
stk::mesh::MetaData&,
ElemDataRequests& faceDataPreReqs);

KOKKOS_FORCEINLINE_FUNCTION MomentumABLWallShearStressEdgeKernel() = default;

KOKKOS_FORCEINLINE_FUNCTION virtual ~MomentumABLWallShearStressEdgeKernel() = default;

using Kernel::execute;

KOKKOS_FUNCTION
virtual void execute(
SharedMemView<DoubleType**, DeviceShmem>&,
SharedMemView<DoubleType*, DeviceShmem>&,
ScratchViews<DoubleType, DeviceTeamHandleType, DeviceShmem>&);

private:
unsigned velocityNp1_ {stk::mesh::InvalidOrdinal};
unsigned bcVelocity_ {stk::mesh::InvalidOrdinal};
unsigned density_ {stk::mesh::InvalidOrdinal};
unsigned exposedAreaVec_ {stk::mesh::InvalidOrdinal};
unsigned wallFricVel_ {stk::mesh::InvalidOrdinal};
unsigned wallShearStress_ {stk::mesh::InvalidOrdinal};
unsigned wallNormDist_ {stk::mesh::InvalidOrdinal};

MasterElement* meFC_{nullptr};
};

} // nalu
} // sierra


#endif /* MOMENTUMABLWALLFUNCEDGEKERNEL_H */
73 changes: 73 additions & 0 deletions include/kernel/ScalarFaceFluxBCElemKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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 SCALARFACEFLUXBCELEMKERNEL_H
#define SCALARFACEFLUXBCELEMKERNEL_H

#include "kernel/Kernel.h"
#include "FieldTypeDef.h"

#include "stk_mesh/base/MetaData.hpp"
#include "stk_mesh/base/Entity.hpp"

namespace sierra {
namespace nalu {

class ElemDataRequests;
class MasterElement;

/**
* This class applies the computed wall heat flux field to the boundary.
*
*/
template <typename BcAlgTraits>
class ScalarFaceFluxBCElemKernel
: public NGPKernel<ScalarFaceFluxBCElemKernel<BcAlgTraits>>
{
public:
ScalarFaceFluxBCElemKernel(
const stk::mesh::BulkData&,
GenericFieldType*,
std::string,
const bool,
ElemDataRequests&);

KOKKOS_FORCEINLINE_FUNCTION
ScalarFaceFluxBCElemKernel() = default;

KOKKOS_FUNCTION
virtual ~ScalarFaceFluxBCElemKernel() = default;

/** Execute the kernel within a Kokkos loop and populate the LHS and RHS for
* the linear solve
*/
using Kernel::execute;

KOKKOS_FUNCTION
virtual void execute(
SharedMemView<DoubleType**, DeviceShmem>&,
SharedMemView<DoubleType*, DeviceShmem>&,
ScratchViews<DoubleType, DeviceTeamHandleType, DeviceShmem>&);

private:
unsigned coordinates_{stk::mesh::InvalidOrdinal};
unsigned bcScalarQ_{stk::mesh::InvalidOrdinal};
unsigned exposedAreaVec_{stk::mesh::InvalidOrdinal};

const bool useShifted_{false};

MasterElement* meFC_{nullptr};
};

} // nalu
} // sierra


#endif /* SCALARFLUXBCELEMKERNEL_H */
Loading