112 *
#include <deal.II/base/
point.h>
113 *
#include <deal.II/base/function.h>
115 *
#include <iostream>
118 *
namespace RandomField
128 *
KLExpansion(
const unsigned int n_terms,
double L,
double l,
double mu);
130 *
double compute_kl_expansion(
const Point<dim>& p, std::vector<double> &samples);
136 * computes our coefficients
140 * computes our
eigenvalues based on the previously computed frequencies
143 *
void compute_lambda_i();
146 * computes
norm values such that our eigenfunctions are normed to
one.
149 *
void compute_alpha_i();
152 * compute the frequencies
155 *
void compute_omega_i();
159 *
functions we need
for the computation of omega_i
162 *
double f_even(
double sol);
163 *
double f_odd(
double sol);
164 *
double grad_f_even(
double sol);
165 *
double grad_f_odd(
double sol);
169 * newton since equation is nonlinear
172 *
void newton_even(
unsigned int index);
173 *
void newton_odd(
unsigned int index);
177 * number of KL expansion terms
180 *
unsigned int n_terms_;
186 *
double domain_length_;
192 *
double correlation_length_;
195 * important parameters
for the construction of the KL-Expansion in x-direction
198 *
std::vector<double> omega_i;
199 *
std::vector<double> lambda_i;
200 *
std::vector<double> alpha_i;
213<a name=
"ann-include/mlmc.h"></a>
214<h1>Annotated version of include/mlmc.h</h1>
233 *
namespace MultilevelMonteCarlo
239 *
MLMC(
unsigned int oneD_samples);
243 * generates the required number of samples
246 *
std::vector<double> generate_samples();
250 * store the samples
for the computation of
mean and variance
253 *
void add_sample(
double rvalue);
255 *
double compute_mean();
257 *
double compute_variance();
260 * removes all samples after reached convergence on a
level
263 *
void clear_samples();
267 *
std::normal_distribution<double> dist;
268 *
unsigned int num_samples;
272 * parameters
for error computation
275 *
std::vector<double> results;
282<a name=
"ann-include/random_darcy.h"></a>
283<h1>Annotated version of include/random_darcy.h</h1>
299 *
#include <deal.II/base/quadrature_lib.h>
300 *
#include <deal.II/dofs/dof_handler.h>
301 *
#include <deal.II/dofs/dof_tools.h>
302 *
#include <deal.II/fe/fe_values.h>
303 *
#include <deal.II/grid/tria.h>
304 *
#include <deal.II/grid/grid_generator.h>
305 *
#include <deal.II/lac/dynamic_sparsity_pattern.h>
306 *
#include <deal.II/lac/full_matrix.h>
307 *
#include <deal.II/lac/sparse_matrix.h>
308 *
#include <deal.II/lac/vector.h>
309 *
#include <deal.II/numerics/data_out.h>
310 *
#include <deal.II/numerics/vector_tools.h>
311 *
#include <deal.II/fe/fe_q.h>
312 *
#include <deal.II/grid/grid_out.h>
313 *
#include <deal.II/lac/affine_constraints.h>
314 *
#include <deal.II/grid/grid_refinement.h>
315 *
#include <deal.II/numerics/error_estimator.h>
316 *
#include <deal.II/base/function.h>
319 *
#include
"random_permeability.h"
321 *
namespace Discretization
339 * Allows switching between coarse and fine triangulations
340 * with virtually no code duplication.
343 *
void set_tria(
bool fine);
345 *
void generate_mesh(
double domain_length);
349 * Implementation follows the logic of deal.II tutorial @ref step_5
"step-5".
352 *
void setup_system();
354 *
void assemble_system(RandomField::RandomPermeability<dim>& random_constant);
365 * If we are on the
first level, we only want to
refine the fine triangulation.
368 *
void refine_grid(
bool firstRun);
372 * On the
first run, we label the output as
"coarse" since both meshes
373 * are identical. After the
first level, the meshes diverge, and we
374 * output the finer mesh.
377 *
void output_results(
bool firstRun,
unsigned int level);
381 * This is our Quantity of Interest (QoI).
382 * It is defined as: @f$K_{eff} = - \int_{\Gamma_{right}} k \frac{\partial p}{\partial x_1} dx_2@f$
385 *
double compute_Keff(RandomField::RandomPermeability<dim>& permeability);
390 * define two triangulations
411<a name=
"ann-include/random_permeability.h"></a>
412<h1>Annotated version of include/random_permeability.h</h1>
428 *
#include
"KL_expansion.h"
430 *
namespace RandomField
438 *
class RandomPermeability :
public Function<dim>
441 *
RandomPermeability(std::vector<double> &first_sample,
unsigned int n_terms,
double domain_length,
double correlation_length,
double mu);
445 * overwrite the samples
448 *
void overwrite_samples(
const std::vector<double> &next_sample);
458 *
KLExpansion<dim> kl_expansion;
459 *
std::vector<double> samples;
466<a name=
"ann-main.cc"></a>
467<h1>Annotated version of
main.cc</h1>
473 *
#include
"include/random_permeability.h"
474 *
#include
"include/random_darcy.h"
475 *
#include
"include/mlmc.h"
478 *
#include <iostream>
484 *
std::ofstream outfile(
"mlmc_results.txt");
485 *
if (!outfile.is_open()) {
486 *
std::cerr <<
"Error: Could not open mlmc_results.txt for writing!" << std::endl;
495 *
double domain_length = 10.0;
502 *
double correlation_length = 5.0;
506 * The number of terms chosen
for 1D. For higher dimensions, we use oneD_samples^dim.
509 *
unsigned int oneD_samples = 20;
513 * The number of levels was not chosen arbitrarily. Convergence is usually so fast
514 * that
using more than 4–5 levels is rarely necessary.
517 *
unsigned int levels = 5;
521 * We used a
constant mean here. While
this was a specific choice
for this case,
534 *
double tolerance = 1
e-1;
539 * I chose these specific
values to keep the implementation simple.
542 *
std::vector<unsigned int> runs_per_level{20000, 10000, 5000, 2500, 1000, 250};
544 *
MultilevelMonteCarlo::MLMC<2> mlmc(oneD_samples);
545 *
std::vector<double> first_sample{};
549 *
RandomField::RandomPermeability<2> permeability(first_sample, oneD_samples, domain_length, correlation_length, mu);
551 *
Discretization::RandomDarcy<2> random_darcy;
553 *
random_darcy.generate_mesh(domain_length);
555 *
double global_mean = 0.0;
559 *
for(
unsigned int i = 0; i<=levels; i++)
561 *
std::cout <<
"Level:" << i << std::endl;
562 *
for(
unsigned int j = 0; j<runs_per_level[i]; j++)
564 *
permeability.overwrite_samples(mlmc.generate_samples());
571 *
random_darcy.set_tria(
false);
572 *
random_darcy.setup_system();
573 *
random_darcy.assemble_system(permeability);
574 *
random_darcy.solve();
575 *
double Keff_coarse = random_darcy.compute_Keff(permeability);
578 *
mlmc.add_sample(Keff_coarse);
589 *
random_darcy.set_tria(
true);
590 *
random_darcy.setup_system();
591 *
random_darcy.assemble_system(permeability);
592 *
random_darcy.solve();
593 *
double Keff_fine = random_darcy.compute_Keff(permeability);
595 *
mlmc.add_sample(Keff_fine-Keff_coarse);
601 *
double var = mlmc.compute_variance();
603 *
if (var / (j+1) < tolerance * tolerance)
605 *
global_mean+= mlmc.compute_mean();
606 *
std::cout <<
"number of samples for level" << i <<
":" << j << std::endl;
607 *
random_darcy.output_results(i==0, i);
609 *
outfile <<
"FINAL_STATS Level:" << i <<
" Mean:" << mlmc.compute_mean()
610 *
<<
" Var:" << mlmc.compute_variance() <<
" Samples:" << j << std::endl;
617 *
random_darcy.refine_grid(i==0);
618 *
mlmc.clear_samples();
619 *
std::cout <<
"global mean" << global_mean << std::endl;
631<a name=
"ann-source/KL_expansion.cc"></a>
632<h1>Annotated version of source/KL_expansion.cc</h1>
647 *
#include
"../include/KL_expansion.h"
652 *
RandomField::KLExpansion<dim>::KLExpansion(
const unsigned int n_terms,
double domain_length,
double correlation_length,
double mu)
653 *
: n_terms_(n_terms)
654 *
, domain_length_(domain_length)
655 *
, correlation_length_(correlation_length)
660 *
compute_lambda_i();
664 *
double RandomField::KLExpansion<dim>::compute_kl_expansion(
const Point<dim>& p, std::vector<double> &samples)
667 *
if constexpr (dim == 1)
669 *
for(
unsigned int i = 0; i<n_terms_; i++)
678 *
val +=
std::sqrt(lambda_i[i])*samples[i]*alpha_i[i]*
std::sin(omega_i[i]*(p[0]-domain_length_/2));
687 *
val +=
std::sqrt(lambda_i[i])*samples[i]*alpha_i[i]*
std::cos(omega_i[i]*(p[0]-domain_length_/2));
691 *
if constexpr (dim == 2)
693 *
for(
unsigned int i = 0; i<n_terms_; i++)
695 *
for(
unsigned int j = 0; j<n_terms_; j++)
702 *
if((i+1)%2==0 && (j+1)%2==0)
704 *
val+=
std::sqrt(lambda_i[i]*lambda_i[j])*samples[i*n_terms_+j]*alpha_i[i]*alpha_i[j]*
std::sin(omega_i[i]*(p[0]-domain_length_/2))*
std::sin(omega_i[j]*(p[1]-domain_length_/2));
711 *
else if((i+1)%2==1 && (j+1)%2==1)
713 *
val+=
std::sqrt(lambda_i[i]*lambda_i[j])*samples[i*n_terms_+j]*alpha_i[i]*alpha_i[j]*
std::cos(omega_i[i]*(p[0]-domain_length_/2))*
std::cos(omega_i[j]*(p[1]-domain_length_/2));
720 *
else if((i+1)%2==1 && (j+1)%2==0)
722 *
val+=
std::sqrt(lambda_i[i]*lambda_i[j])*samples[i*n_terms_+j]*alpha_i[i]*alpha_i[j]*
std::cos(omega_i[i]*(p[0]-domain_length_/2))*
std::sin(omega_i[j]*(p[1]-domain_length_/2));
729 *
else if((i+1)%2==0 && (j+1)%2==1)
731 *
val+=
std::sqrt(lambda_i[i]*lambda_i[j])*samples[i*n_terms_+j]*alpha_i[i]*alpha_i[j]*
std::sin(omega_i[i]*(p[0]-domain_length_/2))*
std::cos(omega_i[j]*(p[1]-domain_length_/2));
742 *
void RandomField::KLExpansion<dim>::compute_omega_i()
744 *
for(
unsigned int i = 1; i<=n_terms_; i++)
758 *
void RandomField::KLExpansion<dim>::compute_alpha_i()
760 *
for(
unsigned int i = 1; i<=n_terms_; i++)
764 *
double w_i = omega_i[i-1];
765 *
double sqrt_val = domain_length_/2 -
std::sin(w_i*domain_length_)/(2*w_i);
766 *
alpha_i.push_back(1/(
std::sqrt(sqrt_val)));
770 *
double w_i = omega_i[i-1];
771 *
double sqrt_val = domain_length_/2 +
std::sin(w_i*domain_length_)/(2*w_i);
772 *
alpha_i.push_back(1/(
std::sqrt(sqrt_val)));
778 *
void RandomField::KLExpansion<dim>::compute_lambda_i()
780 *
for(
unsigned int i = 1; i<=n_terms_; i++)
782 *
double w_i = omega_i[i-1];
783 *
double lambda = 2*correlation_length_/(1+w_i*w_i*correlation_length_*correlation_length_);
784 *
lambda_i.push_back(lambda);
790 *
void RandomField::KLExpansion<dim>::newton_even(
unsigned int index)
792 *
double a = M_PI / domain_length_ * (
index - 1);
793 *
double b = M_PI / domain_length_ *
index;
795 *
double x = a + 0.1 * (
b - a);
797 *
for (
int i = 0; i < 50; ++i)
799 *
double fx = f_even(x);
800 *
double dfx = grad_f_even(x);
804 *
double step = fx / dfx;
805 *
double x_new = x - step;
807 *
int backtrack_count = 0;
808 *
while ((x_new <= a || x_new >= b) && backtrack_count < 10)
815 *
if (x_new <= a || x_new >= b)
break;
818 *
if (!std::isfinite(x_new))
break;
827 *
omega_i.push_back(x);
831 *
void RandomField::KLExpansion<dim>::newton_odd(
unsigned int index)
833 *
double x = M_PI / domain_length_ * (
static_cast<double>(
index) - 0.2);
835 *
for (
int i = 0; i < 50; ++i)
837 *
double fx = f_odd(x);
838 *
double dfx = grad_f_odd(x);
842 *
double x_new = x - fx / dfx;
844 *
if (
std::abs(x_new - x) < 1e-10)
break;
845 *
if (!std::isfinite(x_new))
break;
849 *
omega_i.push_back(x);
854 *
double RandomField::KLExpansion<dim>::f_odd(
double x)
856 *
return 1.0 / correlation_length_ - x *
std::tan(x * domain_length_ / 2.0);
860 *
double RandomField::KLExpansion<dim>::f_even(
double x)
862 *
return (1.0 / correlation_length_) *
std::tan(x * domain_length_ / 2.0) + x;
866 *
double RandomField::KLExpansion<dim>::grad_f_odd(
double x)
868 *
const double L = domain_length_;
869 *
const double t =
std::tan(x * L / 2.0);
870 *
const double sec2 = 1.0 /
std::cos(x * L / 2.0);
871 *
return -t - x * (
L / 2.0) * sec2 * sec2;
875 *
double RandomField::KLExpansion<dim>::grad_f_even(
double x)
877 *
const double L = domain_length_;
878 *
const double sec2 = 1.0 /
std::cos(x * L / 2.0);
879 *
return (1.0 / correlation_length_) * (
L / 2.0) * sec2 * sec2 + 1.0;
882 *
template class RandomField::KLExpansion<1>;
883 *
template class RandomField::KLExpansion<2>;
889<a name=
"ann-source/mlmc.cc"></a>
890<h1>Annotated version of source/mlmc.cc</h1>
906 *
#include
"../include/mlmc.h"
910 *
MultilevelMonteCarlo::MLMC<dim>::MLMC(
unsigned int oneD_samples)
911 *
: rng(std::random_device{}())
914 *
if constexpr (dim == 1) num_samples = oneD_samples;
915 *
else if constexpr (dim == 2) num_samples = oneD_samples*oneD_samples;
919 *
std::vector<double> MultilevelMonteCarlo::MLMC<dim>::generate_samples()
921 *
std::vector<double> samples(num_samples);
923 *
for (
auto &s : samples)
931 *
void MultilevelMonteCarlo::MLMC<dim>::add_sample(
double rvalue)
933 *
results.push_back(rvalue);
937 *
double MultilevelMonteCarlo::MLMC<dim>::compute_mean()
940 *
for(
unsigned int i = 0; i<results.size(); i++)
944 *
return mean/results.size();
948 *
double MultilevelMonteCarlo::MLMC<dim>::compute_variance()
950 *
double mean = compute_mean();
952 *
for(
unsigned int i = 0; i<results.size(); i++)
954 *
var +=
std::pow((results[i]-mean),2);
957 *
return var / (results.size() - 1);
961 *
void MultilevelMonteCarlo::MLMC<dim>::clear_samples()
966 *
template class MultilevelMonteCarlo::MLMC<1>;
967 *
template class MultilevelMonteCarlo::MLMC<2>;
972<a name=
"ann-source/random_darcy.cc"></a>
973<h1>Annotated version of source/random_darcy.cc</h1>
989 *
#include
"../include/random_darcy.h"
990 *
#include <deal.II/lac/sparse_direct.h>
993 *
Discretization::RandomDarcy<dim>::RandomDarcy()
995 *
, dof_handler(coarse_tria)
999 *
void Discretization::RandomDarcy<dim>::set_tria(
bool fine)
1003 *
dof_handler.reinit(fine_tria);
1007 *
dof_handler.reinit(coarse_tria);
1011 *
template <
int dim>
1012 *
void Discretization::RandomDarcy<dim>::generate_mesh(
double domain_length)
1017 *
coarse_tria.refine_global(3);
1018 *
fine_tria.refine_global(3);
1021 *
template <
int dim>
1022 *
void Discretization::RandomDarcy<dim>::setup_system()
1024 *
dof_handler.distribute_dofs(fe);
1026 *
solution.reinit(dof_handler.n_dofs());
1027 *
system_rhs.reinit(dof_handler.n_dofs());
1029 *
constraints.clear();
1034 * 1. Left boundary (indicator 0): u = 1.0
1039 *
Functions::ConstantFunction<dim>(1.0),
1044 * 2. Right boundary (indicator 1): u = 0.0
1049 *
Functions::ConstantFunction<dim>(0.0),
1052 *
constraints.close();
1060 *
sparsity_pattern.copy_from(dsp);
1062 *
system_matrix.reinit(sparsity_pattern);
1065 *
template <
int dim>
1066 *
void Discretization::RandomDarcy<dim>::assemble_system(RandomField::RandomPermeability<dim>& permeability)
1068 *
const QGauss<dim> quadrature_formula(fe.degree + 1);
1071 *
quadrature_formula,
1075 *
const unsigned int dofs_per_cell = fe.n_dofs_per_cell();
1080 *
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1082 *
for (
const auto &cell : dof_handler.active_cell_iterators())
1084 *
fe_values.
reinit(cell);
1089 *
for (
const unsigned int q_index : fe_values.quadrature_point_indices())
1091 *
const double current_coefficient =
1092 *
permeability.
value(fe_values.quadrature_point(q_index));
1093 *
for (
const unsigned int i : fe_values.dof_indices())
1095 *
for (
const unsigned
int j : fe_values.dof_indices())
1097 *
(current_coefficient *
1098 *
fe_values.shape_grad(i, q_index) *
1099 *
fe_values.shape_grad(j, q_index) *
1100 *
fe_values.JxW(q_index));
1102 *
cell_rhs(i) += (fe_values.shape_value(i, q_index) *
1104 *
fe_values.JxW(q_index));
1108 *
cell->get_dof_indices(local_dof_indices);
1109 *
constraints.distribute_local_to_global(
1110 *
cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs);
1115 *
template <
int dim>
1116 *
void Discretization::RandomDarcy<dim>::solve()
1120 *
solution = system_rhs;
1121 *
A_direct.
solve(system_matrix, solution);
1123 *
constraints.distribute(solution);
1126 *
template <
int dim>
1127 *
void Discretization::RandomDarcy<dim>::refine_grid(
bool firstRun)
1129 *
fine_tria.refine_global(1);
1132 *
coarse_tria.refine_global(1);
1136 *
template <
int dim>
1137 *
void Discretization::RandomDarcy<dim>::output_results(
bool firstRun,
unsigned int level)
1142 *
data_out.add_data_vector(solution,
"solution");
1144 *
data_out.build_patches();
1146 *
std::ofstream output(firstRun ?
"solutionCoarse" + std::to_string(
level) +
".vtk" :
"solutionFine" +
std::
to_string(
level) +
".vtk");
1147 *
data_out.write_vtk(output);
1150 *
template <
int dim>
1151 *
double Discretization::RandomDarcy<dim>::compute_Keff(RandomField::RandomPermeability<dim>& permeability)
1153 *
const QGauss<dim - 1> face_quadrature_formula(fe.degree + 1);
1155 *
face_quadrature_formula,
1159 *
std::vector<Tensor<1, dim>> solution_gradients(face_quadrature_formula.size());
1160 *
double Keff = 0.0;
1162 *
for (
const auto &cell : dof_handler.active_cell_iterators())
1163 *
{
for (
const auto face_no : cell->face_indices())
1165 *
if (cell->face(face_no)->at_boundary() &&
1168 *
fe_face_values.
reinit(cell, face_no);
1169 *
fe_face_values.get_function_gradients(solution, solution_gradients);
1170 *
for (
const unsigned int q_index : fe_face_values.quadrature_point_indices())
1172 *
const double current_coefficient = permeability.
value(fe_face_values.quadrature_point(q_index));
1173 *
Keff -= current_coefficient*solution_gradients[q_index][0]*fe_face_values.JxW(q_index);
1183 *
template class Discretization::RandomDarcy<1>;
1184 *
template class Discretization::RandomDarcy<2>;
1189<a name=
"ann-source/random_permeability.cc"></a>
1190<h1>Annotated version of source/random_permeability.cc</h1>
1205 *
#include
"../include/random_permeability.h"
1207 *
template <
int dim>
1208 *
RandomField::RandomPermeability<dim>::RandomPermeability(std::vector<double> &xi,
unsigned int n_terms,
double domain_length,
double correlation_length,
double mu)
1209 *
: kl_expansion(n_terms, domain_length, correlation_length, mu)
1213 *
template <
int dim>
1214 *
void RandomField::RandomPermeability<dim>::overwrite_samples(
const std::vector<double> &next_sample)
1216 *
samples = next_sample;
1219 *
template <
int dim>
1220 *
double RandomField::RandomPermeability<dim>::value(
const Point<dim>& p)
1222 *
return std::exp(kl_expansion.compute_kl_expansion(p, samples));
1225 *
template class RandomField::RandomPermeability<1>;
1226 *
template class RandomField::RandomPermeability<2>;
1231<a name=
"ann-utils/post_processing.py"></a>
1232<h1>Annotated version of utils/post_processing.py</h1>
1235import matplotlib.pyplot as plt
1239def plot_from_file(filename):
1240 if not os.path.exists(filename):
1241 print(f"Error: {filename} not found. Did you run the C++ code first or is it perhaps in the wrong folder?")
1244 levels, means, variances, samples = [], [], [], []
1246 pattern = re.compile(r
"FINAL_STATS Level:(\d+) Mean:([\d\.e+-]+) Var:([\d\.e+-]+) Samples:(\d+)")
1248 with open(filename,
'r') as f:
1250 match = pattern.search(line)
1252 levels.append(
int(match.group(1)))
1253 means.append(abs(
float(match.group(2))))
# Absolute for log-plot
1254 variances.append(
float(match.group(3)))
1255 samples.append(
int(match.group(4)))
1258 print(
"No valid MLMC data found in the file.")
1261 # Convert to arrays for plotting
1262 levels = np.array(levels)
1264 fig, axs = plt.subplots(1, 3, figsize=(16, 5))
1267 axs[0].plot(levels, variances,
'o-', color=
'firebrick', label=r
'Var[@f$P_l - P_{l-1}@f$]')
1268 axs[0].set_yscale(
'log')
1269 axs[0].set_title(
'Variance Decay', fontsize=12, fontweight=
'bold')
1270 axs[0].set_xlabel(
'Level')
1271 axs[0].grid(True, which=
'both', alpha=0.3)
1274 # 2. Mean Difference (Bias)
1275 axs[1].plot(levels, means,
's-', color=
'royalblue', label=r
'|@f$E[P_l - P_{l-1}]@f$|')
1276 axs[1].set_yscale(
'log')
1277 axs[1].set_title(
'Mean Difference (Bias)', fontsize=12, fontweight=
'bold')
1278 axs[1].set_xlabel(
'Level')
1279 axs[1].grid(True, which=
'both', alpha=0.3)
1282 # 3. Samples per Level
1283 axs[2].bar(levels, samples, color=
'seagreen', alpha=0.7)
1284 axs[2].set_yscale(
'log')
1285 axs[2].set_title(
'Samples per Level (Workload)', fontsize=12, fontweight=
'bold')
1286 axs[2].set_xlabel(
'Level')
1287 axs[2].set_ylabel(
'@f$N_l@f$')
1288 axs[2].grid(axis=
'y', alpha=0.3, linestyle=
'--')
1291 plt.savefig(
'mlmc_plots.png', dpi=150)
1292 print(
"Plot saved as 'mlmc_plots.png'")
1295if __name__ == "__main__":
1296 plot_from_file('mlmc_results.txt')
* * for(const auto &cell :triangulation.active_cell_iterators())
* * int main(int argc, char **argv)
* * * struct InterferenceTaperTransform *
void attach_dof_handler(const DoFHandler< dim, spacedim > &)
virtual RangeNumberType value(const Point< dim > &p, const unsigned int component=0) const
void solve(Vector< double > &rhs_and_solution, const bool transpose=false) const
void make_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternBase &sparsity_pattern, const AffineConstraints< number > &constraints={}, const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void refine(Triangulation< dim, spacedim > &tria, const Vector< Number > &criteria, const double threshold, const unsigned int max_to_mark=numbers::invalid_unsigned_int)
@ general
No special properties.
constexpr types::blas_int one
void cell_matrix(FullMatrix< double > &M, const FEValuesBase< dim > &fe, const FEValuesBase< dim > &fetest, const ArrayView< const std::vector< double > > &velocity, const double factor=1.)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
* * if(update_pressure &update_flags) * compute_pressure(constitutive_request
* * * ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number > ThermoPlasticMaterial * mu(mu)
* * * * std::vector< Number > ThermoPlasticMaterial< dim, ViscoplasticYieldLaw, Number >::get_state_parameters const
void run(const Iterator &begin, const std_cxx20::type_identity_t< Iterator > &end, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length, const unsigned int chunk_size)
int(&) functions(const void *v1, const void *v2)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > tan(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)