Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 64 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Adapted from the RACCOON project's test workflow:
# https://github.com/hugary1995/raccoon/blob/devel/.github/workflows/tests.yml

name: Tests

on:
# Triggers the workflow on pushes to the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# Squirrel does not carry MOOSE as a submodule, so CI clones it next to the
# checkout. Pin this to the MOOSE commit the downstream apps use whenever
# master drifts away from squirrel.
MOOSE_REF: master

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4
with:
path: squirrel

- name: Clone MOOSE
run: |
git clone --depth 1 --branch "${MOOSE_REF}" https://github.com/idaholab/moose.git moose

- name: Setup environment
uses: mamba-org/setup-micromamba@v2
with:
environment-name: moose
condarc: |
channels:
- https://conda.software.inl.gov/public
- conda-forge
channel_priority: flexible
init-shell: bash
create-args: moose-dev mpich
continue-on-error: false

- name: Compile squirrel
working-directory: squirrel
env:
MOOSE_DIR: ${{ github.workspace }}/moose
run: |
make -j 4

- name: Regression tests
working-directory: squirrel
env:
MOOSE_DIR: ${{ github.workspace }}/moose
run: |
./run_tests -j 4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,6 @@ squirrel.yaml

# VSCode dotfolder
.vscode

# JIT files
**/.jitcache/*
24 changes: 24 additions & 0 deletions include/bcs/PostprocessorVelocityFunctionTemperatureInflowBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include "PostprocessorVelocityFunctionInflowBC.h"
#include "JvarMapInterface.h"
#include "DerivativeMaterialInterface.h"

class PostprocessorVelocityFunctionTemperatureInflowBC
: public DerivativeMaterialInterface<JvarMapIntegratedBCInterface<PostprocessorVelocityFunctionInflowBC>>
{
public:
PostprocessorVelocityFunctionTemperatureInflowBC(const InputParameters & parameters);

static InputParameters validParams();

protected:
virtual void initialSetup() override;
virtual Real computeQpResidual() override;
virtual Real computeQpJacobian() override;

const MaterialProperty<Real> & _rho;
const MaterialProperty<Real> & _d_rho_d_u;
const MaterialProperty<Real> & _cp;
const MaterialProperty<Real> & _d_cp_d_u;
};
4 changes: 2 additions & 2 deletions src/bcs/DiffusiveFluxBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ DiffusiveFluxBC::initialSetup()
Real
DiffusiveFluxBC::computeQpResidual()
{
return _normals[_qp] * -_D[_qp] * _grad_u[_qp];
return -_test[_i][_qp] * _normals[_qp] * _D[_qp] * _grad_u[_qp];
}

Real
DiffusiveFluxBC::computeQpJacobian()
{
return -_normals[_qp] *
return -_test[_i][_qp] * _normals[_qp] *
(_d_D_d_u[_qp] * _phi[_j][_qp] * _grad_u[_qp] + _D[_qp] * _grad_phi[_j][_qp]);
}
2 changes: 2 additions & 0 deletions src/bcs/PostprocessorTemperatureInflowBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ InputParameters
PostprocessorTemperatureInflowBC::validParams()
{
InputParameters params = PostprocessorInflowBC::validParams();
params.addParam<MaterialPropertyName>("rho", "rho", "Density material property name");
params.addParam<MaterialPropertyName>("cp", "cp", "Specific heat material property name");
return params;
}

Expand Down
43 changes: 43 additions & 0 deletions src/bcs/PostprocessorVelocityFunctionTemperatureInflowBC.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "PostprocessorVelocityFunctionTemperatureInflowBC.h"

registerMooseObject("SquirrelApp", PostprocessorVelocityFunctionTemperatureInflowBC);

InputParameters
PostprocessorVelocityFunctionTemperatureInflowBC::validParams()
{
InputParameters params = PostprocessorVelocityFunctionInflowBC::validParams();
params.addParam<MaterialPropertyName>("rho", "rho", "Density material property name");
params.addParam<MaterialPropertyName>("cp", "cp", "Specific heat material property name");
return params;
}

PostprocessorVelocityFunctionTemperatureInflowBC::PostprocessorVelocityFunctionTemperatureInflowBC(
const InputParameters & parameters)
: DerivativeMaterialInterface<JvarMapIntegratedBCInterface<PostprocessorVelocityFunctionInflowBC>>(parameters),
_rho(getMaterialProperty<Real>("rho")),
_d_rho_d_u(getMaterialPropertyDerivative<Real>("rho", _var.name())),
_cp(getMaterialProperty<Real>("cp")),
_d_cp_d_u(getMaterialPropertyDerivative<Real>("cp", _var.name()))
{
}

void
PostprocessorVelocityFunctionTemperatureInflowBC::initialSetup()
{
validateNonlinearCoupling<Real>("rho");
validateNonlinearCoupling<Real>("cp");
}

Real
PostprocessorVelocityFunctionTemperatureInflowBC::computeQpResidual()
{
return _rho[_qp] * _cp[_qp] * PostprocessorVelocityFunctionInflowBC::computeQpResidual();
}

Real
PostprocessorVelocityFunctionTemperatureInflowBC::computeQpJacobian()
{
return _rho[_qp] * _cp[_qp] * PostprocessorVelocityFunctionInflowBC::computeQpJacobian() +
_d_rho_d_u[_qp] * _phi[_j][_qp] * _cp[_qp] * PostprocessorVelocityFunctionInflowBC::computeQpResidual() +
_rho[_qp] * _d_cp_d_u[_qp] * _phi[_j][_qp] * PostprocessorVelocityFunctionInflowBC::computeQpResidual();
}
2 changes: 2 additions & 0 deletions src/bcs/VelocityFunctionTemperatureOutflowBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ VelocityFunctionTemperatureOutflowBC::validParams()
params.addRequiredParam<FunctionName>("vel_x_func", "The x velocity function");
params.addRequiredParam<FunctionName>("vel_y_func", "The y velocity function");
params.addRequiredParam<FunctionName>("vel_z_func", "The z velocity function");
params.addParam<MaterialPropertyName>("rho", "rho", "Density material property name");
params.addParam<MaterialPropertyName>("cp", "cp", "Specific heat material property name");
return params;
}

Expand Down
2 changes: 2 additions & 0 deletions src/dgkernels/DGFunctionTemperatureAdvection.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ DGFunctionTemperatureAdvection::validParams()
{
InputParameters params = DGFunctionConvection::validParams();
params.addClassDescription("DG upwinding for func temp convection");
params.addParam<MaterialPropertyName>("rho", "rho", "Density material property name");
params.addParam<MaterialPropertyName>("cp", "cp", "Specific heat material property name");
return params;
}

Expand Down
4 changes: 2 additions & 2 deletions src/interface_kernels/InterTemperatureAdvection.C
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ InterTemperatureAdvection::computeQpResidual(Moose::DGResidualType type)
if (vdotn >= 0)
r += vdotn * _u[_qp] * _test[_i][_qp];
else
r += vdotn * _neighbor_value[_qp] * _test[_i][_qp] - _heat_source;
r += (vdotn * _neighbor_value[_qp] - _heat_source) * _test[_i][_qp];
break;

case Moose::Neighbor:
if (vdotn >= 0)
r -= vdotn * _u[_qp] * _test_neighbor[_i][_qp] - _heat_source;
r -= (vdotn * _u[_qp] - _heat_source) * _test_neighbor[_i][_qp];
else
r -= vdotn * _neighbor_value[_qp] * _test_neighbor[_i][_qp];
break;
Expand Down
6 changes: 3 additions & 3 deletions src/kernels/MatINSTemperatureTimeDerivative.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MatINSTemperatureTimeDerivative::computeQpResidual()
Real
MatINSTemperatureTimeDerivative::computeQpJacobian()
{
return _rho[_qp] * _cp[_qp] * TimeDerivative::computeQpJacobian(); // +
// _d_rho_d_u[_qp] * _phi[_j][_qp] * _cp[_qp] * TimeDerivative::computeQpResidual() +
// _rho[_qp] * _d_cp_d_u[_qp] * _phi[_j][_qp] * TimeDerivative::computeQpResidual();
return _rho[_qp] * _cp[_qp] * TimeDerivative::computeQpJacobian() +
_d_rho_d_u[_qp] * _phi[_j][_qp] * _cp[_qp] * TimeDerivative::computeQpResidual() +
_rho[_qp] * _d_cp_d_u[_qp] * _phi[_j][_qp] * TimeDerivative::computeQpResidual();
}
2 changes: 2 additions & 0 deletions src/kernels/VelocityFunctionTemperatureAdvection.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ VelocityFunctionTemperatureAdvection::validParams()
params.addRequiredParam<FunctionName>("vel_x_func", "The x velocity function");
params.addRequiredParam<FunctionName>("vel_y_func", "The y velocity function");
params.addRequiredParam<FunctionName>("vel_z_func", "The z velocity function");
params.addParam<MaterialPropertyName>("rho", "rho", "Density material property name");
params.addParam<MaterialPropertyName>("cp", "cp", "Specific heat material property name");
return params;
}

Expand Down
58 changes: 58 additions & 0 deletions tests/auxkernels/density_from_log/density_from_log.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# DensityFromLog exponentiates a log-density field. Here the log-density falls
# linearly with x, so the recovered density is rho = exp(-x/H).

H = 0.5

[Mesh]
[column]
type = GeneratedMeshGenerator
dim = 1
nx = 4
xmax = 1
[]
[]

[Problem]
solve = false
kernel_coverage_check = false
[]

[Variables]
[dummy]
[]
[]

[AuxVariables]
[log_rho]
[]
[rho]
[]
[]

[Functions]
[log_rho_func]
type = ParsedFunction
expression = '-x / ${H}'
[]
[]

[AuxKernels]
[log_rho]
type = FunctionAux
variable = log_rho
function = log_rho_func
[]
[rho]
type = DensityFromLog
variable = rho
density_log = log_rho
[]
[]

[Executioner]
type = Steady
[]

[Outputs]
exodus = true
[]
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/auxkernels/density_from_log/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Tests]
[density_from_log]
type = Exodiff
input = 'density_from_log.i'
exodiff = 'density_from_log_out.e'
requirement = 'The system shall recover a density field by exponentiating a log-density variable.'
[]
[larger_scale_height]
type = Exodiff
input = 'density_from_log.i'
cli_args = 'H=2
Outputs/file_base=larger_scale_height_out'
exodiff = 'larger_scale_height_out.e'
requirement = 'The system shall flatten the recovered density profile as the log-density scale height increases.'
[]
[]
61 changes: 61 additions & 0 deletions tests/auxkernels/function_derivative_aux/function_derivative_aux.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# FunctionDerivativeAux samples a component of a function gradient. For the
# field u(x) = x^2 the x derivative is 2x, evaluated both at nodes and at
# element quadrature points.

[Mesh]
[rod]
type = GeneratedMeshGenerator
dim = 1
nx = 4
xmax = 1
[]
[]

[Problem]
solve = false
kernel_coverage_check = false
[]

[Variables]
[dummy]
[]
[]

[Functions]
[quadratic]
type = ParsedFunction
expression = 'x * x'
[]
[]

[AuxVariables]
[dudx_nodal]
[]
[dudx_elemental]
order = CONSTANT
family = MONOMIAL
[]
[]

[AuxKernels]
[nodal]
type = FunctionDerivativeAux
variable = dudx_nodal
function = quadratic
component = 1
[]
[elemental]
type = FunctionDerivativeAux
variable = dudx_elemental
function = quadratic
component = 1
[]
[]

[Executioner]
type = Steady
[]

[Outputs]
exodus = true
[]
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions tests/auxkernels/function_derivative_aux/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Tests]
[x_derivative]
type = Exodiff
input = 'function_derivative_aux.i'
exodiff = 'function_derivative_aux_out.e'
requirement = 'The system shall evaluate a component of a function gradient at nodes and at element quadrature points.'
[]
[y_derivative]
type = Exodiff
input = 'function_derivative_aux.i'
cli_args = 'AuxKernels/nodal/component=2
AuxKernels/elemental/component=2
Outputs/file_base=y_derivative_out'
exodiff = 'y_derivative_out.e'
requirement = 'The system shall return a zero derivative for the direction in which the sampled function is constant.'
[]
[]
Loading