Skip to content

Commit

Permalink
A fair amount of new code for modelling heat transfer.
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Jun 15, 2017
1 parent 10720f2 commit e4c90e1
Show file tree
Hide file tree
Showing 16 changed files with 728 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*.aux
*.toc
*.snm
*.csv
*.csv*
*.dylib
*.so
*.gitignore*
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ include $(FRAMEWORK_DIR)/moose.mk

################################## MODULES ####################################
ALL_MODULES := no
PHASE_FIELD := yes
include $(MOOSE_DIR)/modules/modules.mk
###############################################################################

Expand Down
28 changes: 28 additions & 0 deletions include/bcs/ChannelGradientBC.h
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
25 changes: 25 additions & 0 deletions include/bcs/VelocityFunctionOutflowBC.h
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
34 changes: 34 additions & 0 deletions include/bcs/VelocityFunctionTemperatureOutflowBC.h
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
27 changes: 27 additions & 0 deletions include/dgkernels/DGFunctionConvection.h
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
35 changes: 35 additions & 0 deletions include/kernels/VelocityFunctionTemperatureAdvection.h
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
51 changes: 51 additions & 0 deletions include/vectorpostprocessors/ChannelGradient.h
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
144 changes: 144 additions & 0 deletions problems/channel_gradient_test.i
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'
[../]
[]
Loading

0 comments on commit e4c90e1

Please sign in to comment.