Skip to content

Commit

Permalink
Merge pull request #26279 from cpgr/fvenergy
Browse files Browse the repository at this point in the history
FV heat energy capability in porous flow module
  • Loading branch information
cpgr authored Jan 25, 2024
2 parents 58d0497 + 712bbc6 commit b74d234
Show file tree
Hide file tree
Showing 37 changed files with 1,368 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!syntax description /FVBCs/FVPorousFlowAdvectiveFluxBC

This boundary condition implements the weak form of
This boundary condition implements the strong form of
\begin{equation*}
-\nabla\cdot \sum_{\beta}\chi_{\beta}^{\kappa} \rho_{\beta}\frac{k\,k_{\mathrm{r,}\beta}}{\mu_{\beta}}(\nabla P_{\beta} - \rho_{\beta} \mathbf{g})
\end{equation*}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!syntax description /FVKernels/FVPorousFlowAdvectiveFlux

This `FVKernel` implements the weak form of
This `FVKernel` implements the strong form of
\begin{equation*}
-\nabla\cdot \sum_{\beta}\chi_{\beta}^{\kappa} \rho_{\beta}\frac{k\,k_{\mathrm{r,}\beta}}{\mu_{\beta}}(\nabla P_{\beta} - \rho_{\beta} \mathbf{g})
\end{equation*}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!syntax description /FVKernels/FVPorousFlowDispersiveFlux

This `FVKernel` implements the weak form of
This `FVKernel` implements the strong form of
\begin{equation*}
-\nabla\cdot \sum_{\beta}\rho_{\beta}{\mathcal{D}}_{\beta}^{\kappa}\nabla \chi_{\beta}^{\kappa}
\end{equation*}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# FVPorousFlowEnergyTimeDerivative

!syntax description /FVKernels/FVPorousFlowEnergyTimeDerivative

This `FVKernel` implements the strong form of
\begin{equation*}
\frac{\partial}{\partial t}\left((1-\phi)\rho_{R}C_{R}T + \phi\sum_{\beta}S_{\beta}\rho_{\beta}\mathcal{E}_{\beta}\right)
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!alert note
Presently, a first-order accurate implicit Euler time derivative is hard-coded.

!syntax parameters /FVKernels/FVPorousFlowEnergyTimeDerivative

!syntax inputs /FVKernels/FVPorousFlowEnergyTimeDerivative

!syntax children /FVKernels/FVPorousFlowEnergyTimeDerivative
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FVPorousFlowHeatAdvection

!syntax description /FVKernels/FVPorousFlowHeatAdvection

This `FVKernel` implements the strong form of
\begin{equation*}
-\nabla\cdot \sum_{\beta}h_{\beta} \rho_{\beta}\frac{k\,k_{\mathrm{r,}\beta}}{\mu_{\beta}}(\nabla P_{\beta} - \rho_{\beta} \mathbf{g})
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!syntax parameters /FVKernels/FVPorousFlowHeatAdvection

!syntax inputs /FVKernels/FVPorousFlowHeatAdvection

!syntax children /FVKernels/FVPorousFlowHeatAdvection
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FVPorousFlowHeatConduction

!syntax description /FVKernels/FVPorousFlowHeatConduction

This `FVKernel` implements the strong form of
\begin{equation*}
-\nabla\cdot \left(\lambda \nabla T\right)
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!syntax parameters /FVKernels/FVPorousFlowHeatConduction

!syntax inputs /FVKernels/FVPorousFlowHeatConduction

!syntax children /FVKernels/FVPorousFlowHeatConduction
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

!syntax description /FVKernels/FVPorousFlowMassTimeDerivative

This `Kernel` implements the weak form of
This `FVKernel` implements the strong form of
\begin{equation*}
\frac{\partial}{\partial t}\left(\phi\sum_{\beta}S_{\beta}\rho_{\beta}\chi_{\beta}^{\kappa}\right)
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!alert note
Presently, a first-order accurate implicit Euler time derivative is hard-coded.

!syntax parameters /FVKernels/FVPorousFlowMassTimeDerivative

!syntax inputs /FVKernels/FVPorousFlowMassTimeDerivative
Expand Down
14 changes: 14 additions & 0 deletions modules/porous_flow/include/fvbcs/FVPorousFlowAdvectiveFluxBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

class PorousFlowDictator;

/**
* Flux boundary condition where an advective flux is applied
*/
class FVPorousFlowAdvectiveFluxBC : public FVFluxBC
{
public:
Expand All @@ -22,29 +25,40 @@ class FVPorousFlowAdvectiveFluxBC : public FVFluxBC
protected:
virtual ADReal computeQpResidual() override;

/// UserObject that holds information (number of phases, components, etc)
const PorousFlowDictator & _dictator;
/// Number of fluid phases present
const unsigned int _num_phases;
/// Index of the fluid phase this BC applies to
const unsigned int _phase;
/// Index of the fluid component this BC applies to
const unsigned int _fluid_component;

/// Fluid density
const ADMaterialProperty<std::vector<Real>> & _density;
const ADMaterialProperty<std::vector<Real>> & _density_neighbor;

/// Fluid viscosity
const ADMaterialProperty<std::vector<Real>> & _viscosity;
const ADMaterialProperty<std::vector<Real>> & _viscosity_neighbor;

/// Relative permeability
const ADMaterialProperty<std::vector<Real>> & _relperm;
const ADMaterialProperty<std::vector<Real>> & _relperm_neighbor;

/// Mass fraction of fluid components in fluid phases
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions;
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions_neighbor;

/// Permeability
const ADMaterialProperty<RealTensorValue> & _permeability;
const ADMaterialProperty<RealTensorValue> & _permeability_neighbor;

/// Fluid pressure
const ADMaterialProperty<std::vector<Real>> & _pressure;
const ADMaterialProperty<std::vector<Real>> & _pressure_neighbor;

/// Gravity vector
const RealVectorValue & _gravity;

/// The porepressure value at the boundary
Expand Down
13 changes: 13 additions & 0 deletions modules/porous_flow/include/fvkernels/FVPorousFlowAdvectiveFlux.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

class PorousFlowDictator;

/**
* Advective flux of fluid component k in fluid phase alpha
*/
class FVPorousFlowAdvectiveFlux : public FVFluxKernel
{
public:
Expand All @@ -22,28 +25,38 @@ class FVPorousFlowAdvectiveFlux : public FVFluxKernel
protected:
virtual ADReal computeQpResidual() override;

/// UserObject that holds information (number of phases, components, etc)
const PorousFlowDictator & _dictator;
/// Number of fluid phases present
const unsigned int _num_phases;
/// Index of the fluid component this kernel applies to
const unsigned int _fluid_component;

/// Fluid density
const ADMaterialProperty<std::vector<Real>> & _density;
const ADMaterialProperty<std::vector<Real>> & _density_neighbor;

/// Fluid viscosity
const ADMaterialProperty<std::vector<Real>> & _viscosity;
const ADMaterialProperty<std::vector<Real>> & _viscosity_neighbor;

/// Relative permeability
const ADMaterialProperty<std::vector<Real>> & _relperm;
const ADMaterialProperty<std::vector<Real>> & _relperm_neighbor;

/// Mass fraction of fluid components in fluid phases
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions;
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions_neighbor;

/// Permeability
const ADMaterialProperty<RealTensorValue> & _permeability;
const ADMaterialProperty<RealTensorValue> & _permeability_neighbor;

/// Fluid pressure
const ADMaterialProperty<std::vector<Real>> & _pressure;
const ADMaterialProperty<std::vector<Real>> & _pressure_neighbor;
const ADMaterialProperty<std::vector<RealGradient>> & _grad_p;

/// Gravity vector
const RealVectorValue & _gravity;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

class PorousFlowDictator;

/**
* Dispersive flux of component k in fluid phase alpha. Includes the effects
* of both molecular diffusion and hydrodynamic dispersion
*/
class FVPorousFlowDispersiveFlux : public FVFluxKernel
{
public:
Expand All @@ -23,30 +27,39 @@ class FVPorousFlowDispersiveFlux : public FVFluxKernel
protected:
virtual ADReal computeQpResidual() override;

/// UserObject that holds information (number of phases, components, etc)
const PorousFlowDictator & _dictator;
/// Number of fluid phases present
const unsigned int _num_phases;
/// Index of the fluid component this kernel applies to
const unsigned int _fluid_component;

/// Fluid density
const ADMaterialProperty<std::vector<Real>> & _density;

/// Fluid viscosity
const ADMaterialProperty<std::vector<Real>> & _viscosity;
const ADMaterialProperty<std::vector<Real>> & _viscosity_neighbor;

/// Relative permeability
const ADMaterialProperty<std::vector<Real>> & _relperm;
const ADMaterialProperty<std::vector<Real>> & _relperm_neighbor;

/// Mass fraction of fluid components in fluid phases
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions;
const ADMaterialProperty<std::vector<std::vector<Real>>> & _mass_fractions_neighbor;
const ADMaterialProperty<std::vector<std::vector<RealGradient>>> & _grad_mass_frac;

/// Permeability
const ADMaterialProperty<RealTensorValue> & _permeability;
const ADMaterialProperty<RealTensorValue> & _permeability_neighbor;

/// Fluid pressure
const ADMaterialProperty<std::vector<Real>> & _pressure;
const ADMaterialProperty<std::vector<Real>> & _pressure_neighbor;
const ADMaterialProperty<std::vector<RealGradient>> & _grad_p;

/// Porosity at the qps
/// Porosity
const ADMaterialProperty<Real> & _porosity;
const ADMaterialProperty<Real> & _porosity_neighbor;

Expand All @@ -58,6 +71,7 @@ class FVPorousFlowDispersiveFlux : public FVFluxKernel
const MaterialProperty<std::vector<std::vector<Real>>> & _diffusion_coeff;
const MaterialProperty<std::vector<std::vector<Real>>> & _diffusion_coeff_neighbor;

/// Gravity vector
const RealVectorValue & _gravity;
const ADRankTwoTensor _identity_tensor;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

#include "FVTimeKernel.h"

class PorousFlowDictator;

/**
* Time derivative of energy
*/
class FVPorousFlowEnergyTimeDerivative : public FVTimeKernel
{
public:
static InputParameters validParams();
FVPorousFlowEnergyTimeDerivative(const InputParameters & parameters);

protected:
ADReal computeQpResidual() override;

/// UserObject that holds information (number of phases, components, etc)
const PorousFlowDictator & _dictator;
/// Number of fluid phases
const unsigned int _num_phases;
/// Whether fluid is present
const bool _fluid_present;

/// Porosity
const ADMaterialProperty<Real> & _porosity;
const MaterialProperty<Real> & _porosity_old;

/// Fluid density
const ADMaterialProperty<std::vector<Real>> * const _density;
const MaterialProperty<std::vector<Real>> * const _density_old;

/// Internal energy of porous matrix
const ADMaterialProperty<Real> & _rock_energy;
const MaterialProperty<Real> & _rock_energy_old;

/// Internal energy of fluid
const ADMaterialProperty<std::vector<Real>> * const _energy;
const MaterialProperty<std::vector<Real>> * const _energy_old;

/// Fluid phase saturation
const ADMaterialProperty<std::vector<Real>> * const _saturation;
const MaterialProperty<std::vector<Real>> * const _saturation_old;
};
60 changes: 60 additions & 0 deletions modules/porous_flow/include/fvkernels/FVPorousFlowHeatAdvection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#pragma once

#include "FVFluxKernel.h"

class PorousFlowDictator;

/**
* Advective flux of heat energy
*/
class FVPorousFlowHeatAdvection : public FVFluxKernel
{
public:
static InputParameters validParams();
FVPorousFlowHeatAdvection(const InputParameters & params);

protected:
virtual ADReal computeQpResidual() override;

/// UserObject that holds information (number of phases, components, etc)
const PorousFlowDictator & _dictator;
/// Number of fluid phases present
const unsigned int _num_phases;

/// Fluid density
const ADMaterialProperty<std::vector<Real>> & _density;
const ADMaterialProperty<std::vector<Real>> & _density_neighbor;

/// Fluid viscosity
const ADMaterialProperty<std::vector<Real>> & _viscosity;
const ADMaterialProperty<std::vector<Real>> & _viscosity_neighbor;

/// Fluid enthalpy
const ADMaterialProperty<std::vector<Real>> & _enthalpy;
const ADMaterialProperty<std::vector<Real>> & _enthalpy_neighbor;

/// Relative permeability
const ADMaterialProperty<std::vector<Real>> & _relperm;
const ADMaterialProperty<std::vector<Real>> & _relperm_neighbor;

/// Permeability
const ADMaterialProperty<RealTensorValue> & _permeability;
const ADMaterialProperty<RealTensorValue> & _permeability_neighbor;

/// Fluid pressure
const ADMaterialProperty<std::vector<Real>> & _pressure;
const ADMaterialProperty<std::vector<Real>> & _pressure_neighbor;
const ADMaterialProperty<std::vector<RealGradient>> & _grad_p;

/// Gravity vector
const RealVectorValue & _gravity;
};
Loading

0 comments on commit b74d234

Please sign in to comment.