-
Notifications
You must be signed in to change notification settings - Fork 11
Add squirrel tests #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
35cd17d
Add PostprocessorVelocityFunctionTemperatureInflowBC; let rho and cp …
smpark7 4d5b4a6
Merge remote-tracking branch 'origin/master' into vel-func-bc-2026
smpark7 fff9b1d
Add CI testing
smpark7 775d681
Add squirrel tests
smpark7 ee775a8
Uncomment MatINSTemperatureTimeDerivative full Jacobian
smpark7 45aa8b2
Update CI workflow name
smpark7 4765001
Merge branch 'master' into vel-func-bc-2026
smpark7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,3 +152,6 @@ squirrel.yaml | |
|
|
||
| # VSCode dotfolder | ||
| .vscode | ||
|
|
||
| # JIT files | ||
| **/.jitcache/* | ||
24 changes: 24 additions & 0 deletions
24
include/bcs/PostprocessorVelocityFunctionTemperatureInflowBC.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/bcs/PostprocessorVelocityFunctionTemperatureInflowBC.C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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"); | ||||||||||
|
Comment on lines
+10
to
+11
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| return params; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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"); | ||||||||||
|
Comment on lines
+13
to
+14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| return params; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
61
tests/auxkernels/function_derivative_aux/function_derivative_aux.i
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 added
BIN
+46.8 KB
tests/auxkernels/function_derivative_aux/gold/function_derivative_aux_out.e
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.' | ||
| [] | ||
| [] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these include units?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because Moltres and Squirrel are unit-agnostic. Users have the freedom of choosing their own units (and the responsibility of ensuring consistency across their mesh, group constants, material properties).