Skip to content

Commit

Permalink
Add kestrel capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
rpodgorney committed Jun 23, 2022
1 parent 63b3464 commit 91b81f5
Show file tree
Hide file tree
Showing 27 changed files with 1,144 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "moose"]
path = moose
url = https://github.com/idaholab/moose.git
[submodule "iapws95"]
path = iapws95
url = [email protected]:idaholab/iapws95.git
update = none
52 changes: 47 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,62 @@ else
MOOSE_DIR ?= $(shell dirname `pwd`)/moose
endif

# check that MOOSE is available
MOOSE_CONTENT := $(shell ls $(MOOSE_DIR) 2> /dev/null)
ifeq ($(MOOSE_CONTENT),)
$(error MOOSE framework does not seem to be available. Make sure that either the submodule is checked out or that your MOOSE_DIR points to the correct location)
endif

# check that IAPWS95 is available
IAPWS95_DIR ?= $(CURDIR)/iapws95
IAPWS95_CONTENT := $(shell ls $(IAPWS95_DIR) 2> /dev/null)

# framework
FRAMEWORK_DIR := $(MOOSE_DIR)/framework
CURRENT_DIR := $(shell pwd)
FALCON_DIR ?= $(CURRENT_DIR)

# moose submodule status
moose_status := $(shell git -C $(FALCON_DIR) submodule status 2>/dev/null | grep moose | cut -c1)
ifneq (,$(findstring +,$(moose_status)))
ifneq ($(origin FALCON_DIR),environment)
moose_status_msg = "WARNING: Your MOOSE submodule is out of date.\n"
endif
endif

all: moose_submodule_status

moose_submodule_status:
@if [ x$(moose_status_msg) != "x" ]; then echo $(moose_status_msg); fi

include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

################################## MODULES ####################################
GEOCHEMISTRY := yes
POROUS_FLOW := yes
STOCHASTIC_TOOLS := yes
TENSOR_MECHANICS := yes

GEOCHEMISTRY := yes
POROUS_FLOW := yes
STOCHASTIC_TOOLS := yes
TENSOR_MECHANICS := yes
THERMAL_HYDRAULICS := yes
FLUID_PROPERTIES := yes
HEAT_CONDUCTION := yes
MISC := yes
NAVIER_STOKES := yes
RDG := yes
USE_TEST_LIBS := yes
include $(MOOSE_DIR)/modules/modules.mk
###############################################################################

# IAPWS95
ifneq ($(IAPWS95_CONTENT),)
APPLICATION_DIR := $(IAPWS95_DIR)
APPLICATION_NAME := iapws95
GEN_REVISION := no
libmesh_CXXFLAGS += -DIAPWS95_ENABLED
include $(FRAMEWORK_DIR)/app.mk
include $(IAPWS95_DIR)/libSBTL.mk
endif

# dep apps
APPLICATION_DIR := $(CURDIR)
APPLICATION_NAME := falcon
Expand Down
1 change: 1 addition & 0 deletions iapws95
Submodule iapws95 added at 208297
28 changes: 28 additions & 0 deletions include/closures/Closures1PhaseFalcon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include "Closures1PhaseBase.h"

/**
* Single-phase closures for tube geometry based on TRACE v5
*/
class Closures1PhaseFalcon : public Closures1PhaseBase
{
public:
Closures1PhaseFalcon(const InputParameters & params);

virtual void checkFlowChannel(const FlowChannelBase & flow_channel) const override;
virtual void checkHeatTransfer(const HeatTransferBase & heat_transfer, const FlowChannelBase & flow_channel) const override;
virtual void addMooseObjectsFlowChannel(const FlowChannelBase & flow_channel) override;
virtual void addMooseObjectsHeatTransfer(const HeatTransferBase & heat_transfer, const FlowChannelBase & flow_channel) override;

protected:
/**
* Adds material that computes wall friction factor using Churchill correlation
*
* @param[in] flow_channel Flow channel component
*/
void addWallFrictionChurchillMaterial(const FlowChannel1Phase & flow_channel) const;

public:
static InputParameters validParams();
};
52 changes: 52 additions & 0 deletions include/materials/ADWallHeatTransferCoefficient3EqnMaterial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

#include "Material.h"
#include "FlowChannelBase.h"

class SinglePhaseFluidProperties;

/**
* Computes liquid wall heat transfer coefficient for pipe geometry using TRACE closures
*/
class ADWallHeatTransferCoefficient3EqnMaterial : public Material
{
public:
ADWallHeatTransferCoefficient3EqnMaterial(const InputParameters & parameters);

protected:
virtual void computeQpProperties();

/// Wall heat transfer coefficient
ADMaterialProperty<Real> & _Hw;
/// Fluid density
const ADMaterialProperty<Real> & _rho;
/// Fluid velocity
const ADMaterialProperty<Real> & _vel;
/// Hydraulic diameter
const ADMaterialProperty<Real> & _D_h;
/// Specific volume
const ADMaterialProperty<Real> & _v;
/// Specific internal energy
const ADMaterialProperty<Real> & _e;
/// Fluid temperature
const ADMaterialProperty<Real> & _T;
/// Wall temperature
const ADMaterialProperty<Real> & _T_wall;
/// Pressure of the fluid
const ADMaterialProperty<Real> & _p;
/// Reynolds number
const ADMaterialProperty<Real> & _Re;
/// Prandtl number
const ADMaterialProperty<Real> & _Pr;
/// Thermal conductivity of the fluid
const ADMaterialProperty<Real> & _k;
/// Dynamic viscosity of the fluid
const ADMaterialProperty<Real> & _mu;
/// Gravitational acceleration magnitude
const Real & _gravity_magnitude;
/// Fluid properties
const SinglePhaseFluidProperties & _fp;

public:
static InputParameters validParams();
};
20 changes: 19 additions & 1 deletion src/base/FalconApp.C
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ Baseline dependencies (do NOT touch)
#include "AppFactory.h"
#include "ModulesApp.h"
#include "MooseSyntax.h"

#ifdef IAPWS95_ENABLED
#include "IAPWS95App.h"
#endif
#include "ThermalHydraulicsApp.h"
/*******************************************************************************
Input template (do NOT touch)
*******************************************************************************/
Expand Down Expand Up @@ -51,8 +54,19 @@ FalconApp::registerAll(Factory & f, ActionFactory & af, Syntax & syntax)
ModulesApp::registerAll(f, af, syntax);
Registry::registerObjectsTo(f, {"FalconApp"});
Registry::registerActionsTo(af, {"FalconApp"});
Registry::registerObjectsTo(f, {"THMTestApp"});

/* register custom execute flags, action syntax, etc. here */
ThermalHydraulicsApp::registerAll(f, af, syntax);


#ifdef IAPWS95_ENABLED
IAPWS95App::registerAll(f, af, syntax);
#endif

// built-in closure types
ThermalHydraulicsApp::registerClosuresOption("falcon", "Closures1PhaseFalcon", THM::FM_SINGLE_PHASE);

}

// External entry point for object registration
Expand All @@ -69,6 +83,10 @@ void
FalconApp::registerApps()
{
registerApp(FalconApp);

#ifdef IAPWS95_ENABLED
registerApp(IAPWS95App);
#endif
}

extern "C" void
Expand Down
153 changes: 153 additions & 0 deletions src/closures/Closures1PhaseFalcon.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#include "Closures1PhaseFalcon.h"
#include "FlowModelSinglePhase.h"
#include "FlowChannel1Phase.h"
#include "HeatTransfer1PhaseBase.h"

registerMooseObject("FalconApp", Closures1PhaseFalcon);

InputParameters
Closures1PhaseFalcon::validParams()
{
InputParameters params = Closures1PhaseBase::validParams();

params.addClassDescription("Single-phase closures for tube geometry based on TRACE v5");

return params;
}

Closures1PhaseFalcon::Closures1PhaseFalcon(const InputParameters & params)
: Closures1PhaseBase(params)
{
}

void
Closures1PhaseFalcon::checkFlowChannel(const FlowChannelBase & flow_channel) const
{
if (MooseUtils::absoluteFuzzyEqual(flow_channel.getGravityMagnitude(), 0.0))
logComponentError(flow_channel.cname(), "Falcon closures assume non-zero gravity.");

if (flow_channel.getNumberOfHeatTransferConnections() > 0)
{
if (!flow_channel.getTemperatureMode())
logComponentError(flow_channel.cname(),
"Heat transfer from heat flux is currently not available. Please, contact "
"developers if you have a need for it.");
}
}

void
Closures1PhaseFalcon::checkHeatTransfer(const HeatTransferBase & /*heat_transfer*/,
const FlowChannelBase & /*flow_channel*/) const
{
}

void
Closures1PhaseFalcon::addMooseObjectsFlowChannel(const FlowChannelBase & flow_channel)
{
const FlowChannel1Phase & flow_channel_1phase =
dynamic_cast<const FlowChannel1Phase &>(flow_channel);

// wall friction material
if (flow_channel.isParamValid("f"))
addWallFrictionFunctionMaterial(flow_channel_1phase);
else
addWallFrictionChurchillMaterial(flow_channel_1phase);

const unsigned int n_ht_connections = flow_channel_1phase.getNumberOfHeatTransferConnections();
if (n_ht_connections > 0)
{
if (n_ht_connections > 1)
addAverageWallTemperatureMaterial(flow_channel_1phase);
else
addWallTemperatureFromAuxMaterial(flow_channel_1phase);
}
}

void
Closures1PhaseFalcon::addMooseObjectsHeatTransfer(const HeatTransferBase & heat_transfer,
const FlowChannelBase & flow_channel)
{
const HeatTransfer1PhaseBase & heat_transfer_1phase =
dynamic_cast<const HeatTransfer1PhaseBase &>(heat_transfer);

if (heat_transfer.isParamValid("Hw"))
{
const FunctionName & Hw_fn_name = heat_transfer.getParam<FunctionName>("Hw");

const std::string class_name = "ADGenericFunctionMaterial";
InputParameters params = _factory.getValidParams(class_name);
params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
params.set<std::vector<std::string>>("prop_names") = {
heat_transfer_1phase.getWallHeatTransferCoefficient1PhaseName()};
params.set<std::vector<FunctionName>>("prop_values") = {Hw_fn_name};
_sim.addMaterial(class_name, genName(heat_transfer.name(), "Hw_material"), params);

heat_transfer.makeFunctionControllableIfConstant(Hw_fn_name, "Hw");
}
else
{
const FlowChannel1Phase & flow_channel_1phase =
_sim.getComponentByName<FlowChannel1Phase>(heat_transfer_1phase.getFlowChannelName());
{
const std::string class_name = "ADReynoldsNumberMaterial";
InputParameters params = _factory.getValidParams(class_name);
params.set<std::vector<SubdomainName>>("block") =
heat_transfer_1phase.getFlowChannelSubdomains();
params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
params.set<MaterialPropertyName>("Re") = FlowModelSinglePhase::REYNOLDS_NUMBER;
_sim.addMaterial(class_name, genName(heat_transfer.name(), "reynolds_mat"), params);
}
{
const std::string class_name = "ADPrandtlNumberMaterial";
InputParameters params = _factory.getValidParams(class_name);
params.set<std::vector<SubdomainName>>("block") =
heat_transfer_1phase.getFlowChannelSubdomains();
params.set<MaterialPropertyName>("cp") =
FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE;
params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
_sim.addMaterial(class_name, genName(heat_transfer.name(), "prandtl_mat"), params);
}
{
const std::string class_name = "ADWallHeatTransferCoefficient3EqnMaterial";
InputParameters params = _factory.getValidParams(class_name);
params.set<std::vector<SubdomainName>>("block") =
heat_transfer_1phase.getFlowChannelSubdomains();
params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
params.set<MaterialPropertyName>("v") = FlowModelSinglePhase::SPECIFIC_VOLUME;
params.set<MaterialPropertyName>("e") = FlowModelSinglePhase::SPECIFIC_INTERNAL_ENERGY;
params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
params.set<MaterialPropertyName>("T_wall") = FlowModelSinglePhase::TEMPERATURE_WALL;
params.set<MaterialPropertyName>("p") = FlowModelSinglePhase::PRESSURE;
params.set<MaterialPropertyName>("Re") = FlowModelSinglePhase::REYNOLDS_NUMBER;
params.set<MaterialPropertyName>("Pr") = "Pr";
params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
params.set<UserObjectName>("fp") = heat_transfer_1phase.getFluidPropertiesName();
params.set<Real>("gravity_magnitude") = flow_channel_1phase.getGravityMagnitude();
_sim.addMaterial(class_name, genName(heat_transfer.name(), "whtc_mat"), params);
}
}
}

void
Closures1PhaseFalcon::addWallFrictionChurchillMaterial(
const FlowChannel1Phase & flow_channel) const
{
const std::string class_name = "ADWallFrictionChurchillMaterial";
InputParameters params = _factory.getValidParams(class_name);
params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
params.set<Real>("roughness") = flow_channel.getParam<Real>("roughness");
const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
_sim.addMaterial(class_name, obj_name, params);
flow_channel.connectObject(params, obj_name, "roughness");
}
Loading

0 comments on commit 91b81f5

Please sign in to comment.