diff --git a/.gitmodules b/.gitmodules index 9e10450f..ec1b26cd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ [submodule "moose"] path = moose url = https://github.com/idaholab/moose.git +[submodule "iapws95"] + path = iapws95 + url = git@hpcgitlab.hpc.inl.gov:idaholab/iapws95.git + update = none diff --git a/Makefile b/Makefile index 41dfa658..36296424 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/iapws95 b/iapws95 new file mode 160000 index 00000000..20829796 --- /dev/null +++ b/iapws95 @@ -0,0 +1 @@ +Subproject commit 20829796e670e9d48151c8acf06fcca5a604a629 diff --git a/include/closures/Closures1PhaseFalcon.h b/include/closures/Closures1PhaseFalcon.h new file mode 100644 index 00000000..fd36eeb1 --- /dev/null +++ b/include/closures/Closures1PhaseFalcon.h @@ -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(); +}; diff --git a/include/materials/ADWallHeatTransferCoefficient3EqnMaterial.h b/include/materials/ADWallHeatTransferCoefficient3EqnMaterial.h new file mode 100644 index 00000000..2ea1a41b --- /dev/null +++ b/include/materials/ADWallHeatTransferCoefficient3EqnMaterial.h @@ -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 & _Hw; + /// Fluid density + const ADMaterialProperty & _rho; + /// Fluid velocity + const ADMaterialProperty & _vel; + /// Hydraulic diameter + const ADMaterialProperty & _D_h; + /// Specific volume + const ADMaterialProperty & _v; + /// Specific internal energy + const ADMaterialProperty & _e; + /// Fluid temperature + const ADMaterialProperty & _T; + /// Wall temperature + const ADMaterialProperty & _T_wall; + /// Pressure of the fluid + const ADMaterialProperty & _p; + /// Reynolds number + const ADMaterialProperty & _Re; + /// Prandtl number + const ADMaterialProperty & _Pr; + /// Thermal conductivity of the fluid + const ADMaterialProperty & _k; + /// Dynamic viscosity of the fluid + const ADMaterialProperty & _mu; + /// Gravitational acceleration magnitude + const Real & _gravity_magnitude; + /// Fluid properties + const SinglePhaseFluidProperties & _fp; + +public: + static InputParameters validParams(); +}; diff --git a/src/base/FalconApp.C b/src/base/FalconApp.C index 3a40f30a..8362d555 100644 --- a/src/base/FalconApp.C +++ b/src/base/FalconApp.C @@ -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) *******************************************************************************/ @@ -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 @@ -69,6 +83,10 @@ void FalconApp::registerApps() { registerApp(FalconApp); + +#ifdef IAPWS95_ENABLED + registerApp(IAPWS95App); +#endif } extern "C" void diff --git a/src/closures/Closures1PhaseFalcon.C b/src/closures/Closures1PhaseFalcon.C new file mode 100644 index 00000000..4eb22863 --- /dev/null +++ b/src/closures/Closures1PhaseFalcon.C @@ -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(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(heat_transfer); + + if (heat_transfer.isParamValid("Hw")) + { + const FunctionName & Hw_fn_name = heat_transfer.getParam("Hw"); + + const std::string class_name = "ADGenericFunctionMaterial"; + InputParameters params = _factory.getValidParams(class_name); + params.set>("block") = flow_channel.getSubdomainNames(); + params.set>("prop_names") = { + heat_transfer_1phase.getWallHeatTransferCoefficient1PhaseName()}; + params.set>("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(heat_transfer_1phase.getFlowChannelName()); + { + const std::string class_name = "ADReynoldsNumberMaterial"; + InputParameters params = _factory.getValidParams(class_name); + params.set>("block") = + heat_transfer_1phase.getFlowChannelSubdomains(); + params.set("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER; + params.set("rho") = FlowModelSinglePhase::DENSITY; + params.set("vel") = FlowModelSinglePhase::VELOCITY; + params.set("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY; + params.set("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>("block") = + heat_transfer_1phase.getFlowChannelSubdomains(); + params.set("cp") = + FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE; + params.set("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY; + params.set("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>("block") = + heat_transfer_1phase.getFlowChannelSubdomains(); + params.set("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER; + params.set("rho") = FlowModelSinglePhase::DENSITY; + params.set("vel") = FlowModelSinglePhase::VELOCITY; + params.set("v") = FlowModelSinglePhase::SPECIFIC_VOLUME; + params.set("e") = FlowModelSinglePhase::SPECIFIC_INTERNAL_ENERGY; + params.set("T") = FlowModelSinglePhase::TEMPERATURE; + params.set("T_wall") = FlowModelSinglePhase::TEMPERATURE_WALL; + params.set("p") = FlowModelSinglePhase::PRESSURE; + params.set("Re") = FlowModelSinglePhase::REYNOLDS_NUMBER; + params.set("Pr") = "Pr"; + params.set("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY; + params.set("fp") = heat_transfer_1phase.getFluidPropertiesName(); + params.set("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>("block") = flow_channel.getSubdomainNames(); + params.set("rho") = FlowModelSinglePhase::DENSITY; + params.set("vel") = FlowModelSinglePhase::VELOCITY; + params.set("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER; + params.set("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY; + params.set("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY; + params.set("roughness") = flow_channel.getParam("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"); +} diff --git a/src/materials/ADWallHeatTransferCoefficient3EqnMaterial.C b/src/materials/ADWallHeatTransferCoefficient3EqnMaterial.C new file mode 100644 index 00000000..6a2ce128 --- /dev/null +++ b/src/materials/ADWallHeatTransferCoefficient3EqnMaterial.C @@ -0,0 +1,114 @@ +#include "ADWallHeatTransferCoefficient3EqnMaterial.h" +#include "SinglePhaseFluidProperties.h" +#include "FlowModelSinglePhase.h" +#include "Numerics.h" + +registerMooseObject("FalconApp", ADWallHeatTransferCoefficient3EqnMaterial); + +InputParameters +ADWallHeatTransferCoefficient3EqnMaterial::validParams() +{ + InputParameters params = Material::validParams(); + params.addRequiredParam("fp", + "The name of the user object with fluid properties"); + params.addRequiredParam("rho", "Density of the liquid"); + params.addRequiredParam("vel", "x-component of the liquid velocity"); + params.addRequiredParam("D_h", "Hydraulic diameter"); + params.addRequiredParam("v", "Specific volume of the liquid"); + params.addRequiredParam("e", "Specific internal energy of the liquid"); + params.addRequiredParam("T", "Fluid temperature"); + params.addRequiredParam("T_wall", "Wall temperature"); + params.addRequiredParam("p", "Pressure of the liquid"); + params.addRequiredParam("Re", "Reynolds number of the liquid"); + params.addRequiredParam("Pr", "Prandtl number of the liquid"); + params.addRequiredParam("mu", "Dynamic viscosity of the liquid"); + params.addRequiredParam("gravity_magnitude", "Gravitational acceleration magnitude"); + return params; +} + +ADWallHeatTransferCoefficient3EqnMaterial:: + ADWallHeatTransferCoefficient3EqnMaterial(const InputParameters & parameters) + : Material(parameters), + _Hw(declareADProperty(FlowModelSinglePhase::HEAT_TRANSFER_COEFFICIENT_WALL)), + _rho(getADMaterialProperty("rho")), + _vel(getADMaterialProperty("vel")), + _D_h(getADMaterialProperty("D_h")), + _v(getADMaterialProperty("v")), + _e(getADMaterialProperty("e")), + _T(getADMaterialProperty("T")), + _T_wall(getADMaterialProperty("T_wall")), + _p(getADMaterialProperty("p")), + _Re(getADMaterialProperty("Re")), + _Pr(getADMaterialProperty("Pr")), + _k(getADMaterialProperty("k")), + _mu(getADMaterialProperty("mu")), + _gravity_magnitude(getParam("gravity_magnitude")), + _fp(getUserObject("fp")) +{ +} + +const Real Nu_lam_const = 4.36; + +static +ADReal +naturalConvectionLiquid(ADReal Gr, ADReal Pr) +{ + // Eq. 6-20 + ADReal turb = 0.1 * std::cbrt(Gr * Pr); + // Eq. 6-16 + ADReal lam = 0.59 * std::pow(Gr * Pr, 0.25); + // Eq. 6-14 + return std::max(turb, lam); +} + +static +ADReal +Gnielinski(ADReal Pr, ADReal Re) +{ + // see TRACE manual p. 255 + Pr = std::max(0.5, Pr); + // see TRACE manual p. 255 + Re = std::max(1000., Re); + // Eq. 6-10 + ADReal f = std::pow(1.58 * std::log(Re) - 3.28, -2); + ADReal f2 = f * 0.5; + // Eq. 6-9 + return (f2 * (Re - 1000) * Pr) / (1 + 12.7 * std::pow(f2, 0.5) * (std::pow(Pr, 2. / 3.) - 1)); +} + +void +ADWallHeatTransferCoefficient3EqnMaterial::computeQpProperties() +{ + ADReal Re = std::max(1.0, _Re[_qp]); + + ADReal beta = _fp.beta_from_p_T(_p[_qp], _T[_qp]); + // Note that Equation (6-19) in the TRACE V5.0 theory manual gives the film + // density to be computed as + // T_film = 0.5 * (T_wall + _T[_qp]) + // rho_film = rho_from_p_T(_p[_qp], T_film) + // However, this can cause NaNs. + // The idaholab/trace, hash 0885f96f12567a8fa5780510f48d594c35e49e2c, version + // of TRACE computes film density as follows: + // rho_film = rho + 0.5 * drho/dT * (T_wall - T) + const ADReal drho_dT = -beta * _rho[_qp]; // Using the relation: beta = -drho/dT / rho + const ADReal rho_film = _rho[_qp] + 0.5 * drho_dT * (_T_wall[_qp] - _T[_qp]); + ADReal dT = std::abs(_T_wall[_qp] - _T[_qp]); + // Eq. 6-17 + ADReal Gr = std::max(THM::Grashof(beta, dT, _D_h[_qp], rho_film, _mu[_qp], _gravity_magnitude), 1.e-20); + const ADReal rho_w = _fp.rho_from_p_T(_p[_qp], _T_wall[_qp]); + const ADReal e_w = _fp.e_from_p_rho(_p[_qp], rho_w); + ADReal Pr_w = THM::Prandtl(_fp.cp_from_v_e(1 / rho_w, e_w), + _fp.mu_from_v_e(1 / rho_w, e_w), + _fp.k_from_v_e(1 / rho_w, e_w)); + + // turbulent flow (eq 6-12) + ADReal Pr_ratio = _Pr[_qp] / Pr_w; + ADReal Nu_turb = Gnielinski(_Pr[_qp], Re) * std::pow(Pr_ratio, 0.11); + + ADReal Nu_fc = std::max(Nu_lam_const, Nu_turb); + + ADReal Nu_nc = naturalConvectionLiquid(Gr, _Pr[_qp]); + ADReal Nu = std::max(Nu_fc, Nu_nc); + + _Hw[_qp] = THM::wallHeatTransferCoefficient(Nu, _k[_qp], _D_h[_qp]); +} diff --git a/test/tests/1d_well/1d_well.i b/test/tests/1d_well/1d_well.i new file mode 100644 index 00000000..1e6aaabd --- /dev/null +++ b/test/tests/1d_well/1d_well.i @@ -0,0 +1,107 @@ +[GlobalParams] + gravity_vector = '0 0 -9.81' + + initial_vel = 0 + initial_p = 1.5e7 + initial_T = initial_T_fn + + closures = simple +[] + +[Closures] + [simple] + type = Closures1PhaseSimple + [] +[] + +[Modules] + [FluidProperties] + [./water] + type = IAPWS95LiquidFluidProperties + [../] + [] +[] + +[Functions] + [./initial_T_fn] + type = PiecewiseLinear + axis = z + x = '0 1000' + y = '327 550' + [../] + + [./inlet_m_dot_fn] + type = PiecewiseLinear + x = '0 120' + y = '0 5' + [../] +[] + +[Components] + [./inlet] + type = InletMassFlowRateTemperature1Phase + input = 'pipe:in' + m_dot = 5 + T = 327 + [../] + + [./pipe] + type = FlowChannel1Phase + fp = water + position = '0 0 0' + orientation = '0 0 1' + # r = 0.2 m + A = 1.2566370614e-01 + D_h = 4.0000000000e-01 + + f = 0.01 + + length = 1000 + n_elems = 100 + [../] + + [./outlet] + type = Outlet1Phase + input = 'pipe:out' + p = 1.5e7 + [../] +[] + +[ControlLogic] + [./inlet_m_dot] + type = TimeFunctionComponentControl + component = inlet + parameter = m_dot + function = inlet_m_dot_fn + [../] +[] + +[Preconditioning] + [./pc] + type = SMP + full = true + [../] +[] + +[Executioner] + type = Transient + scheme = 'bdf2' + + start_time = 0 + num_steps = 1 + dt = 0.1 + + solve_type = 'NEWTON' + line_search = basic + nl_rel_tol = 1e-5 + nl_abs_tol = 1e-8 + nl_max_its = 10 + l_tol = 1e-3 + l_max_its = 10 +[] + +[Outputs] + exodus = true + print_linear_residuals = false + velocity_as_vector = false +[] diff --git a/test/tests/1d_well/1d_well_w_hs.i b/test/tests/1d_well/1d_well_w_hs.i new file mode 100644 index 00000000..b55de8ae --- /dev/null +++ b/test/tests/1d_well/1d_well_w_hs.i @@ -0,0 +1,185 @@ +T_inj = 323.15 + +T_top = 327 +T_bottom = 550 + +p_out = 1.5e7 + +well_length = 1000 +well_radius = 0.1 +well_A = ${fparse pi * well_radius * well_radius} +well_D_h = ${fparse 2 * well_radius} +well_P_hf = ${fparse 2 * pi * well_radius} + +[GlobalParams] + gravity_vector = '0 0 -9.81' + + initial_vel = 0 + initial_p = ${p_out} + initial_T = initial_T_fn + + closures = simple + + n_elems = 100 +[] + +[Closures] + [simple] + type = Closures1PhaseSimple + [] +[] + +[Modules] + [FluidProperties] + [./water] + type = IAPWS95LiquidFluidProperties + [../] + [] +[] + +[HeatStructureMaterials] + [./mild_steel] + type = SolidMaterialProperties + rho = 7850 + cp = 510.8 + k = 60 + [../] + + [./cement] + type = SolidMaterialProperties + rho = 2400 + cp = 920 + k = 0.29 + [../] + + [./rock] + type = SolidMaterialProperties + rho = 2750 + cp = 830 + k = 3 + [../] +[] + +[Functions] + [./initial_T_fn] + type = PiecewiseLinear + axis = z + x = '-${well_length} 0' + y = '${T_bottom} ${T_top}' + [../] + + [./inlet_m_dot_fn] + type = PiecewiseLinear + x = '0 120' + y = '0 5' + [../] + + [./T_ext_fn] + type = PiecewiseLinear + axis = z + x = '-${well_length} 0' + y = '${T_bottom} ${T_top}' + [../] +[] + +[Components] + [./inlet] + type = InletMassFlowRateTemperature1Phase + input = 'pipe:in' + m_dot = 5 + T = ${T_inj} + [../] + + [./pipe] + type = FlowChannel1Phase + fp = water + position = '0 0 0' + orientation = '0 0 -1' + A = ${well_A} + D_h = ${well_D_h} + + f = 0.01 + + length = ${well_length} + [../] + + [./surr] + type = HeatStructureCylindrical + position = '0 0 0' + orientation = '0 0 -1' + length = ${well_length} + + names = 'wall cement rock' + widths = '0.00635 5.10E-02 4.84265' + materials = 'mild_steel cement rock' + n_part_elems = '10 5 5' + inner_radius = ${well_radius} + initial_T = initial_T_fn + [../] + + [./hx_pipe_surr] + type = HeatTransferFromHeatStructure1Phase + flow_channel = pipe + hs = surr + hs_side = INNER + P_hf = ${well_P_hf} + Hw = 1000 + [../] + + [./T_ext] + type = HSBoundarySpecifiedTemperature + hs = surr + boundary = surr:outer + T = T_ext_fn + [../] + + [./outlet] + type = Outlet1Phase + input = 'pipe:out' + p = ${p_out} + [../] +[] + +[ControlLogic] + [./inlet_m_dot] + type = TimeFunctionComponentControl + component = inlet + parameter = m_dot + function = inlet_m_dot_fn + [../] +[] + +[Preconditioning] + [./pc] + type = SMP + full = true + [../] +[] + +[Executioner] + type = Transient + scheme = 'bdf2' + + start_time = 0 + end_time = 172800 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 0.1 + [../] + + solve_type = 'NEWTON' + line_search = basic + nl_rel_tol = 1e-5 + nl_abs_tol = 1e-8 + nl_max_its = 10 + l_tol = 1e-3 + l_max_its = 10 + + automatic_scaling = true +[] + +[Outputs] + exodus = true + print_linear_residuals = false + velocity_as_vector = false +[] diff --git a/test/tests/1d_well/gold/1d_well_out.e b/test/tests/1d_well/gold/1d_well_out.e new file mode 100644 index 00000000..f2ddf0ed Binary files /dev/null and b/test/tests/1d_well/gold/1d_well_out.e differ diff --git a/test/tests/1d_well/tests b/test/tests/1d_well/tests new file mode 100644 index 00000000..86bf4f9a --- /dev/null +++ b/test/tests/1d_well/tests @@ -0,0 +1,16 @@ +[Tests] + [./1d_well] + type = 'Exodiff' + input = '1d_well.i' + exodiff = '1d_well_out.e' + required_submodule = 'iapws95' + [../] + + [./1d_well_w_hs.syntax_check] + type = RunApp + input = '1d_well_w_hs.i' + check_input = true + recover = false + required_submodule = 'iapws95' + [../] +[] diff --git a/test/tests/closures/falcon_1phase/err.zero_gravity.i b/test/tests/closures/falcon_1phase/err.zero_gravity.i new file mode 100644 index 00000000..4143fce1 --- /dev/null +++ b/test/tests/closures/falcon_1phase/err.zero_gravity.i @@ -0,0 +1,56 @@ +[GlobalParams] + gravity_vector = '0 0 0' + + initial_T = 300 + initial_p = 1e5 + initial_vel = 0 +[] + +[Closures] + [Falcon] + type = Closures1PhaseFalcon + [] +[] + +[Modules] + [FluidProperties] + [./eos] + type = IAPWS95LiquidFluidProperties + [../] + [] +[] + +[Components] + [./pipe] + type = FlowChannel1Phase + + position = '0 0 0' + orientation = '1 0 0' + length = 1 + n_elems = 1 + A = 1.0e-02 + D_h = 1.0e-01 + fp = eos + closures = Falcon + [../] + + [./inlet] + type = SolidWall1Phase + input = 'pipe:in' + [../] + + [./outlet] + type = SolidWall1Phase + input = 'pipe:out' + [../] +[] + +[Executioner] + type = Transient + scheme = 'bdf2' + + start_time = 0 + dt = 1 + num_steps = 1 + abort_on_solve_fail = true +[] diff --git a/test/tests/closures/falcon_1phase/f_wall.i b/test/tests/closures/falcon_1phase/f_wall.i new file mode 100644 index 00000000..d0f18628 --- /dev/null +++ b/test/tests/closures/falcon_1phase/f_wall.i @@ -0,0 +1,41 @@ +[ClosureTest1Phase] + A = ${A} + D_h = ${D_h} + T_wall = ${T_wall} + + T = ${T} + p = ${p} + vel = ${vel} + fp_1phase = fp_1phase + + output = 'f_F' +[] + +[Modules] + [FluidProperties] + [./fp_1phase] + type = IAPWS95LiquidFluidProperties + [../] + [] +[] + +[Materials] + [./wall_friction_mat] + type = WallFrictionChurchillMaterial + rhoA = rhoA + rhouA = rhouA + rhoEA = rhoEA + rho = rho + vel = vel + D_h = D_h + mu = mu + f_D = f_D + roughness = 2.5e-6 + [../] + + [./f_F_mat] + type = FanningFrictionFactorMaterial + f_F = f_F + f_D = f_D + [../] +[] diff --git a/test/tests/closures/falcon_1phase/gold/f_wall_01.csv b/test/tests/closures/falcon_1phase/gold/f_wall_01.csv new file mode 100644 index 00000000..ab254ba1 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/f_wall_01.csv @@ -0,0 +1,2 @@ +time,f_F +1,0.007687449 diff --git a/test/tests/closures/falcon_1phase/gold/f_wall_02.csv b/test/tests/closures/falcon_1phase/gold/f_wall_02.csv new file mode 100644 index 00000000..ad7c8990 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/f_wall_02.csv @@ -0,0 +1,2 @@ +time,f_F +1,0.00764825 diff --git a/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_01.csv b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_01.csv new file mode 100644 index 00000000..37aad79e --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_01.csv @@ -0,0 +1,2 @@ +time,Hw +1,28.1031425561896 diff --git a/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_02.csv b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_02.csv new file mode 100644 index 00000000..7eb7ed27 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_02.csv @@ -0,0 +1,2 @@ +time,Hw +1,9772.48756793146 diff --git a/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_03.csv b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_03.csv new file mode 100644 index 00000000..b261f2f2 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_03.csv @@ -0,0 +1,2 @@ +time,Hw +1,1617.24658217762 diff --git a/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_04.csv b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_04.csv new file mode 100644 index 00000000..db1a81c2 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/htc_wall_liquid_04.csv @@ -0,0 +1,2 @@ +time,Hw +1,1209.21059528872 diff --git a/test/tests/closures/falcon_1phase/gold/phy.f_out_f_0002.csv b/test/tests/closures/falcon_1phase/gold/phy.f_out_f_0002.csv new file mode 100644 index 00000000..1b9b3fee --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/phy.f_out_f_0002.csv @@ -0,0 +1,2 @@ +x,y,z,id,f_D +0.5,0,3.0616169978684e-17,0.5,0.059628779127185 diff --git a/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.T_wall_Hw_0002.csv b/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.T_wall_Hw_0002.csv new file mode 100644 index 00000000..ad6e862f --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.T_wall_Hw_0002.csv @@ -0,0 +1,2 @@ +x,y,z,id,Hw +0.5,0,3.0616169978684e-17,0.5,247.92429595566 diff --git a/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.const_Hw_0002.csv b/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.const_Hw_0002.csv new file mode 100644 index 00000000..c0becef2 --- /dev/null +++ b/test/tests/closures/falcon_1phase/gold/phy.whtc_liquid.const_Hw_0002.csv @@ -0,0 +1,2 @@ +x,y,z,id,Hw +0.5,0,3.0616169978684e-17,0.5,1234 diff --git a/test/tests/closures/falcon_1phase/htc_wall.i b/test/tests/closures/falcon_1phase/htc_wall.i new file mode 100644 index 00000000..36d2e0eb --- /dev/null +++ b/test/tests/closures/falcon_1phase/htc_wall.i @@ -0,0 +1,61 @@ +[ClosureTest1Phase] + A = ${A} + D_h = ${D_h} + T_wall = ${T_wall} + T = ${T} + p = ${p} + vel = ${vel} + fp_1phase = fp_1phase + + ad_output = 'Hw' + ad = true +[] + +[Modules] + [FluidProperties] + [fp_1phase] + type = IAPWS95LiquidFluidProperties + [] + [] +[] + +[Materials] + [Re_material] + type = ADReynoldsNumberMaterial + D_h = D_h + Re = Re + mu = mu + rho = rho + vel = vel + [] + + [Pr_material] + type = ADPrandtlNumberMaterial + cp = cp + mu = mu + k = k + [] + + [T_wall_material] + type = ADCoupledVariableValueMaterial + prop_name = T_wall + coupled_variable = T_wall + [] + + [Hw_mat] + type = ADWallHeatTransferCoefficient3EqnMaterial + D_h = D_h + rho = rho + vel = vel + v = v + e = e + T = T + T_wall = T_wall + p = p + Re = Re + Pr = Pr + mu = mu + fp = fp_1phase + gravity_magnitude = 9.80665 + [] +[] diff --git a/test/tests/closures/falcon_1phase/phy.f.i b/test/tests/closures/falcon_1phase/phy.f.i new file mode 100644 index 00000000..8b75b227 --- /dev/null +++ b/test/tests/closures/falcon_1phase/phy.f.i @@ -0,0 +1,95 @@ +# This test makes sure that the right closure for wall friction is used through +# the closure class when running 1-phase flow problem. + +[GlobalParams] + gravity_vector = '-9.81 0 0' + + initial_T = 372.7 + initial_p = 1e5 + initial_vel = 0 +[] + +[Closures] + [Falcon] + type = Closures1PhaseFalcon + [] +[] + +[Modules] + [FluidProperties] + [./fp] + type = IAPWS95LiquidFluidProperties + [../] + [] +[] + +[Components] + [./pipe] + type = FlowChannel1Phase + + position = '0 0 0' + orientation = '1 0 0' + length = 1 + n_elems = 1 + A = 1.0e-02 + D_h = 1.0e-01 + + fp = fp + closures = Falcon + [../] + + [./inlet] + type = SolidWall1Phase + input = 'pipe:in' + [../] + + [./outlet] + type = SolidWall1Phase + input = 'pipe:out' + [../] +[] + +[Preconditioning] + [./SMP_PJFNK] + type = SMP + full = true + [../] +[] + +[VectorPostprocessors] + [./f] + type = ADSampler1DReal + block = pipe + property = 'f_D' + sort_by = x + [../] +[] + + +[Executioner] + type = Transient + scheme = 'bdf2' + + start_time = 0 + dt = 0.1 + num_steps = 1 + abort_on_solve_fail = true + + solve_type = 'PJFNK' + nl_rel_tol = 1e-10 + nl_abs_tol = 1e-8 + nl_max_its = 30 + + l_tol = 1e-2 + l_max_its = 30 + + automatic_scaling = true +[] + +[Outputs] + [./out] + type = CSV + execute_on = final + [../] + velocity_as_vector = false +[] diff --git a/test/tests/closures/falcon_1phase/phy.whtc.i b/test/tests/closures/falcon_1phase/phy.whtc.i new file mode 100644 index 00000000..6a35c6b4 --- /dev/null +++ b/test/tests/closures/falcon_1phase/phy.whtc.i @@ -0,0 +1,101 @@ +# This test makes sure that the right closure for wall heat transfer is used through +# the closure class when running 1-phase flow problem. Different closure is used when +# using liquid or vapor fluid. The fluid properties are set from `tests` file. + +[GlobalParams] + gravity_vector = '-9.81 0 0' + + initial_T = 372.7 + initial_p = 1e5 + initial_vel = 0 +[] + +[Closures] + [Falcon] + type = Closures1PhaseFalcon + [] +[] + +[Modules] + [FluidProperties] + [./fp] + [../] + [] +[] + +[Components] + [./pipe] + type = FlowChannel1Phase + + position = '0 0 0' + orientation = '1 0 0' + length = 1 + n_elems = 1 + A = 1.0e-02 + D_h = 1.0e-01 + + f = 0 + fp = fp + closures = Falcon + [../] + + [./ht_pipe] + flow_channel = pipe + P_hf = 4.0e-01 + [../] + + [./inlet] + type = SolidWall1Phase + input = 'pipe:in' + [../] + + [./outlet] + type = SolidWall1Phase + input = 'pipe:out' + [../] +[] + +[Preconditioning] + [./SMP_PJFNK] + type = SMP + full = true + [../] +[] + +[VectorPostprocessors] + [./Hw] + type = ADSampler1DReal + block = pipe + property = 'Hw' + sort_by = x + [../] +[] + + +[Executioner] + type = Transient + scheme = 'bdf2' + + start_time = 0 + dt = 0.1 + num_steps = 1 + abort_on_solve_fail = true + + solve_type = 'PJFNK' + nl_rel_tol = 1e-10 + nl_abs_tol = 1e-8 + nl_max_its = 30 + + l_tol = 1e-2 + l_max_its = 30 + + automatic_scaling = true +[] + +[Outputs] + [./out] + type = CSV + execute_on = final + [../] + velocity_as_vector = false +[] diff --git a/test/tests/closures/falcon_1phase/tests b/test/tests/closures/falcon_1phase/tests new file mode 100644 index 00000000..3bf63a12 --- /dev/null +++ b/test/tests/closures/falcon_1phase/tests @@ -0,0 +1,46 @@ +[Tests] + [./phy.f] + type = 'CSVDiff' + input = 'phy.f.i' + csvdiff = 'phy.f_out_f_0002.csv' + required_submodule = 'iapws95' + [../] + + [./phy.whtc_liquid.T_wall] + type = 'CSVDiff' + input = 'phy.whtc.i' + csvdiff = 'phy.whtc_liquid.T_wall_Hw_0002.csv' + cli_args = ' + Modules/FluidProperties/fp/type=IAPWS95LiquidFluidProperties + Components/ht_pipe/type=HeatTransferFromSpecifiedTemperature1Phase + Components/ht_pipe/T_wall=372.8 + Outputs/file_base=phy.whtc_liquid.T_wall' + required_submodule = 'iapws95' + [../] + + [./phy.whtc_liquid.q_wall] + type = 'RunException' + input = 'phy.whtc.i' + cli_args = ' + Modules/FluidProperties/fp/type=IAPWS95LiquidFluidProperties + Components/ht_pipe/type=HeatTransferFromHeatFlux1Phase + Components/ht_pipe/q_wall=1000 + Outputs/file_base=phy.whtc_liquid.q_wall' + expect_err = 'pipe: Heat transfer from heat flux is currently not available. Please, contact developers if you have a need for it.' + required_submodule = 'iapws95' + [../] + + [./phy.whtc_liquid.const] + type = 'CSVDiff' + input = 'phy.whtc.i' + csvdiff = 'phy.whtc_liquid.const_Hw_0002.csv' + cli_args = ' + Modules/FluidProperties/fp/type=IAPWS95LiquidFluidProperties + Components/ht_pipe/type=HeatTransferFromSpecifiedTemperature1Phase + Components/ht_pipe/T_wall=372.8 + Components/ht_pipe/Hw=1234 + Outputs/file_base=phy.whtc_liquid.const' + rel_err = 1e-15 + required_submodule = 'iapws95' + [../] +[]