Skip to content

Commit

Permalink
Use libmesh namespace in code that uses it implicitly
Browse files Browse the repository at this point in the history
Format code with clang format
refs idaholab/moose#28499
  • Loading branch information
GiudGiud committed Oct 15, 2024
1 parent cc4908f commit f28e755
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
2 changes: 2 additions & 0 deletions src/bcs/PTMassFluxBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Descriptions: P-T based single-phase mass balance equation

#include "PTMassFluxBC.h"

using namespace libMesh;

registerMooseObject("FalconApp", PTMassFluxBC);

InputParameters PTMassFluxBC::validParams()
Expand Down
2 changes: 2 additions & 0 deletions src/bcs/PTMassFreeBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Descriptions: P-T based single-phase mass balance equation

#include "PTMassFreeBC.h"

using namespace libMesh;

registerMooseObject("FalconApp", PTMassFreeBC);

InputParameters PTMassFreeBC::validParams()
Expand Down
2 changes: 2 additions & 0 deletions src/kernels/PTEnergyResidual.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Descriptions: compute the residual & Jacobian of

#include "PTEnergyResidual.h"

using namespace libMesh;

registerMooseObject("FalconApp", PTEnergyResidual);

InputParameters PTEnergyResidual::validParams()
Expand Down
60 changes: 28 additions & 32 deletions src/kernels/PTMassResidual.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,77 +23,73 @@ Descriptions: compute the residual & Jacobian of

#include "PTMassResidual.h"

using namespace libMesh;

registerMooseObject("FalconApp", PTMassResidual);

InputParameters PTMassResidual::validParams()
{
InputParameters params = Kernel::validParams();
params.addCoupledVar("coupled_temperature",
"This coupled variable will be used as temperature");
"This coupled variable will be used as temperature");
return params;
}


/*******************************************************************************
Routine: PTMassResidual -- constructor
Authors: Yidong Xia
*******************************************************************************/
PTMassResidual::PTMassResidual(const InputParameters & parameters):
Kernel(parameters),
_has_coupled_temp(isCoupled("coupled_temperature")),
_wrho(getMaterialProperty<Real>("density_water")),
_wtau(getMaterialProperty<Real>("tau_water")),
_gfor(getMaterialProperty<Real>("gravity")),
_drot(getMaterialProperty<Real>("partial_rho_over_partial_temp")),
_perm(getMaterialProperty<Real>("permeability")),
_dkdp(getMaterialProperty<Real>("partial_perm_over_partial_pres")),
_guvec(getMaterialProperty<RealGradient>("gravity_direction")),
_wdmfx(getMaterialProperty<RealGradient>("darcy_mass_flux_water")),
_temp_var(_has_coupled_temp ? coupled("coupled_temperature") : zero)
{}

PTMassResidual::PTMassResidual(const InputParameters &parameters) : Kernel(parameters),
_has_coupled_temp(isCoupled("coupled_temperature")),
_wrho(getMaterialProperty<Real>("density_water")),
_wtau(getMaterialProperty<Real>("tau_water")),
_gfor(getMaterialProperty<Real>("gravity")),
_drot(getMaterialProperty<Real>("partial_rho_over_partial_temp")),
_perm(getMaterialProperty<Real>("permeability")),
_dkdp(getMaterialProperty<Real>("partial_perm_over_partial_pres")),
_guvec(getMaterialProperty<RealGradient>("gravity_direction")),
_wdmfx(getMaterialProperty<RealGradient>("darcy_mass_flux_water")),
_temp_var(_has_coupled_temp ? coupled("coupled_temperature") : zero)
{
}

/*******************************************************************************
Routine: computeQpResidual -- compute residual at quadrature point
Authors: Yidong Xia
*******************************************************************************/
Real
PTMassResidual::
computeQpResidual()
Real PTMassResidual::
computeQpResidual()
{
return -_wdmfx[_qp]*_grad_test[_i][_qp];
return -_wdmfx[_qp] * _grad_test[_i][_qp];
}


/*******************************************************************************
Routine: computeQpJacobian -- compute Jacobian at quadrature point
Authors: Yidong Xia
*******************************************************************************/
Real
PTMassResidual::
computeQpJacobian()
Real PTMassResidual::
computeQpJacobian()
{
Real r = 0.0;

// contribution from Darcy mass flux due to pressure gradient
r += (_wtau[_qp]*_wrho[_qp]*_grad_phi[_j][_qp] +
_dkdp[_qp]/_perm[_qp]*_wdmfx[_qp])*_grad_test[_i][_qp];
r += (_wtau[_qp] * _wrho[_qp] * _grad_phi[_j][_qp] +
_dkdp[_qp] / _perm[_qp] * _wdmfx[_qp]) *
_grad_test[_i][_qp];

// contribution from Darcy mass flux due to elevation
// omitted

return r;
}


/*******************************************************************************
Routine: computeQpOffDiagJacobian
-- compute off-diagonal entries of Jacobian at quadrature point
Authors: Yidong Xia
*******************************************************************************/
Real
PTMassResidual::
computeQpOffDiagJacobian(unsigned int jvar)
Real PTMassResidual::
computeQpOffDiagJacobian(unsigned int jvar)
{
Real r = 0.0;

Expand All @@ -102,8 +98,8 @@ computeQpOffDiagJacobian(unsigned int jvar)

// contribution from Darcy mass flux due to elevation
if (jvar == _temp_var && _has_coupled_temp)
r += 2.0*_wtau[_qp]*_wrho[_qp]*_drot[_qp]*_phi[_j][_qp]*
_gfor[_qp]*(_guvec[_qp]*_grad_test[_i][_qp]);
r += 2.0 * _wtau[_qp] * _wrho[_qp] * _drot[_qp] * _phi[_j][_qp] *
_gfor[_qp] * (_guvec[_qp] * _grad_test[_i][_qp]);

return r;
}
2 changes: 2 additions & 0 deletions src/utils/StochasticField.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <fstream>

using namespace libMesh;

StochasticField::StochasticField(std::string fname)
{
std::ifstream file(fname.c_str());
Expand Down

0 comments on commit f28e755

Please sign in to comment.