10#include <deal.II/base/exceptions.h>
11#include <deal.II/base/work_stream.h>
13#include <deal.II/dofs/dof_renumbering.h>
14#include <deal.II/dofs/dof_tools.h>
16#include <deal.II/lac/affine_constraints.h>
17#include <deal.II/lac/dynamic_sparsity_pattern.h>
18#include <deal.II/lac/solver_control.h>
19#include <deal.II/lac/sparsity_tools.h>
20#include <deal.II/lac/trilinos_precondition.h>
21#include <deal.II/lac/trilinos_solver.h>
23#include <deal.II/numerics/error_estimator.h>
24#include <deal.II/numerics/vector_tools.h>
27 MeltVolumeRequiresPhaseChange,
28 "Calculation of the melt volume requires that a fluid has at least a 'phase_change' physical property model");
57 RequiresConstantViscosity(
"assemble_nitsche_heat_restriction"));
63 for (
unsigned int i_solid = 0; i_solid < solids.size(); ++i_solid)
66 std::shared_ptr<Particles::ParticleHandler<dim>> &solid_ph =
67 solids[i_solid]->get_solid_particle_handler();
72 const unsigned int dofs_per_cell = this->
fe->dofs_per_cell;
74 std::vector<types::global_dof_index> heat_dof_indices(dofs_per_cell);
75 FullMatrix<double> local_matrix(dofs_per_cell, dofs_per_cell);
76 dealii::Vector<double> local_rhs(dofs_per_cell);
78 Function<dim> *solid_temperature =
79 solids[i_solid]->get_solid_temperature();
87 auto particle = solid_ph->begin();
88 while (particle != solid_ph->end())
93 const auto &cell = particle->get_surrounding_cell();
106 const double penalty_parameter =
108 const auto &dh_cell =
109 typename DoFHandler<dim>::cell_iterator(*cell,
111 dh_cell->get_dof_indices(heat_dof_indices);
113 const auto pic = solid_ph->particles_in_cell(cell);
114 Assert(pic.begin() == particle, ExcInternalError());
115 for (
const auto &p : pic)
117 const ArrayView<const double> properties = p.get_properties();
119 double fluid_temperature = 0;
120 const auto &ref_q = p.get_reference_location();
121 const auto &real_q = p.get_location();
122 const auto &JxW = properties[0];
124 for (
unsigned int k = 0; k < dofs_per_cell; ++k)
131 this->
fe->shape_value(k, ref_q);
134 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
138 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
140 local_matrix(i, j) +=
141 penalty_parameter * beta *
142 this->
fe->shape_value(i, ref_q) *
143 this->
fe->shape_value(j, ref_q) * JxW;
149 local_rhs(i) += penalty_parameter * beta *
150 (solid_temperature->value(real_q, 0) -
152 this->
fe->shape_value(i, ref_q) * JxW;
156 const AffineConstraints<double> &constraints_used =
159 constraints_used.distribute_local_to_global(local_matrix,
164 particle = pic.end();
167 this->
system_rhs.compress(VectorOperation::add);
178 std::vector<double> heat_flux_on_nitsche_ib_vector(solids.size(), 0);
181 for (
unsigned int i_solid = 0; i_solid < solids.size(); ++i_solid)
184 std::shared_ptr<Particles::ParticleHandler<dim>> &solid_ph =
185 solids[i_solid]->get_solid_particle_handler();
186 double heat_flux_on_nitsche_bc = 0;
191 const unsigned int dofs_per_cell = this->
fe->dofs_per_cell;
193 std::vector<types::global_dof_index> heat_dof_indices(dofs_per_cell);
194 FullMatrix<double> local_matrix(dofs_per_cell, dofs_per_cell);
195 dealii::Vector<double> local_rhs(dofs_per_cell);
197 Function<dim> *solid_temperature =
198 solids[i_solid]->get_solid_temperature();
206 auto particle = solid_ph->begin();
207 while (particle != solid_ph->end())
212 const auto &cell = particle->get_surrounding_cell();
214 const auto &dh_cell =
215 typename DoFHandler<dim>::cell_iterator(*cell,
217 dh_cell->get_dof_indices(heat_dof_indices);
219 const auto pic = solid_ph->particles_in_cell(cell);
220 Assert(pic.begin() == particle, ExcInternalError());
221 for (
const auto &p : pic)
223 const ArrayView<const double> properties = p.get_properties();
225 double fluid_temperature = 0;
226 const auto &ref_q = p.get_reference_location();
227 const auto &real_q = p.get_location();
228 const auto &JxW = properties[0];
230 for (
unsigned int k = 0; k < dofs_per_cell; ++k)
236 this->
fe->shape_value(k, ref_q);
239 heat_flux_on_nitsche_bc +=
241 (solid_temperature->value(real_q, 0) - fluid_temperature) *
244 particle = pic.end();
247 heat_flux_on_nitsche_ib_vector[i_solid] =
248 Utilities::MPI::sum(heat_flux_on_nitsche_bc,
256 this->
pcout <<
"Heat flux at the nitsche immersed boundary : "
258 for (
unsigned int i_solid = 0; i_solid < solids.size(); ++i_solid)
260 this->
pcout <<
"\t Nitsche boundary " << i_solid <<
" : "
261 << heat_flux_on_nitsche_ib_vector[i_solid] << std::endl;
266 for (
unsigned int i_solid = 0; i_solid < solids.size(); ++i_solid)
269 Utilities::int_to_string(i_solid, 1),
270 heat_flux_on_nitsche_ib_vector[i_solid]);
281 "The SDIRK scheme is not yet supported for this physics"));
294 dim>::LaserType::gaussian_heat_flux_cls_interface)
304 dim>::LaserType::uniform_heat_flux_cls_interface)
357 .has_convection_radiation_bc)
373 .time_harmonic_maxwell_parameters.electromagnetic_scaling_type !=
375 ExcMessage(
"Time-harmonic Maxwell solution scaling is none, but heat "
376 "transfer physics requires a non-dimensionless solution."));
383 .time_harmonic_maxwell_parameters,
384 this->simulation_parameters.dimensionality));
397 .viscous_dissipative_fluid));
408 .heat_transfer_dcdd_stabilization)
437 const DoFHandler<dim> &dof_handler_fluid =
445 *this->cell_quadrature,
446 *this->temperature_mapping,
447 dof_handler_fluid.get_fe(),
448 *this->face_quadrature,
453 const DoFHandler<dim> &dof_handler_cls =
455 scratch_data.enable_cls(
456 dof_handler_cls.get_fe(),
457 *this->cell_quadrature,
458 *this->temperature_mapping,
459 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
464 const DoFHandler<dim> &dof_handler_thm =
466 scratch_data.enable_time_harmonic_maxwell(dof_handler_thm.get_fe(),
467 *this->cell_quadrature,
468 *this->temperature_mapping);
472 this->dof_handler->end(),
478 this->cell_quadrature->size()));
489 const typename DoFHandler<dim>::active_cell_iterator &cell,
494 if (!cell->is_locally_owned())
505 const DoFHandler<dim> &dof_handler_fluid =
508 typename DoFHandler<dim>::active_cell_iterator fd_cell(&(*
triangulation),
519 average_velocity_profile &&
520 !this->simulation_parameters.multiphysics.fluid_dynamics &&
522 this->simulation_parameters.post_processing
523 .initial_time_for_average_velocities)
529 this->simulation_parameters.ale);
537 this->simulation_parameters.ale);
546 average_velocity_profile &&
547 !this->simulation_parameters.multiphysics.fluid_dynamics &&
549 this->simulation_parameters.post_processing
550 .initial_time_for_average_velocities)
555 this->simulation_parameters.ale);
562 this->simulation_parameters.ale);
568 const DoFHandler<dim> &dof_handler_cls =
570 typename DoFHandler<dim>::active_cell_iterator phase_cell(
578 this->multiphysics->get_filtered_solution(
584 const DoFHandler<dim> &dof_handler_thm =
586 typename DoFHandler<dim>::active_cell_iterator thm_cell(
603 assembler->assemble_matrix(scratch_data, copy_data);
619 constraints_used.distribute_local_to_global(copy_data.
local_matrix,
634 const DoFHandler<dim> &dof_handler_fluid =
642 *this->cell_quadrature,
643 *this->temperature_mapping,
644 dof_handler_fluid.get_fe(),
645 *this->face_quadrature,
650 const DoFHandler<dim> &dof_handler_cls =
652 scratch_data.enable_cls(
653 dof_handler_cls.get_fe(),
654 *this->cell_quadrature,
655 *this->temperature_mapping,
656 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
661 const DoFHandler<dim> &dof_handler_thm =
663 scratch_data.enable_time_harmonic_maxwell(dof_handler_thm.get_fe(),
664 *this->cell_quadrature,
665 *this->temperature_mapping);
669 this->dof_handler->end(),
675 this->cell_quadrature->size()));
677 this->
system_rhs.compress(VectorOperation::add);
686 const typename DoFHandler<dim>::active_cell_iterator &cell,
691 if (!cell->is_locally_owned())
702 const DoFHandler<dim> &dof_handler_fluid =
705 typename DoFHandler<dim>::active_cell_iterator fd_cell(&(*
triangulation),
716 average_velocity_profile &&
717 !this->simulation_parameters.multiphysics.fluid_dynamics &&
719 this->simulation_parameters.post_processing
720 .initial_time_for_average_velocities)
726 this->simulation_parameters.ale);
733 this->simulation_parameters.ale);
744 average_velocity_profile &&
745 !this->simulation_parameters.multiphysics.fluid_dynamics &&
747 this->simulation_parameters.post_processing
748 .initial_time_for_average_velocities)
753 this->simulation_parameters.ale);
760 this->simulation_parameters.ale);
769 const DoFHandler<dim> &dof_handler_cls =
771 typename DoFHandler<dim>::active_cell_iterator phase_cell(
779 this->multiphysics->get_filtered_solution(
785 const DoFHandler<dim> &dof_handler_thm =
787 typename DoFHandler<dim>::active_cell_iterator thm_cell(
804 assembler->assemble_rhs(scratch_data, copy_data);
819 constraints_used.distribute_local_to_global(copy_data.
local_rhs,
825std::vector<OutputStruct<dim, GlobalVectorType>>
829 std::vector<OutputStruct<dim, GlobalVectorType>> solution_output_structs;
830 solution_output_structs.emplace_back(
834 std::vector<std::string>{
"temperature"},
835 std::vector<DataComponentInterpretation::DataComponentInterpretation>{
836 DataComponentInterpretation::component_is_scalar});
839 const unsigned int n_fluids =
841 .get_number_of_fluids();
842 const unsigned int n_solids =
844 .get_number_of_solids();
845 unsigned int mesh_m_id = 0;
848 const bool solid_phase_present = (n_solids > 0);
854 for (
unsigned int f_id = 0; f_id < n_fluids; ++f_id)
861 solid_phase_present));
862 solution_output_structs.emplace_back(
870 for (
unsigned int m_id = n_fluids; m_id < n_fluids + n_solids; ++m_id)
878 solid_phase_present));
879 solution_output_structs.emplace_back(
892 solution_output_structs.emplace_back(
896 std::vector<std::string>{
"average_temperature"},
897 std::vector<DataComponentInterpretation::DataComponentInterpretation>{
898 DataComponentInterpretation::component_is_scalar});
905 for (
unsigned int f_id = 0; f_id < n_fluids; ++f_id)
912 solid_phase_present));
913 solution_output_structs.emplace_back(
922 for (
unsigned int m_id = n_fluids; m_id < n_fluids + n_solids; ++m_id)
930 solid_phase_present));
931 solution_output_structs.emplace_back(
940 return solution_output_structs;
947 double solution_maximum, solution_minimum;
963 std::max(solution_maximum - solution_minimum, minimum_delta_T_ref);
973 auto mpi_communicator =
triangulation->get_mpi_communicator();
978 update_values | update_gradients |
979 update_quadrature_points | update_JxW_values);
983 std::vector<double> q_exact_solution(n_q_points);
984 std::vector<double> q_scalar_values(n_q_points);
991 for (
const auto &cell :
dof_handler->active_cell_iterators())
993 if (cell->is_locally_owned())
995 fe_values.reinit(cell);
999 exact_solution.value_list(fe_values.get_quadrature_points(),
1002 for (
unsigned int q = 0; q < n_q_points; q++)
1004 double sim = q_scalar_values[q];
1005 double exact = q_exact_solution[q];
1006 l2error += (sim - exact) * (sim - exact) * fe_values.JxW(q);
1010 l2error = Utilities::MPI::sum(l2error, mpi_communicator);
1018 auto mpi_communicator =
triangulation->get_mpi_communicator();
1019 unsigned int this_mpi_process(
1020 Utilities::MPI::this_mpi_process(mpi_communicator));
1022 if (this_mpi_process == 0 &&
1026 error_table.omit_column_from_convergence_rate_evaluation(
"cells");
1033 ConvergenceTable::reduction_rate_log2);
1035 error_table.set_scientific(
"error_temperature",
true);
1044 this->
pcout << std::defaultfloat;
1046 this->
pcout << std::scientific;
1056 (*previous_solutions)[i] = (*previous_solutions)[i - 1];
1072 error_table.add_value(
"error_temperature", temperature_error);
1073 error_table.set_scientific(
"error_temperature",
true);
1075 if (Utilities::MPI::this_mpi_process(
1078 std::string filename =
1081 "_heat_transfer.dat";
1082 std::ofstream output(filename.c_str());
1089 this->
pcout <<
"L2 error temperature : " << temperature_error
1107 std::string domain_name(
"fluid");
1108 bool gather_cls(
false);
1111 .get_number_of_fluids() == 2)
1115 switch (monitored_fluid)
1119 domain_name =
"fluid";
1124 domain_name =
"fluid_0";
1129 domain_name =
"fluid_1";
1154 this->simulation_parameters.post_processing.output_frequency ==
1191 this->simulation_parameters.post_processing.output_frequency ==
1200 "Calculate algebraic melt volume");
1203 MeltVolumeRequiresPhaseChange());
1207 this->simulation_parameters.post_processing.output_frequency ==
1216 "Calculate geometric melt volume");
1219 this->simulation_parameters.post_processing.output_frequency ==
1228 TimerOutput::Scope t(
1230 "Compute bounding values of temperature isocontours");
1234 .ids_and_isocontours_per_variable,
1236 *this->present_solution,
1237 this->simulation_control->get_current_time(),
1238 this->simulation_parameters.post_processing.verbosity,
1240 this->temperature_isocontour_bounding_values_tables);
1243 this->simulation_parameters.post_processing.output_frequency ==
1247 this->simulation_parameters.simulation_control.output_folder,
1249 this->simulation_parameters.post_processing.isocontour_bounding_boxes
1250 .ids_and_isocontours_per_variable,
1251 this->temperature_isocontour_bounding_values_tables);
1269 this->
pcout << std::defaultfloat;
1271 this->
pcout << std::scientific;
1295 auto mpi_communicator =
triangulation->get_mpi_communicator();
1317 (*previous_solutions)[i] = tmp_previous_solution;
1327 const std::pair<const Variable, Parameters::MultipleAdaptationParameters>
1329 dealii::Vector<float> &estimated_error_per_cell)
1334 ivar.second.error_estimator ==
1337 "Only the Kelly error estimator is currently implemented for the "
1338 "<temperature> field."));
1341 ComponentMask temperature_mask =
1342 fe->component_mask(FEValuesExtractors::Scalar(0));
1351 dealii::Vector<float> &estimated_error_per_cell,
1352 const ComponentMask &component_mask)
1354 KellyErrorEstimator<dim>::estimate(
1358 typename std::map<types::boundary_id,
const Function<dim, double> *>(),
1360 estimated_error_per_cell,
1365std::vector<OutputStructTableHandler>
1368 std::vector<OutputStructTableHandler> table_output_structs;
1370 std::string prefix =
1372 std::string suffix =
".checkpoint";
1375 table_output_structs.emplace_back(
1381 table_output_structs.emplace_back(
1388 .calculate_temperature_statistics)
1389 table_output_structs.emplace_back(
1396 .calculate_algebraic_melt_volume)
1397 table_output_structs.emplace_back(
1401 .algebraic_melt_volume_output_name +
1405 .calculate_geometric_melt_volume)
1406 table_output_structs.emplace_back(
1410 .geometric_melt_volume_output_name +
1424 for (
auto it = begin; it != end; ++it, ++i)
1427 const std::string &isocontour_output_name =
1428 it->second.second.output_name;
1430 table_output_structs.emplace_back(
1432 prefix + isocontour_output_name + suffix);
1436 return table_output_structs;
1443 auto mpi_communicator = this->
triangulation->get_mpi_communicator();
1444 std::vector<const GlobalVectorType *> sol_set_transfer;
1447 std::make_shared<SolutionTransfer<dim, GlobalVectorType>>(*dof_handler);
1452 sol_set_transfer.emplace_back(&previous_solution);
1455 std::string checkpoint_file_prefix =
1461 std::vector<const GlobalVectorType *> avg_scalar_set_transfer =
1464 sol_set_transfer.insert(sol_set_transfer.end(),
1465 avg_scalar_set_transfer.begin(),
1466 avg_scalar_set_transfer.end());
1473 const std::vector<OutputStructTableHandler> &table_output_structs =
1482 auto mpi_communicator =
triangulation->get_mpi_communicator();
1483 this->
pcout <<
"Reading heat transfer checkpoint" << std::endl;
1487 input_vectors[0] = &distributed_system;
1490 std::vector<GlobalVectorType> distributed_previous_solutions;
1494 distributed_previous_solutions.emplace_back(
1496 input_vectors[i + 1] = &distributed_previous_solutions[i];
1499 SolutionTransfer<dim, GlobalVectorType> system_trans_vectors(
1502 std::string checkpoint_file_prefix =
1508 std::vector<GlobalVectorType *> sum_vectors =
1511 input_vectors.insert(input_vectors.end(),
1512 sum_vectors.begin(),
1523 .initial_time_for_average_temp_and_hf +
1525 this->simulation_control->get_current_time())
1528 <<
"Warning: The checkpointed time-averaged temperature and heat flux have been reinitialized because the initial averaging time has not yet been reached."
1538 (*previous_solutions)[i] = distributed_previous_solutions[i];
1543 std::vector<OutputStructTableHandler> table_output_structs =
1557 DoFRenumbering::Cuthill_McKee(*this->
dof_handler);
1559 auto mpi_communicator =
triangulation->get_mpi_communicator();
1587 DoFTools::make_hanging_node_constraints(*this->
dof_handler,
1590 for (
auto const &[
id, type] :
1596 VectorTools::interpolate_boundary_values(
1600 .dirichlet_value.at(
id),
1605 const auto &periodic_boundary =
1607 .periodic_boundaries.at(
id);
1608 DoFTools::make_periodicity_constraints(
1611 periodic_boundary.neighbor_id,
1612 periodic_boundary.direction,
1619 .calculate_average_temp_and_hf)
1634 DoFTools::make_hanging_node_constraints(*this->
dof_handler,
1637 for (
auto const &[
id, type] :
1642 VectorTools::interpolate_boundary_values(
1645 Functions::ZeroFunction<dim>(),
1650 const auto &periodic_boundary =
1652 .periodic_boundaries.at(
id);
1653 DoFTools::make_periodicity_constraints(
1656 periodic_boundary.neighbor_id,
1657 periodic_boundary.direction,
1666 DoFTools::make_sparsity_pattern(*this->
dof_handler,
1671 SparsityTools::distribute_sparsity_pattern(dsp,
1680 this->
pcout <<
" Number of thermal degrees of freedom: "
1690 this->previous_solutions);
1704 for (
auto const &[
id, type] :
1722 DoFTools::make_hanging_node_constraints(*this->
dof_handler,
1725 for (
auto const &[
id, type] :
1731 VectorTools::interpolate_boundary_values(
1740 const auto &periodic_boundary =
1742 .periodic_boundaries.at(
id);
1743 DoFTools::make_periodicity_constraints(*this->
dof_handler,
1745 periodic_boundary.neighbor_id,
1746 periodic_boundary.direction,
1772 const unsigned int ilu_fill =
1775 const double ilu_atol =
1778 const double ilu_rtol =
1781 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
1782 ilu_fill, ilu_atol, ilu_rtol, 0);
1796 std::vector<std::vector<bool>> constant_modes;
1798 ComponentMask components(1,
true);
1800 DoFTools::extract_constant_modes(*this->
dof_handler, components);
1804 const bool elliptic =
false;
1805 bool higher_order_elements =
false;
1807 higher_order_elements =
true;
1808 const unsigned int n_cycles =
1811 const bool w_cycle =
1814 const double aggregation_threshold =
1816 .amg_aggregation_threshold;
1817 const unsigned int smoother_sweeps =
1819 .amg_smoother_sweeps;
1820 const unsigned int smoother_overlap =
1822 .amg_smoother_overlap;
1823 const bool output_details =
false;
1824 const char *smoother_type =
"ILU";
1825 const char *coarse_type =
"ILU";
1826 TrilinosWrappers::PreconditionAMG::AdditionalData preconditionerOptions(
1828 higher_order_elements,
1831 aggregation_threshold,
1839 Teuchos::ParameterList parameter_ml;
1840 std::unique_ptr<Epetra_MultiVector> distributed_constant_modes;
1841 preconditionerOptions.set_parameters(parameter_ml,
1842 distributed_constant_modes,
1844 const double ilu_fill =
1846 .amg_precond_ilu_fill;
1847 const double ilu_atol =
1849 .amg_precond_ilu_atol;
1850 const double ilu_rtol =
1852 .amg_precond_ilu_rtol;
1853 parameter_ml.set(
"smoother: ifpack level-of-fill", ilu_fill);
1854 parameter_ml.set(
"smoother: ifpack absolute threshold", ilu_atol);
1855 parameter_ml.set(
"smoother: ifpack relative threshold", ilu_rtol);
1857 parameter_ml.set(
"coarse: ifpack level-of-fill", ilu_fill);
1858 parameter_ml.set(
"coarse: ifpack absolute threshold", ilu_atol);
1859 parameter_ml.set(
"coarse: ifpack relative threshold", ilu_rtol);
1871 auto mpi_communicator =
triangulation->get_mpi_communicator();
1873 const AffineConstraints<double> &constraints_used = this->
zero_constraints;
1875 const double absolute_residual =
1878 const double relative_residual =
1883 const double current_residual =
system_rhs.l2_norm() / rescale_metric;
1884 const double linear_solver_tolerance =
1885 std::max(relative_residual * current_residual, absolute_residual);
1889 this->
pcout <<
" -Tolerance of iterative solver is : "
1890 << linear_solver_tolerance << std::endl;
1892 const double non_rescaled_linear_solver_tolerance =
1893 linear_solver_tolerance * rescale_metric;
1901 non_rescaled_linear_solver_tolerance,
1905 TrilinosWrappers::SolverGMRES::AdditionalData solver_parameters(
1908 .max_krylov_vectors);
1911 TrilinosWrappers::SolverGMRES solver(solver_control, solver_parameters);
1913 const auto preconditioner_type =
1921 completely_distributed_solution,
1925 else if (preconditioner_type ==
1930 completely_distributed_solution,
1938 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
1943 this->
pcout <<
" -Iterative solver took : " << solver_control.last_step()
1944 <<
" steps to reach a residual norm of "
1945 << solver_control.last_value() / rescale_metric << std::endl;
1948 constraints_used.distribute(completely_distributed_solution);
1955 const bool gather_cls,
1957 const std::string &domain_name,
1958 const bool time_average)
1961 const MPI_Comm mpi_communicator = this->
dof_handler->get_mpi_communicator();
1964 std::vector<double> local_temperature_values(n_q_points);
1968 update_values | update_JxW_values);
1971 std::shared_ptr<const DoFHandler<dim>> dof_handler_cls;
1972 std::shared_ptr<FEValues<dim>> fe_values_cls;
1973 std::vector<double> filtered_phase_values(n_q_points);
1977 dof_handler_cls = std::shared_ptr<const DoFHandler<dim>>(
1979 [](
const DoFHandler<dim> *) {});
1983 dof_handler_cls->get_fe(),
1989 double phase_coefficient(0.);
1990 double volume_integral(0.);
1991 double temperature_integral(0.);
1992 double minimum_temperature(std::numeric_limits<double>::max());
1993 double maximum_temperature(std::numeric_limits<double>::lowest());
1997 bool point_is_in_postprocessed_fluid(
false);
2000 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
2002 if (cell->is_locally_owned())
2005 fe_values_ht.reinit(cell);
2010 local_temperature_values);
2015 fe_values_ht.get_function_values(
2017 local_temperature_values);
2023 typename DoFHandler<dim>::active_cell_iterator cell_cls(
2027 &(*dof_handler_cls));
2030 fe_values_cls->reinit(cell_cls);
2031 fe_values_cls->get_function_values(
2033 filtered_phase_values);
2036 for (
unsigned int q = 0; q < n_q_points; q++)
2038 std::tie(phase_coefficient, point_is_in_postprocessed_fluid) =
2041 filtered_phase_values[q]);
2043 if (point_is_in_postprocessed_fluid)
2045 maximum_temperature =
2046 std::max(local_temperature_values[q], maximum_temperature);
2047 minimum_temperature =
2048 std::min(local_temperature_values[q], minimum_temperature);
2051 volume_integral += fe_values_ht.JxW(q) * phase_coefficient;
2052 temperature_integral += local_temperature_values[q] *
2053 phase_coefficient * fe_values_ht.JxW(q);
2058 minimum_temperature =
2059 Utilities::MPI::min(minimum_temperature, mpi_communicator);
2060 maximum_temperature =
2061 Utilities::MPI::max(maximum_temperature, mpi_communicator);
2063 volume_integral = Utilities::MPI::sum(volume_integral, mpi_communicator);
2064 temperature_integral =
2065 Utilities::MPI::sum(temperature_integral, mpi_communicator);
2066 double temperature_average = temperature_integral / volume_integral;
2069 double temperature_variance_integral = 0;
2070 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
2072 if (cell->is_locally_owned())
2074 fe_values_ht.reinit(cell);
2079 local_temperature_values);
2084 fe_values_ht.get_function_values(
2086 local_temperature_values);
2092 typename DoFHandler<dim>::active_cell_iterator cell_cls(
2096 &(*dof_handler_cls));
2099 fe_values_cls->reinit(cell_cls);
2100 fe_values_cls->get_function_values(
2102 filtered_phase_values);
2105 for (
unsigned int q = 0; q < n_q_points; q++)
2110 filtered_phase_values[q])
2113 temperature_variance_integral +=
2114 (local_temperature_values[q] - temperature_average) *
2115 (local_temperature_values[q] - temperature_average) *
2116 phase_coefficient * fe_values_ht.JxW(q);
2121 temperature_variance_integral =
2122 Utilities::MPI::sum(temperature_variance_integral, mpi_communicator);
2123 double temperature_variance = temperature_variance_integral / volume_integral;
2124 double temperature_std_deviation = std::sqrt(temperature_variance);
2130 std::string temperature_label =
2131 time_average ?
"Time-averaged temperature statistics on " :
2132 "Temperature statistics on ";
2133 this->
pcout << temperature_label << domain_name <<
": " << std::endl;
2134 this->
pcout <<
"\t Min: " << minimum_temperature << std::endl;
2135 this->
pcout <<
"\t Max: " << maximum_temperature << std::endl;
2136 this->
pcout <<
"\t Average: " << temperature_average << std::endl;
2137 this->
pcout <<
"\t Std-Dev: " << temperature_std_deviation << std::endl;
2155 temperature_average);
2157 temperature_std_deviation);
2165 auto mpi_communicator =
triangulation->get_mpi_communicator();
2167 if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
2169 std::string filename =
2172 domain_name +
".dat";
2173 std::ofstream output(filename.c_str());
2184 const MPI_Comm mpi_communicator = this->
dof_handler->get_mpi_communicator();
2190 .monitored_fluid_with_phase_change ==
2193 "For single-fluid flows only 'fluid_0' can be monitored."));
2196 std::vector<double> local_temperature_values(n_q_points);
2200 update_values | update_JxW_values);
2203 std::shared_ptr<const DoFHandler<dim>> dof_handler_cls;
2204 std::shared_ptr<FEValues<dim>> fe_values_cls;
2205 std::vector<double> filtered_phase_values(n_q_points);
2209 const auto &physical_properties_parameters =
2211 .get_physical_properties_parameters();
2215 dof_handler_cls = std::shared_ptr<const DoFHandler<dim>>(
2217 [](
const DoFHandler<dim> *) {});
2220 dof_handler_cls->get_fe(),
2226 double liquid_volume_integral(0.);
2229 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
2231 if (cell->is_locally_owned())
2234 fe_values_ht.reinit(cell);
2236 local_temperature_values);
2241 typename DoFHandler<dim>::active_cell_iterator cell_cls(
2245 &(*dof_handler_cls));
2248 fe_values_cls->reinit(cell_cls);
2249 fe_values_cls->get_function_values(
2251 filtered_phase_values);
2254 for (
unsigned int q = 0; q < n_q_points; q++)
2260 liquid_volume_integral +=
2262 physical_properties_parameters
2264 .phase_change_parameters) *
2265 fe_values_ht.JxW(q);
2271 .monitored_fluid_with_phase_change ==
2274 liquid_volume_integral +=
2275 (1. - filtered_phase_values[q]) *
2277 physical_properties_parameters
2279 .phase_change_parameters) *
2280 fe_values_ht.JxW(q);
2285 .monitored_fluid_with_phase_change ==
2288 liquid_volume_integral +=
2289 (filtered_phase_values[q]) *
2291 physical_properties_parameters
2293 .phase_change_parameters) *
2294 fe_values_ht.JxW(q);
2301 liquid_volume_integral =
2302 Utilities::MPI::sum(liquid_volume_integral, mpi_communicator);
2305 std::string melt_volume_column_name, melt_volume_console_string;
2306 if constexpr (dim == 2)
2308 melt_volume_column_name =
"melt_surface_alge";
2309 melt_volume_console_string =
"melt surface alge";
2311 else if constexpr (dim == 3)
2313 melt_volume_column_name =
"melt_volume_alge";
2314 melt_volume_console_string =
"melt volume alge";
2321 this->
pcout << melt_volume_console_string <<
": "
2322 << liquid_volume_integral << std::endl;
2330 liquid_volume_integral);
2339 auto mpi_communicator =
triangulation->get_mpi_communicator();
2341 if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
2343 std::string filename =
2346 .algebraic_melt_volume_output_name +
2348 std::ofstream output(filename.c_str());
2358 const MPI_Comm mpi_communicator = this->
dof_handler->get_mpi_communicator();
2364 .monitored_fluid_with_phase_change ==
2367 "For single-fluid flows only 'fluid_0' can be monitored."));
2371 double melt_surface;
2375 this->
dof_handler->locally_owned_dofs(), mpi_communicator);
2378 DoFTools::extract_locally_relevant_dofs(*this->dof_handler),
2382 const double melting_temperature =
2386 std::shared_ptr<const DoFHandler<dim>> dof_handler_cls;
2387 std::shared_ptr<NonMatching::FEValues<dim>> non_matching_fe_values_cls;
2388 std::shared_ptr<GlobalVectorType> phase_indicator_vector_owned_copy;
2389 const double phase_indicator_interface_value = 0.5;
2395 dof_handler_cls = std::shared_ptr<const DoFHandler<dim>>(
2397 [](
const DoFHandler<dim> *) {});
2401 phase_indicator_vector_owned_copy = std::make_shared<GlobalVectorType>();
2402 phase_indicator_vector_owned_copy->reinit(
2403 this->
dof_handler->locally_owned_dofs(), mpi_communicator);
2404 FETools::interpolate(
2408 *phase_indicator_vector_owned_copy);
2410 phase_indicator_vector_owned_copy->add(-phase_indicator_interface_value);
2412 .monitored_fluid_with_phase_change ==
2414 phase_indicator_vector_owned_copy->operator*=(-1);
2418 for (
const auto dof_id : this->
dof_handler->locally_owned_dofs())
2420 melt_indicator_vector_owned_copy[dof_id] =
2422 melting_temperature)),
2423 (*phase_indicator_vector_owned_copy)[dof_id]);
2425 melt_indicator_vector_relevant_copy = melt_indicator_vector_owned_copy;
2432 melt_indicator_vector_owned_copy.add(-melting_temperature);
2433 melt_indicator_vector_owned_copy.operator*=(
2436 melt_indicator_vector_relevant_copy = melt_indicator_vector_owned_copy;
2440 std::tie(melt_volume, melt_surface) =
2442 *this->
dof_handler, *this->
fe, melt_indicator_vector_relevant_copy);
2445 std::string melt_volume_column_name, melt_volume_console_string;
2446 std::string melt_contour_column_name, melt_contour_console_string;
2447 if constexpr (dim == 2)
2449 melt_volume_column_name =
"melt_surface_geo";
2450 melt_contour_column_name =
"melt_contour_length_geo";
2451 melt_volume_console_string =
"melt surface geo";
2452 melt_contour_console_string =
"melt contour length geo";
2454 else if constexpr (dim == 3)
2456 melt_volume_column_name =
"melt_volume_geo";
2457 melt_contour_column_name =
"melt_contour_surface_geo";
2458 melt_volume_console_string =
"melt volume geo";
2459 melt_contour_console_string =
"melt contour surface geo";
2466 this->
pcout << melt_volume_console_string <<
": " << melt_volume
2468 this->
pcout << melt_contour_console_string <<
": " << melt_surface
2488 auto mpi_communicator =
triangulation->get_mpi_communicator();
2490 if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
2492 std::string filename =
2495 .geometric_melt_volume_output_name +
2497 std::ofstream output(filename.c_str());
2504template <
typename VectorType>
2507 const bool gather_cls,
2511 const MPI_Comm mpi_communicator = this->
dof_handler->get_mpi_communicator();
2514 std::vector<double> local_temperature_values(n_q_points_face);
2515 std::vector<Tensor<1, dim>> temperature_gradient(n_q_points_face);
2518 *this->face_quadrature,
2519 update_values | update_gradients |
2521 update_normal_vectors);
2524 const DoFHandler<dim> &dof_handler_fd =
2526 const FEValuesExtractors::Vector velocities(0);
2527 std::vector<Tensor<1, dim>> local_velocity_values(n_q_points_face);
2529 dof_handler_fd.get_fe(),
2530 *this->face_quadrature,
2534 std::shared_ptr<const DoFHandler<dim>> dof_handler_cls;
2535 std::shared_ptr<FEFaceValues<dim>> fe_face_values_cls;
2536 std::vector<double> filtered_phase_values(n_q_points_face);
2540 dof_handler_cls = std::shared_ptr<const DoFHandler<dim>>(
2542 [](
const DoFHandler<dim> *) {});
2543 fe_face_values_cls =
2545 dof_handler_cls->get_fe(),
2551 auto &properties_manager =
2553 std::map<field, double> field_values;
2554 std::map<field, std::vector<double>> fields;
2558 double specific_heat(0.);
2559 double thermal_conductivity(0.);
2562 std::vector<double> density_0(n_q_points_face);
2563 std::vector<double> specific_heat_0(n_q_points_face);
2564 std::vector<double> thermal_conductivity_0(n_q_points_face);
2565 std::vector<double> density_1(n_q_points_face);
2566 std::vector<double> specific_heat_1(n_q_points_face);
2567 std::vector<double> thermal_conductivity_1(n_q_points_face);
2569 switch (properties_manager.get_number_of_fluids())
2574 const auto density_model = properties_manager.get_density();
2575 const auto specific_heat_model =
2576 properties_manager.get_specific_heat();
2577 const auto conductivity_model =
2578 properties_manager.get_thermal_conductivity();
2580 density = density_model->value(field_values);
2581 specific_heat = specific_heat_model->value(field_values);
2582 thermal_conductivity = conductivity_model->value(field_values);
2590 const auto density_models = properties_manager.get_density_vector();
2591 const auto specific_heat_models =
2592 properties_manager.get_specific_heat_vector();
2594 properties_manager.get_thermal_conductivity_vector();
2596 density_models[0]->vector_value(fields, density_0);
2597 specific_heat_models[0]->vector_value(fields, specific_heat_0);
2599 thermal_conductivity_0);
2601 density_models[1]->vector_value(fields, density_1);
2602 specific_heat_models[1]->vector_value(fields, specific_heat_1);
2604 thermal_conductivity_1);
2610 std::map<types::boundary_id, double> heat_flux;
2611 std::map<types::boundary_id, double> convective_flux;
2614 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
2616 if (cell->is_locally_owned() && cell->at_boundary())
2618 for (
const auto face : cell->face_indices())
2620 if (cell->face(face)->at_boundary())
2622 types::boundary_id boundary_index =
2623 cell->face(face)->boundary_id();
2626 const double h_coefficient =
2629 ->value(Point<dim>());
2630 const double T_inf =
2633 ->value(Point<dim>());
2637 fe_face_values_ht.reinit(cell, face);
2638 fe_face_values_ht.get_function_values(
2640 fe_face_values_ht.get_function_gradients(
2644 typename DoFHandler<dim>::active_cell_iterator cell_fd(
2651 fe_face_values_fd.reinit(cell_fd, face);
2652 fe_face_values_fd[velocities].get_function_values(
2653 current_solution_fd, local_velocity_values);
2658 typename DoFHandler<dim>::active_cell_iterator cell_cls(
2662 &(*dof_handler_cls));
2665 fe_face_values_cls->reinit(cell_cls, face);
2666 fe_face_values_cls->get_function_values(
2669 filtered_phase_values);
2673 for (
unsigned int q = 0; q < n_q_points_face; q++)
2675 if (properties_manager.get_number_of_fluids() == 2)
2679 thermal_conductivity =
2681 thermal_conductivity_0[q],
2682 thermal_conductivity_1[q]);
2692 specific_heat_1[q]);
2695 Tensor<1, dim> normal_vector_ht =
2696 -fe_face_values_ht.normal_vector(q);
2698 heat_flux[boundary_index] +=
2699 (-thermal_conductivity * temperature_gradient[q] *
2701 local_temperature_values[q] * density * specific_heat *
2702 local_velocity_values[q] * normal_vector_ht) *
2703 fe_face_values_ht.JxW(q);
2705 convective_flux[boundary_index] +=
2706 h_coefficient * (local_temperature_values[q] - T_inf) *
2707 fe_face_values_ht.JxW(q);
2717 for (
auto const &[
id, type] :
2720 heat_flux[id] = Utilities::MPI::sum(heat_flux[
id], mpi_communicator);
2722 convective_flux[id] =
2723 Utilities::MPI::sum(convective_flux[
id], mpi_communicator);
2731 <<
"Total heat flux at the heat transfer boundary conditions : "
2733 for (
auto const &[
id, type] :
2735 this->
pcout <<
"\t boundary " <<
id <<
" : " << heat_flux.at(
id)
2740 <<
"Convective heat flux at the heat transfer boundary conditions : "
2742 for (
auto const &[
id, type] :
2744 this->
pcout <<
"\t boundary " <<
id <<
" : " << convective_flux.at(
id)
2751 for (
auto const &[
id, type] :
2755 Utilities::int_to_string(
id, 1),
2758 Utilities::int_to_string(
id, 1),
2759 convective_flux.at(
id));
2765 const bool gather_cls,
2770 const bool gather_cls,
2775 const bool gather_cls,
2780 const bool gather_cls,
2784template <
typename VectorType>
2787 const bool gather_cls,
2789 const std::string &domain_name,
2793 const MPI_Comm mpi_communicator = this->
dof_handler->get_mpi_communicator();
2796 std::vector<double> local_temperature_values(n_q_points);
2797 std::vector<Tensor<1, dim>> temperature_gradient(n_q_points);
2800 *this->cell_quadrature,
2801 update_values | update_JxW_values);
2804 const DoFHandler<dim> &dof_handler_fd =
2806 const FEValuesExtractors::Vector velocities(0);
2807 std::vector<Tensor<1, dim>> local_velocity_values(n_q_points);
2809 dof_handler_fd.get_fe(),
2810 *this->cell_quadrature,
2814 std::shared_ptr<const DoFHandler<dim>> dof_handler_cls;
2815 std::shared_ptr<FEValues<dim>> fe_values_cls;
2816 std::vector<double> filtered_phase_values(n_q_points);
2820 dof_handler_cls = std::shared_ptr<const DoFHandler<dim>>(
2822 [](
const DoFHandler<dim> *) {});
2825 dof_handler_cls->get_fe(),
2831 auto &properties_manager =
2833 std::map<field, double> field_values;
2834 std::map<field, std::vector<double>> fields;
2838 double specific_heat(0.);
2841 std::vector<double> density_0(n_q_points);
2842 std::vector<double> specific_heat_0(n_q_points);
2843 std::vector<double> density_1(n_q_points);
2844 std::vector<double> specific_heat_1(n_q_points);
2846 switch (properties_manager.get_number_of_fluids())
2851 const auto density_model = properties_manager.get_density();
2852 const auto specific_heat_model =
2853 properties_manager.get_specific_heat();
2855 density = density_model->value(field_values);
2856 specific_heat = specific_heat_model->value(field_values);
2864 const auto density_models = properties_manager.get_density_vector();
2865 const auto specific_heat_models =
2866 properties_manager.get_specific_heat_vector();
2868 density_models[0]->vector_value(fields, density_0);
2869 specific_heat_models[0]->vector_value(fields, specific_heat_0);
2871 density_models[1]->vector_value(fields, density_1);
2872 specific_heat_models[1]->vector_value(fields, specific_heat_1);
2879 double phase_coefficient(0.);
2880 double heat_in_domain(0.);
2883 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
2885 if (cell->is_locally_owned())
2888 fe_values_ht.reinit(cell);
2890 local_temperature_values);
2893 typename DoFHandler<dim>::active_cell_iterator cell_fd(
2900 fe_values_fd.reinit(cell_fd);
2901 fe_values_fd[velocities].get_function_values(current_solution_fd,
2902 local_velocity_values);
2907 typename DoFHandler<dim>::active_cell_iterator cell_cls(
2911 &(*dof_handler_cls));
2914 fe_values_cls->reinit(cell_cls);
2915 fe_values_cls->get_function_values(
2917 filtered_phase_values);
2921 for (
unsigned int q = 0; q < n_q_points; q++)
2926 filtered_phase_values[q])
2929 if (properties_manager.get_number_of_fluids() == 2)
2940 specific_heat_1[q]);
2944 (density * specific_heat * local_temperature_values[q]) *
2945 phase_coefficient * fe_values_ht.JxW(q);
2951 heat_in_domain = Utilities::MPI::sum(heat_in_domain, mpi_communicator);
2957 this->
pcout <<
"Thermal energy in " << domain_name <<
" : "
2958 << heat_in_domain << std::endl;
2968 const bool gather_cls,
2970 const std::string &domain_name,
2975 const bool gather_cls,
2977 const std::string &domain_name,
2982 const bool gather_cls,
2984 const std::string &domain_name,
2989 const bool gather_cls,
2991 const std::string &domain_name,
2998 auto mpi_communicator =
triangulation->get_mpi_communicator();
3000 if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
3002 std::string filename =
3005 domain_name +
".dat";
3006 std::ofstream output(filename.c_str());
3013std::pair<double, bool>
3015 const bool gather_cls,
3017 const double phase_value_q)
3019 double phase_coefficient(0.);
3020 bool point_is_in_postprocessed_fluid(
false);
3022 switch (monitored_fluid)
3027 phase_coefficient = 1.;
3028 point_is_in_postprocessed_fluid =
true;
3035 phase_coefficient = 1. - phase_value_q;
3036 if (phase_value_q < 0.5)
3037 point_is_in_postprocessed_fluid =
true;
3043 phase_coefficient = 1.;
3044 point_is_in_postprocessed_fluid =
true;
3052 phase_coefficient = phase_value_q;
3053 if (phase_value_q > 0.5)
3054 point_is_in_postprocessed_fluid =
true;
3060 throw std::logic_error(
3061 "Inconsistency in .prm!\n when CLS = false"
3062 "\n use (default value): set postprocessed fluid = both"
3063 "\n or: set postprocessed fluid = fluid_0");
3069 return std::make_pair(phase_coefficient, point_is_in_postprocessed_fluid);
Compute the local heat flux vector field within a domain.
Class that assembles the transient time arising from BDF time integration for the heat transfer solve...
Class that assembles the evaporation sink for the heat transfer solver at the free surface (air/metal...
Class that assembles the core of the heat transfer equation. This class assembles the weak form of: ...
Class that assembles the Discontinuity-Capturing Directional Dissipation stabilization term for the h...
Class that assembles the radiation sink for the heat transfer solver at the free surface (air/metal i...
Class that assembles the laser heating as a volumetric source for the heat transfer solver when CLS i...
Class that assembles the laser heating as a volumetric source for the heat transfer solver....
Class that assembles the laser heating as a surface flux for the heat transfer solver when CLS is ena...
Class that assembles the time average electromagnetic heating for the heat transfer solver when the t...
Class that assembles the Robin boundary condition for the heat transfer solver.
Class that assembles the viscous dissipation for the heat transfer solver, for the specific case of C...
Class that assembles the viscous dissipation for the heat transfer solver.
Class that stores the information required by the assembly procedure for a heat transfer advection-di...
void reinit_cls(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType ¤t_solution, const VectorType ¤t_filtered_solution)
Reinitialize the content of the scratch for CLS.
void reinit_fluid_dynamics(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType ¤t_solution, const Parameters::ALE< dim > &ale)
Reinitialize cell's velocity and pressure values with values calculated in the Fluid Dynamics (FD) ph...
void calculate_physical_properties()
Calculates the physical properties. This method calculates the physical properties that may be requir...
void reinit_velocity_gradient(const VectorType ¤t_solution)
Reinitialize the velocity gradient, calculated by the Fluid Dynamics.
void reinit_time_harmonic_maxwell(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType ¤t_solution)
Reinitialize the content of the scratch for the time-harmonic Maxwell problem.
void reinit(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType ¤t_solution, const std::vector< GlobalVectorType > &previous_solutions, Function< dim > *source_function)
Reinitializes the content of the scratch.
Implementation of heat transfer as an auxiliary physics. The heat equation is weakly coupled to the v...
void write_geometric_melt_volume()
Write the geometric melt volume to an output file.
void percolate_time_vectors() override
Rearrange vector solution correctly for transient simulations.
void write_algebraic_melt_volume()
Post-processing. Write the algebraic melt volume to an output file.
TimerOutput computing_timer
Store information related to the computing time such as CPU times or wall time.
void assemble_nitsche_heat_restriction(const bool assemble_matrix)
Call for the assembly of the matrix and the right-hand side of the Nitsche restriction for the heat t...
GlobalVectorType local_evaluation_point
The local evaluation point. Ghosts cells are not considered in this evaluation.
void postprocess_geometric_melt_volume_and_surface()
Compute the geometric melt volume (3D) or surface (2D) and the contour surface area (3D) or length (2...
void solve_linear_system() override
Call for the solution of the linear system of equation using ILU or GMRES.
IndexSet locally_owned_dofs
Store a subset of the DoF indices that are stored on a particular processor on a distributed architec...
std::shared_ptr< SimulationControl > simulation_control
Responsible for the control of steady-state and transient simulations. Contains all the information r...
GlobalVectorType average_temperature_to_output
Locally owned average temperature calculated using the AverageScalar object.
double calculate_L2_error()
Calculate the L2 error of the solution.
TableHandler melt_volume_geo_table
Evolution of the melt volume in the simulated domain.
TableHandler heat_flux_table
Contain heat flux information used for post-processing:
std::shared_ptr< AverageScalar< dim > > average_temperature
Compute the average temperature in time.
std::shared_ptr< TrilinosWrappers::PreconditionAMG > amg_preconditioner
AMG preconditioner used by the iterative linear solver.
void postprocess_algebraic_melt_volume()
Compute the algebraic (phase indicator and liquid fraction weighted) melt volume (3D) or surface (2D)...
MultiphysicsInterface< dim > * multiphysics
void postprocess_temperature_statistics(const bool gather_cls, const Parameters::FluidIndicator monitored_fluid, const std::string &domain_name, const bool time_average)
Post-processing. Calculate temperature statistics on the domain : Max, min, average and standard-devi...
void setup_ilu()
Set up the ILU preconditioner stored in ilu_preconditioner.
std::vector< HeatFluxPostprocessor< dim > > heat_flux_postprocessors
Compute local heat flux quantities from temperature field and material properties.
TrilinosWrappers::SparseMatrix system_matrix
The system matrix.
void output_per_iteration_timer() override
Output the per iteration wallclock times.
virtual void copy_local_matrix_to_global_matrix(const StabilizedMethodsCopyData ©_data)
Copy local cell information to global matrix.
virtual void assemble_local_system_rhs(const typename DoFHandler< dim >::active_cell_iterator &cell, HeatTransferScratchData< dim > &scratch_data, StabilizedMethodsCopyData ©_data)
Assemble the local rhs for a given cell.
AffineConstraints< double > zero_constraints
void compute_kelly(dealii::Vector< float > &estimated_error_per_cell, const ComponentMask &component_mask)
Compute the Kelly error estimator on the temperature variable for mesh refinement....
void write_checkpoint() override
Prepare Heat Transfer to write checkpoint.
virtual void setup_assemblers()
Set up the vector of assembler functions.
const SimulationParameters< dim > & simulation_parameters
Contain the simulation parameter file information.
void post_mesh_adaptation() override
Interpolate the auxiliary physics variables to the new mesh.
std::vector< std::shared_ptr< ThermalConductivityModel > > thermal_conductivity_models
Abstract class that allows to calculate the thermal conductivity on each quadrature point using the t...
std::shared_ptr< Quadrature< dim - 1 > > face_quadrature
Approximate an integral by evaluating the integrand at specific points and summing the point values w...
virtual void assemble_local_system_matrix(const typename DoFHandler< dim >::active_cell_iterator &cell, HeatTransferScratchData< dim > &scratch_data, StabilizedMethodsCopyData ©_data)
Assemble the local matrix for a given cell.
std::shared_ptr< SolutionTransfer< dim, GlobalVectorType > > solution_transfer
SolutionTransfer<dim, GlobalVectorType>> is used to implement the transfer of a discrete FE function ...
std::shared_ptr< Quadrature< dim > > cell_quadrature
Approximate an integral by evaluating the integrand at specific points and summing the point values w...
void write_heat_flux(const std::string &domain_name)
Post-processing. Write the heat transfer values to an output file.
std::vector< SolutionTransfer< dim, GlobalVectorType > > previous_solutions_transfer
previous_solutions_transfer occupies the same role as solution_transfer but for solutions at previous...
std::vector< OutputStruct< dim, GlobalVectorType > > gather_output_hook() override
Gather and return vector of output structs that are particular to some applications.
std::pair< double, bool > set_phase_coefficient(const bool gather_cls, const Parameters::FluidIndicator monitored_fluid, const double phase_value_q)
Set a phase_coefficient that is used in the postprocessing, to account for multiphase flow.
void write_temperature_statistics(const std::string &domain_name)
Post-processing. Write the temperature statistics to an output file.
GlobalVectorType evaluation_point
The point at which the evaluation is performed.
void setup_amg()
Set up the AMG preconditioner stored in amg_preconditioner.
std::shared_ptr< Mapping< dim > > temperature_mapping
Transformation which maps point in the reference cell to points in the actual grid cell.
void assemble_rhs()
Call for the assembly of the right-hand side.
void read_checkpoint() override
Allow Heat Transfer to set up solution vector from checkpoint file.
GlobalVectorType newton_update
The direction used to perform the newton iteration in . Where is the size of the step.
void finish_simulation() override
Carry out the operations required to finish a simulation correctly.
std::vector< TableHandler > temperature_isocontour_bounding_values_tables
Vector of tables containing evolution of temperature isocontour bounding values.
void pre_mesh_adaptation() override
Prepare the auxiliary physics variables for a mesh refinement/coarsening.
void postprocess_thermal_energy_in_fluid(const bool gather_cls, const Parameters::FluidIndicator monitored_fluid, const std::string &domain_name, const VectorType ¤t_solution_fd)
std::vector< std::shared_ptr< HeatTransferAssemblerBase< dim > > > assemblers
Assemblers for the matrix and the right hand side (RHS).
void compute_error_estimate(const std::pair< const Variable, Parameters::MultipleAdaptationParameters > &ivar, dealii::Vector< float > &estimated_error_per_cell) override
Compute the error estimator for mesh refinement.
double calculate_delta_T_ref(double minimum_delta_T_ref=1.)
Calculate delta_T_ref for the DCDD shock capture mechanism. delta_T_ref = T_max - T_min.
std::vector< OutputStructTableHandler > gather_tables() override
Returns a vector of references to TableHandler objects that needs to be serialized/deserialized for t...
double get_residual_rescale_metric() const override
Return the metric for residual rescaling. By default, should return 1. If the rescale_residual_by_vol...
void update_boundary_conditions() override
Update non zero constraints if the boundary is time-dependent.
std::shared_ptr< DoFHandler< dim > > dof_handler
Given a triangulation and a description of a finite element, this class enumerates degrees of freedom...
ConvergenceTable error_table
Store some convergence data, such as residuals of the cg-method, or some evaluated L2-errors of discr...
void postprocess(bool first_iteration) override
Postprocess the auxiliary physics results. Post-processing this case implies the calculation of all d...
IndexSet locally_relevant_dofs
Store a subset of the DoF indices that contains both the locally_owned_dofs and the DoF indices on gh...
void assemble_system_matrix() override
Assemble the matrix associated with the solver.
std::vector< HeatFluxPostprocessor< dim > > average_heat_flux_postprocessors
Compute local average heat flux quantities from temperature field and material properties.
std::shared_ptr< GlobalVectorType > present_solution
A vector containing all the values of the solution.
std::shared_ptr< FiniteElement< dim > > fe
The base class for finite element.
void assemble_system_rhs() override
Assemble the rhs associated with the solver.
void setup_dofs() override
Set up the DofHandler and the degrees of freedom associated with the physics.
std::shared_ptr< std::vector< GlobalVectorType > > previous_solutions
Previous solution vector.
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
Collection of cells that cover the domain on which one wants to solve a partial differential equation...
void verify_consistency_of_boundary_conditions()
Verify consistency of the input parameters for boundary conditions to ensure that for every boundary ...
void postprocess_heat_flux_on_bc(const bool gather_cls, const VectorType ¤t_solution_fd)
std::shared_ptr< TrilinosWrappers::PreconditionILU > ilu_preconditioner
ILU preconditioner used by the iterative linear solver.
TableHandler statistics_table
Temperature statistics table used for post-processing. It contains the minimum , maximum,...
AffineConstraints< double > nonzero_constraints
Store the nonzero constraints that arise from several sources such as boundary conditions and hanging...
virtual void copy_local_rhs_to_global_rhs(const StabilizedMethodsCopyData ©_data)
Copy local cell rhs information to global rhs.
void assemble_matrix_and_rhs()
Call for the assembly of the matrix and the right-hand side.
GlobalVectorType system_rhs
The right hand side vector.
void postprocess_heat_flux_on_nitsche_ib()
void set_initial_conditions() override
Set up the initial conditions associated with the physics. heat_transfer allows a temperature functio...
TableHandler melt_volume_alge_table
Liquid fraction in the domain.
Laser parameters - Defines the parameters for the laser heat source.
Class responsible for storing the information calculated using the assembly of stabilized scalar equa...
Vector< double > local_rhs
FullMatrix< double > local_matrix
void reset()
Resets the cell_matrix, cell_rhs, strong_residual and strong_jacobian to zero.
std::vector< types::global_dof_index > local_dof_indices
void serialize_tables_vector(const std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator)
Serializes all the TableHandler objects in table_output_structs.
void announce_string(const ConditionalOStream &pcout, const std::string &expression, const char delimiter='-')
Prints a string and then adds a line above and below made with dashes containing as many dashes as th...
double calculate_point_property(const double phase, const double property0, const double property1)
Calculate the equivalent properties for a given phase. Method called in quadrature points loops in CL...
void deserialize_tables_vector(std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator)
Deserializes all the TableHandler objects in table_output_structs.
DeclExceptionMsg(MeltVolumeRequiresPhaseChange, "Calculation of the melt volume requires that a fluid has at least a 'phase_change' physical property model")
@ temperature
Temperature scalar field from heat transfer.
@ fluid_dynamics
Fluid Dynamics (Velocity,Pressure).
@ electromagnetics
Time-harmonic electromagnetics (Electric field, Magnetic field).
@ heat_transfer
Heat transfer (Temperature).
FluidDynamicsInitialConditionType
FluidIndicator
Class to account for different fluid indicators. This is used for multiphase simulations in PostProce...
double calculate_liquid_fraction(const double &T, const Parameters::PhaseChange &phase_change_parameters)
calculate_liquid_fraction Calculates the liquid fraction of a phase change material at a temperature ...
std::pair< double, double > calculate_L2_error(const DoFHandler< dim > &dof_handler, const VectorType &evaluation_point, const Function< dim > *exact_solution, const Quadrature< dim > &quadrature_formula, const Mapping< dim > &mapping)
Calculates the L2 norm of the error on velocity and pressure.
Struct containing information about the solution output. It is used to pass the information required ...
Struct containing information about the solution output. It is used to pass all the information requi...
@ amg
Algebraic Multigrid.
@ ilu
Incomplete LU Factorization.
GlobalVectorType VectorType
bool is_steady(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is a steady-state method.
bool time_stepping_is_bdf(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the bdf family.
bool time_stepping_is_sdirk(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the sdirk family.
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType
dealii::TrilinosWrappers::MPI::BlockVector GlobalBlockVectorType