-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A fair amount of new code for modelling heat transfer.
- Loading branch information
Showing
16 changed files
with
728 additions
and
2 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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
*.aux | ||
*.toc | ||
*.snm | ||
*.csv | ||
*.csv* | ||
*.dylib | ||
*.so | ||
*.gitignore* | ||
|
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,28 @@ | ||
|
||
#ifndef CHANNELGRADIENTBC_H | ||
#define CHANNELGRADIENTBC_H | ||
|
||
#include "IntegratedBC.h" | ||
|
||
class ChannelGradientBC; | ||
|
||
template <> | ||
InputParameters validParams<ChannelGradientBC>(); | ||
|
||
class ChannelGradientBC : public IntegratedBC | ||
{ | ||
public: | ||
ChannelGradientBC(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real getGradient(); | ||
virtual Real computeQpResidual(); | ||
virtual Real computeQpJacobian(); | ||
|
||
const MooseEnum _axis; | ||
const VectorPostprocessorValue & _channel_gradient_axis_coordinate; | ||
const VectorPostprocessorValue & _channel_gradient_value; | ||
const MaterialProperty<Real> & _h; | ||
}; | ||
|
||
#endif // CHANNELGRADIENTBC_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,25 @@ | ||
#ifndef VELOCITYFUNCTIONOUTFLOWBC_H | ||
#define VELOCITYFUNCTIONOUTFLOWBC_H | ||
|
||
#include "IntegratedBC.h" | ||
|
||
class VelocityFunctionOutflowBC; | ||
|
||
template <> | ||
InputParameters validParams<VelocityFunctionOutflowBC>(); | ||
|
||
class VelocityFunctionOutflowBC : public IntegratedBC | ||
{ | ||
public: | ||
VelocityFunctionOutflowBC(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeQpResidual(); | ||
virtual Real computeQpJacobian(); | ||
|
||
Function & _vel_x_func; | ||
Function & _vel_y_func; | ||
Function & _vel_z_func; | ||
}; | ||
|
||
#endif // VELOCITYFUNCTIONOUTFLOWBC_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,34 @@ | ||
#ifndef VELOCITYFUNCTIONTEMPERATUREOUTFLOWBC_H | ||
#define VELOCITYFUNCTIONTEMPERATUREOUTFLOWBC_H | ||
|
||
#include "IntegratedBC.h" | ||
#include "JvarMapInterface.h" | ||
#include "DerivativeMaterialInterface.h" | ||
|
||
class VelocityFunctionTemperatureOutflowBC; | ||
|
||
template <> | ||
InputParameters validParams<VelocityFunctionTemperatureOutflowBC>(); | ||
|
||
class VelocityFunctionTemperatureOutflowBC | ||
: public DerivativeMaterialInterface<JvarMapIntegratedBCInterface<IntegratedBC>> | ||
{ | ||
public: | ||
VelocityFunctionTemperatureOutflowBC(const InputParameters & parameters); | ||
|
||
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; | ||
|
||
Function & _vel_x_func; | ||
Function & _vel_y_func; | ||
Function & _vel_z_func; | ||
}; | ||
|
||
#endif // VELOCITYFUNCTIONTEMPERATUREOUTFLOWBC_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,27 @@ | ||
#ifndef DGFUNCTIONCONVECTION_H | ||
#define DGFUNCTIONCONVECTION_H | ||
|
||
#include "DGKernel.h" | ||
|
||
class DGFunctionConvection; | ||
|
||
template <> | ||
InputParameters validParams<DGFunctionConvection>(); | ||
|
||
class DGFunctionConvection : public DGKernel | ||
{ | ||
public: | ||
DGFunctionConvection(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeQpResidual(Moose::DGResidualType type); | ||
virtual Real computeQpJacobian(Moose::DGJacobianType type); | ||
|
||
RealVectorValue _velocity; | ||
|
||
Function & _vel_x_func; | ||
Function & _vel_y_func; | ||
Function & _vel_z_func; | ||
}; | ||
|
||
#endif // DGFUNCTIONCONVECTION_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,35 @@ | ||
#ifndef VELOCITYFUNCTIONTEMPERATUREADVECTION_H | ||
#define VELOCITYFUNCTIONTEMPERATUREADVECTION_H | ||
|
||
#include "Kernel.h" | ||
#include "JvarMapInterface.h" | ||
#include "DerivativeMaterialInterface.h" | ||
|
||
// Forward Declaration | ||
class VelocityFunctionTemperatureAdvection; | ||
|
||
template <> | ||
InputParameters validParams<VelocityFunctionTemperatureAdvection>(); | ||
|
||
class VelocityFunctionTemperatureAdvection | ||
: public DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>> | ||
{ | ||
public: | ||
VelocityFunctionTemperatureAdvection(const InputParameters & parameters); | ||
|
||
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; | ||
|
||
Function & _vel_x_func; | ||
Function & _vel_y_func; | ||
Function & _vel_z_func; | ||
}; | ||
|
||
#endif // VELOCITYFUNCTIONTEMPERATUREADVECTION_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,51 @@ | ||
#ifndef CHANNELGRADIENT_H | ||
#define CHANNELGRADIENT_H | ||
|
||
#include "GeneralVectorPostprocessor.h" | ||
|
||
// Forward Declarations | ||
class ChannelGradient; | ||
|
||
template <> | ||
InputParameters validParams<ChannelGradient>(); | ||
|
||
/** | ||
* ChannelGradient is a VectorPostprocessor that performs a least squares | ||
* fit on data calculated in another VectorPostprocessor. | ||
*/ | ||
|
||
class ChannelGradient : public GeneralVectorPostprocessor | ||
{ | ||
public: | ||
/** | ||
* Class constructor | ||
* @param parameters The input parameters | ||
*/ | ||
ChannelGradient(const InputParameters & parameters); | ||
|
||
/** | ||
* Initialize, clears old results | ||
*/ | ||
virtual void initialize() override; | ||
|
||
/** | ||
* Perform the least squares fit | ||
*/ | ||
virtual void execute() override; | ||
|
||
protected: | ||
VectorPostprocessorName _lv1_name; | ||
VectorPostprocessorName _lv2_name; | ||
|
||
std::string _axis; | ||
|
||
/// The variables with the x, y data to be fit | ||
const VectorPostprocessorValue & _lv1_variable_values; | ||
const VectorPostprocessorValue & _lv2_variable_values; | ||
const VectorPostprocessorValue & _lv1_axis_values; | ||
|
||
VectorPostprocessorValue * _axis_values; | ||
VectorPostprocessorValue * _gradient_values; | ||
}; | ||
|
||
#endif |
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,144 @@ | ||
Nu = 4 | ||
k = 1 | ||
half_channel_length = 0.5 | ||
h = ${/ ${* ${Nu} ${k}} ${half_channel_length}} | ||
|
||
|
||
[Mesh] | ||
type = GeneratedMesh | ||
nx = 10 | ||
ny = 10 | ||
xmax = 1 | ||
ymax = 1 | ||
dim = 2 | ||
[] | ||
|
||
[Variables] | ||
|
||
[./u] | ||
order = FIRST | ||
family = LAGRANGE | ||
[../] | ||
[./v] | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
[./conv] | ||
type = ConservativeAdvection | ||
variable = u | ||
velocity = '0 1 0' | ||
[../] | ||
[./diff] | ||
type = Diffusion | ||
variable = u | ||
[../] | ||
[./src] | ||
type = UserForcingFunction | ||
variable = u | ||
function = ffn | ||
[../] | ||
[./diffv] | ||
type = Diffusion | ||
variable = v | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
|
||
[./left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = bottom | ||
value = 2 | ||
[../] | ||
|
||
[./right] | ||
type = ChannelGradientBC | ||
variable = u | ||
boundary = right | ||
channel_gradient_pps = channel_gradient | ||
axis = y | ||
h_name = h | ||
[../] | ||
[./top] | ||
type = OutflowBC | ||
variable = u | ||
boundary = top | ||
velocity = '0 1 0' | ||
[../] | ||
[./leftv] | ||
type = DirichletBC | ||
variable = v | ||
boundary = left | ||
value = 0 | ||
[../] | ||
|
||
[./rightv] | ||
type = DirichletBC | ||
variable = v | ||
boundary = right | ||
value = 1 | ||
[../] | ||
[] | ||
|
||
[Materials] | ||
[./mat] | ||
type = GenericConstantMaterial | ||
prop_names = 'h' | ||
prop_values = '${h}' | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
|
||
solve_type = 'PJFNK' | ||
petsc_options = '-snes_converged_reason -ksp_converged_reason -snes_linesearch_monitor' | ||
[] | ||
|
||
[Outputs] | ||
file_base = out | ||
exodus = true | ||
[./csv] | ||
type = CSV | ||
[../] | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[./lv1] | ||
num_points = 30 | ||
start_point = '0 0 0' | ||
end_point = '0 1 0' | ||
sort_by = 'y' | ||
variable = u | ||
type = LineValueSampler | ||
execute_on = 'timestep_begin nonlinear timestep_end linear' | ||
[../] | ||
[./lv2] | ||
num_points = 30 | ||
start_point = '1 0 0' | ||
end_point = '1 1 0' | ||
sort_by = 'y' | ||
variable = v | ||
type = LineValueSampler | ||
execute_on = 'timestep_begin nonlinear timestep_end linear' | ||
[../] | ||
[./channel_gradient] | ||
lv1 = lv1 | ||
lv2 = lv2 | ||
var1 = u | ||
var2 = v | ||
axis = y | ||
outputs = 'csv' | ||
type = ChannelGradient | ||
execute_on = 'timestep_begin nonlinear timestep_end linear' | ||
[../] | ||
[] | ||
|
||
[Functions] | ||
[./ffn] | ||
type = ParsedFunction | ||
value = '1' | ||
[../] | ||
[] |
Oops, something went wrong.