forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add VectorPostprocessorInterface to ScalarKernel closes idaholab#7425
- Loading branch information
Showing
8 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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
46 changes: 46 additions & 0 deletions
46
test/include/scalarkernels/VectorPostprocessorScalarKernel.h
This file contains 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,46 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#ifndef VECTORPOSTPROCESSORSCALARKERNEL_H | ||
#define VECTORPOSTPROCESSORSCALARKERNEL_H | ||
|
||
|
||
#include "ODEKernel.h" | ||
|
||
//Forward Declarations | ||
class VectorPostprocessorScalarKernel; | ||
|
||
template<> | ||
InputParameters validParams<VectorPostprocessorScalarKernel>(); | ||
|
||
/** | ||
* | ||
*/ | ||
class VectorPostprocessorScalarKernel : public ODEKernel | ||
{ | ||
public: | ||
VectorPostprocessorScalarKernel(const InputParameters & parameters); | ||
virtual ~VectorPostprocessorScalarKernel(); | ||
|
||
protected: | ||
virtual Real computeQpResidual(); | ||
virtual Real computeQpJacobian(); | ||
|
||
const VectorPostprocessorValue & _vpp; | ||
|
||
unsigned int _index; | ||
}; | ||
|
||
|
||
#endif /* VECTORPOSTPROCESSORSCALARKERNEL_H */ |
This file contains 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 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,48 @@ | ||
/****************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* MOOSE - Multiphysics Object Oriented Simulation Environment */ | ||
/* */ | ||
/* (c) 2010 Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/* */ | ||
/* Prepared by Battelle Energy Alliance, LLC */ | ||
/* Under Contract No. DE-AC07-05ID14517 */ | ||
/* With the U. S. Department of Energy */ | ||
/* */ | ||
/* See COPYRIGHT for full restrictions */ | ||
/****************************************************************/ | ||
|
||
#include "VectorPostprocessorScalarKernel.h" | ||
|
||
template<> | ||
InputParameters validParams<VectorPostprocessorScalarKernel>() | ||
{ | ||
InputParameters params = validParams<ODEKernel>(); | ||
|
||
params.addRequiredParam<VectorPostprocessorName>("vpp", "VectorPostprocessor to pull the values out of"); | ||
params.addRequiredParam<std::string>("vector", "The vector to use from the VectorPostprocessor. This vector MUST be the same size as the scalar variable's ORDER."); | ||
|
||
return params; | ||
} | ||
|
||
VectorPostprocessorScalarKernel::VectorPostprocessorScalarKernel(const InputParameters & parameters) : | ||
ODEKernel(parameters), | ||
_vpp(getVectorPostprocessorValue("vpp", getParam<std::string>("vector"))) | ||
{ | ||
} | ||
|
||
VectorPostprocessorScalarKernel::~VectorPostprocessorScalarKernel() | ||
{ | ||
} | ||
|
||
Real | ||
VectorPostprocessorScalarKernel::computeQpResidual() | ||
{ | ||
return _u[_i] - _vpp[_i]; | ||
} | ||
|
||
Real | ||
VectorPostprocessorScalarKernel::computeQpJacobian() | ||
{ | ||
return 1.; | ||
} |
Binary file added
BIN
+29.1 KB
...ests/kernels/scalarkernel_vectorpostprocessor/gold/scalarkernel_vectorpostprocessor_out.e
Binary file not shown.
66 changes: 66 additions & 0 deletions
66
test/tests/kernels/scalarkernel_vectorpostprocessor/scalarkernel_vectorpostprocessor.i
This file contains 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,66 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
nx = 10 | ||
ny = 10 | ||
[] | ||
|
||
[Variables] | ||
[./u] | ||
[../] | ||
[./scalar] | ||
order = THIRD | ||
family = SCALAR | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
[./diff] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
[./left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = left | ||
value = 0 | ||
[../] | ||
[./right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = right | ||
value = 1 | ||
[../] | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[./constant] | ||
type = ConstantVectorPostprocessor | ||
value = '1.7 2.3 4.7' | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
# Preconditioned JFNK (default) | ||
type = Steady | ||
solve_type = PJFNK | ||
petsc_options_iname = '-pc_type -pc_hypre_type' | ||
petsc_options_value = 'hypre boomeramg' | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] | ||
|
||
[ScalarKernels] | ||
[./vppsk] | ||
variable = scalar | ||
vector = value | ||
type = VectorPostprocessorScalarKernel | ||
vpp = constant | ||
[../] | ||
[] | ||
|
This file contains 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,7 @@ | ||
[Tests] | ||
[./test] | ||
type = 'Exodiff' | ||
input = 'scalarkernel_vectorpostprocessor.i' | ||
exodiff = 'scalarkernel_vectorpostprocessor_out.e' | ||
[../] | ||
[] |