Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r1900
- Loading branch information
Showing
5 changed files
with
173 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef SINNEUMANNBC_H | ||
#define SINNEUMANNBC_H | ||
|
||
#include "BoundaryCondition.h" | ||
|
||
|
||
//Forward Declarations | ||
class SinNeumannBC; | ||
|
||
template<> | ||
InputParameters validParams<SinNeumannBC>(); | ||
|
||
/** | ||
* Implements a simple constant SinNeumann BC where grad(u)=value on the boundary. | ||
* Uses the term produced from integrating the diffusion operator by parts. | ||
*/ | ||
class SinNeumannBC : public BoundaryCondition | ||
{ | ||
public: | ||
|
||
/** | ||
* Factory constructor, takes parameters so that all derived classes can be built using the same | ||
* constructor. | ||
*/ | ||
SinNeumannBC(std::string name, MooseSystem & moose_system, InputParameters parameters); | ||
|
||
virtual ~SinNeumannBC() {} | ||
|
||
protected: | ||
virtual Real computeQpResidual(); | ||
|
||
private: | ||
Real _initial; | ||
Real _final; | ||
Real _duration; | ||
|
||
/** | ||
* Value of grad(u) on the boundary. | ||
*/ | ||
Real _value; | ||
}; | ||
|
||
#endif //SINNEUMANNBC_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
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,34 @@ | ||
#include "SinNeumannBC.h" | ||
|
||
#include "MooseSystem.h" | ||
|
||
template<> | ||
InputParameters validParams<SinNeumannBC>() | ||
{ | ||
InputParameters params = validParams<BoundaryCondition>(); | ||
params.set<Real>("initial")=0.0; | ||
params.set<Real>("final")=0.0; | ||
params.set<Real>("duration")=0.0; | ||
return params; | ||
} | ||
|
||
SinNeumannBC::SinNeumannBC(std::string name, MooseSystem & moose_system, InputParameters parameters) | ||
:BoundaryCondition(name, moose_system, setIntegratedParam(parameters, true)), | ||
_initial(_parameters.get<Real>("initial")), | ||
_final(_parameters.get<Real>("final")), | ||
_duration(_parameters.get<Real>("duration")) | ||
{} | ||
|
||
Real | ||
SinNeumannBC::computeQpResidual() | ||
{ | ||
Real value; | ||
|
||
if(_moose_system._t < _duration) | ||
value = _initial + (_final-_initial) * std::sin((0.5/_duration) * libMesh::pi * _moose_system._t); | ||
else | ||
value = _final; | ||
|
||
return -_phi[_i][_qp]*value; | ||
} | ||
|
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