-
Notifications
You must be signed in to change notification settings - Fork 273
Expand file tree
/
Copy pathVoT.cc
More file actions
199 lines (170 loc) · 6.9 KB
/
VoT.cc
File metadata and controls
199 lines (170 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
Copyright (C) 2011 - 2023 by the authors of the ASPECT code.
This file is part of ASPECT.
ASPECT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
ASPECT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ASPECT; see the file LICENSE. If not see
<http://www.gnu.org/licenses/>.
*/
#include <aspect/material_model/interface.h>
#include <aspect/simulator_access.h>
#include <deal.II/base/parameter_handler.h>
#include <cmath>
namespace aspect
{
namespace MaterialModel
{
/**
* A material model similar to the "Simpler" model, but with a temperature
* dependent viscosity (a "viscosity as a function of temperature", or VoT).
*
* @ingroup MaterialModels
*/
template <int dim>
class VoT : public Interface<dim>
{
public:
bool is_compressible () const override;
void evaluate(const typename Interface<dim>::MaterialModelInputs &in,
typename Interface<dim>::MaterialModelOutputs &out) const override;
/**
* @name Functions used in dealing with run-time parameters
* @{
*/
/**
* Declare the parameters this class takes through input files.
*/
static
void
declare_parameters (ParameterHandler &prm);
/**
* Read the parameters this class declares from the parameter file.
*/
void
parse_parameters (ParameterHandler &prm) override;
/**
* @}
*/
private:
double reference_rho;
double reference_T;
double eta;
double thermal_alpha;
double reference_specific_heat;
double k_value;
};
template <int dim>
bool
VoT<dim>::
is_compressible () const
{
return false;
}
template <int dim>
void
VoT<dim>::
evaluate(const typename Interface<dim>::MaterialModelInputs &in,
typename Interface<dim>::MaterialModelOutputs &out) const
{
for (unsigned int i=0; i<in.n_evaluation_points(); ++i)
{
out.viscosities[i] = eta*std::pow(1000,(-in.temperature[i]));
out.densities[i] = reference_rho * (1.0 - thermal_alpha * (in.temperature[i] - reference_T));
out.thermal_expansion_coefficients[i] = thermal_alpha;
out.specific_heat[i] = reference_specific_heat;
out.thermal_conductivities[i] = k_value;
out.compressibilities[i] = 0.0;
out.entropy_derivative_pressure[i] = 0.0;
out.entropy_derivative_temperature[i] = 0.0;
for (unsigned int c=0; c<in.composition[i].size(); ++c)
out.reaction_terms[i][c] = 0.0;
}
}
template <int dim>
void
VoT<dim>::declare_parameters (ParameterHandler &prm)
{
prm.enter_subsection("Material model");
{
prm.enter_subsection("VoT model");
{
prm.declare_entry ("Reference density", "3300.",
Patterns::Double (0.),
"Reference density $\\rho_0$. "
"Units: $\\frac{\\text{kg}}{\\text{m}^3}$.");
prm.declare_entry ("Reference temperature", "293.",
Patterns::Double (0.),
"The reference temperature $T_0$. The reference temperature is used "
"in the density formula. Units: $\\text{K}$.");
prm.declare_entry ("Viscosity", "5e24",
Patterns::Double (0.),
"The value of the viscosity $\\eta$. Units: $\\text{Pa}\\text{s}$.");
prm.declare_entry ("Thermal conductivity", "4.7",
Patterns::Double (0.),
"The value of the thermal conductivity $k$. "
"Units: $\\frac{\\text{W}}{\\text{m}\\text{K}}$.");
prm.declare_entry ("Reference specific heat", "1250.",
Patterns::Double (0.),
"The value of the specific heat $cp$. "
"Units: $\\frac{\\text{J}}{\\text{K}\\text{kg}}$.");
prm.declare_entry ("Thermal expansion coefficient", "2e-5",
Patterns::Double (0.),
"The value of the thermal expansion coefficient $\\beta$. "
"Units: $\\frac{1}{\\text{K}}$.");
}
prm.leave_subsection();
}
prm.leave_subsection();
}
template <int dim>
void
VoT<dim>::parse_parameters (ParameterHandler &prm)
{
prm.enter_subsection("Material model");
{
prm.enter_subsection("VoT model");
{
reference_rho = prm.get_double ("Reference density");
reference_T = prm.get_double ("Reference temperature");
eta = prm.get_double ("Viscosity");
k_value = prm.get_double ("Thermal conductivity");
reference_specific_heat = prm.get_double ("Reference specific heat");
thermal_alpha = prm.get_double ("Thermal expansion coefficient");
}
prm.leave_subsection();
}
prm.leave_subsection();
// Declare dependencies on solution variables
this->model_dependence.viscosity = NonlinearDependence::temperature;
this->model_dependence.density = NonlinearDependence::temperature;
this->model_dependence.compressibility = NonlinearDependence::none;
this->model_dependence.specific_heat = NonlinearDependence::none;
this->model_dependence.thermal_conductivity = NonlinearDependence::none;
}
}
}
// explicit instantiations
namespace aspect
{
namespace MaterialModel
{
ASPECT_REGISTER_MATERIAL_MODEL(VoT,
"VoT",
"A material model that has constant values "
"except for density, which depends linearly on temperature: "
"\\begin{align}"
" \\rho(p,T) &= \\left(1-\\alpha (T-T_0)\\right)\\rho_0."
"\\end{align}"
"\n\n"
"\\note{This material model fills the role the ``simple'' material "
"model was originally intended to fill, before the latter acquired "
"all sorts of complicated temperature and compositional dependencies.}")
}
}