NavierStokesOperatorBase< dim, number >.
-Definition at line 1032 of file mf_navier_stokes_operators.cc.
+Definition at line 1053 of file mf_navier_stokes_operators.cc.
References Parameters::Stabilization::gls, and is_bdf().
diff --git a/doxygen/gls__navier__stokes_8cc_source.html b/doxygen/gls__navier__stokes_8cc_source.html
index cb8a88d1fe..c51a6e799f 100644
--- a/doxygen/gls__navier__stokes_8cc_source.html
+++ b/doxygen/gls__navier__stokes_8cc_source.html
@@ -1204,742 +1204,752 @@
-
- 1127 TimerOutput::Scope t(this->computing_timer,
"Set initial conditions");
-
-
-
- 1131 this->pcout <<
"************************" << std::endl;
- 1132 this->pcout <<
"---> Simulation Restart " << std::endl;
- 1133 this->pcout <<
"************************" << std::endl;
-
-
- 1136 else if (initial_condition_type ==
-
-
- 1139 assemble_L2_projection();
- 1140 setup_preconditioner();
-
- 1142 if (this->simulation_parameters.linear_solver
-
-
- 1145 solve_system_GMRES(
true, 1e-15, 1e-15);
-
- 1147 this->present_solution = this->newton_update;
- 1148 this->finish_time_step();
-
-
-
- 1152 this->set_nodal_values();
- 1153 this->finish_time_step();
-
-
-
- 1157 this->set_nodal_values();
- 1158 std::shared_ptr<RheologicalModel> original_viscosity_model =
- 1159 this->simulation_parameters.physical_properties_manager.get_rheology();
-
-
- 1162 std::shared_ptr<Newtonian> temporary_rheology =
- 1163 std::make_shared<Newtonian>(
- 1164 this->simulation_parameters.initial_condition->kinematic_viscosity);
+
+
+ 1128 this->pcout <<
"************************" << std::endl;
+ 1129 this->pcout <<
"---> Simulation Restart " << std::endl;
+ 1130 this->pcout <<
"************************" << std::endl;
+
+
+ 1133 else if (initial_condition_type ==
+
+
+ 1136 assemble_L2_projection();
+ 1137 setup_preconditioner();
+
+ 1139 if (this->simulation_parameters.linear_solver
+
+
+ 1142 solve_system_GMRES(
true, 1e-15, 1e-15);
+
+ 1144 this->present_solution = this->newton_update;
+ 1145 this->finish_time_step();
+
+
+
+ 1149 this->set_nodal_values();
+ 1150 this->finish_time_step();
+
+
+
+ 1154 this->set_nodal_values();
+ 1155 std::shared_ptr<RheologicalModel> original_viscosity_model =
+ 1156 this->simulation_parameters.physical_properties_manager.get_rheology();
+
+
+ 1159 std::shared_ptr<Newtonian> temporary_rheology =
+ 1160 std::make_shared<Newtonian>(
+ 1161 this->simulation_parameters.initial_condition->kinematic_viscosity);
+
+ 1163 this->simulation_parameters.physical_properties_manager.set_rheology(
+ 1164 temporary_rheology);
- 1166 this->simulation_parameters.physical_properties_manager.set_rheology(
- 1167 temporary_rheology);
-
-
- 1170 this->simulation_control->set_assembly_method(
-
-
- 1173 this->finish_time_step();
-
- 1175 this->simulation_parameters.physical_properties_manager.set_rheology(
- 1176 original_viscosity_model);
-
-
-
- 1180 this->pcout <<
"*********************************" << std::endl;
- 1181 this->pcout <<
" Initial condition using ramp " << std::endl;
- 1182 this->pcout <<
"*********************************" << std::endl;
-
- 1184 this->set_nodal_values();
-
-
- 1187 std::shared_ptr<RheologicalModel> viscosity_model =
- 1188 this->simulation_parameters.physical_properties_manager.get_rheology();
-
-
- 1191 const double n_end = viscosity_model->get_n();
- 1192 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
-
-
-
- 1196 this->simulation_parameters.initial_condition->ramp.ramp_n.n_init;
- 1197 const int n_iter_n =
- 1198 this->simulation_parameters.initial_condition->ramp.ramp_n.n_iter;
- 1199 const double alpha_n =
- 1200 this->simulation_parameters.initial_condition->ramp.ramp_n.alpha;
-
-
- 1203 const int n_iter_viscosity =
- 1204 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
-
- 1206 double kinematic_viscosity =
- 1207 n_iter_viscosity > 0 ?
- 1208 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
- 1209 .kinematic_viscosity_init :
-
- 1211 const double alpha_viscosity =
- 1212 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
-
-
- 1215 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
-
-
- 1218 for (
int i = 0; i < n_iter_n; ++i)
-
- 1220 this->pcout << std::setprecision(4)
- 1221 <<
"********* Solution for n = " + std::to_string(n) +
- 1222 " and viscosity = " +
- 1223 std::to_string(kinematic_viscosity) +
" *********"
-
-
- 1226 viscosity_model->set_n(n);
-
- 1228 this->simulation_control->set_assembly_method(
-
-
- 1231 this->finish_time_step();
-
- 1233 n += alpha_n * (n_end - n);
-
-
-
- 1237 viscosity_model->set_n(n_end);
-
-
- 1240 for (
int i = 0; i < n_iter_viscosity; ++i)
-
- 1242 this->pcout << std::setprecision(4)
- 1243 <<
"********* Solution for n = " + std::to_string(n_end) +
- 1244 " and viscosity = " +
- 1245 std::to_string(kinematic_viscosity) +
" *********"
-
-
- 1248 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
-
- 1250 this->simulation_control->set_assembly_method(
-
-
- 1253 this->finish_time_step();
-
- 1255 kinematic_viscosity +=
- 1256 alpha_viscosity * (viscosity_end - kinematic_viscosity);
-
-
-
- 1260 viscosity_model->set_kinematic_viscosity(viscosity_end);
-
-
-
- 1264 throw std::runtime_error(
"GLSNS - Initial condition could not be set");
-
-
-
-
-
-
-
-
- 1273 this->system_rhs = 0;
- 1274 FEValues<dim> fe_values(*this->mapping,
-
- 1276 *this->cell_quadrature,
- 1277 update_values | update_quadrature_points |
-
- 1279 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
- 1280 const unsigned int n_q_points = this->cell_quadrature->size();
- 1281 FullMatrix<double> local_matrix(dofs_per_cell, dofs_per_cell);
- 1282 Vector<double> local_rhs(dofs_per_cell);
- 1283 std::vector<Vector<double>> initial_velocity(n_q_points,
- 1284 Vector<double>(dim + 1));
- 1285 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
- 1286 const FEValuesExtractors::Vector velocities(0);
- 1287 const FEValuesExtractors::Scalar
pressure(dim);
-
- 1289 Tensor<1, dim> rhs_initial_velocity_pressure;
- 1290 double rhs_initial_pressure;
-
- 1292 std::vector<Tensor<1, dim>> phi_u(dofs_per_cell);
- 1293 std::vector<double> phi_p(dofs_per_cell);
-
- 1295 for (
const auto &cell : this->dof_handler.active_cell_iterators())
-
- 1297 if (cell->is_locally_owned())
-
- 1299 fe_values.reinit(cell);
-
-
- 1302 this->simulation_parameters.initial_condition->uvwp.vector_value_list(
- 1303 fe_values.get_quadrature_points(), initial_velocity);
- 1304 for (
unsigned int q = 0; q < n_q_points; ++q)
-
- 1306 for (
unsigned int k = 0; k < dofs_per_cell; ++k)
-
- 1308 phi_p[k] = fe_values[
pressure].value(k, q);
- 1309 phi_u[k] = fe_values[velocities].value(k, q);
-
-
-
- 1313 for (
int i = 0; i < dim; ++i)
-
- 1315 const unsigned int component_i =
- 1316 this->fe->system_to_component_index(i).first;
- 1317 rhs_initial_velocity_pressure[i] =
- 1318 initial_velocity[q](component_i);
-
- 1320 rhs_initial_pressure = initial_velocity[q](dim);
+
+ 1167 this->simulation_control->set_assembly_method(
+
+
+ 1170 this->finish_time_step();
+
+ 1172 this->simulation_parameters.physical_properties_manager.set_rheology(
+ 1173 original_viscosity_model);
+
+
+
+ 1177 this->pcout <<
"*********************************" << std::endl;
+ 1178 this->pcout <<
" Initial condition using ramp " << std::endl;
+ 1179 this->pcout <<
"*********************************" << std::endl;
+
+ 1181 Timer timer(this->mpi_communicator);
+
+ 1183 this->set_nodal_values();
+
+
+ 1186 std::shared_ptr<RheologicalModel> viscosity_model =
+ 1187 this->simulation_parameters.physical_properties_manager.get_rheology();
+
+
+ 1190 const double n_end = viscosity_model->get_n();
+ 1191 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
+
+
+
+ 1195 this->simulation_parameters.initial_condition->ramp.ramp_n.n_init;
+ 1196 const int n_iter_n =
+ 1197 this->simulation_parameters.initial_condition->ramp.ramp_n.n_iter;
+ 1198 const double alpha_n =
+ 1199 this->simulation_parameters.initial_condition->ramp.ramp_n.alpha;
+
+
+ 1202 const int n_iter_viscosity =
+ 1203 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+
+ 1205 double kinematic_viscosity =
+ 1206 n_iter_viscosity > 0 ?
+ 1207 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+ 1208 .kinematic_viscosity_init :
+
+ 1210 const double alpha_viscosity =
+ 1211 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+
+
+ 1214 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
+
+
+ 1217 for (
int i = 0; i < n_iter_n; ++i)
+
+ 1219 this->pcout << std::setprecision(4)
+ 1220 <<
"********* Solution for n = " + std::to_string(n) +
+ 1221 " and viscosity = " +
+ 1222 std::to_string(kinematic_viscosity) +
" *********"
+
+
+ 1225 viscosity_model->set_n(n);
+
+ 1227 this->simulation_control->set_assembly_method(
+
+
+ 1230 this->finish_time_step();
+
+ 1232 n += alpha_n * (n_end - n);
+
+
+
+ 1236 viscosity_model->set_n(n_end);
+
+
+ 1239 for (
int i = 0; i < n_iter_viscosity; ++i)
+
+ 1241 this->pcout << std::setprecision(4)
+ 1242 <<
"********* Solution for n = " + std::to_string(n_end) +
+ 1243 " and viscosity = " +
+ 1244 std::to_string(kinematic_viscosity) +
" *********"
+
+
+ 1247 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
+
+ 1249 this->simulation_control->set_assembly_method(
+
+
+ 1252 this->finish_time_step();
+
+ 1254 kinematic_viscosity +=
+ 1255 alpha_viscosity * (viscosity_end - kinematic_viscosity);
+
+
+
+ 1259 viscosity_model->set_kinematic_viscosity(viscosity_end);
+
+
+
+ 1263 if (this->simulation_parameters.timer.type !=
+
+
+ 1266 this->pcout <<
"*********************************" << std::endl;
+ 1267 this->pcout <<
" Time spent in ramp: " << timer.wall_time() <<
"s"
+
+ 1269 this->pcout <<
"*********************************" << std::endl;
+
+
+
+
+ 1274 throw std::runtime_error(
"GLSNS - Initial condition could not be set");
+
+
+
+
+
+
+
+
+ 1283 this->system_rhs = 0;
+ 1284 FEValues<dim> fe_values(*this->mapping,
+
+ 1286 *this->cell_quadrature,
+ 1287 update_values | update_quadrature_points |
+
+ 1289 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
+ 1290 const unsigned int n_q_points = this->cell_quadrature->size();
+ 1291 FullMatrix<double> local_matrix(dofs_per_cell, dofs_per_cell);
+ 1292 Vector<double> local_rhs(dofs_per_cell);
+ 1293 std::vector<Vector<double>> initial_velocity(n_q_points,
+ 1294 Vector<double>(dim + 1));
+ 1295 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
+ 1296 const FEValuesExtractors::Vector velocities(0);
+ 1297 const FEValuesExtractors::Scalar
pressure(dim);
+
+ 1299 Tensor<1, dim> rhs_initial_velocity_pressure;
+ 1300 double rhs_initial_pressure;
+
+ 1302 std::vector<Tensor<1, dim>> phi_u(dofs_per_cell);
+ 1303 std::vector<double> phi_p(dofs_per_cell);
+
+ 1305 for (
const auto &cell : this->dof_handler.active_cell_iterators())
+
+ 1307 if (cell->is_locally_owned())
+
+ 1309 fe_values.reinit(cell);
+
+
+ 1312 this->simulation_parameters.initial_condition->uvwp.vector_value_list(
+ 1313 fe_values.get_quadrature_points(), initial_velocity);
+ 1314 for (
unsigned int q = 0; q < n_q_points; ++q)
+
+ 1316 for (
unsigned int k = 0; k < dofs_per_cell; ++k)
+
+ 1318 phi_p[k] = fe_values[
pressure].value(k, q);
+ 1319 phi_u[k] = fe_values[velocities].value(k, q);
+
- 1322 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
-
-
- 1325 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
-
- 1327 local_matrix(i, j) +=
- 1328 (phi_u[j] * phi_u[i]) * fe_values.JxW(q);
- 1329 local_matrix(i, j) +=
- 1330 (phi_p[j] * phi_p[i]) * fe_values.JxW(q);
-
- 1332 local_rhs(i) += (phi_u[i] * rhs_initial_velocity_pressure +
- 1333 phi_p[i] * rhs_initial_pressure) *
-
-
-
-
- 1338 cell->get_dof_indices(local_dof_indices);
- 1339 this->nonzero_constraints.distribute_local_to_global(
-
-
-
-
-
-
-
- 1347 system_matrix.compress(VectorOperation::add);
- 1348 this->system_rhs.compress(VectorOperation::add);
-
-
-
-
-
-
-
- 1356 const double absolute_residual =
-
-
- 1359 const double relative_residual =
-
-
-
-
-
- 1365 solve_system_GMRES(initial_step, absolute_residual, relative_residual);
- 1366 else if (this->simulation_parameters.linear_solver
-
-
- 1369 solve_system_BiCGStab(initial_step, absolute_residual, relative_residual);
- 1370 else if (this->simulation_parameters.linear_solver
-
-
- 1373 solve_system_direct(initial_step, absolute_residual, relative_residual);
-
-
-
-
-
-
-
-
-
- 1383 "This linear solver is not supported. Only <gmres>, <bicgstab> and <direct> linear solvers are supported."));
-
- 1385 this->rescale_pressure_dofs_in_newton_update();
-
-
-
-
-
-
-
-
-
- 1395 else if (this->simulation_parameters.linear_solver
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1409 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
-
-
-
-
-
-
-
- 1417 TimerOutput::Scope t(this->computing_timer,
"Setup ILU");
-
- 1419 const double ilu_atol =
-
-
- 1422 const double ilu_rtol =
-
-
- 1425 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
- 1426 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
-
- 1428 ilu_preconditioner = std::make_shared<TrilinosWrappers::PreconditionILU>();
-
- 1430 ilu_preconditioner->initialize(system_matrix, preconditionerOptions);
-
-
-
-
-
-
- 1437 TimerOutput::Scope t(this->computing_timer,
"setup_AMG");
-
-
- 1440 std::vector<std::vector<bool>> constant_modes;
-
-
- 1443 ComponentMask components(dim + 1,
true);
- 1444 DoFTools::extract_constant_modes(this->dof_handler,
-
-
-
- 1448 const bool elliptic =
false;
- 1449 bool higher_order_elements =
false;
- 1450 if (this->velocity_fem_degree > 1)
- 1451 higher_order_elements =
true;
- 1452 const unsigned int n_cycles =
-
-
- 1455 const bool w_cycle =
-
-
- 1458 const double aggregation_threshold =
-
- 1460 .amg_aggregation_threshold;
- 1461 const unsigned int smoother_sweeps =
-
- 1463 .amg_smoother_sweeps;
- 1464 const unsigned int smoother_overlap =
-
- 1466 .amg_smoother_overlap;
- 1467 const bool output_details =
false;
- 1468 const char *smoother_type =
"ILU";
- 1469 const char *coarse_type =
"ILU";
- 1470 TrilinosWrappers::PreconditionAMG::AdditionalData preconditionerOptions(
-
- 1472 higher_order_elements,
-
-
- 1475 aggregation_threshold,
-
-
-
-
-
-
-
- 1483 Teuchos::ParameterList parameter_ml;
- 1484 std::unique_ptr<Epetra_MultiVector> distributed_constant_modes;
- 1485 preconditionerOptions.set_parameters(parameter_ml,
- 1486 distributed_constant_modes,
-
- 1488 const double ilu_fill = current_preconditioner_fill_level;
- 1489 const double ilu_atol =
-
- 1491 .amg_precond_ilu_atol;
- 1492 const double ilu_rtol =
-
- 1494 .amg_precond_ilu_rtol;
- 1495 parameter_ml.set(
"smoother: ifpack level-of-fill", ilu_fill);
- 1496 parameter_ml.set(
"smoother: ifpack absolute threshold", ilu_atol);
- 1497 parameter_ml.set(
"smoother: ifpack relative threshold", ilu_rtol);
-
- 1499 parameter_ml.set(
"coarse: ifpack level-of-fill", ilu_fill);
- 1500 parameter_ml.set(
"coarse: ifpack absolute threshold", ilu_atol);
- 1501 parameter_ml.set(
"coarse: ifpack relative threshold", ilu_rtol);
- 1502 amg_preconditioner = std::make_shared<TrilinosWrappers::PreconditionAMG>();
- 1503 amg_preconditioner->initialize(system_matrix, parameter_ml);
-
-
-
-
-
- 1509 const double absolute_residual,
- 1510 const double relative_residual)
-
- 1512 const unsigned int max_iter = 3;
- 1513 unsigned int iter = 0;
- 1514 bool success =
false;
+
+ 1323 for (
int i = 0; i < dim; ++i)
+
+ 1325 const unsigned int component_i =
+ 1326 this->fe->system_to_component_index(i).first;
+ 1327 rhs_initial_velocity_pressure[i] =
+ 1328 initial_velocity[q](component_i);
+
+ 1330 rhs_initial_pressure = initial_velocity[q](dim);
+
+ 1332 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
+
+
+ 1335 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
+
+ 1337 local_matrix(i, j) +=
+ 1338 (phi_u[j] * phi_u[i]) * fe_values.JxW(q);
+ 1339 local_matrix(i, j) +=
+ 1340 (phi_p[j] * phi_p[i]) * fe_values.JxW(q);
+
+ 1342 local_rhs(i) += (phi_u[i] * rhs_initial_velocity_pressure +
+ 1343 phi_p[i] * rhs_initial_pressure) *
+
+
+
+
+ 1348 cell->get_dof_indices(local_dof_indices);
+ 1349 this->nonzero_constraints.distribute_local_to_global(
+
+
+
+
+
+
+
+ 1357 system_matrix.compress(VectorOperation::add);
+ 1358 this->system_rhs.compress(VectorOperation::add);
+
+
+
+
+
+
+
+ 1366 const double absolute_residual =
+
+
+ 1369 const double relative_residual =
+
+
+
+
+
+ 1375 solve_system_GMRES(initial_step, absolute_residual, relative_residual);
+ 1376 else if (this->simulation_parameters.linear_solver
+
+
+ 1379 solve_system_BiCGStab(initial_step, absolute_residual, relative_residual);
+ 1380 else if (this->simulation_parameters.linear_solver
+
+
+ 1383 solve_system_direct(initial_step, absolute_residual, relative_residual);
+
+
+
+
+
+
+
+
+
+ 1393 "This linear solver is not supported. Only <gmres>, <bicgstab> and <direct> linear solvers are supported."));
+
+ 1395 this->rescale_pressure_dofs_in_newton_update();
+
+
+
+
+
+
+
+
+
+ 1405 else if (this->simulation_parameters.linear_solver
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1419 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
+
+
+
+
+
+
+
+ 1427 TimerOutput::Scope t(this->computing_timer,
"Setup ILU");
+
+ 1429 const double ilu_atol =
+
+
+ 1432 const double ilu_rtol =
+
+
+ 1435 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
+ 1436 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
+
+ 1438 ilu_preconditioner = std::make_shared<TrilinosWrappers::PreconditionILU>();
+
+ 1440 ilu_preconditioner->initialize(system_matrix, preconditionerOptions);
+
+
+
+
+
+
+ 1447 TimerOutput::Scope t(this->computing_timer,
"setup_AMG");
+
+
+ 1450 std::vector<std::vector<bool>> constant_modes;
+
+
+ 1453 ComponentMask components(dim + 1,
true);
+ 1454 DoFTools::extract_constant_modes(this->dof_handler,
+
+
+
+ 1458 const bool elliptic =
false;
+ 1459 bool higher_order_elements =
false;
+ 1460 if (this->velocity_fem_degree > 1)
+ 1461 higher_order_elements =
true;
+ 1462 const unsigned int n_cycles =
+
+
+ 1465 const bool w_cycle =
+
+
+ 1468 const double aggregation_threshold =
+
+ 1470 .amg_aggregation_threshold;
+ 1471 const unsigned int smoother_sweeps =
+
+ 1473 .amg_smoother_sweeps;
+ 1474 const unsigned int smoother_overlap =
+
+ 1476 .amg_smoother_overlap;
+ 1477 const bool output_details =
false;
+ 1478 const char *smoother_type =
"ILU";
+ 1479 const char *coarse_type =
"ILU";
+ 1480 TrilinosWrappers::PreconditionAMG::AdditionalData preconditionerOptions(
+
+ 1482 higher_order_elements,
+
+
+ 1485 aggregation_threshold,
+
+
+
+
+
+
+
+ 1493 Teuchos::ParameterList parameter_ml;
+ 1494 std::unique_ptr<Epetra_MultiVector> distributed_constant_modes;
+ 1495 preconditionerOptions.set_parameters(parameter_ml,
+ 1496 distributed_constant_modes,
+
+ 1498 const double ilu_fill = current_preconditioner_fill_level;
+ 1499 const double ilu_atol =
+
+ 1501 .amg_precond_ilu_atol;
+ 1502 const double ilu_rtol =
+
+ 1504 .amg_precond_ilu_rtol;
+ 1505 parameter_ml.set(
"smoother: ifpack level-of-fill", ilu_fill);
+ 1506 parameter_ml.set(
"smoother: ifpack absolute threshold", ilu_atol);
+ 1507 parameter_ml.set(
"smoother: ifpack relative threshold", ilu_rtol);
+
+ 1509 parameter_ml.set(
"coarse: ifpack level-of-fill", ilu_fill);
+ 1510 parameter_ml.set(
"coarse: ifpack absolute threshold", ilu_atol);
+ 1511 parameter_ml.set(
"coarse: ifpack relative threshold", ilu_rtol);
+ 1512 amg_preconditioner = std::make_shared<TrilinosWrappers::PreconditionAMG>();
+ 1513 amg_preconditioner->initialize(system_matrix, parameter_ml);
+
-
- 1517 auto &system_rhs = this->system_rhs;
- 1518 auto &nonzero_constraints = this->nonzero_constraints;
-
- 1520 const AffineConstraints<double> &zero_constraints_used =
- 1521 (!this->simulation_parameters.constrain_solid_domain.enable) ?
- 1522 this->zero_constraints :
- 1523 this->dynamic_zero_constraints;
-
- 1525 const AffineConstraints<double> &constraints_used =
- 1526 initial_step ? nonzero_constraints : zero_constraints_used;
-
- 1528 const double linear_solver_tolerance =
- 1529 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
-
-
-
-
- 1534 this->pcout <<
" -Tolerance of iterative solver is : "
- 1535 << linear_solver_tolerance << std::endl;
-
-
- 1538 this->mpi_communicator);
-
- 1540 SolverControl solver_control(this->simulation_parameters.linear_solver
-
-
- 1543 linear_solver_tolerance,
-
-
- 1546 bool extra_verbose =
false;
-
-
- 1549 extra_verbose =
true;
-
- 1551 TrilinosWrappers::SolverGMRES::AdditionalData solver_parameters(
-
-
- 1554 .max_krylov_vectors);
-
-
-
-
-
-
-
- 1562 while (success ==
false and iter < max_iter)
-
-
-
- 1566 if (!ilu_preconditioner && !amg_preconditioner)
- 1567 setup_preconditioner();
-
- 1569 TrilinosWrappers::SolverGMRES solver(solver_control,
-
-
-
- 1573 TimerOutput::Scope t(this->computing_timer,
"Solve linear system");
-
- 1575 if (this->simulation_parameters.linear_solver
-
-
-
- 1579 solver.solve(system_matrix,
- 1580 completely_distributed_solution,
-
- 1582 *ilu_preconditioner);
- 1583 else if (this->simulation_parameters.linear_solver
-
-
-
- 1587 solver.solve(system_matrix,
- 1588 completely_distributed_solution,
-
- 1590 *amg_preconditioner);
-
-
- 1593 this->simulation_parameters.linear_solver
-
-
-
- 1597 this->simulation_parameters.linear_solver
-
-
-
-
- 1602 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
-
- 1604 if (this->simulation_parameters.linear_solver
-
-
-
-
- 1609 <<
" -Iterative solver took : " << solver_control.last_step()
- 1610 <<
" steps to reach a residual norm of "
- 1611 << solver_control.last_value() << std::endl;
-
-
-
- 1615 this->computing_timer.enter_subsection(
- 1616 "Distribute constraints after linear solve");
-
- 1618 constraints_used.distribute(completely_distributed_solution);
-
- 1620 this->computing_timer.leave_subsection(
- 1621 "Distribute constraints after linear solve");
-
- 1623 auto &newton_update = this->newton_update;
- 1624 newton_update = completely_distributed_solution;
-
-
- 1627 catch (std::exception &e)
-
- 1629 current_preconditioner_fill_level += 1;
-
- 1631 <<
" GMRES solver failed! Trying with a higher preconditioner fill level. New fill = "
- 1632 << current_preconditioner_fill_level << std::endl;
- 1633 setup_preconditioner();
-
- 1635 if (iter == max_iter - 1 && !this->simulation_parameters.linear_solver
-
- 1637 .force_linear_solver_continuation)
-
-
-
-
- 1642 current_preconditioner_fill_level = initial_preconditioner_fill_level;
-
+
+
+
+ 1519 const double absolute_residual,
+ 1520 const double relative_residual)
+
+ 1522 const unsigned int max_iter = 3;
+ 1523 unsigned int iter = 0;
+ 1524 bool success =
false;
+
+
+ 1527 auto &system_rhs = this->system_rhs;
+ 1528 auto &nonzero_constraints = this->nonzero_constraints;
+
+ 1530 const AffineConstraints<double> &zero_constraints_used =
+ 1531 (!this->simulation_parameters.constrain_solid_domain.enable) ?
+ 1532 this->zero_constraints :
+ 1533 this->dynamic_zero_constraints;
+
+ 1535 const AffineConstraints<double> &constraints_used =
+ 1536 initial_step ? nonzero_constraints : zero_constraints_used;
+
+ 1538 const double linear_solver_tolerance =
+ 1539 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
+
+
+
+
+ 1544 this->pcout <<
" -Tolerance of iterative solver is : "
+ 1545 << linear_solver_tolerance << std::endl;
+
+
+ 1548 this->mpi_communicator);
+
+ 1550 SolverControl solver_control(this->simulation_parameters.linear_solver
+
+
+ 1553 linear_solver_tolerance,
+
+
+ 1556 bool extra_verbose =
false;
+
+
+ 1559 extra_verbose =
true;
+
+ 1561 TrilinosWrappers::SolverGMRES::AdditionalData solver_parameters(
+
+
+ 1564 .max_krylov_vectors);
+
+
+
+
+
+
+
+ 1572 while (success ==
false and iter < max_iter)
+
+
+
+ 1576 if (!ilu_preconditioner && !amg_preconditioner)
+ 1577 setup_preconditioner();
+
+ 1579 TrilinosWrappers::SolverGMRES solver(solver_control,
+
+
+
+ 1583 TimerOutput::Scope t(this->computing_timer,
"Solve linear system");
+
+ 1585 if (this->simulation_parameters.linear_solver
+
+
+
+ 1589 solver.solve(system_matrix,
+ 1590 completely_distributed_solution,
+
+ 1592 *ilu_preconditioner);
+ 1593 else if (this->simulation_parameters.linear_solver
+
+
+
+ 1597 solver.solve(system_matrix,
+ 1598 completely_distributed_solution,
+
+ 1600 *amg_preconditioner);
+
+
+ 1603 this->simulation_parameters.linear_solver
+
+
+
+ 1607 this->simulation_parameters.linear_solver
+
+
+
+
+ 1612 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
+
+ 1614 if (this->simulation_parameters.linear_solver
+
+
+
+
+ 1619 <<
" -Iterative solver took : " << solver_control.last_step()
+ 1620 <<
" steps to reach a residual norm of "
+ 1621 << solver_control.last_value() << std::endl;
+
+
+
+ 1625 this->computing_timer.enter_subsection(
+ 1626 "Distribute constraints after linear solve");
+
+ 1628 constraints_used.distribute(completely_distributed_solution);
+
+ 1630 this->computing_timer.leave_subsection(
+ 1631 "Distribute constraints after linear solve");
+
+ 1633 auto &newton_update = this->newton_update;
+ 1634 newton_update = completely_distributed_solution;
+
+
+ 1637 catch (std::exception &e)
+
+ 1639 current_preconditioner_fill_level += 1;
+
+ 1641 <<
" GMRES solver failed! Trying with a higher preconditioner fill level. New fill = "
+ 1642 << current_preconditioner_fill_level << std::endl;
+ 1643 setup_preconditioner();
-
-
-
-
-
-
-
-
- 1653 const bool initial_step,
- 1654 const double absolute_residual,
- 1655 const double relative_residual)
-
- 1657 TimerOutput::Scope t(this->computing_timer,
"solve");
- 1658 const unsigned int max_iter = 3;
- 1659 unsigned int iter = 0;
- 1660 bool success =
false;
-
-
- 1663 auto &system_rhs = this->system_rhs;
- 1664 auto &nonzero_constraints = this->nonzero_constraints;
-
- 1666 const AffineConstraints<double> &zero_constraints_used =
- 1667 (!this->simulation_parameters.constrain_solid_domain.enable) ?
- 1668 this->zero_constraints :
- 1669 this->dynamic_zero_constraints;
-
- 1671 const AffineConstraints<double> &constraints_used =
- 1672 initial_step ? nonzero_constraints : zero_constraints_used;
- 1673 const double linear_solver_tolerance =
- 1674 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
-
-
-
- 1678 this->pcout <<
" -Tolerance of iterative solver is : "
- 1679 << linear_solver_tolerance << std::endl;
-
-
- 1682 this->mpi_communicator);
-
- 1684 bool extra_verbose =
false;
+ 1645 if (iter == max_iter - 1 && !this->simulation_parameters.linear_solver
+
+ 1647 .force_linear_solver_continuation)
+
+
+
+
+ 1652 current_preconditioner_fill_level = initial_preconditioner_fill_level;
+
+
+
+
+
+
+
+
+
+
+ 1663 const bool initial_step,
+ 1664 const double absolute_residual,
+ 1665 const double relative_residual)
+
+ 1667 TimerOutput::Scope t(this->computing_timer,
"solve");
+ 1668 const unsigned int max_iter = 3;
+ 1669 unsigned int iter = 0;
+ 1670 bool success =
false;
+
+
+ 1673 auto &system_rhs = this->system_rhs;
+ 1674 auto &nonzero_constraints = this->nonzero_constraints;
+
+ 1676 const AffineConstraints<double> &zero_constraints_used =
+ 1677 (!this->simulation_parameters.constrain_solid_domain.enable) ?
+ 1678 this->zero_constraints :
+ 1679 this->dynamic_zero_constraints;
+
+ 1681 const AffineConstraints<double> &constraints_used =
+ 1682 initial_step ? nonzero_constraints : zero_constraints_used;
+ 1683 const double linear_solver_tolerance =
+ 1684 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
-
- 1687 extra_verbose =
true;
- 1688 TrilinosWrappers::SolverBicgstab::AdditionalData solver_parameters(
-
-
- 1691 SolverControl solver_control(this->simulation_parameters.linear_solver
-
-
- 1694 linear_solver_tolerance,
-
-
- 1697 TrilinosWrappers::SolverBicgstab solver(solver_control, solver_parameters);
- 1698 while (success ==
false and iter < max_iter)
-
-
-
- 1702 if (!ilu_preconditioner)
- 1703 setup_preconditioner();
-
-
- 1706 TimerOutput::Scope t(this->computing_timer,
"Solve linear system");
-
- 1708 if (this->simulation_parameters.linear_solver
-
-
-
- 1712 solver.solve(system_matrix,
- 1713 completely_distributed_solution,
-
- 1715 *ilu_preconditioner);
-
-
- 1718 this->simulation_parameters.linear_solver
-
-
-
-
- 1723 "This linear solver does not support this preconditioner. Only <ilu> preconditioner is supported."));
-
- 1725 if (this->simulation_parameters.linear_solver
-
-
-
-
- 1730 <<
" -Iterative solver took : " << solver_control.last_step()
- 1731 <<
" steps to reach a residual norm of "
- 1732 << solver_control.last_value() << std::endl;
-
- 1734 constraints_used.distribute(completely_distributed_solution);
- 1735 this->newton_update = completely_distributed_solution;
-
-
-
- 1739 catch (std::exception &e)
-
- 1741 current_preconditioner_fill_level += 1;
-
- 1743 <<
" BiCGStab solver failed! Trying with a higher preconditioner fill level. New fill = "
- 1744 << current_preconditioner_fill_level << std::endl;
- 1745 setup_preconditioner();
-
- 1747 if (iter == max_iter - 1 && !this->simulation_parameters.linear_solver
-
- 1749 .force_linear_solver_continuation)
-
-
-
-
- 1754 current_preconditioner_fill_level = initial_preconditioner_fill_level;
-
+
+
+ 1688 this->pcout <<
" -Tolerance of iterative solver is : "
+ 1689 << linear_solver_tolerance << std::endl;
+
+
+ 1692 this->mpi_communicator);
+
+ 1694 bool extra_verbose =
false;
+
+
+ 1697 extra_verbose =
true;
+ 1698 TrilinosWrappers::SolverBicgstab::AdditionalData solver_parameters(
+
+
+ 1701 SolverControl solver_control(this->simulation_parameters.linear_solver
+
+
+ 1704 linear_solver_tolerance,
+
+
+ 1707 TrilinosWrappers::SolverBicgstab solver(solver_control, solver_parameters);
+ 1708 while (success ==
false and iter < max_iter)
+
+
+
+ 1712 if (!ilu_preconditioner)
+ 1713 setup_preconditioner();
+
+
+ 1716 TimerOutput::Scope t(this->computing_timer,
"Solve linear system");
+
+ 1718 if (this->simulation_parameters.linear_solver
+
+
+
+ 1722 solver.solve(system_matrix,
+ 1723 completely_distributed_solution,
+
+ 1725 *ilu_preconditioner);
+
+
+ 1728 this->simulation_parameters.linear_solver
+
+
+
+
+ 1733 "This linear solver does not support this preconditioner. Only <ilu> preconditioner is supported."));
+
+ 1735 if (this->simulation_parameters.linear_solver
+
+
+
+
+ 1740 <<
" -Iterative solver took : " << solver_control.last_step()
+ 1741 <<
" steps to reach a residual norm of "
+ 1742 << solver_control.last_value() << std::endl;
+
+ 1744 constraints_used.distribute(completely_distributed_solution);
+ 1745 this->newton_update = completely_distributed_solution;
+
+
+
+ 1749 catch (std::exception &e)
+
+ 1751 current_preconditioner_fill_level += 1;
+
+ 1753 <<
" BiCGStab solver failed! Trying with a higher preconditioner fill level. New fill = "
+ 1754 << current_preconditioner_fill_level << std::endl;
+ 1755 setup_preconditioner();
-
-
-
- 1760 const double absolute_residual,
- 1761 const double relative_residual)
-
- 1763 auto &system_rhs = this->system_rhs;
- 1764 auto &nonzero_constraints = this->nonzero_constraints;
-
- 1766 const AffineConstraints<double> &zero_constraints_used =
- 1767 (!this->simulation_parameters.constrain_solid_domain.enable) ?
- 1768 this->zero_constraints :
- 1769 this->dynamic_zero_constraints;
-
- 1771 const AffineConstraints<double> &constraints_used =
- 1772 initial_step ? nonzero_constraints : zero_constraints_used;
- 1773 const double linear_solver_tolerance =
- 1774 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
+ 1757 if (iter == max_iter - 1 && !this->simulation_parameters.linear_solver
+
+ 1759 .force_linear_solver_continuation)
+
+
+
+
+ 1764 current_preconditioner_fill_level = initial_preconditioner_fill_level;
+
+
+
+
+
+ 1770 const double absolute_residual,
+ 1771 const double relative_residual)
+
+ 1773 auto &system_rhs = this->system_rhs;
+ 1774 auto &nonzero_constraints = this->nonzero_constraints;
-
- 1777 this->mpi_communicator);
-
- 1779 SolverControl solver_control(this->simulation_parameters.linear_solver
-
-
- 1782 linear_solver_tolerance,
-
-
- 1785 TrilinosWrappers::SolverDirect solver(solver_control);
-
- 1787 solver.initialize(system_matrix);
- 1788 solver.solve(completely_distributed_solution, system_rhs);
- 1789 constraints_used.distribute(completely_distributed_solution);
- 1790 auto &newton_update = this->newton_update;
- 1791 newton_update = completely_distributed_solution;
-
-
-
-
-
-
- 1798 this->computing_timer.enter_subsection(
"Read mesh and manifolds");
-
-
- 1801 *this->triangulation,
- 1802 this->simulation_parameters.mesh,
- 1803 this->simulation_parameters.manifolds_parameters,
- 1804 this->simulation_parameters.restart_parameters.restart,
- 1805 this->simulation_parameters.boundary_conditions);
-
- 1807 this->computing_timer.leave_subsection(
"Read mesh and manifolds");
-
-
- 1810 this->enable_dynamic_zero_constraints_fd();
- 1811 this->box_refine_mesh(this->simulation_parameters.restart_parameters.restart);
- 1812 this->set_initial_condition(
- 1813 this->simulation_parameters.initial_condition->type,
- 1814 this->simulation_parameters.restart_parameters.restart);
- 1815 this->update_multiphysics_time_average_solution();
+ 1776 const AffineConstraints<double> &zero_constraints_used =
+ 1777 (!this->simulation_parameters.constrain_solid_domain.enable) ?
+ 1778 this->zero_constraints :
+ 1779 this->dynamic_zero_constraints;
+
+ 1781 const AffineConstraints<double> &constraints_used =
+ 1782 initial_step ? nonzero_constraints : zero_constraints_used;
+ 1783 const double linear_solver_tolerance =
+ 1784 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
+
+
+ 1787 this->mpi_communicator);
+
+ 1789 SolverControl solver_control(this->simulation_parameters.linear_solver
+
+
+ 1792 linear_solver_tolerance,
+
+
+ 1795 TrilinosWrappers::SolverDirect solver(solver_control);
+
+ 1797 solver.initialize(system_matrix);
+ 1798 solver.solve(completely_distributed_solution, system_rhs);
+ 1799 constraints_used.distribute(completely_distributed_solution);
+ 1800 auto &newton_update = this->newton_update;
+ 1801 newton_update = completely_distributed_solution;
+
+
+
+
+
+
+ 1808 this->computing_timer.enter_subsection(
"Read mesh and manifolds");
+
+
+ 1811 *this->triangulation,
+ 1812 this->simulation_parameters.mesh,
+ 1813 this->simulation_parameters.manifolds_parameters,
+ 1814 this->simulation_parameters.restart_parameters.restart,
+ 1815 this->simulation_parameters.boundary_conditions);
- 1817 while (this->simulation_control->integrate())
-
- 1819 this->forcing_function->set_time(
- 1820 this->simulation_control->get_current_time());
-
- 1822 bool refinement_step;
- 1823 if (this->simulation_parameters.mesh_adaptation.refinement_at_frequency)
-
- 1825 this->simulation_control->get_step_number() %
- 1826 this->simulation_parameters.mesh_adaptation.frequency !=
-
-
- 1829 refinement_step = this->simulation_control->get_step_number() == 0;
- 1830 if (refinement_step ||
- 1831 this->simulation_parameters.mesh_adaptation.type ==
-
- 1833 this->simulation_control->is_at_start())
-
-
-
- 1837 this->update_boundary_conditions();
- 1838 this->multiphysics->update_boundary_conditions();
-
-
- 1841 this->simulation_control->print_progression(this->pcout);
- 1842 this->dynamic_flow_control();
-
- 1844 if (!this->simulation_control->is_at_start())
-
-
- 1847 this->define_dynamic_zero_constraints();
-
- 1849 this->postprocess(
false);
- 1850 this->finish_time_step();
-
-
+ 1817 this->computing_timer.leave_subsection(
"Read mesh and manifolds");
+
+
+ 1820 this->enable_dynamic_zero_constraints_fd();
+ 1821 this->box_refine_mesh(this->simulation_parameters.restart_parameters.restart);
+ 1822 this->set_initial_condition(
+ 1823 this->simulation_parameters.initial_condition->type,
+ 1824 this->simulation_parameters.restart_parameters.restart);
+ 1825 this->update_multiphysics_time_average_solution();
+
+ 1827 while (this->simulation_control->integrate())
+
+ 1829 this->forcing_function->set_time(
+ 1830 this->simulation_control->get_current_time());
+
+ 1832 bool refinement_step;
+ 1833 if (this->simulation_parameters.mesh_adaptation.refinement_at_frequency)
+
+ 1835 this->simulation_control->get_step_number() %
+ 1836 this->simulation_parameters.mesh_adaptation.frequency !=
+
+
+ 1839 refinement_step = this->simulation_control->get_step_number() == 0;
+ 1840 if (refinement_step ||
+ 1841 this->simulation_parameters.mesh_adaptation.type ==
+
+ 1843 this->simulation_control->is_at_start())
+
+
+
+ 1847 this->update_boundary_conditions();
+ 1848 this->multiphysics->update_boundary_conditions();
+
+
+ 1851 this->simulation_control->print_progression(this->pcout);
+ 1852 this->dynamic_flow_control();
- 1854 this->finish_simulation();
-
+ 1854 if (!this->simulation_control->is_at_start())
+
-
-
-
-
-
+ 1857 this->define_dynamic_zero_constraints();
+
+ 1859 this->postprocess(
false);
+ 1860 this->finish_time_step();
+
+
+
+ 1864 this->finish_simulation();
+
+
+
+
+
+
+
Class that assembles the transient time arising from BDF time integration for the isothermal compress...
Class that assembles the core of the isothermal compressible Navier-Stokes equations....
@@ -1955,28 +1965,28 @@
virtual void setup_dofs_fd() override
setup_dofs_fd Setup the degree of freedom, system matrix and solution vectors Navier-Stokes problem
virtual void copy_local_rhs_to_global_rhs(const StabilizedMethodsTensorCopyData< dim > ©_data)
Copy local cell rhs information to global rhs.
-void assemble_L2_projection()
Assembles an L2_projection matrix for the velocity and the pressure. This L2 projection matrix can be...
+void assemble_L2_projection()
Assembles an L2_projection matrix for the velocity and the pressure. This L2 projection matrix can be...
void update_boundary_conditions()
update non zero constraint if the boundary is time-dependent
-void solve_system_GMRES(const bool initial_step, const double absolute_residual, const double relative_residual)
GMRES solver with ILU(N) preconditioning or AMG preconditioning.
+void solve_system_GMRES(const bool initial_step, const double absolute_residual, const double relative_residual)
GMRES solver with ILU(N) preconditioning or AMG preconditioning.
virtual void assemble_system_rhs() override
Assemble the rhs associated with the solver.
-void solve_linear_system(const bool initial_step, const bool renewed_matrix=true) override
Call for the assembly of the linear system of equation.
+void solve_linear_system(const bool initial_step, const bool renewed_matrix=true) override
Call for the assembly of the linear system of equation.
void define_dynamic_zero_constraints()
Define the zero constraints used to solved the problem that change with other physics' solutions.
virtual void copy_local_matrix_to_global_matrix(const StabilizedMethodsTensorCopyData< dim > ©_data)
Copy local cell information to global matrix.
-void setup_AMG()
Set-up AMG preconditioner.
-virtual void solve()
solve Solves the Navier-Stokes problem
+void setup_AMG()
Set-up AMG preconditioner.
+virtual void solve()
solve Solves the Navier-Stokes problem
void define_non_zero_constraints()
Define the non-zero constraints used to solve the problem.
virtual void assemble_system_matrix() override
Assembles the matrix associated with the solver.
int initial_preconditioner_fill_level
virtual void update_multiphysics_time_average_solution() override
Updates the average velocity field solution in the multiphyscics interface.
virtual void assemble_local_system_matrix(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > ©_data)
Assemble the local matrix for a given cell.
-void setup_preconditioner() override
Set-up the appropriate preconditioner.
+void setup_preconditioner() override
Set-up the appropriate preconditioner.
void define_zero_constraints()
Define the zero constraints used to solve the problem.
virtual void setup_assemblers()
sets up the vector of assembler functions
-void setup_ILU()
Set-up ILU preconditioner.
+void setup_ILU()
Set-up ILU preconditioner.
virtual void assemble_local_system_rhs(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > ©_data)
Assemble the local rhs for a given cell.
-void solve_system_direct(const bool initial_step, const double absolute_residual, const double relative_residual)
Direct solver using TrilinosWrappers::SolverDirect The use of this solver should be avoided for 3D pr...
+void solve_system_direct(const bool initial_step, const double absolute_residual, const double relative_residual)
Direct solver using TrilinosWrappers::SolverDirect The use of this solver should be avoided for 3D pr...
GLSNavierStokesSolver(SimulationParameters< dim > &nsparam)
-void solve_system_BiCGStab(const bool initial_step, const double absolute_residual, const double relative_residual)
BiCGStab solver with ILU(N) preconditioning.
+void solve_system_BiCGStab(const bool initial_step, const double absolute_residual, const double relative_residual)
BiCGStab solver with ILU(N) preconditioning.
Assembles the transient time arising from BDF time integration for the Navier-Stokes equation with fr...
Assembles the core of the Navier-Stokes equation with free surface using VOF modeling....
Assembles the Marangoni effect for the Navier-Stokes equations according to the following equation:
@@ -2044,7 +2054,7 @@
-
+
Struct containing fluid id, temperature and phase fraction range information, and flag containers for...
diff --git a/doxygen/gls__nitsche__navier__stokes_8cc_source.html b/doxygen/gls__nitsche__navier__stokes_8cc_source.html
index c43e753a29..6636e24389 100644
--- a/doxygen/gls__nitsche__navier__stokes_8cc_source.html
+++ b/doxygen/gls__nitsche__navier__stokes_8cc_source.html
@@ -1182,9 +1182,9 @@
void output_solid_triangulation(const unsigned int i_solid)
Outputs a vtu file for each output frequency of the solid triangulation.
virtual void refine_mesh() override
Allow the refinement of the mesh according to one of the 2 methods proposed. Overrides the regular me...
std::vector< PVDHandler > pvdhandler_solid_triangulation
-virtual void read_checkpoint()
read_checkpoint
+virtual void read_checkpoint()
read_checkpoint
SimulationParameters< dim > simulation_parameters
-virtual void write_checkpoint()
write_checkpoint
+virtual void write_checkpoint()
write_checkpoint
diff --git a/doxygen/gls__sharp__navier__stokes_8cc_source.html b/doxygen/gls__sharp__navier__stokes_8cc_source.html
index a6fba4257d..33134e23a0 100644
--- a/doxygen/gls__sharp__navier__stokes_8cc_source.html
+++ b/doxygen/gls__sharp__navier__stokes_8cc_source.html
@@ -5119,13 +5119,13 @@
GlobalVectorType system_rhs
DoFHandler< dim > dof_handler
virtual void refine_mesh()
Allow the refinement of the mesh according to one of the 2 methods proposed.
-virtual void read_checkpoint()
read_checkpoint
+virtual void read_checkpoint()
read_checkpoint
virtual void finish_time_step()
finish_time_step Finishes the time step of the fluid dynamics Post-processing and time stepping
const unsigned int this_mpi_process
SimulationParameters< dim > simulation_parameters
virtual void iterate()
iterate Do a regular CFD iteration
-virtual void postprocess_fd(bool first_iteration)
postprocess Post-process fluid dynamics after an iteration
+virtual void postprocess_fd(bool first_iteration)
postprocess Post-process fluid dynamics after an iteration
TimerOutput computing_timer
GlobalVectorType evaluation_point
std::shared_ptr< Function< dim > > forcing_function
@@ -5139,7 +5139,7 @@
virtual void set_initial_condition(Parameters::InitialConditionType initial_condition_type, bool restart=false)
set_initial_conditions
virtual void setup_dofs()
setup_dofs
std::shared_ptr< Mapping< dim > > mapping
-virtual void write_checkpoint()
write_checkpoint
+virtual void write_checkpoint()
write_checkpoint
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
This class implements a boundary conditions for the Navier-Stokes equation where the velocity compone...
virtual double value(const Point< dim > &p, const unsigned int component) const override
Calculates the value of a Function-type Navier-Stokes equations.
diff --git a/doxygen/mf__navier__stokes_8cc_source.html b/doxygen/mf__navier__stokes_8cc_source.html
index 9169236054..92d6a58141 100644
--- a/doxygen/mf__navier__stokes_8cc_source.html
+++ b/doxygen/mf__navier__stokes_8cc_source.html
@@ -302,2275 +302,2309 @@
221 , simulation_parameters(simulation_parameters)
222 , dof_handler(dof_handler)
223 , dof_handler_fe_q_iso_q1(dof_handler_fe_q_iso_q1)
- 224 , mg_setup_timer(MPI_COMM_WORLD,
-
-
- 227 TimerOutput::wall_times)
- 228 , mg_vmult_timer(MPI_COMM_WORLD,
-
-
- 231 TimerOutput::wall_times)
-
-
-
-
-
- 237 const unsigned int n_h_levels =
- 238 this->dof_handler.get_triangulation().n_global_levels();
-
-
-
-
-
-
-
-
-
-
-
- 250 mg_min_level <=
static_cast<int>(MGTools::max_level_for_coarse_mesh(
- 251 this->dof_handler.get_triangulation())),
- 252 ExcMessage(std::string(
- 253 "The maximum level allowed for the coarse mesh (mg min level) is: " +
- 254 std::to_string(MGTools::max_level_for_coarse_mesh(
- 255 this->dof_handler.get_triangulation())) +
-
-
- 258 int mg_level_min_cells =
-
-
-
-
- 263 std::vector<unsigned int> n_cells_on_levels(
- 264 this->dof_handler.get_triangulation().n_global_levels(), 0);
-
- 266 for (
unsigned int l = 0;
- 267 l < this->dof_handler.get_triangulation().n_levels();
-
- 269 for (
const auto &cell :
- 270 this->dof_handler.get_triangulation().cell_iterators_on_level(l))
- 271 if (cell->is_locally_owned_on_level())
- 272 n_cells_on_levels[l]++;
-
- 274 Utilities::MPI::sum(n_cells_on_levels,
- 275 this->dof_handler.get_communicator(),
-
-
- 278 mg_level_min_cells <=
static_cast<int>(n_cells_on_levels[
maxlevel]),
-
- 280 "The mg level min cells specified are larger than the cells of the finest mg level."));
-
-
- 283 if (mg_min_level != -1)
-
-
- 286 if (mg_level_min_cells != -1)
-
-
-
- 290 if (
static_cast<int>(n_cells_on_levels[level]) >=
-
-
-
-
-
-
-
-
-
-
-
- 302 this->
pcout << std::endl;
- 303 this->
pcout <<
" -Levels of MG preconditioner:" << std::endl;
-
-
-
- 307 << this->dof_handler.n_dofs(level) <<
" DoFs, "
- 308 << n_cells_on_levels[level] <<
" cells" << std::endl;
- 309 this->
pcout << std::endl;
-
-
- 312 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
- 313 partitioners(this->dof_handler.get_triangulation().n_global_levels());
+ 224 , mg_setup_timer(this->pcout, TimerOutput::never, TimerOutput::wall_times)
+ 225 , mg_vmult_timer(this->pcout, TimerOutput::never, TimerOutput::wall_times)
+
+
+
+
+
+ 231 const unsigned int n_h_levels =
+ 232 this->dof_handler.get_triangulation().n_global_levels();
+
+
+
+
+
+
+
+
+
+
+
+ 244 mg_min_level <=
static_cast<int>(MGTools::max_level_for_coarse_mesh(
+ 245 this->dof_handler.get_triangulation())),
+ 246 ExcMessage(std::string(
+ 247 "The maximum level allowed for the coarse mesh (mg min level) is: " +
+ 248 std::to_string(MGTools::max_level_for_coarse_mesh(
+ 249 this->dof_handler.get_triangulation())) +
+
+
+ 252 int mg_level_min_cells =
+
+
+
+
+ 257 std::vector<unsigned int> n_cells_on_levels(
+ 258 this->dof_handler.get_triangulation().n_global_levels(), 0);
+
+ 260 for (
unsigned int l = 0;
+ 261 l < this->dof_handler.get_triangulation().n_levels();
+
+ 263 for (
const auto &cell :
+ 264 this->dof_handler.get_triangulation().cell_iterators_on_level(l))
+ 265 if (cell->is_locally_owned_on_level())
+ 266 n_cells_on_levels[l]++;
+
+ 268 Utilities::MPI::sum(n_cells_on_levels,
+ 269 this->dof_handler.get_communicator(),
+
+
+ 272 mg_level_min_cells <=
static_cast<int>(n_cells_on_levels[
maxlevel]),
+
+ 274 "The mg level min cells specified are larger than the cells of the finest mg level."));
+
+
+ 277 if (mg_min_level != -1)
+
+
+ 280 if (mg_level_min_cells != -1)
+
+
+
+ 284 if (
static_cast<int>(n_cells_on_levels[level]) >=
+
+
+
+
+
+
+
+
+
+
+
+ 296 this->
pcout << std::endl;
+ 297 this->
pcout <<
" -Levels of MG preconditioner:" << std::endl;
+
+
+
+ 301 << this->dof_handler.n_dofs(level) <<
" DoFs, "
+ 302 << n_cells_on_levels[level] <<
" cells" << std::endl;
+ 303 this->
pcout << std::endl;
+
+
+
+
+
+
+ 310 this->
pcout <<
" -MG vertical communication efficiency: "
+ 311 << MGTools::vertical_communication_efficiency(
+ 312 this->dof_handler.get_triangulation())
+
-
- 316 MGLevelObject<AffineConstraints<double>> level_constraints;
-
-
-
- 320 level_constraints.resize(this->
minlevel, this->maxlevel);
-
-
+ 315 this->
pcout <<
" -MG workload imbalance: "
+ 316 << MGTools::workload_imbalance(
+ 317 this->dof_handler.get_triangulation())
+
+
+
+ 321 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
+ 322 partitioners(this->dof_handler.get_triangulation().n_global_levels());
-
-
+
+ 325 MGLevelObject<AffineConstraints<double>> level_constraints;
-
-
-
- 330 FEValuesExtractors::Vector velocities(0);
- 331 FEValuesExtractors::Scalar
pressure(dim);
+
+
+ 329 level_constraints.resize(this->
minlevel, this->maxlevel);
+
+
- 333 for (
unsigned int i_bc = 0;
-
-
-
-
-
-
- 340 std::set<types::boundary_id> no_normal_flux_boundaries;
- 341 no_normal_flux_boundaries.insert(
-
-
-
-
- 346 AffineConstraints<double> temp_constraints;
- 347 temp_constraints.clear();
- 348 const IndexSet locally_relevant_level_dofs =
- 349 DoFTools::extract_locally_relevant_level_dofs(
- 350 this->dof_handler, level);
- 351 temp_constraints.reinit(locally_relevant_level_dofs);
- 352 VectorTools::compute_no_normal_flux_constraints_on_level(
-
-
- 355 no_normal_flux_boundaries,
-
-
-
-
-
- 361 temp_constraints.close();
-
- 363 level, temp_constraints);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ 339 FEValuesExtractors::Vector velocities(0);
+ 340 FEValuesExtractors::Scalar
pressure(dim);
+
+ 342 for (
unsigned int i_bc = 0;
+
+
+
+
+
+
+ 349 std::set<types::boundary_id> no_normal_flux_boundaries;
+ 350 no_normal_flux_boundaries.insert(
+
+
+
+
+ 355 AffineConstraints<double> temp_constraints;
+ 356 temp_constraints.clear();
+ 357 const IndexSet locally_relevant_level_dofs =
+ 358 DoFTools::extract_locally_relevant_level_dofs(
+ 359 this->dof_handler, level);
+ 360 temp_constraints.reinit(locally_relevant_level_dofs);
+ 361 VectorTools::compute_no_normal_flux_constraints_on_level(
+
+
+ 364 no_normal_flux_boundaries,
+
+
+
+
+
+ 370 temp_constraints.close();
+
+ 372 level, temp_constraints);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 394 std::set<types::boundary_id> dirichlet_boundary_id = {
-
-
-
- 398 dirichlet_boundary_id,
- 399 fe->component_mask(velocities));
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- 410 level_constraints[level].clear();
+
+
+ 403 std::set<types::boundary_id> dirichlet_boundary_id = {
+
+
+
+ 407 dirichlet_boundary_id,
+ 408 fe->component_mask(velocities));
+
+
- 412 const IndexSet relevant_dofs =
- 413 DoFTools::extract_locally_relevant_level_dofs(this->dof_handler,
-
-
- 416 level_constraints[level].reinit(relevant_dofs);
-
- 418 #if DEAL_II_VERSION_GTE(9, 6, 0)
-
- 420 level_constraints[level], level,
true,
false,
true,
true);
-
-
-
-
- 425 "The constraints for the lsmg preconditioner require a most recent version of deal.II."));
-
-
-
- 429 .fix_pressure_constant &&
- 430 level == this->minlevel)
-
- 432 unsigned int min_index = numbers::invalid_unsigned_int;
-
- 434 std::vector<types::global_dof_index> dof_indices;
-
-
- 437 for (
const auto &cell : this->dof_handler.active_cell_iterators())
-
- 439 if (cell->is_locally_owned())
-
- 441 const auto &fe = cell->get_fe();
+
+
+
+
+
+
+
+ 419 level_constraints[level].clear();
+
+ 421 const IndexSet relevant_dofs =
+ 422 DoFTools::extract_locally_relevant_level_dofs(this->dof_handler,
+
+
+ 425 level_constraints[level].reinit(relevant_dofs);
+
+ 427 #if DEAL_II_VERSION_GTE(9, 6, 0)
+
+ 429 level_constraints[level], level,
true,
false,
true,
true);
+
+
+
+
+ 434 "The constraints for the lsmg preconditioner require a most recent version of deal.II."));
+
+
+
+ 438 .fix_pressure_constant &&
+ 439 level == this->minlevel)
+
+ 441 unsigned int min_index = numbers::invalid_unsigned_int;
- 443 dof_indices.resize(fe.n_dofs_per_cell());
- 444 cell->get_dof_indices(dof_indices);
-
- 446 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
- 447 if (fe.system_to_component_index(i).first == dim)
- 448 min_index = std::min(min_index, dof_indices[i]);
-
-
+ 443 std::vector<types::global_dof_index> dof_indices;
+
+
+ 446 for (
const auto &cell : this->dof_handler.active_cell_iterators())
+
+ 448 if (cell->is_locally_owned())
+
+ 450 const auto &fe = cell->get_fe();
-
-
- 454 Utilities::MPI::min(min_index,
- 455 this->dof_handler.get_communicator());
-
- 457 if (relevant_dofs.is_element(min_index))
- 458 level_constraints[level].add_line(min_index);
-
+ 452 dof_indices.resize(fe.n_dofs_per_cell());
+ 453 cell->get_dof_indices(dof_indices);
+
+ 455 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
+ 456 if (fe.system_to_component_index(i).first == dim)
+ 457 min_index = std::min(min_index, dof_indices[i]);
+
+
- 461 level_constraints[level].close();
-
-
-
-
-
- 467 auto quadrature_mg = *cell_quadrature;
-
-
- 470 .mg_use_fe_q_iso_q1 &&
- 471 level == this->minlevel)
-
-
- 474 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
-
-
- 477 quadrature_mg = QIterated<dim>(QGauss<1>(2), points);
-
-
-
- 481 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
-
-
-
-
-
- 487 .mg_use_fe_q_iso_q1 &&
- 488 level == this->minlevel) ?
-
-
- 491 level_constraints[level],
-
-
-
-
-
-
-
-
-
- 501 .mg_enable_hessians_jacobian,
-
-
-
-
-
-
- 508 partitioners[level] =
-
-
-
-
-
-
- 515 this->
mg_setup_timer.enter_subsection(
"Create transfer operator");
+
+
+ 463 Utilities::MPI::min(min_index,
+ 464 this->dof_handler.get_communicator());
+
+ 466 if (relevant_dofs.is_element(min_index))
+ 467 level_constraints[level].add_line(min_index);
+
+
+ 470 level_constraints[level].close();
+
+
+
+
+
+ 476 auto quadrature_mg = *cell_quadrature;
+
+
+ 479 .mg_use_fe_q_iso_q1 &&
+ 480 level == this->minlevel)
+
+
+ 483 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
+
+
+ 486 quadrature_mg = QIterated<dim>(QGauss<1>(2), points);
+
+
+
+ 490 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
+
+
+
+
+
+ 496 .mg_use_fe_q_iso_q1 &&
+ 497 level == this->minlevel) ?
+
+
+ 500 level_constraints[level],
+
+
+
+
+
+
+
+
+
+ 510 .mg_enable_hessians_jacobian,
+
+
+
+
+
-
-
-
-
-
- 522 this->
mg_setup_timer.leave_subsection(
"Create transfer operator");
-
-
-
-
-
-
-
- 530 this->
mg_setup_timer.enter_subsection(
"Create level triangulations");
-
- 532 MGTransferGlobalCoarseningTools::create_geometric_coarsening_sequence(
- 533 this->dof_handler.get_triangulation());
- 534 this->
mg_setup_timer.leave_subsection(
"Create level triangulations");
-
-
-
- 538 std::vector<std::shared_ptr<const Triangulation<dim>>> temp;
-
-
-
-
-
-
- 545 (mg_min_level + 1) <=
-
-
- 548 "The mg min level specified is higher than the finest mg level."));
-
- 550 int mg_level_min_cells =
-
-
-
-
- 555 mg_level_min_cells <=
- 556 static_cast<int>(
this
-
-
- 559 ->n_global_active_cells()),
-
- 561 "The mg level min cells specified are larger than the cells of the finest mg level."));
+ 517 partitioners[level] =
+
+
+
+
+
+
+ 524 this->
mg_setup_timer.enter_subsection(
"Create transfer operator");
+
+
+
+
+
+
+ 531 this->
mg_setup_timer.leave_subsection(
"Create transfer operator");
+
+
+
+
+
+
+
+ 539 this->
mg_setup_timer.enter_subsection(
"Create level triangulations");
+
+ 541 MGTransferGlobalCoarseningTools::create_geometric_coarsening_sequence(
+ 542 this->dof_handler.get_triangulation());
+ 543 this->
mg_setup_timer.leave_subsection(
"Create level triangulations");
+
+
+
+ 547 std::vector<std::shared_ptr<const Triangulation<dim>>> temp;
+
+
+
+
+
+
+ 554 (mg_min_level + 1) <=
+
+
+ 557 "The mg min level specified is higher than the finest mg level."));
+
+ 559 int mg_level_min_cells =
+
+
-
- 564 auto ptr = std::find_if(
-
- 566 this->coarse_grid_triangulations.end() - 1,
- 567 [&mg_min_level, &mg_level_min_cells](
const auto &tria) {
- 568 if (mg_min_level != -1)
-
- 570 if ((mg_min_level + 1) <=
- 571 static_cast<int>(tria->n_global_levels()))
-
-
- 574 else if (mg_level_min_cells != -1)
-
- 576 if (
static_cast<int>(tria->n_global_active_cells()) >=
-
-
-
-
-
-
-
-
-
-
-
-
- 589 temp.push_back(*(ptr++));
-
-
-
-
-
-
-
-
-
- 599 MGLevelObject<AffineConstraints<typename VectorType::value_type>>
-
+
+ 564 mg_level_min_cells <=
+ 565 static_cast<int>(
this
+
+
+ 568 ->n_global_active_cells()),
+
+ 570 "The mg level min cells specified are larger than the cells of the finest mg level."));
+
+
+ 573 auto ptr = std::find_if(
+
+ 575 this->coarse_grid_triangulations.end() - 1,
+ 576 [&mg_min_level, &mg_level_min_cells](
const auto &tria) {
+ 577 if (mg_min_level != -1)
+
+ 579 if ((mg_min_level + 1) <=
+ 580 static_cast<int>(tria->n_global_levels()))
+
+
+ 583 else if (mg_level_min_cells != -1)
+
+ 585 if (
static_cast<int>(tria->n_global_active_cells()) >=
+
+
+
+
+
+
+
+
+
+
+
+
+ 598 temp.push_back(*(ptr++));
+
+
-
-
-
-
+
+
+
+
-
-
- 609 "Create DoFHandlers and distribute DoFs");
-
-
-
-
-
+
+ 608 MGLevelObject<AffineConstraints<typename VectorType::value_type>>
+
+
+
+
+
+
-
-
-
-
-
- 621 .mg_use_fe_q_iso_q1 &&
-
-
-
- 625 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
-
-
-
- 629 FESystem<dim>(FE_Q_iso_Q1<dim>(points), dim + 1));
-
-
- 632 this->
dof_handlers[l].distribute_dofs(this->dof_handler.get_fe());
-
-
-
- 636 "Create DoFHandlers and distribute DoFs");
-
-
-
-
-
- 642 this->
pcout << std::endl;
- 643 this->
pcout <<
" -Levels of MG preconditioner:" << std::endl;
-
-
- 646 this->
pcout <<
" Level " << level <<
": "
-
-
- 649 ->n_global_active_cells()
- 650 <<
" cells" << std::endl;
+
+
+ 618 "Create DoFHandlers and distribute DoFs");
+
+
+
+
+
+
+
+
+
+
+
+ 630 .mg_use_fe_q_iso_q1 &&
+
+
+
+ 634 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
+
+
+
+ 638 FESystem<dim>(FE_Q_iso_Q1<dim>(points), dim + 1));
+
+
+ 641 this->
dof_handlers[l].distribute_dofs(this->dof_handler.get_fe());
+
+
+
+ 645 "Create DoFHandlers and distribute DoFs");
+
+
+
+
+
651 this->
pcout << std::endl;
-
-
-
-
-
-
- 658 const auto &level_dof_handler = this->
dof_handlers[level];
- 659 auto &level_constraint = constraints[level];
-
-
+ 652 this->
pcout <<
" -Levels of MG preconditioner:" << std::endl;
+
+
+ 655 this->
pcout <<
" Level " << level <<
": "
+
+
+ 658 ->n_global_active_cells()
+ 659 <<
" cells" << std::endl;
+ 660 this->
pcout << std::endl;
+
- 663 level_constraint.clear();
- 664 const IndexSet locally_relevant_dofs =
- 665 DoFTools::extract_locally_relevant_dofs(level_dof_handler);
- 666 level_constraint.reinit(locally_relevant_dofs);
-
- 668 DoFTools::make_hanging_node_constraints(level_dof_handler,
-
-
- 671 FEValuesExtractors::Vector velocities(0);
- 672 FEValuesExtractors::Scalar
pressure(dim);
-
- 674 for (
unsigned int i_bc = 0;
-
-
-
-
-
-
- 681 std::set<types::boundary_id> no_normal_flux_boundaries;
- 682 no_normal_flux_boundaries.insert(
-
- 684 VectorTools::compute_no_normal_flux_constraints(
-
-
- 687 no_normal_flux_boundaries,
-
-
-
-
-
-
-
- 695 DoFTools::make_periodicity_constraints(
-
-
- 698 this->simulation_parameters.boundary_conditions
-
- 700 this->simulation_parameters.boundary_conditions
- 701 .periodic_direction[i_bc],
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 667 this->
pcout <<
" -MG vertical communication efficiency: "
+ 668 << MGTools::vertical_communication_efficiency(
+
+
+
+ 672 this->
pcout <<
" -MG workload imbalance: "
+ 673 << MGTools::workload_imbalance(
+
+
+
+
+
+
+
+
+ 682 const auto &level_dof_handler = this->
dof_handlers[level];
+ 683 auto &level_constraint = constraints[level];
+
+
+
+ 687 level_constraint.clear();
+ 688 const IndexSet locally_relevant_dofs =
+ 689 DoFTools::extract_locally_relevant_dofs(level_dof_handler);
+ 690 level_constraint.reinit(locally_relevant_dofs);
+
+ 692 DoFTools::make_hanging_node_constraints(level_dof_handler,
+
+
+ 695 FEValuesExtractors::Vector velocities(0);
+ 696 FEValuesExtractors::Scalar
pressure(dim);
+
+ 698 for (
unsigned int i_bc = 0;
+
+
+
+
+
+
+ 705 std::set<types::boundary_id> no_normal_flux_boundaries;
+ 706 no_normal_flux_boundaries.insert(
+
+ 708 VectorTools::compute_no_normal_flux_constraints(
+
+
+ 711 no_normal_flux_boundaries,
+
+
+
+
+
+
+
+ 719 DoFTools::make_periodicity_constraints(
+
+
+ 722 this->simulation_parameters.boundary_conditions
+
+ 724 this->simulation_parameters.boundary_conditions
+ 725 .periodic_direction[i_bc],
+
-
-
- 730 VectorTools::interpolate_boundary_values(
-
-
-
- 734 dealii::Functions::ZeroFunction<dim>(dim + 1),
-
- 736 fe->component_mask(velocities));
-
-
-
-
- 741 .fix_pressure_constant &&
- 742 level == this->minlevel)
-
- 744 unsigned int min_index = numbers::invalid_unsigned_int;
-
- 746 std::vector<types::global_dof_index> dof_indices;
-
-
- 749 for (
const auto &cell : level_dof_handler.active_cell_iterators())
-
- 751 if (cell->is_locally_owned())
-
- 753 const auto &fe = cell->get_fe();
-
- 755 dof_indices.resize(fe.n_dofs_per_cell());
- 756 cell->get_dof_indices(dof_indices);
-
- 758 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
- 759 if (fe.system_to_component_index(i).first == dim)
- 760 min_index = std::min(min_index, dof_indices[i]);
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 754 VectorTools::interpolate_boundary_values(
+
+
+
+ 758 dealii::Functions::ZeroFunction<dim>(dim + 1),
+
+ 760 fe->component_mask(velocities));
+
+
-
-
- 766 Utilities::MPI::min(min_index,
- 767 this->dof_handler.get_communicator());
-
- 769 if (locally_relevant_dofs.is_element(min_index))
- 770 level_constraint.add_line(min_index);
-
-
- 773 level_constraint.close();
-
-
-
-
+
+ 765 .fix_pressure_constant &&
+ 766 level == this->minlevel)
+
+ 768 unsigned int min_index = numbers::invalid_unsigned_int;
+
+ 770 std::vector<types::global_dof_index> dof_indices;
+
+
+ 773 for (
const auto &cell : level_dof_handler.active_cell_iterators())
+
+ 775 if (cell->is_locally_owned())
+
+ 777 const auto &fe = cell->get_fe();
-
-
- 781 auto quadrature_mg = *cell_quadrature;
-
-
- 784 .mg_use_fe_q_iso_q1 &&
- 785 level == this->minlevel)
-
-
- 788 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
-
-
- 791 quadrature_mg = QIterated<dim>(QGauss<1>(2), points);
-
-
-
- 795 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
+ 779 dof_indices.resize(fe.n_dofs_per_cell());
+ 780 cell->get_dof_indices(dof_indices);
+
+ 782 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
+ 783 if (fe.system_to_component_index(i).first == dim)
+ 784 min_index = std::min(min_index, dof_indices[i]);
+
+
+
+
+
+ 790 Utilities::MPI::min(min_index,
+ 791 this->dof_handler.get_communicator());
+
+ 793 if (locally_relevant_dofs.is_element(min_index))
+ 794 level_constraint.add_line(min_index);
+
-
-
-
-
-
-
-
-
-
- 806 numbers::invalid_unsigned_int,
-
-
-
- 810 .mg_enable_hessians_jacobian,
-
-
-
-
-
-
- 817 this->
mg_setup_timer.enter_subsection(
"Create transfer operator");
-
-
-
-
- 822 constraints[level + 1],
-
-
-
- 826 this->
transfers, [&](
const auto l,
auto &vec) {
-
-
-
- 830 this->
mg_setup_timer.leave_subsection(
"Create transfer operator");
-
-
- 833 AssertThrow(
false, ExcNotImplemented());
-
-
-
-
-
- 839 const std::shared_ptr<SimulationControl> simulation_control,
-
-
- 842 const VectorType &time_derivative_previous_solutions)
-
-
- 845 MGLevelObject<VectorType> mg_solution(this->minlevel, this->maxlevel);
- 846 MGLevelObject<VectorType> mg_time_derivative_previous_solutions(
- 847 this->minlevel, this->maxlevel);
+ 797 level_constraint.close();
+
+
+
+
+
+
+
+ 805 auto quadrature_mg = *cell_quadrature;
+
+
+ 808 .mg_use_fe_q_iso_q1 &&
+ 809 level == this->minlevel)
+
+
+ 812 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
+
+
+ 815 quadrature_mg = QIterated<dim>(QGauss<1>(2), points);
+
+
+
+ 819 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
+
+
+
+
+
+
+
+
+
+
+ 830 numbers::invalid_unsigned_int,
+
+
+
+ 834 .mg_enable_hessians_jacobian,
+
+
+
+
+
+
+ 841 this->
mg_setup_timer.enter_subsection(
"Create transfer operator");
+
+
+
+
+ 846 constraints[level + 1],
+
- 849 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
-
- 851 this->mg_operators[level]->initialize_dof_vector(mg_solution[level]);
- 852 if (
is_bdf(simulation_control->get_assembly_method()))
- 853 this->mg_operators[level]->initialize_dof_vector(
- 854 mg_time_derivative_previous_solutions[level]);
+
+ 850 this->
transfers, [&](
const auto l,
auto &vec) {
+
+
+
+ 854 this->
mg_setup_timer.leave_subsection(
"Create transfer operator");
-
- 857 this->mg_setup_timer.enter_subsection(
"Execute relevant transfers");
-
-
-
-
-
-
- 864 this->mg_transfer_ls->interpolate_to_mg(this->dof_handler,
-
-
-
- 868 if (
is_bdf(simulation_control->get_assembly_method()))
- 869 this->mg_transfer_ls->interpolate_to_mg(
-
- 871 mg_time_derivative_previous_solutions,
- 872 time_derivative_previous_solutions);
-
-
- 875 std::make_shared<mg::Matrix<VectorType>>(this->ls_mg_operators);
-
- 877 else if (this->simulation_parameters.linear_solver
-
-
-
-
- 882 this->mg_transfer_gc->interpolate_to_mg(this->dof_handler,
-
-
-
- 886 if (
is_bdf(simulation_control->get_assembly_method()))
- 887 this->mg_transfer_gc->interpolate_to_mg(
-
- 889 mg_time_derivative_previous_solutions,
- 890 time_derivative_previous_solutions);
+
+ 857 AssertThrow(
false, ExcNotImplemented());
+
+
+
+
+
+ 863 const std::shared_ptr<SimulationControl> simulation_control,
+
+
+ 866 const VectorType &time_derivative_previous_solutions)
+
+
+ 869 MGLevelObject<VectorType> mg_solution(this->minlevel, this->maxlevel);
+ 870 MGLevelObject<VectorType> mg_time_derivative_previous_solutions(
+ 871 this->minlevel, this->maxlevel);
+
+ 873 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
+
+ 875 this->mg_operators[level]->initialize_dof_vector(mg_solution[level]);
+ 876 if (
is_bdf(simulation_control->get_assembly_method()))
+ 877 this->mg_operators[level]->initialize_dof_vector(
+ 878 mg_time_derivative_previous_solutions[level]);
+
+
+ 881 this->mg_setup_timer.enter_subsection(
"Execute relevant transfers");
+
+
+
+
+
+
+ 888 this->mg_transfer_ls->interpolate_to_mg(this->dof_handler,
+
+
-
- 893 std::make_shared<mg::Matrix<VectorType>>(this->mg_operators);
-
-
- 896 this->mg_setup_timer.leave_subsection(
"Execute relevant transfers");
+ 892 if (
is_bdf(simulation_control->get_assembly_method()))
+ 893 this->mg_transfer_ls->interpolate_to_mg(
+
+ 895 mg_time_derivative_previous_solutions,
+ 896 time_derivative_previous_solutions);
-
- 899 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
-
- 901 mg_solution[level].update_ghost_values();
- 902 this->mg_operators[level]->evaluate_non_linear_term_and_calculate_tau(
-
-
- 905 if (
is_bdf(simulation_control->get_assembly_method()))
-
- 907 mg_time_derivative_previous_solutions[level].update_ghost_values();
- 908 this->mg_operators[level]
- 909 ->evaluate_time_derivative_previous_solutions(
- 910 mg_time_derivative_previous_solutions[level]);
-
- 912 if (this->simulation_parameters.flow_control.enable_flow_control)
- 913 this->mg_operators[level]->update_beta_force(
-
-
-
-
-
- 919 this->mg_setup_timer.enter_subsection(
"Set up and initialize smoother");
-
- 921 this->mg_smoother = std::make_shared<
- 922 MGSmootherPrecondition<OperatorType, SmootherType, VectorType>>();
-
- 924 MGLevelObject<typename SmootherType::AdditionalData> smoother_data(
- 925 this->minlevel, this->maxlevel);
-
- 927 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
-
-
- 930 this->mg_operators[level]->compute_inverse_diagonal(diagonal_vector);
- 931 smoother_data[level].preconditioner =
- 932 std::make_shared<SmootherPreconditionerType>(diagonal_vector);
- 933 smoother_data[level].n_iterations =
-
- 935 .mg_smoother_iterations;
-
- 937 if (this->simulation_parameters.linear_solver
-
- 939 .mg_smoother_eig_estimation)
-
- 941 #if DEAL_II_VERSION_GTE(9, 6, 0)
-
-
- 944 smoother_data[level].relaxation = 0.0;
- 945 smoother_data[level].smoothing_range =
- 946 this->simulation_parameters.linear_solver
-
- 948 .eig_estimation_smoothing_range;
- 949 smoother_data[level].eig_cg_n_iterations =
- 950 this->simulation_parameters.linear_solver
-
- 952 .eig_estimation_cg_n_iterations;
- 953 smoother_data[level].eigenvalue_algorithm =
- 954 SmootherType::AdditionalData::EigenvalueAlgorithm::power_iteration;
- 955 smoother_data[level].constraints.copy_from(
- 956 this->mg_operators[level]
- 957 ->get_system_matrix_free()
- 958 .get_affine_constraints());
-
-
-
-
- 963 "The estimation of eigenvalues within LSMG requires a version of deal.II >= 9.6.0"));
-
-
-
- 967 smoother_data[level].relaxation =
- 968 this->simulation_parameters.linear_solver
-
- 970 .mg_smoother_relaxation;
-
-
- 973 mg_smoother->initialize(this->mg_operators, smoother_data);
-
- 975 #if DEAL_II_VERSION_GTE(9, 6, 0)
-
- 977 .mg_smoother_eig_estimation &&
-
-
-
-
- 982 for (
unsigned int level = this->minlevel; level <= this->maxlevel;
-
-
-
- 986 this->mg_operators[level]->initialize_dof_vector(vec);
-
- 988 mg_smoother->smoothers[level].estimate_eigenvalues(vec);
-
- 990 this->pcout << std::endl;
- 991 this->pcout <<
" -Eigenvalue estimation level "
- 992 << level - this->minlevel <<
":" << std::endl;
- 993 this->pcout <<
" Relaxation parameter: "
- 994 << mg_smoother->smoothers[level].get_relaxation()
-
- 996 this->pcout <<
" Minimum eigenvalue: "
- 997 << evs.min_eigenvalue_estimate << std::endl;
- 998 this->pcout <<
" Maximum eigenvalue: "
- 999 << evs.max_eigenvalue_estimate << std::endl;
- 1000 this->pcout << std::endl;
-
-
-
-
-
-
- 1007 "The estimation of eigenvalues within LSMG requires a version of deal.II >= 9.6.0"));
-
-
- 1010 this->mg_setup_timer.leave_subsection(
"Set up and initialize smoother");
-
-
- 1013 this->mg_setup_timer.enter_subsection(
"Create coarse-grid solver");
-
-
- 1016 .mg_coarse_grid_solver ==
-
-
- 1019 const int max_iterations =
-
- 1021 .mg_gmres_max_iterations;
- 1022 const double tolerance =
-
- 1024 .mg_gmres_tolerance;
- 1025 const double reduce =
-
-
- 1028 this->coarse_grid_solver_control = std::make_shared<ReductionControl>(
- 1029 max_iterations, tolerance, reduce,
false,
false);
- 1030 SolverGMRES<VectorType>::AdditionalData solver_parameters;
- 1031 solver_parameters.max_n_tmp_vectors =
-
- 1033 .mg_gmres_max_krylov_vectors;
-
- 1035 this->coarse_grid_solver = std::make_shared<SolverGMRES<VectorType>>(
- 1036 *this->coarse_grid_solver_control, solver_parameters);
-
- 1038 if (this->simulation_parameters.linear_solver
-
- 1040 .mg_gmres_preconditioner ==
-
-
-
-
- 1045 this->mg_coarse = std::make_shared<
-
- 1047 SolverGMRES<VectorType>,
-
- 1049 TrilinosWrappers::PreconditionAMG>>(
- 1050 *this->coarse_grid_solver,
- 1051 *this->mg_operators[this->minlevel],
- 1052 *this->precondition_amg);
-
- 1054 else if (this->simulation_parameters.linear_solver
-
- 1056 .mg_gmres_preconditioner ==
-
-
-
-
- 1061 this->mg_coarse = std::make_shared<
-
- 1063 SolverGMRES<VectorType>,
-
- 1065 TrilinosWrappers::PreconditionILU>>(
- 1066 *this->coarse_grid_solver,
- 1067 *this->mg_operators[this->minlevel],
- 1068 *this->precondition_ilu);
-
-
- 1071 else if (this->simulation_parameters.linear_solver
-
- 1073 .mg_coarse_grid_solver ==
-
-
-
-
- 1078 this->mg_coarse = std::make_shared<
-
- 1080 TrilinosWrappers::PreconditionAMG>>(
- 1081 *this->precondition_amg);
-
- 1083 else if (this->simulation_parameters.linear_solver
-
- 1085 .mg_coarse_grid_solver ==
-
-
-
-
- 1090 this->mg_coarse = std::make_shared<
-
- 1092 TrilinosWrappers::PreconditionILU>>(
- 1093 *this->precondition_ilu);
+
+ 899 std::make_shared<mg::Matrix<VectorType>>(this->ls_mg_operators);
+
+ 901 else if (this->simulation_parameters.linear_solver
+
+
+
+
+ 906 this->mg_transfer_gc->interpolate_to_mg(this->dof_handler,
+
+
+
+ 910 if (
is_bdf(simulation_control->get_assembly_method()))
+ 911 this->mg_transfer_gc->interpolate_to_mg(
+
+ 913 mg_time_derivative_previous_solutions,
+ 914 time_derivative_previous_solutions);
+
+
+ 917 std::make_shared<mg::Matrix<VectorType>>(this->mg_operators);
+
+
+ 920 this->mg_setup_timer.leave_subsection(
"Execute relevant transfers");
+
+
+ 923 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
+
+ 925 mg_solution[level].update_ghost_values();
+ 926 this->mg_operators[level]->evaluate_non_linear_term_and_calculate_tau(
+
+
+ 929 if (
is_bdf(simulation_control->get_assembly_method()))
+
+ 931 mg_time_derivative_previous_solutions[level].update_ghost_values();
+ 932 this->mg_operators[level]
+ 933 ->evaluate_time_derivative_previous_solutions(
+ 934 mg_time_derivative_previous_solutions[level]);
+
+ 936 if (this->simulation_parameters.flow_control.enable_flow_control)
+ 937 this->mg_operators[level]->update_beta_force(
+
+
+
+
+
+ 943 this->mg_setup_timer.enter_subsection(
"Set up and initialize smoother");
+
+ 945 this->mg_smoother = std::make_shared<
+ 946 MGSmootherPrecondition<OperatorType, SmootherType, VectorType>>();
+
+ 948 MGLevelObject<typename SmootherType::AdditionalData> smoother_data(
+ 949 this->minlevel, this->maxlevel);
+
+ 951 for (
unsigned int level = this->minlevel; level <= this->maxlevel; ++level)
+
+
+ 954 this->mg_operators[level]->compute_inverse_diagonal(diagonal_vector);
+ 955 smoother_data[level].preconditioner =
+ 956 std::make_shared<SmootherPreconditionerType>(diagonal_vector);
+ 957 smoother_data[level].n_iterations =
+
+ 959 .mg_smoother_iterations;
+
+ 961 if (this->simulation_parameters.linear_solver
+
+ 963 .mg_smoother_eig_estimation)
+
+ 965 #if DEAL_II_VERSION_GTE(9, 6, 0)
+
+
+ 968 smoother_data[level].relaxation = 0.0;
+ 969 smoother_data[level].smoothing_range =
+ 970 this->simulation_parameters.linear_solver
+
+ 972 .eig_estimation_smoothing_range;
+ 973 smoother_data[level].eig_cg_n_iterations =
+ 974 this->simulation_parameters.linear_solver
+
+ 976 .eig_estimation_cg_n_iterations;
+ 977 smoother_data[level].eigenvalue_algorithm =
+ 978 SmootherType::AdditionalData::EigenvalueAlgorithm::power_iteration;
+ 979 smoother_data[level].constraints.copy_from(
+ 980 this->mg_operators[level]
+ 981 ->get_system_matrix_free()
+ 982 .get_affine_constraints());
+
+
+
+
+ 987 "The estimation of eigenvalues within LSMG requires a version of deal.II >= 9.6.0"));
+
+
+
+ 991 smoother_data[level].relaxation =
+ 992 this->simulation_parameters.linear_solver
+
+ 994 .mg_smoother_relaxation;
+
+
+ 997 mg_smoother->initialize(this->mg_operators, smoother_data);
+
+ 999 #if DEAL_II_VERSION_GTE(9, 6, 0)
+
+ 1001 .mg_smoother_eig_estimation &&
+
+
+
+
+ 1006 for (
unsigned int level = this->minlevel; level <= this->maxlevel;
+
+
+
+ 1010 this->mg_operators[level]->initialize_dof_vector(vec);
+
+ 1012 mg_smoother->smoothers[level].estimate_eigenvalues(vec);
+
+ 1014 this->pcout << std::endl;
+ 1015 this->pcout <<
" -Eigenvalue estimation level "
+ 1016 << level - this->minlevel <<
":" << std::endl;
+ 1017 this->pcout <<
" Relaxation parameter: "
+ 1018 << mg_smoother->smoothers[level].get_relaxation()
+
+ 1020 this->pcout <<
" Minimum eigenvalue: "
+ 1021 << evs.min_eigenvalue_estimate << std::endl;
+ 1022 this->pcout <<
" Maximum eigenvalue: "
+ 1023 << evs.max_eigenvalue_estimate << std::endl;
+ 1024 this->pcout << std::endl;
+
+
+
+
+
+
+ 1031 "The estimation of eigenvalues within LSMG requires a version of deal.II >= 9.6.0"));
+
+
+ 1034 this->mg_setup_timer.leave_subsection(
"Set up and initialize smoother");
+
+
+ 1037 this->mg_setup_timer.enter_subsection(
"Create coarse-grid solver");
+
+
+ 1040 .mg_coarse_grid_solver ==
+
+
+ 1043 const int max_iterations =
+
+ 1045 .mg_gmres_max_iterations;
+ 1046 const double tolerance =
+
+ 1048 .mg_gmres_tolerance;
+ 1049 const double reduce =
+
+
+ 1052 this->coarse_grid_solver_control = std::make_shared<ReductionControl>(
+ 1053 max_iterations, tolerance, reduce,
false,
false);
+ 1054 SolverGMRES<VectorType>::AdditionalData solver_parameters;
+ 1055 solver_parameters.max_n_tmp_vectors =
+
+ 1057 .mg_gmres_max_krylov_vectors;
+
+ 1059 this->coarse_grid_solver = std::make_shared<SolverGMRES<VectorType>>(
+ 1060 *this->coarse_grid_solver_control, solver_parameters);
+
+ 1062 if (this->simulation_parameters.linear_solver
+
+ 1064 .mg_gmres_preconditioner ==
+
+
+
+
+ 1069 this->mg_coarse = std::make_shared<
+
+ 1071 SolverGMRES<VectorType>,
+
+ 1073 TrilinosWrappers::PreconditionAMG>>(
+ 1074 *this->coarse_grid_solver,
+ 1075 *this->mg_operators[this->minlevel],
+ 1076 *this->precondition_amg);
+
+ 1078 else if (this->simulation_parameters.linear_solver
+
+ 1080 .mg_gmres_preconditioner ==
+
+
+
+
+ 1085 this->mg_coarse = std::make_shared<
+
+ 1087 SolverGMRES<VectorType>,
+
+ 1089 TrilinosWrappers::PreconditionILU>>(
+ 1090 *this->coarse_grid_solver,
+ 1091 *this->mg_operators[this->minlevel],
+ 1092 *this->precondition_ilu);
+
1095 else if (this->simulation_parameters.linear_solver
1097 .mg_coarse_grid_solver ==
-
+
- 1100 #if DEAL_II_VERSION_GTE(9, 6, 0)
- 1101 TrilinosWrappers::SolverDirect::AdditionalData data;
- 1102 this->direct_solver_control =
- 1103 std::make_shared<SolverControl>(100, 1.e-10);
-
- 1105 this->precondition_direct =
- 1106 std::make_shared<TrilinosWrappers::SolverDirect>(
- 1107 *this->direct_solver_control, data);
-
- 1109 this->precondition_direct->initialize(
- 1110 this->mg_operators[this->minlevel]->get_system_matrix());
-
- 1112 this->mg_coarse = std::make_shared<
-
- 1114 TrilinosWrappers::SolverDirect>>(
- 1115 *this->precondition_direct);
-
-
-
-
- 1120 "The usage of a direct solver as coarse grid solver requires a version of deal.II >= 9.6.0"));
-
-
-
-
-
- 1126 .mg_coarse_grid_solver ==
-
-
- 1129 .mg_coarse_grid_solver ==
-
-
- 1132 .mg_coarse_grid_solver ==
-
-
- 1135 .mg_coarse_grid_solver ==
-
-
- 1138 "This coarse-grid solver is not supported. Supported options are <gmres|amg|ilu|direct>."));
-
- 1140 this->mg_setup_timer.leave_subsection(
"Create coarse-grid solver");
-
-
-
-
-
-
- 1147 this->mg_interface_matrix_in =
- 1148 std::make_shared<mg::Matrix<VectorType>>(this->ls_mg_interface_in);
-
-
- 1151 this->mg = std::make_shared<Multigrid<VectorType>>(*this->mg_matrix,
-
- 1153 *this->mg_transfer_ls,
-
-
-
-
- 1158 if (this->dof_handler.get_triangulation().has_hanging_nodes())
- 1159 this->mg->set_edge_in_matrix(*this->mg_interface_matrix_in);
-
-
- 1162 this->ls_multigrid_preconditioner =
- 1163 std::make_shared<PreconditionMG<dim, VectorType, LSTransferType>>(
- 1164 this->dof_handler, *this->mg, *this->mg_transfer_ls);
-
- 1166 else if (this->simulation_parameters.linear_solver
-
-
-
-
-
- 1172 this->mg = std::make_shared<Multigrid<VectorType>>(*this->mg_matrix,
-
- 1174 *this->mg_transfer_gc,
-
- 1176 *this->mg_smoother);
-
-
- 1179 this->gc_multigrid_preconditioner =
- 1180 std::make_shared<PreconditionMG<dim, VectorType, GCTransferType>>(
- 1181 this->dof_handler, *this->mg, *this->mg_transfer_gc);
-
-
-
- 1185 const auto create_mg_timer_function = [&](
const std::string &label) {
- 1186 return [label,
this](
const bool flag,
const unsigned int level) {
- 1187 const std::string label_full =
-
- 1189 (
"gmg::vmult::level_" + std::to_string(level)) :
- 1190 (
"gmg::vmult::level_" + std::to_string(level) +
"::" + label);
-
-
- 1193 this->mg_vmult_timer.enter_subsection(label_full);
-
- 1195 this->mg_vmult_timer.leave_subsection(label_full);
-
-
-
- 1199 this->mg->connect_pre_smoother_step(
- 1200 create_mg_timer_function(
"0_pre_smoother_step"));
- 1201 this->mg->connect_residual_step(create_mg_timer_function(
"1_residual_step"));
- 1202 this->mg->connect_restriction(create_mg_timer_function(
"2_restriction"));
- 1203 this->mg->connect_coarse_solve(create_mg_timer_function(
""));
- 1204 this->mg->connect_prolongation(create_mg_timer_function(
"3_prolongation"));
- 1205 this->mg->connect_edge_prolongation(
- 1206 create_mg_timer_function(
"4_edge_prolongation"));
- 1207 this->mg->connect_post_smoother_step(
- 1208 create_mg_timer_function(
"5_post_smoother_step"));
-
-
- 1211 const auto create_mg_precon_timer_function = [&](
const std::string &label) {
- 1212 return [label,
this](
const bool flag) {
- 1213 const std::string label_full =
"gmg::vmult::" + label;
-
-
- 1216 this->mg_vmult_timer.enter_subsection(label_full);
-
- 1218 this->mg_vmult_timer.leave_subsection(label_full);
-
-
-
-
-
-
- 1225 this->ls_multigrid_preconditioner->connect_transfer_to_mg(
- 1226 create_mg_precon_timer_function(
"transfer_to_mg"));
- 1227 this->ls_multigrid_preconditioner->connect_transfer_to_global(
- 1228 create_mg_precon_timer_function(
"transfer_to_global"));
-
- 1230 else if (this->simulation_parameters.linear_solver
-
-
-
-
- 1235 this->gc_multigrid_preconditioner->connect_transfer_to_mg(
- 1236 create_mg_precon_timer_function(
"transfer_to_mg"));
- 1237 this->gc_multigrid_preconditioner->connect_transfer_to_global(
- 1238 create_mg_precon_timer_function(
"transfer_to_global"));
-
-
-
-
-
-
-
-
- 1247 if (this->ls_multigrid_preconditioner)
- 1248 this->ls_multigrid_preconditioner->vmult(dst, src);
- 1249 else if (this->gc_multigrid_preconditioner)
- 1250 this->gc_multigrid_preconditioner->vmult(dst, src);
-
- 1252 AssertThrow(
false, ExcNotImplemented());
-
-
-
- 1256 .mg_coarse_grid_solver ==
-
- 1258 this->coarse_grid_iterations.emplace_back(
- 1259 this->coarse_grid_solver_control->last_step());
-
-
-
-
-
-
-
- 1267 .mg_coarse_grid_solver ==
-
-
- 1270 if (this->coarse_grid_iterations.empty())
- 1271 this->pcout <<
" -Coarse grid solver took: 0 iterations" << std::endl;
-
-
- 1274 unsigned int total = this->coarse_grid_iterations[0];
- 1275 this->pcout <<
" -Coarse grid solver took: "
- 1276 << this->coarse_grid_iterations[0];
- 1277 for (
unsigned int i = 1; i < this->coarse_grid_iterations.size(); i++)
-
- 1279 this->pcout <<
" + " << this->coarse_grid_iterations[i];
- 1280 total += this->coarse_grid_iterations[i];
-
- 1282 this->pcout <<
" = " << total <<
" iterations" << std::endl;
-
- 1284 this->coarse_grid_iterations.clear();
-
-
-
-
-
- 1290 const MGLevelObject<std::shared_ptr<NavierStokesOperatorBase<dim, double>>> &
-
-
- 1293 return this->mg_operators;
-
-
-
-
-
-
- 1300 TrilinosWrappers::PreconditionAMG::AdditionalData amg_data;
-
-
- 1303 const TrilinosWrappers::SparseMatrix &min_level_matrix =
- 1304 this->mg_operators[this->minlevel]->get_system_matrix();
-
-
- 1307 .mg_amg_use_default_parameters)
-
- 1309 amg_data.elliptic =
false;
- 1310 if (this->dof_handler.get_fe().degree > 1)
- 1311 amg_data.higher_order_elements =
true;
-
-
-
-
-
-
- 1318 amg_data.aggregation_threshold =
-
- 1320 .amg_aggregation_threshold;
- 1321 amg_data.smoother_sweeps =
-
- 1323 .amg_smoother_sweeps;
- 1324 amg_data.smoother_overlap =
-
- 1326 .amg_smoother_overlap;
- 1327 amg_data.output_details =
false;
- 1328 amg_data.smoother_type =
"ILU";
- 1329 amg_data.coarse_type =
"ILU";
-
- 1331 std::vector<std::vector<bool>> constant_modes;
- 1332 ComponentMask components(dim + 1,
true);
- 1333 if (this->simulation_parameters.linear_solver
-
-
-
-
-
- 1339 #if DEAL_II_VERSION_GTE(9, 6, 0)
-
- 1341 DoFTools::extract_level_constant_modes(this->minlevel,
-
-
-
-
-
-
-
- 1349 "The extraction of constant modes for the AMG coarse-grid solver requires a version of deal.II >= 9.6.0"));
-
-
- 1352 else if (this->simulation_parameters.linear_solver
-
-
-
-
-
- 1358 DoFTools::extract_constant_modes(this->dof_handlers[this->minlevel],
-
-
-
-
- 1363 amg_data.constant_modes = constant_modes;
-
- 1365 Teuchos::ParameterList parameter_ml;
- 1366 std::unique_ptr<Epetra_MultiVector> distributed_constant_modes;
- 1367 amg_data.set_parameters(parameter_ml,
- 1368 distributed_constant_modes,
-
-
- 1371 const double ilu_fill =
-
- 1373 .amg_precond_ilu_fill;
- 1374 const double ilu_atol =
-
- 1376 .amg_precond_ilu_atol;
- 1377 const double ilu_rtol =
-
- 1379 .amg_precond_ilu_rtol;
- 1380 parameter_ml.set(
"smoother: ifpack level-of-fill", ilu_fill);
- 1381 parameter_ml.set(
"smoother: ifpack absolute threshold", ilu_atol);
- 1382 parameter_ml.set(
"smoother: ifpack relative threshold", ilu_rtol);
-
- 1384 parameter_ml.set(
"coarse: ifpack level-of-fill", ilu_fill);
- 1385 parameter_ml.set(
"coarse: ifpack absolute threshold", ilu_atol);
- 1386 parameter_ml.set(
"coarse: ifpack relative threshold", ilu_rtol);
-
- 1388 this->precondition_amg =
- 1389 std::make_shared<TrilinosWrappers::PreconditionAMG>();
-
- 1391 this->precondition_amg->initialize(min_level_matrix, parameter_ml);
-
-
-
- 1395 this->precondition_amg =
- 1396 std::make_shared<TrilinosWrappers::PreconditionAMG>();
-
- 1398 this->precondition_amg->initialize(min_level_matrix, amg_data);
-
-
-
-
-
-
-
- 1406 int current_preconditioner_fill_level =
-
-
- 1409 const double ilu_atol =
-
-
- 1412 const double ilu_rtol =
-
-
- 1415 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
- 1416 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
-
- 1418 this->precondition_ilu =
- 1419 std::make_shared<TrilinosWrappers::PreconditionILU>();
-
- 1421 this->precondition_ilu->initialize(
- 1422 this->mg_operators[this->minlevel]->get_system_matrix(),
- 1423 preconditionerOptions);
+
+
+ 1102 this->mg_coarse = std::make_shared<
+
+ 1104 TrilinosWrappers::PreconditionAMG>>(
+ 1105 *this->precondition_amg);
+
+ 1107 else if (this->simulation_parameters.linear_solver
+
+ 1109 .mg_coarse_grid_solver ==
+
+
+
+
+ 1114 this->mg_coarse = std::make_shared<
+
+ 1116 TrilinosWrappers::PreconditionILU>>(
+ 1117 *this->precondition_ilu);
+
+ 1119 else if (this->simulation_parameters.linear_solver
+
+ 1121 .mg_coarse_grid_solver ==
+
+
+ 1124 #if DEAL_II_VERSION_GTE(9, 6, 0)
+ 1125 TrilinosWrappers::SolverDirect::AdditionalData data;
+ 1126 this->direct_solver_control =
+ 1127 std::make_shared<SolverControl>(100, 1.e-10);
+
+ 1129 this->precondition_direct =
+ 1130 std::make_shared<TrilinosWrappers::SolverDirect>(
+ 1131 *this->direct_solver_control, data);
+
+ 1133 this->precondition_direct->initialize(
+ 1134 this->mg_operators[this->minlevel]->get_system_matrix());
+
+ 1136 this->mg_coarse = std::make_shared<
+
+ 1138 TrilinosWrappers::SolverDirect>>(
+ 1139 *this->precondition_direct);
+
+
+
+
+ 1144 "The usage of a direct solver as coarse grid solver requires a version of deal.II >= 9.6.0"));
+
+
+
+
+
+ 1150 .mg_coarse_grid_solver ==
+
+
+ 1153 .mg_coarse_grid_solver ==
+
+
+ 1156 .mg_coarse_grid_solver ==
+
+
+ 1159 .mg_coarse_grid_solver ==
+
+
+ 1162 "This coarse-grid solver is not supported. Supported options are <gmres|amg|ilu|direct>."));
+
+ 1164 this->mg_setup_timer.leave_subsection(
"Create coarse-grid solver");
+
+
+
+
+
+
+ 1171 this->mg_interface_matrix_in =
+ 1172 std::make_shared<mg::Matrix<VectorType>>(this->ls_mg_interface_in);
+
+
+ 1175 this->mg = std::make_shared<Multigrid<VectorType>>(*this->mg_matrix,
+
+ 1177 *this->mg_transfer_ls,
+
+
+
+
+ 1182 if (this->dof_handler.get_triangulation().has_hanging_nodes())
+ 1183 this->mg->set_edge_in_matrix(*this->mg_interface_matrix_in);
+
+
+ 1186 this->ls_multigrid_preconditioner =
+ 1187 std::make_shared<PreconditionMG<dim, VectorType, LSTransferType>>(
+ 1188 this->dof_handler, *this->mg, *this->mg_transfer_ls);
+
+ 1190 else if (this->simulation_parameters.linear_solver
+
+
+
+
+
+ 1196 this->mg = std::make_shared<Multigrid<VectorType>>(*this->mg_matrix,
+
+ 1198 *this->mg_transfer_gc,
+
+ 1200 *this->mg_smoother);
+
+
+ 1203 this->gc_multigrid_preconditioner =
+ 1204 std::make_shared<PreconditionMG<dim, VectorType, GCTransferType>>(
+ 1205 this->dof_handler, *this->mg, *this->mg_transfer_gc);
+
+
+
+ 1209 const auto create_mg_timer_function = [&](
const std::string &label) {
+ 1210 return [label,
this](
const bool flag,
const unsigned int level) {
+ 1211 const std::string label_full =
+
+ 1213 (
"gmg::vmult::level_" + std::to_string(level)) :
+ 1214 (
"gmg::vmult::level_" + std::to_string(level) +
"::" + label);
+
+
+ 1217 this->mg_vmult_timer.enter_subsection(label_full);
+
+ 1219 this->mg_vmult_timer.leave_subsection(label_full);
+
+
+
+ 1223 this->mg->connect_pre_smoother_step(
+ 1224 create_mg_timer_function(
"0_pre_smoother_step"));
+ 1225 this->mg->connect_residual_step(create_mg_timer_function(
"1_residual_step"));
+ 1226 this->mg->connect_restriction(create_mg_timer_function(
"2_restriction"));
+ 1227 this->mg->connect_coarse_solve(create_mg_timer_function(
""));
+ 1228 this->mg->connect_prolongation(create_mg_timer_function(
"3_prolongation"));
+ 1229 this->mg->connect_edge_prolongation(
+ 1230 create_mg_timer_function(
"4_edge_prolongation"));
+ 1231 this->mg->connect_post_smoother_step(
+ 1232 create_mg_timer_function(
"5_post_smoother_step"));
+
+
+ 1235 const auto create_mg_precon_timer_function = [&](
const std::string &label) {
+ 1236 return [label,
this](
const bool flag) {
+ 1237 const std::string label_full =
"gmg::vmult::" + label;
+
+
+ 1240 this->mg_vmult_timer.enter_subsection(label_full);
+
+ 1242 this->mg_vmult_timer.leave_subsection(label_full);
+
+
+
+
+
+
+ 1249 this->ls_multigrid_preconditioner->connect_transfer_to_mg(
+ 1250 create_mg_precon_timer_function(
"transfer_to_mg"));
+ 1251 this->ls_multigrid_preconditioner->connect_transfer_to_global(
+ 1252 create_mg_precon_timer_function(
"transfer_to_global"));
+
+ 1254 else if (this->simulation_parameters.linear_solver
+
+
+
+
+ 1259 this->gc_multigrid_preconditioner->connect_transfer_to_mg(
+ 1260 create_mg_precon_timer_function(
"transfer_to_mg"));
+ 1261 this->gc_multigrid_preconditioner->connect_transfer_to_global(
+ 1262 create_mg_precon_timer_function(
"transfer_to_global"));
+
+
+
+
+
+
+
+
+ 1271 if (this->ls_multigrid_preconditioner)
+ 1272 this->ls_multigrid_preconditioner->vmult(dst, src);
+ 1273 else if (this->gc_multigrid_preconditioner)
+ 1274 this->gc_multigrid_preconditioner->vmult(dst, src);
+
+ 1276 AssertThrow(
false, ExcNotImplemented());
+
+
+
+ 1280 .mg_coarse_grid_solver ==
+
+ 1282 this->coarse_grid_iterations.emplace_back(
+ 1283 this->coarse_grid_solver_control->last_step());
+
+
+
+
+
+
+
+ 1291 .mg_coarse_grid_solver ==
+
+
+ 1294 if (this->coarse_grid_iterations.empty())
+ 1295 this->pcout <<
" -Coarse grid solver took: 0 iterations" << std::endl;
+
+
+ 1298 unsigned int total = this->coarse_grid_iterations[0];
+ 1299 this->pcout <<
" -Coarse grid solver took: "
+ 1300 << this->coarse_grid_iterations[0];
+ 1301 for (
unsigned int i = 1; i < this->coarse_grid_iterations.size(); i++)
+
+ 1303 this->pcout <<
" + " << this->coarse_grid_iterations[i];
+ 1304 total += this->coarse_grid_iterations[i];
+
+ 1306 this->pcout <<
" = " << total <<
" iterations" << std::endl;
+
+ 1308 this->coarse_grid_iterations.clear();
+
+
+
+
+
+ 1314 const MGLevelObject<std::shared_ptr<NavierStokesOperatorBase<dim, double>>> &
+
+
+ 1317 return this->mg_operators;
+
+
+
+
+
+
+ 1324 TrilinosWrappers::PreconditionAMG::AdditionalData amg_data;
+
+
+ 1327 const TrilinosWrappers::SparseMatrix &min_level_matrix =
+ 1328 this->mg_operators[this->minlevel]->get_system_matrix();
+
+
+ 1331 .mg_amg_use_default_parameters)
+
+ 1333 amg_data.elliptic =
false;
+ 1334 if (this->dof_handler.get_fe().degree > 1)
+ 1335 amg_data.higher_order_elements =
true;
+
+
+
+
+
+
+ 1342 amg_data.aggregation_threshold =
+
+ 1344 .amg_aggregation_threshold;
+ 1345 amg_data.smoother_sweeps =
+
+ 1347 .amg_smoother_sweeps;
+ 1348 amg_data.smoother_overlap =
+
+ 1350 .amg_smoother_overlap;
+ 1351 amg_data.output_details =
false;
+ 1352 amg_data.smoother_type =
"ILU";
+ 1353 amg_data.coarse_type =
"ILU";
+
+ 1355 std::vector<std::vector<bool>> constant_modes;
+ 1356 ComponentMask components(dim + 1,
true);
+ 1357 if (this->simulation_parameters.linear_solver
+
+
+
+
+
+ 1363 #if DEAL_II_VERSION_GTE(9, 6, 0)
+
+ 1365 DoFTools::extract_level_constant_modes(this->minlevel,
+
+
+
+
+
+
+
+ 1373 "The extraction of constant modes for the AMG coarse-grid solver requires a version of deal.II >= 9.6.0"));
+
+
+ 1376 else if (this->simulation_parameters.linear_solver
+
+
+
+
+
+ 1382 DoFTools::extract_constant_modes(this->dof_handlers[this->minlevel],
+
+
+
+
+ 1387 amg_data.constant_modes = constant_modes;
+
+ 1389 Teuchos::ParameterList parameter_ml;
+ 1390 std::unique_ptr<Epetra_MultiVector> distributed_constant_modes;
+ 1391 amg_data.set_parameters(parameter_ml,
+ 1392 distributed_constant_modes,
+
+
+ 1395 const double ilu_fill =
+
+ 1397 .amg_precond_ilu_fill;
+ 1398 const double ilu_atol =
+
+ 1400 .amg_precond_ilu_atol;
+ 1401 const double ilu_rtol =
+
+ 1403 .amg_precond_ilu_rtol;
+ 1404 parameter_ml.set(
"smoother: ifpack level-of-fill", ilu_fill);
+ 1405 parameter_ml.set(
"smoother: ifpack absolute threshold", ilu_atol);
+ 1406 parameter_ml.set(
"smoother: ifpack relative threshold", ilu_rtol);
+
+ 1408 parameter_ml.set(
"coarse: ifpack level-of-fill", ilu_fill);
+ 1409 parameter_ml.set(
"coarse: ifpack absolute threshold", ilu_atol);
+ 1410 parameter_ml.set(
"coarse: ifpack relative threshold", ilu_rtol);
+
+ 1412 this->precondition_amg =
+ 1413 std::make_shared<TrilinosWrappers::PreconditionAMG>();
+
+ 1415 this->precondition_amg->initialize(min_level_matrix, parameter_ml);
+
+
+
+ 1419 this->precondition_amg =
+ 1420 std::make_shared<TrilinosWrappers::PreconditionAMG>();
+
+ 1422 this->precondition_amg->initialize(min_level_matrix, amg_data);
+
-
-
-
-
-
-
-
-
- 1435 "Matrix free Navier-Stokes does not support different orders for the velocity and the pressure!"));
-
- 1437 this->
fe = std::make_shared<FESystem<dim>>(
-
-
-
- 1441 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
-
-
-
-
-
-
-
-
-
-
- 1452 this->dof_handler.clear();
-
-
-
-
-
-
- 1459 this->computing_timer.enter_subsection(
"Read mesh and manifolds");
+
+
+
+ 1430 int current_preconditioner_fill_level =
+
+
+ 1433 const double ilu_atol =
+
+
+ 1436 const double ilu_rtol =
+
+
+ 1439 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
+ 1440 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
+
+ 1442 this->precondition_ilu =
+ 1443 std::make_shared<TrilinosWrappers::PreconditionILU>();
+
+ 1445 this->precondition_ilu->initialize(
+ 1446 this->mg_operators[this->minlevel]->get_system_matrix(),
+ 1447 preconditionerOptions);
+
+
+
+
+
+
+
+
+
+
+
+ 1459 "Matrix free Navier-Stokes does not support different orders for the velocity and the pressure!"));
-
- 1462 *this->triangulation,
- 1463 this->simulation_parameters.mesh,
- 1464 this->simulation_parameters.manifolds_parameters,
- 1465 this->simulation_parameters.restart_parameters.restart,
- 1466 this->simulation_parameters.boundary_conditions);
-
- 1468 this->computing_timer.leave_subsection(
"Read mesh and manifolds");
-
-
- 1471 this->set_initial_condition(
- 1472 this->simulation_parameters.initial_condition->type,
- 1473 this->simulation_parameters.restart_parameters.restart);
-
-
- 1476 if (this->multiphysics->get_active_physics().size() > 1)
- 1477 this->update_multiphysics_time_average_solution();
+ 1461 this->
fe = std::make_shared<FESystem<dim>>(
+
+
+
+ 1465 std::make_shared<NavierStokesStabilizedOperator<dim, double>>();
+
+
+
+
+
+
+
+
+
+
+ 1476 this->dof_handler.clear();
+
- 1479 while (this->simulation_control->integrate())
-
- 1481 if (this->forcing_function)
- 1482 this->forcing_function->set_time(
- 1483 this->simulation_control->get_current_time());
+
+
+
+
+ 1483 this->computing_timer.enter_subsection(
"Read mesh and manifolds");
- 1485 bool refinement_step;
- 1486 if (this->simulation_parameters.mesh_adaptation.refinement_at_frequency)
-
- 1488 this->simulation_control->get_step_number() %
- 1489 this->simulation_parameters.mesh_adaptation.frequency !=
-
-
- 1492 refinement_step = this->simulation_control->get_step_number() == 0;
- 1493 if ((refinement_step ||
- 1494 this->simulation_parameters.mesh_adaptation.type ==
-
- 1496 this->simulation_control->is_at_start()) &&
- 1497 this->simulation_parameters.boundary_conditions.time_dependent)
-
- 1499 update_boundary_conditions();
- 1500 this->multiphysics->update_boundary_conditions();
-
+
+ 1486 *this->triangulation,
+ 1487 this->simulation_parameters.mesh,
+ 1488 this->simulation_parameters.manifolds_parameters,
+ 1489 this->simulation_parameters.restart_parameters.restart,
+ 1490 this->simulation_parameters.boundary_conditions);
+
+ 1492 this->computing_timer.leave_subsection(
"Read mesh and manifolds");
+
+
+ 1495 this->set_initial_condition(
+ 1496 this->simulation_parameters.initial_condition->type,
+ 1497 this->simulation_parameters.restart_parameters.restart);
+
+
+ 1500 if (this->multiphysics->get_active_physics().size() > 1)
+ 1501 this->update_multiphysics_time_average_solution();
- 1503 this->simulation_control->print_progression(this->pcout);
- 1504 this->dynamic_flow_control();
-
- 1506 if (!this->simulation_control->is_at_start())
-
-
-
-
- 1511 if (
is_bdf(this->simulation_control->get_assembly_method()))
-
- 1513 this->computing_timer.enter_subsection(
- 1514 "Calculate time derivative previous solutions");
-
- 1516 calculate_time_derivative_previous_solutions();
- 1517 this->time_derivative_previous_solutions.update_ghost_values();
- 1518 this->system_operator->evaluate_time_derivative_previous_solutions(
- 1519 this->time_derivative_previous_solutions);
-
- 1521 this->computing_timer.leave_subsection(
- 1522 "Calculate time derivative previous solutions");
-
- 1524 if (this->simulation_parameters.flow_control.enable_flow_control)
- 1525 this->system_operator->update_beta_force(
- 1526 this->flow_control.get_beta());
-
-
-
-
-
- 1532 if (this->multiphysics->get_active_physics().size() > 1)
- 1533 update_solutions_for_multiphysics();
+ 1503 while (this->simulation_control->integrate())
+
+ 1505 if (this->forcing_function)
+ 1506 this->forcing_function->set_time(
+ 1507 this->simulation_control->get_current_time());
+
+ 1509 bool refinement_step;
+ 1510 if (this->simulation_parameters.mesh_adaptation.refinement_at_frequency)
+
+ 1512 this->simulation_control->get_step_number() %
+ 1513 this->simulation_parameters.mesh_adaptation.frequency !=
+
+
+ 1516 refinement_step = this->simulation_control->get_step_number() == 0;
+ 1517 if ((refinement_step ||
+ 1518 this->simulation_parameters.mesh_adaptation.type ==
+
+ 1520 this->simulation_control->is_at_start()) &&
+ 1521 this->simulation_parameters.boundary_conditions.time_dependent)
+
+ 1523 update_boundary_conditions();
+ 1524 this->multiphysics->update_boundary_conditions();
+
+
+ 1527 this->simulation_control->print_progression(this->pcout);
+ 1528 this->dynamic_flow_control();
+
+ 1530 if (!this->simulation_control->is_at_start())
+
+
+
-
- 1536 this->postprocess(
false);
- 1537 this->finish_time_step();
-
- 1539 if (this->simulation_parameters.timer.type ==
-
- 1541 print_mg_setup_times();
-
-
-
- 1545 print_mg_setup_times();
-
- 1547 this->finish_simulation();
-
-
-
-
-
-
- 1554 TimerOutput::Scope t(this->computing_timer,
"Setup DoFs");
-
-
- 1557 ilu_preconditioner.reset();
- 1558 gmg_preconditioner.reset();
-
-
- 1561 this->system_operator->clear();
+ 1535 if (
is_bdf(this->simulation_control->get_assembly_method()))
+
+ 1537 this->computing_timer.enter_subsection(
+ 1538 "Calculate time derivative previous solutions");
+
+ 1540 calculate_time_derivative_previous_solutions();
+ 1541 this->time_derivative_previous_solutions.update_ghost_values();
+ 1542 this->system_operator->evaluate_time_derivative_previous_solutions(
+ 1543 this->time_derivative_previous_solutions);
+
+ 1545 this->computing_timer.leave_subsection(
+ 1546 "Calculate time derivative previous solutions");
+
+ 1548 if (this->simulation_parameters.flow_control.enable_flow_control)
+ 1549 this->system_operator->update_beta_force(
+ 1550 this->flow_control.get_beta());
+
+
+
+
+
+ 1556 if (this->multiphysics->get_active_physics().size() > 1)
+ 1557 update_solutions_for_multiphysics();
+
+
+ 1560 this->postprocess(
false);
+ 1561 this->finish_time_step();
-
- 1564 this->dof_handler.distribute_dofs(*this->fe);
-
-
-
-
- 1569 this->dof_handler.distribute_mg_dofs();
+ 1563 if (this->simulation_parameters.timer.type ==
+
+ 1565 print_mg_setup_times();
+
+
+
+ 1569 print_mg_setup_times();
-
-
- 1573 if (this->simulation_parameters.linear_solver
-
- 1575 .mg_use_fe_q_iso_q1)
-
- 1577 this->dof_handler_fe_q_iso_q1.reinit(*this->triangulation);
-
-
- 1580 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
-
-
- 1583 this->dof_handler_fe_q_iso_q1.distribute_dofs(
- 1584 FESystem<dim>(FE_Q_iso_Q1<dim>(points), dim + 1));
- 1585 this->dof_handler_fe_q_iso_q1.distribute_mg_dofs();
-
-
-
- 1589 this->locally_owned_dofs = this->dof_handler.locally_owned_dofs();
- 1590 this->locally_relevant_dofs =
- 1591 DoFTools::extract_locally_relevant_dofs(this->dof_handler);
-
-
- 1594 define_non_zero_constraints();
-
-
- 1597 define_zero_constraints();
-
-
- 1600 unsigned int mg_level = numbers::invalid_unsigned_int;
- 1601 this->system_operator->reinit(
-
-
- 1604 this->zero_constraints,
- 1605 *this->cell_quadrature,
- 1606 this->forcing_function,
- 1607 this->simulation_parameters.physical_properties_manager
- 1608 .get_kinematic_viscosity_scale(),
- 1609 this->simulation_parameters.stabilization.stabilization,
-
- 1611 this->simulation_control,
-
- 1613 .enable_hessians_jacobian,
-
- 1615 .enable_hessians_residual);
+ 1571 this->finish_simulation();
+
+
+
+
+
+
+ 1578 TimerOutput::Scope t(this->computing_timer,
"Setup DoFs");
+
+
+ 1581 ilu_preconditioner.reset();
+ 1582 gmg_preconditioner.reset();
+
+
+ 1585 this->system_operator->clear();
+
+
+ 1588 this->dof_handler.distribute_dofs(*this->fe);
+
+
+
+
+ 1593 this->dof_handler.distribute_mg_dofs();
+
+
+
+ 1597 if (this->simulation_parameters.linear_solver
+
+ 1599 .mg_use_fe_q_iso_q1)
+
+ 1601 this->dof_handler_fe_q_iso_q1.reinit(*this->triangulation);
+
+
+ 1604 QGaussLobatto<1>(this->dof_handler.get_fe().degree + 1)
+
+
+ 1607 this->dof_handler_fe_q_iso_q1.distribute_dofs(
+ 1608 FESystem<dim>(FE_Q_iso_Q1<dim>(points), dim + 1));
+ 1609 this->dof_handler_fe_q_iso_q1.distribute_mg_dofs();
+
+
+
+ 1613 this->locally_owned_dofs = this->dof_handler.locally_owned_dofs();
+ 1614 this->locally_relevant_dofs =
+ 1615 DoFTools::extract_locally_relevant_dofs(this->dof_handler);
-
-
- 1619 this->system_operator->initialize_dof_vector(this->present_solution);
- 1620 this->system_operator->initialize_dof_vector(this->evaluation_point);
- 1621 this->system_operator->initialize_dof_vector(this->newton_update);
- 1622 this->system_operator->initialize_dof_vector(this->system_rhs);
- 1623 this->system_operator->initialize_dof_vector(this->local_evaluation_point);
- 1624 this->system_operator->initialize_dof_vector(
- 1625 this->time_derivative_previous_solutions);
-
-
- 1628 for (
auto &solution : this->previous_solutions)
-
- 1630 this->system_operator->initialize_dof_vector(solution);
-
-
- 1633 if (this->simulation_parameters.post_processing.calculate_average_velocities)
-
- 1635 this->average_velocities->initialize_vectors(
- 1636 this->locally_owned_dofs,
- 1637 this->locally_relevant_dofs,
- 1638 this->fe->n_dofs_per_vertex(),
- 1639 this->mpi_communicator);
+
+ 1618 define_non_zero_constraints();
+
+
+ 1621 define_zero_constraints();
+
+
+ 1624 unsigned int mg_level = numbers::invalid_unsigned_int;
+ 1625 this->system_operator->reinit(
+
+
+ 1628 this->zero_constraints,
+ 1629 *this->cell_quadrature,
+ 1630 this->forcing_function,
+ 1631 this->simulation_parameters.physical_properties_manager
+ 1632 .get_kinematic_viscosity_scale(),
+ 1633 this->simulation_parameters.stabilization.stabilization,
+
+ 1635 this->simulation_control,
+
+ 1637 .enable_hessians_jacobian,
+
+ 1639 .enable_hessians_residual);
-
-
- 1643 this->multiphysics_average_velocities.reinit(this->locally_owned_dofs,
- 1644 this->locally_relevant_dofs,
- 1645 this->mpi_communicator);
-
- 1647 if (this->simulation_parameters.restart_parameters.checkpoint)
-
- 1649 this->average_velocities->initialize_checkpoint_vectors(
- 1650 this->locally_owned_dofs,
- 1651 this->locally_relevant_dofs,
- 1652 this->mpi_communicator);
-
-
-
- 1656 double global_volume =
- 1657 GridTools::volume(*this->triangulation, *this->mapping);
-
- 1659 this->pcout <<
" Number of active cells: "
- 1660 << this->triangulation->n_global_active_cells() << std::endl
- 1661 <<
" Number of degrees of freedom: "
- 1662 << this->dof_handler.n_dofs() << std::endl;
- 1663 this->pcout <<
" Volume of triangulation: " << global_volume
-
-
-
- 1667 this->multiphysics_present_solution.reinit(this->locally_owned_dofs,
- 1668 this->locally_relevant_dofs,
- 1669 this->mpi_communicator);
+
+
+ 1643 this->system_operator->initialize_dof_vector(this->present_solution);
+ 1644 this->system_operator->initialize_dof_vector(this->evaluation_point);
+ 1645 this->system_operator->initialize_dof_vector(this->newton_update);
+ 1646 this->system_operator->initialize_dof_vector(this->system_rhs);
+ 1647 this->system_operator->initialize_dof_vector(this->local_evaluation_point);
+ 1648 this->system_operator->initialize_dof_vector(
+ 1649 this->time_derivative_previous_solutions);
+
+
+ 1652 for (
auto &solution : this->previous_solutions)
+
+ 1654 this->system_operator->initialize_dof_vector(solution);
+
+
+ 1657 if (this->simulation_parameters.post_processing.calculate_average_velocities)
+
+ 1659 this->average_velocities->initialize_vectors(
+ 1660 this->locally_owned_dofs,
+ 1661 this->locally_relevant_dofs,
+ 1662 this->fe->n_dofs_per_vertex(),
+ 1663 this->mpi_communicator);
+
+
+
+ 1667 this->multiphysics_average_velocities.reinit(this->locally_owned_dofs,
+ 1668 this->locally_relevant_dofs,
+ 1669 this->mpi_communicator);
-
-
- 1673 this->multiphysics_previous_solutions.resize(
- 1674 this->simulation_control->get_number_of_previous_solution_in_assembly());
-
- 1676 for (
auto &solution : this->multiphysics_previous_solutions)
- 1677 solution.reinit(this->locally_owned_dofs,
- 1678 this->locally_relevant_dofs,
- 1679 this->mpi_communicator);
-
-
-
- 1683 if (this->multiphysics->get_active_physics().size() > 1)
- 1684 update_solutions_for_multiphysics();
-
-
-
-
-
-
- 1691 if (this->simulation_parameters.boundary_conditions.time_dependent)
-
- 1693 double time = this->simulation_control->get_current_time();
- 1694 for (
unsigned int i_bc = 0;
- 1695 i_bc < this->simulation_parameters.boundary_conditions.size;
-
-
- 1698 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 1700 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 1702 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 1704 this->simulation_parameters.boundary_conditions
- 1705 .bcPressureFunction[i_bc]
-
-
- 1708 define_non_zero_constraints();
-
- 1710 auto &nonzero_constraints = this->nonzero_constraints;
- 1711 nonzero_constraints.distribute(this->local_evaluation_point);
- 1712 this->present_solution = this->local_evaluation_point;
-
-
-
-
-
-
-
-
-
-
- 1723 TimerOutput::Scope t(this->computing_timer,
"Set initial conditions");
-
-
-
- 1727 this->pcout <<
"************************" << std::endl;
- 1728 this->pcout <<
"---> Simulation Restart " << std::endl;
- 1729 this->pcout <<
"************************" << std::endl;
-
-
-
-
- 1734 this->set_nodal_values();
- 1735 this->present_solution.update_ghost_values();
- 1736 this->finish_time_step();
+ 1671 if (this->simulation_parameters.restart_parameters.checkpoint)
+
+ 1673 this->average_velocities->initialize_checkpoint_vectors(
+ 1674 this->locally_owned_dofs,
+ 1675 this->locally_relevant_dofs,
+ 1676 this->mpi_communicator);
+
+
+
+ 1680 double global_volume =
+ 1681 GridTools::volume(*this->triangulation, *this->mapping);
+
+ 1683 this->pcout <<
" Number of active cells: "
+ 1684 << this->triangulation->n_global_active_cells() << std::endl
+ 1685 <<
" Number of degrees of freedom: "
+ 1686 << this->dof_handler.n_dofs() << std::endl;
+ 1687 this->pcout <<
" Volume of triangulation: " << global_volume
+
+
+
+ 1691 this->multiphysics_present_solution.reinit(this->locally_owned_dofs,
+ 1692 this->locally_relevant_dofs,
+ 1693 this->mpi_communicator);
+
+
+
+ 1697 this->multiphysics_previous_solutions.resize(
+ 1698 this->simulation_control->get_number_of_previous_solution_in_assembly());
+
+ 1700 for (
auto &solution : this->multiphysics_previous_solutions)
+ 1701 solution.reinit(this->locally_owned_dofs,
+ 1702 this->locally_relevant_dofs,
+ 1703 this->mpi_communicator);
+
+
+
+ 1707 if (this->multiphysics->get_active_physics().size() > 1)
+ 1708 update_solutions_for_multiphysics();
+
+
+
+
+
+
+ 1715 if (this->simulation_parameters.boundary_conditions.time_dependent)
+
+ 1717 double time = this->simulation_control->get_current_time();
+ 1718 for (
unsigned int i_bc = 0;
+ 1719 i_bc < this->simulation_parameters.boundary_conditions.size;
+
+
+ 1722 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 1724 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 1726 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 1728 this->simulation_parameters.boundary_conditions
+ 1729 .bcPressureFunction[i_bc]
+
+
+ 1732 define_non_zero_constraints();
+
+ 1734 auto &nonzero_constraints = this->nonzero_constraints;
+ 1735 nonzero_constraints.distribute(this->local_evaluation_point);
+ 1736 this->present_solution = this->local_evaluation_point;
-
-
-
- 1741 this->set_nodal_values();
- 1742 this->present_solution.update_ghost_values();
-
-
- 1745 std::shared_ptr<RheologicalModel> viscosity_model =
- 1746 this->simulation_parameters.physical_properties_manager.get_rheology();
-
-
- 1749 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
-
-
- 1752 viscosity_model->set_kinematic_viscosity(
- 1753 this->simulation_parameters.initial_condition->kinematic_viscosity);
-
-
-
- 1757 this->system_operator->set_kinematic_viscosity(
- 1758 this->simulation_parameters.physical_properties_manager
- 1759 .get_kinematic_viscosity_scale());
-
-
- 1762 if ((this->simulation_parameters.linear_solver
-
-
-
- 1766 (this->simulation_parameters.linear_solver
-
-
-
-
-
-
- 1773 if (!gmg_preconditioner)
- 1774 gmg_preconditioner =
- 1775 std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
- 1776 this->simulation_parameters,
-
- 1778 this->dof_handler_fe_q_iso_q1,
-
- 1780 this->cell_quadrature,
- 1781 this->forcing_function,
- 1782 this->simulation_control,
-
-
- 1785 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
- 1786 for (
unsigned int level = mg_operators.min_level();
- 1787 level <= mg_operators.max_level();
-
-
- 1790 mg_operators[level]->set_kinematic_viscosity(
- 1791 this->simulation_parameters.physical_properties_manager
- 1792 .get_kinematic_viscosity_scale());
-
-
-
-
- 1797 this->simulation_control->set_assembly_method(
-
-
- 1800 solve_non_linear_system(
false);
- 1801 this->finish_time_step();
-
-
-
- 1805 viscosity_model->set_kinematic_viscosity(viscosity_end);
-
-
- 1808 viscosity_model->set_kinematic_viscosity(viscosity_end);
- 1809 this->system_operator->set_kinematic_viscosity(viscosity_end);
-
- 1811 if ((this->simulation_parameters.linear_solver
-
-
-
- 1815 (this->simulation_parameters.linear_solver
-
-
-
-
- 1820 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
- 1821 for (
unsigned int level = mg_operators.min_level();
- 1822 level <= mg_operators.max_level();
-
-
- 1825 mg_operators[level]->set_kinematic_viscosity(viscosity_end);
-
-
-
-
-
- 1831 this->pcout <<
"*********************************" << std::endl;
- 1832 this->pcout <<
" Initial condition using ramp " << std::endl;
- 1833 this->pcout <<
"*********************************" << std::endl;
-
-
- 1836 this->set_nodal_values();
- 1837 this->present_solution.update_ghost_values();
-
-
- 1840 std::shared_ptr<RheologicalModel> viscosity_model =
- 1841 this->simulation_parameters.physical_properties_manager.get_rheology();
-
-
- 1844 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
-
-
- 1847 const int n_iter_viscosity =
- 1848 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
-
- 1850 double kinematic_viscosity =
- 1851 n_iter_viscosity > 0 ?
- 1852 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
- 1853 .kinematic_viscosity_init :
-
- 1855 const double alpha_viscosity =
- 1856 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
-
-
- 1859 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
-
-
- 1862 for (
int i = 0; i < n_iter_viscosity; ++i)
-
- 1864 this->pcout << std::setprecision(4)
- 1865 <<
"********* Solution for kinematic viscosity = " +
- 1866 std::to_string(kinematic_viscosity) +
" *********"
-
+
+
+
+
+
+
+
+
+
+
+ 1748 this->pcout <<
"************************" << std::endl;
+ 1749 this->pcout <<
"---> Simulation Restart " << std::endl;
+ 1750 this->pcout <<
"************************" << std::endl;
+
+
+
+
+ 1755 this->set_nodal_values();
+ 1756 this->present_solution.update_ghost_values();
+ 1757 this->finish_time_step();
+
+
+
+
+ 1762 this->set_nodal_values();
+ 1763 this->present_solution.update_ghost_values();
+
+
+ 1766 std::shared_ptr<RheologicalModel> viscosity_model =
+ 1767 this->simulation_parameters.physical_properties_manager.get_rheology();
+
+
+ 1770 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
+
+
+ 1773 viscosity_model->set_kinematic_viscosity(
+ 1774 this->simulation_parameters.initial_condition->kinematic_viscosity);
+
+
+
+ 1778 this->system_operator->set_kinematic_viscosity(
+ 1779 this->simulation_parameters.physical_properties_manager
+ 1780 .get_kinematic_viscosity_scale());
+
+
+ 1783 if ((this->simulation_parameters.linear_solver
+
+
+
+ 1787 (this->simulation_parameters.linear_solver
+
+
+
+
+
+
+ 1794 if (!gmg_preconditioner)
+ 1795 gmg_preconditioner =
+ 1796 std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
+ 1797 this->simulation_parameters,
+
+ 1799 this->dof_handler_fe_q_iso_q1,
+
+ 1801 this->cell_quadrature,
+ 1802 this->forcing_function,
+ 1803 this->simulation_control,
+
+
+ 1806 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
+ 1807 for (
unsigned int level = mg_operators.min_level();
+ 1808 level <= mg_operators.max_level();
+
+
+ 1811 mg_operators[level]->set_kinematic_viscosity(
+ 1812 this->simulation_parameters.physical_properties_manager
+ 1813 .get_kinematic_viscosity_scale());
+
+
+
+
+ 1818 this->simulation_control->set_assembly_method(
+
+
+ 1821 solve_non_linear_system(
false);
+ 1822 this->finish_time_step();
+
+
+
+ 1826 viscosity_model->set_kinematic_viscosity(viscosity_end);
+
+
+ 1829 viscosity_model->set_kinematic_viscosity(viscosity_end);
+ 1830 this->system_operator->set_kinematic_viscosity(viscosity_end);
+
+ 1832 if ((this->simulation_parameters.linear_solver
+
+
+
+ 1836 (this->simulation_parameters.linear_solver
+
+
+
+
+ 1841 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
+ 1842 for (
unsigned int level = mg_operators.min_level();
+ 1843 level <= mg_operators.max_level();
+
+
+ 1846 mg_operators[level]->set_kinematic_viscosity(viscosity_end);
+
+
+
+
+
+ 1852 this->pcout <<
"*********************************" << std::endl;
+ 1853 this->pcout <<
" Initial condition using ramp " << std::endl;
+ 1854 this->pcout <<
"*********************************" << std::endl;
+
+ 1856 Timer timer(this->mpi_communicator);
+
+
+ 1859 this->set_nodal_values();
+ 1860 this->present_solution.update_ghost_values();
+
+
+ 1863 std::shared_ptr<RheologicalModel> viscosity_model =
+ 1864 this->simulation_parameters.physical_properties_manager.get_rheology();
+
+
+ 1867 const double viscosity_end = viscosity_model->get_kinematic_viscosity();
- 1869 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
-
-
-
- 1873 this->system_operator->set_kinematic_viscosity(
- 1874 this->simulation_parameters.physical_properties_manager
- 1875 .get_kinematic_viscosity_scale());
-
-
- 1878 if ((this->simulation_parameters.linear_solver
-
-
-
- 1882 (this->simulation_parameters.linear_solver
-
-
-
-
-
-
- 1889 if (!gmg_preconditioner)
- 1890 gmg_preconditioner =
- 1891 std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
- 1892 this->simulation_parameters,
-
- 1894 this->dof_handler_fe_q_iso_q1,
-
- 1896 this->cell_quadrature,
- 1897 this->forcing_function,
- 1898 this->simulation_control,
-
-
- 1901 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
- 1902 for (
unsigned int level = mg_operators.min_level();
- 1903 level <= mg_operators.max_level();
-
-
- 1906 mg_operators[level]->set_kinematic_viscosity(
- 1907 this->simulation_parameters.physical_properties_manager
- 1908 .get_kinematic_viscosity_scale());
-
-
-
- 1912 this->simulation_control->set_assembly_method(
-
-
-
- 1916 solve_non_linear_system(
false);
- 1917 this->finish_time_step();
-
- 1919 kinematic_viscosity +=
- 1920 alpha_viscosity * (viscosity_end - kinematic_viscosity);
-
-
- 1923 viscosity_model->set_kinematic_viscosity(viscosity_end);
- 1924 this->system_operator->set_kinematic_viscosity(viscosity_end);
-
- 1926 if ((this->simulation_parameters.linear_solver
-
-
-
- 1930 (this->simulation_parameters.linear_solver
-
-
-
-
- 1935 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
- 1936 for (
unsigned int level = mg_operators.min_level();
- 1937 level <= mg_operators.max_level();
-
-
- 1940 mg_operators[level]->set_kinematic_viscosity(viscosity_end);
-
-
-
-
-
- 1946 throw std::runtime_error(
- 1947 "Type of initial condition is not supported by MF Navier-Stokes");
-
-
-
-
-
-
-
-
- 1956 TimerOutput::Scope t(this->computing_timer,
"Assemble matrix");
-
-
-
-
-
-
- 1963 TimerOutput::Scope t(this->computing_timer,
"Assemble RHS");
-
- 1965 this->system_operator->evaluate_residual(this->system_rhs,
- 1966 this->evaluation_point);
-
- 1968 this->system_rhs *= -1.0;
-
-
-
- 1972 if (this->simulation_control->is_first_assembly())
- 1973 this->simulation_control->provide_residual(this->system_rhs.l2_norm());
-
-
-
-
-
-
- 1980 TimerOutput::Scope t(this->computing_timer,
- 1981 "Update multiphysics average solution");
-
- 1983 if (this->simulation_parameters.post_processing.calculate_average_velocities)
-
- 1985 TrilinosWrappers::MPI::Vector temp_average_velocities(
- 1986 this->locally_owned_dofs, this->mpi_communicator);
-
- 1988 temp_average_velocities,
- 1989 this->average_velocities->get_average_velocities());
- 1990 this->multiphysics_average_velocities = temp_average_velocities;
-
- 1992 this->multiphysics->set_time_average_solution(
-
-
-
-
-
-
-
-
- 2001 this->time_derivative_previous_solutions = 0;
-
-
- 2004 const auto method = this->simulation_control->get_assembly_method();
-
- 2006 const Vector<double> &bdf_coefs =
- 2007 this->simulation_control->get_bdf_coefficients();
-
-
-
- 2011 this->time_derivative_previous_solutions.add(bdf_coefs[p + 1],
- 2012 this->previous_solutions[p]);
-
-
-
-
-
-
-
- 2020 TimerOutput::Scope t(this->computing_timer,
"Setup GMG");
-
- 2022 if (!gmg_preconditioner)
- 2023 gmg_preconditioner = std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
- 2024 this->simulation_parameters,
-
- 2026 this->dof_handler_fe_q_iso_q1,
-
- 2028 this->cell_quadrature,
- 2029 this->forcing_function,
- 2030 this->simulation_control,
-
-
- 2033 gmg_preconditioner->initialize(this->simulation_control,
-
- 2035 this->present_solution,
- 2036 this->time_derivative_previous_solutions);
-
-
-
-
-
-
- 2043 TimerOutput::Scope t(this->computing_timer,
"Setup ILU");
-
- 2045 int current_preconditioner_fill_level =
-
-
- 2048 const double ilu_atol =
-
-
- 2051 const double ilu_rtol =
-
-
- 2054 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
- 2055 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
-
- 2057 ilu_preconditioner = std::make_shared<TrilinosWrappers::PreconditionILU>();
-
- 2059 ilu_preconditioner->initialize(system_operator->get_system_matrix(),
- 2060 preconditionerOptions);
-
-
-
-
-
-
-
-
-
-
-
- 2072 this->gmg_preconditioner->mg_setup_timer.print_wall_time_statistics(
-
-
-
- 2076 this->gmg_preconditioner->mg_vmult_timer.print_wall_time_statistics(
-
+
+ 1870 const int n_iter_viscosity =
+ 1871 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+
+ 1873 double kinematic_viscosity =
+ 1874 n_iter_viscosity > 0 ?
+ 1875 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+ 1876 .kinematic_viscosity_init :
+
+ 1878 const double alpha_viscosity =
+ 1879 this->simulation_parameters.initial_condition->ramp.ramp_viscosity
+
+
+ 1882 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
+
+
+ 1885 for (
int i = 0; i < n_iter_viscosity; ++i)
+
+ 1887 this->pcout << std::setprecision(4)
+ 1888 <<
"********* Solution for kinematic viscosity = " +
+ 1889 std::to_string(kinematic_viscosity) +
" *********"
+
+
+ 1892 viscosity_model->set_kinematic_viscosity(kinematic_viscosity);
+
+
+
+ 1896 this->system_operator->set_kinematic_viscosity(
+ 1897 this->simulation_parameters.physical_properties_manager
+ 1898 .get_kinematic_viscosity_scale());
+
+
+ 1901 if ((this->simulation_parameters.linear_solver
+
+
+
+ 1905 (this->simulation_parameters.linear_solver
+
+
+
+
+
+
+ 1912 if (!gmg_preconditioner)
+ 1913 gmg_preconditioner =
+ 1914 std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
+ 1915 this->simulation_parameters,
+
+ 1917 this->dof_handler_fe_q_iso_q1,
+
+ 1919 this->cell_quadrature,
+ 1920 this->forcing_function,
+ 1921 this->simulation_control,
+
+
+ 1924 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
+ 1925 for (
unsigned int level = mg_operators.min_level();
+ 1926 level <= mg_operators.max_level();
+
+
+ 1929 mg_operators[level]->set_kinematic_viscosity(
+ 1930 this->simulation_parameters.physical_properties_manager
+ 1931 .get_kinematic_viscosity_scale());
+
+
+
+ 1935 this->simulation_control->set_assembly_method(
+
+
+
+ 1939 solve_non_linear_system(
false);
+ 1940 this->finish_time_step();
+
+ 1942 kinematic_viscosity +=
+ 1943 alpha_viscosity * (viscosity_end - kinematic_viscosity);
+
+
+ 1946 viscosity_model->set_kinematic_viscosity(viscosity_end);
+ 1947 this->system_operator->set_kinematic_viscosity(viscosity_end);
+
+ 1949 if ((this->simulation_parameters.linear_solver
+
+
+
+ 1953 (this->simulation_parameters.linear_solver
+
+
+
+
+ 1958 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
+ 1959 for (
unsigned int level = mg_operators.min_level();
+ 1960 level <= mg_operators.max_level();
+
+
+ 1963 mg_operators[level]->set_kinematic_viscosity(viscosity_end);
+
+
+
+
+
+ 1969 if (this->simulation_parameters.timer.type !=
+
+
+ 1972 this->pcout <<
"*********************************" << std::endl;
+ 1973 this->pcout <<
" Time spent in ramp: " << timer.wall_time() <<
"s"
+
+ 1975 this->pcout <<
"*********************************" << std::endl;
+
+
+
+
+ 1980 throw std::runtime_error(
+ 1981 "Type of initial condition is not supported by MF Navier-Stokes");
+
+
+
+
+
+
+
+
+ 1990 TimerOutput::Scope t(this->computing_timer,
"Assemble matrix");
+
+
+
+
+
+
+ 1997 TimerOutput::Scope t(this->computing_timer,
"Assemble RHS");
+
+ 1999 this->system_operator->evaluate_residual(this->system_rhs,
+ 2000 this->evaluation_point);
+
+ 2002 this->system_rhs *= -1.0;
+
+
+
+ 2006 if (this->simulation_control->is_first_assembly())
+ 2007 this->simulation_control->provide_residual(this->system_rhs.l2_norm());
+
+
+
+
+
+
+ 2014 TimerOutput::Scope t(this->computing_timer,
+ 2015 "Update multiphysics average solution");
+
+ 2017 if (this->simulation_parameters.post_processing.calculate_average_velocities)
+
+ 2019 TrilinosWrappers::MPI::Vector temp_average_velocities(
+ 2020 this->locally_owned_dofs, this->mpi_communicator);
+
+ 2022 temp_average_velocities,
+ 2023 this->average_velocities->get_average_velocities());
+ 2024 this->multiphysics_average_velocities = temp_average_velocities;
+
+ 2026 this->multiphysics->set_time_average_solution(
+
+
+
+
+
+
+
+
+ 2035 this->time_derivative_previous_solutions = 0;
+
+
+ 2038 const auto method = this->simulation_control->get_assembly_method();
+
+ 2040 const Vector<double> &bdf_coefs =
+ 2041 this->simulation_control->get_bdf_coefficients();
+
+
+
+ 2045 this->time_derivative_previous_solutions.add(bdf_coefs[p + 1],
+ 2046 this->previous_solutions[p]);
+
+
+
+
+
+
+
+ 2054 TimerOutput::Scope t(this->computing_timer,
"Setup GMG");
+
+ 2056 if (!gmg_preconditioner)
+ 2057 gmg_preconditioner = std::make_shared<MFNavierStokesPreconditionGMG<dim>>(
+ 2058 this->simulation_parameters,
+
+ 2060 this->dof_handler_fe_q_iso_q1,
+
+ 2062 this->cell_quadrature,
+ 2063 this->forcing_function,
+ 2064 this->simulation_control,
+
+
+ 2067 gmg_preconditioner->initialize(this->simulation_control,
+
+ 2069 this->present_solution,
+ 2070 this->time_derivative_previous_solutions);
+
+
+
+
+
+
+ 2077 TimerOutput::Scope t(this->computing_timer,
"Setup ILU");
-
- 2080 this->system_operator->timer.print_wall_time_statistics(MPI_COMM_WORLD);
-
- 2082 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
- 2083 for (
unsigned int level = mg_operators.min_level();
- 2084 level <= mg_operators.max_level();
-
-
-
- 2088 "Operator level " + std::to_string(level) +
" times");
- 2089 mg_operators[level]->timer.print_wall_time_statistics(MPI_COMM_WORLD);
+ 2079 int current_preconditioner_fill_level =
+
+
+ 2082 const double ilu_atol =
+
+
+ 2085 const double ilu_rtol =
+
+
+ 2088 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
+ 2089 current_preconditioner_fill_level, ilu_atol, ilu_rtol, 0);
-
- 2092 mg_operators[level]->timer.reset();
-
-
-
- 2096 this->gmg_preconditioner->mg_setup_timer.reset();
- 2097 this->gmg_preconditioner->mg_vmult_timer.reset();
-
-
-
-
-
-
-
- 2105 TimerOutput::Scope t(this->computing_timer,
- 2106 "Update solutions for multiphysics");
-
-
-
- 2110 &this->dof_handler);
-
+ 2091 ilu_preconditioner = std::make_shared<TrilinosWrappers::PreconditionILU>();
+
+ 2093 ilu_preconditioner->initialize(system_operator->get_system_matrix(),
+ 2094 preconditionerOptions);
+
+
+
+
+
+
+
+
+
+
+
+ 2106 this->gmg_preconditioner->mg_setup_timer.print_wall_time_statistics(
+
+
+
+ 2110 this->gmg_preconditioner->mg_vmult_timer.print_wall_time_statistics(
+
-
-
-
- 2116 TrilinosWrappers::MPI::Vector temp_solution(this->locally_owned_dofs,
- 2117 this->mpi_communicator);
-
- 2119 this->present_solution.update_ghost_values();
-
- 2121 multiphysics_present_solution = temp_solution;
-
-
- 2124 &this->multiphysics_present_solution);
-
-
-
-
- 2129 this->simulation_control->get_number_of_previous_solution_in_assembly();
-
- 2131 std::vector<TrilinosWrappers::MPI::Vector> temp_previous_solutions;
-
-
- 2134 for (
auto &solution : temp_previous_solutions)
- 2135 solution.reinit(this->locally_owned_dofs, this->mpi_communicator);
-
-
-
- 2139 this->previous_solutions[i].update_ghost_values();
-
- 2141 this->previous_solutions[i]);
-
- 2143 this->multiphysics_previous_solutions[i] = temp_previous_solutions[i];
-
+
+ 2114 this->system_operator->timer.print_wall_time_statistics(MPI_COMM_WORLD);
+
+ 2116 auto mg_operators = this->gmg_preconditioner->get_mg_operators();
+ 2117 for (
unsigned int level = mg_operators.min_level();
+ 2118 level <= mg_operators.max_level();
+
+
+
+ 2122 "Operator level " + std::to_string(level) +
" times");
+ 2123 mg_operators[level]->timer.print_wall_time_statistics(MPI_COMM_WORLD);
+
+
+ 2126 mg_operators[level]->timer.reset();
+
+
+
+ 2130 this->gmg_preconditioner->mg_setup_timer.reset();
+ 2131 this->gmg_preconditioner->mg_vmult_timer.reset();
+
+
+
+
+
+
+
+ 2139 TimerOutput::Scope t(this->computing_timer,
+ 2140 "Update solutions for multiphysics");
+
+
+
+ 2144 &this->dof_handler);
- 2146 this->multiphysics->set_previous_solutions(
-
-
-
-
-
-
-
- 2154 double time = this->simulation_control->get_current_time();
- 2155 FEValuesExtractors::Vector velocities(0);
- 2156 FEValuesExtractors::Scalar
pressure(dim);
-
- 2158 auto &nonzero_constraints = this->get_nonzero_constraints();
-
- 2160 nonzero_constraints.clear();
- 2161 nonzero_constraints.reinit(this->locally_relevant_dofs);
-
- 2163 DoFTools::make_hanging_node_constraints(this->dof_handler,
- 2164 nonzero_constraints);
- 2165 for (
unsigned int i_bc = 0;
- 2166 i_bc < this->simulation_parameters.boundary_conditions.size;
-
-
- 2169 if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2172 VectorTools::interpolate_boundary_values(
-
-
- 2175 this->simulation_parameters.boundary_conditions.id[i_bc],
- 2176 dealii::Functions::ZeroFunction<dim>(dim + 1),
- 2177 nonzero_constraints,
- 2178 this->fe->component_mask(velocities));
-
- 2180 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2183 std::set<types::boundary_id> no_normal_flux_boundaries;
- 2184 no_normal_flux_boundaries.insert(
- 2185 this->simulation_parameters.boundary_conditions.id[i_bc]);
- 2186 VectorTools::compute_no_normal_flux_constraints(
-
-
- 2189 no_normal_flux_boundaries,
- 2190 nonzero_constraints,
-
-
- 2193 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2196 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 2198 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 2200 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
-
- 2202 VectorTools::interpolate_boundary_values(
-
-
- 2205 this->simulation_parameters.boundary_conditions.id[i_bc],
-
- 2207 &this->simulation_parameters.boundary_conditions
-
-
- 2210 &this->simulation_parameters.boundary_conditions
-
-
- 2213 &this->simulation_parameters.boundary_conditions
-
-
- 2216 nonzero_constraints,
- 2217 this->fe->component_mask(velocities));
-
- 2219 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2222 DoFTools::make_periodicity_constraints(
-
- 2224 this->simulation_parameters.boundary_conditions.id[i_bc],
- 2225 this->simulation_parameters.boundary_conditions.periodic_id[i_bc],
- 2226 this->simulation_parameters.boundary_conditions
- 2227 .periodic_direction[i_bc],
- 2228 nonzero_constraints);
-
-
-
-
-
-
- 2235 this->establish_solid_domain(
true);
-
- 2237 nonzero_constraints.close();
-
-
-
-
-
-
- 2244 FEValuesExtractors::Vector velocities(0);
- 2245 FEValuesExtractors::Scalar
pressure(dim);
- 2246 this->zero_constraints.clear();
- 2247 this->locally_relevant_dofs =
- 2248 DoFTools::extract_locally_relevant_dofs(this->dof_handler);
- 2249 this->zero_constraints.reinit(this->locally_relevant_dofs);
-
- 2251 DoFTools::make_hanging_node_constraints(this->dof_handler,
- 2252 this->zero_constraints);
-
- 2254 for (
unsigned int i_bc = 0;
- 2255 i_bc < this->simulation_parameters.boundary_conditions.size;
-
-
- 2258 if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2261 std::set<types::boundary_id> no_normal_flux_boundaries;
- 2262 no_normal_flux_boundaries.insert(
- 2263 this->simulation_parameters.boundary_conditions.id[i_bc]);
- 2264 VectorTools::compute_no_normal_flux_constraints(
-
-
- 2267 no_normal_flux_boundaries,
- 2268 this->zero_constraints,
-
-
- 2271 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
- 2274 DoFTools::make_periodicity_constraints(
-
- 2276 this->simulation_parameters.boundary_conditions.id[i_bc],
- 2277 this->simulation_parameters.boundary_conditions.periodic_id[i_bc],
- 2278 this->simulation_parameters.boundary_conditions
- 2279 .periodic_direction[i_bc],
- 2280 this->zero_constraints);
-
- 2282 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
-
-
- 2287 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
-
-
- 2292 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
+
+
+
+
+ 2150 TrilinosWrappers::MPI::Vector temp_solution(this->locally_owned_dofs,
+ 2151 this->mpi_communicator);
+
+ 2153 this->present_solution.update_ghost_values();
+
+ 2155 multiphysics_present_solution = temp_solution;
+
+
+ 2158 &this->multiphysics_present_solution);
+
+
+
+
+ 2163 this->simulation_control->get_number_of_previous_solution_in_assembly();
+
+ 2165 std::vector<TrilinosWrappers::MPI::Vector> temp_previous_solutions;
+
+
+ 2168 for (
auto &solution : temp_previous_solutions)
+ 2169 solution.reinit(this->locally_owned_dofs, this->mpi_communicator);
+
+
+
+ 2173 this->previous_solutions[i].update_ghost_values();
+
+ 2175 this->previous_solutions[i]);
+
+ 2177 this->multiphysics_previous_solutions[i] = temp_previous_solutions[i];
+
+
+ 2180 this->multiphysics->set_previous_solutions(
+
+
+
+
+
+
+
+ 2188 double time = this->simulation_control->get_current_time();
+ 2189 FEValuesExtractors::Vector velocities(0);
+ 2190 FEValuesExtractors::Scalar
pressure(dim);
+
+ 2192 auto &nonzero_constraints = this->get_nonzero_constraints();
+
+ 2194 nonzero_constraints.clear();
+ 2195 nonzero_constraints.reinit(this->locally_relevant_dofs);
+
+ 2197 DoFTools::make_hanging_node_constraints(this->dof_handler,
+ 2198 nonzero_constraints);
+ 2199 for (
unsigned int i_bc = 0;
+ 2200 i_bc < this->simulation_parameters.boundary_conditions.size;
+
+
+ 2203 if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+ 2206 VectorTools::interpolate_boundary_values(
+
+
+ 2209 this->simulation_parameters.boundary_conditions.id[i_bc],
+ 2210 dealii::Functions::ZeroFunction<dim>(dim + 1),
+ 2211 nonzero_constraints,
+ 2212 this->fe->component_mask(velocities));
+
+ 2214 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+ 2217 std::set<types::boundary_id> no_normal_flux_boundaries;
+ 2218 no_normal_flux_boundaries.insert(
+ 2219 this->simulation_parameters.boundary_conditions.id[i_bc]);
+ 2220 VectorTools::compute_no_normal_flux_constraints(
+
+
+ 2223 no_normal_flux_boundaries,
+ 2224 nonzero_constraints,
+
+
+ 2227 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+ 2230 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 2232 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 2234 this->simulation_parameters.boundary_conditions.bcFunctions[i_bc]
+
+ 2236 VectorTools::interpolate_boundary_values(
+
+
+ 2239 this->simulation_parameters.boundary_conditions.id[i_bc],
+
+ 2241 &this->simulation_parameters.boundary_conditions
+
+
+ 2244 &this->simulation_parameters.boundary_conditions
+
+
+ 2247 &this->simulation_parameters.boundary_conditions
+
+
+ 2250 nonzero_constraints,
+ 2251 this->fe->component_mask(velocities));
+
+ 2253 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+ 2256 DoFTools::make_periodicity_constraints(
+
+ 2258 this->simulation_parameters.boundary_conditions.id[i_bc],
+ 2259 this->simulation_parameters.boundary_conditions.periodic_id[i_bc],
+ 2260 this->simulation_parameters.boundary_conditions
+ 2261 .periodic_direction[i_bc],
+ 2262 nonzero_constraints);
+
+
+
+
+
+
+ 2269 this->establish_solid_domain(
true);
+
+ 2271 nonzero_constraints.close();
+
+
+
+
+
+
+ 2278 FEValuesExtractors::Vector velocities(0);
+ 2279 FEValuesExtractors::Scalar
pressure(dim);
+ 2280 this->zero_constraints.clear();
+ 2281 this->locally_relevant_dofs =
+ 2282 DoFTools::extract_locally_relevant_dofs(this->dof_handler);
+ 2283 this->zero_constraints.reinit(this->locally_relevant_dofs);
+
+ 2285 DoFTools::make_hanging_node_constraints(this->dof_handler,
+ 2286 this->zero_constraints);
+
+ 2288 for (
unsigned int i_bc = 0;
+ 2289 i_bc < this->simulation_parameters.boundary_conditions.size;
+
+
+ 2292 if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
-
-
- 2297 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
-
-
-
-
-
-
- 2304 VectorTools::interpolate_boundary_values(
-
-
- 2307 this->simulation_parameters.boundary_conditions.id[i_bc],
- 2308 dealii::Functions::ZeroFunction<dim>(dim + 1),
- 2309 this->zero_constraints,
- 2310 this->fe->component_mask(velocities));
-
-
-
- 2314 this->establish_solid_domain(
false);
-
- 2316 this->zero_constraints.close();
-
-
-
-
-
-
- 2323 this->present_solution.update_ghost_values();
-
- 2325 this->computing_timer.enter_subsection(
"Evaluate non linear term and tau");
-
- 2327 this->system_operator->evaluate_non_linear_term_and_calculate_tau(
- 2328 this->present_solution);
-
- 2330 this->computing_timer.leave_subsection(
"Evaluate non linear term and tau");
-
-
-
-
- 2335 else if ((this->simulation_parameters.linear_solver
-
-
-
- 2339 (this->simulation_parameters.linear_solver
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2353 "This linear solver does not support this preconditioner. Only <ilu|lsmg|gcmg> preconditioners are supported."));
-
-
-
-
-
-
-
- 2361 const double absolute_residual =
-
-
- 2364 const double relative_residual =
-
-
-
-
-
- 2370 solve_system_GMRES(initial_step, absolute_residual, relative_residual);
-
- 2372 AssertThrow(
false, ExcMessage(
"This solver is not allowed"));
- 2373 this->rescale_pressure_dofs_in_newton_update();
-
-
-
-
-
-
-
-
-
-
-
-
- 2386 const double absolute_residual,
- 2387 const double relative_residual)
-
- 2389 auto &system_rhs = this->system_rhs;
- 2390 auto &nonzero_constraints = this->nonzero_constraints;
-
- 2392 const AffineConstraints<double> &constraints_used =
- 2393 initial_step ? nonzero_constraints : this->zero_constraints;
- 2394 const double linear_solver_tolerance =
- 2395 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
-
-
-
-
- 2400 this->pcout <<
" -Tolerance of iterative solver is : "
- 2401 << linear_solver_tolerance << std::endl;
-
-
- 2404 SolverControl solver_control(this->simulation_parameters.linear_solver
-
-
- 2407 linear_solver_tolerance,
-
-
-
- 2411 SolverGMRES<VectorType>::AdditionalData solver_parameters;
-
- 2413 solver_parameters.max_n_tmp_vectors =
-
- 2415 .max_krylov_vectors;
- 2416 solver_parameters.right_preconditioning =
true;
-
- 2418 SolverGMRES<VectorType> solver(solver_control, solver_parameters);
-
- 2420 this->newton_update = 0.0;
-
- 2422 this->computing_timer.enter_subsection(
"Solve linear system");
-
-
-
-
-
-
-
- 2430 solver.solve(*(this->system_operator),
- 2431 this->newton_update,
-
- 2433 *(this->gmg_preconditioner));
-
- 2435 if (this->simulation_parameters.linear_solver
-
-
- 2438 this->gmg_preconditioner->print_relevant_info();
-
- 2440 else if (this->simulation_parameters.linear_solver
-
-
-
- 2444 solver.solve(*(this->system_operator),
- 2445 this->newton_update,
-
- 2447 *(this->ilu_preconditioner));
-
-
-
-
-
-
-
-
-
-
-
-
- 2460 "This linear solver does not support this preconditioner. Only <ilu|lsmg|gcmg> preconditioners are supported."));
-
- 2462 this->computing_timer.leave_subsection(
"Solve linear system");
-
-
-
-
- 2467 this->pcout <<
" -Iterative solver took : " << solver_control.last_step()
- 2468 <<
" steps to reach a residual norm of "
- 2469 << solver_control.last_value() << std::endl;
-
-
- 2472 this->computing_timer.enter_subsection(
- 2473 "Distribute constraints after linear solve");
-
- 2475 constraints_used.distribute(this->newton_update);
-
- 2477 this->computing_timer.leave_subsection(
- 2478 "Distribute constraints after linear solve");
-
-
-
-
+ 2295 std::set<types::boundary_id> no_normal_flux_boundaries;
+ 2296 no_normal_flux_boundaries.insert(
+ 2297 this->simulation_parameters.boundary_conditions.id[i_bc]);
+ 2298 VectorTools::compute_no_normal_flux_constraints(
+
+
+ 2301 no_normal_flux_boundaries,
+ 2302 this->zero_constraints,
+
+
+ 2305 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+ 2308 DoFTools::make_periodicity_constraints(
+
+ 2310 this->simulation_parameters.boundary_conditions.id[i_bc],
+ 2311 this->simulation_parameters.boundary_conditions.periodic_id[i_bc],
+ 2312 this->simulation_parameters.boundary_conditions
+ 2313 .periodic_direction[i_bc],
+ 2314 this->zero_constraints);
+
+ 2316 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+
+
+ 2321 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+
+
+ 2326 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+
+
+ 2331 else if (this->simulation_parameters.boundary_conditions.type[i_bc] ==
+
+
+
+
+
+
+ 2338 VectorTools::interpolate_boundary_values(
+
+
+ 2341 this->simulation_parameters.boundary_conditions.id[i_bc],
+ 2342 dealii::Functions::ZeroFunction<dim>(dim + 1),
+ 2343 this->zero_constraints,
+ 2344 this->fe->component_mask(velocities));
+
+
+
+ 2348 this->establish_solid_domain(
false);
+
+ 2350 this->zero_constraints.close();
+
+
+
+
+
+
+ 2357 this->present_solution.update_ghost_values();
+
+ 2359 this->computing_timer.enter_subsection(
"Evaluate non linear term and tau");
+
+ 2361 this->system_operator->evaluate_non_linear_term_and_calculate_tau(
+ 2362 this->present_solution);
+
+ 2364 this->computing_timer.leave_subsection(
"Evaluate non linear term and tau");
+
+
+
+
+ 2369 else if ((this->simulation_parameters.linear_solver
+
+
+
+ 2373 (this->simulation_parameters.linear_solver
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2387 "This linear solver does not support this preconditioner. Only <ilu|lsmg|gcmg> preconditioners are supported."));
+
+
+
+
+
+
+
+ 2395 const double absolute_residual =
+
+
+ 2398 const double relative_residual =
+
+
+
+
+
+ 2404 solve_system_GMRES(initial_step, absolute_residual, relative_residual);
+
+ 2406 AssertThrow(
false, ExcMessage(
"This solver is not allowed"));
+ 2407 this->rescale_pressure_dofs_in_newton_update();
+
+
+
+
+
+
+
+
+
+
+
+
+ 2420 const double absolute_residual,
+ 2421 const double relative_residual)
+
+ 2423 auto &system_rhs = this->system_rhs;
+ 2424 auto &nonzero_constraints = this->nonzero_constraints;
+
+ 2426 const AffineConstraints<double> &constraints_used =
+ 2427 initial_step ? nonzero_constraints : this->zero_constraints;
+ 2428 const double linear_solver_tolerance =
+ 2429 std::max(relative_residual * system_rhs.l2_norm(), absolute_residual);
+
+
+
+
+ 2434 this->pcout <<
" -Tolerance of iterative solver is : "
+ 2435 << linear_solver_tolerance << std::endl;
+
+
+ 2438 SolverControl solver_control(this->simulation_parameters.linear_solver
+
+
+ 2441 linear_solver_tolerance,
+
+
+
+ 2445 SolverGMRES<VectorType>::AdditionalData solver_parameters;
+
+ 2447 solver_parameters.max_n_tmp_vectors =
+
+ 2449 .max_krylov_vectors;
+ 2450 solver_parameters.right_preconditioning =
true;
+
+ 2452 SolverGMRES<VectorType> solver(solver_control, solver_parameters);
+
+ 2454 this->newton_update = 0.0;
+
+ 2456 this->computing_timer.enter_subsection(
"Solve linear system");
+
+
+
+
+
+
+
+ 2464 solver.solve(*(this->system_operator),
+ 2465 this->newton_update,
+
+ 2467 *(this->gmg_preconditioner));
+
+ 2469 if (this->simulation_parameters.linear_solver
+
+
+ 2472 this->gmg_preconditioner->print_relevant_info();
+
+ 2474 else if (this->simulation_parameters.linear_solver
+
+
+
+ 2478 solver.solve(*(this->system_operator),
+ 2479 this->newton_update,
+
+ 2481 *(this->ilu_preconditioner));
+
+
+
+
+
+
+
+
+
+
+
+
+ 2494 "This linear solver does not support this preconditioner. Only <ilu|lsmg|gcmg> preconditioners are supported."));
+
+ 2496 this->computing_timer.leave_subsection(
"Solve linear system");
+
+
+
+
+ 2501 this->pcout <<
" -Iterative solver took : " << solver_control.last_step()
+ 2502 <<
" steps to reach a residual norm of "
+ 2503 << solver_control.last_value() << std::endl;
+
+
+ 2506 this->computing_timer.enter_subsection(
+ 2507 "Distribute constraints after linear solve");
+
+ 2509 constraints_used.distribute(this->newton_update);
+
+ 2511 this->computing_timer.leave_subsection(
+ 2512 "Distribute constraints after linear solve");
+
+
+
+
unsigned int number_of_previous_solutions(Parameters::SimulationControl::TimeSteppingMethod method)
Get the number of previous time steps for a specific BDF scheme.
Class allows to dynamically control the flow with a beta coefficient calculated at each step time.
Tensor< 1, dim > get_beta()
get_beta. This function gives the beta force of the step time
TimerOutput mg_setup_timer
Timer for specific geometric multigrid components.
MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > transfers
Transfers for each of the levels of the global coarsening algorithm.
-const MGLevelObject< std::shared_ptr< OperatorType > > & get_mg_operators() const
Getter function for all level operators.
+const MGLevelObject< std::shared_ptr< OperatorType > > & get_mg_operators() const
Getter function for all level operators.
std::vector< std::shared_ptr< const Triangulation< dim > > > coarse_grid_triangulations
Triangulations for the global coarsening case.
-void setup_ILU()
Set the up ILU object needed for coarse-grid solver or preconditioning.
-void initialize(const std::shared_ptr< SimulationControl > simulation_control, FlowControl< dim > &flow_control, const VectorType &present_solution, const VectorType &time_derivative_previous_solutions)
Initialize smoother, coarse grid solver and multigrid object needed for the geometric multigrid preco...
+void setup_ILU()
Set the up ILU object needed for coarse-grid solver or preconditioning.
+void initialize(const std::shared_ptr< SimulationControl > simulation_control, FlowControl< dim > &flow_control, const VectorType &present_solution, const VectorType &time_derivative_previous_solutions)
Initialize smoother, coarse grid solver and multigrid object needed for the geometric multigrid preco...
MGLevelObject< MatrixFreeOperators::MGInterfaceOperator< OperatorType > > ls_mg_operators
LinearAlgebra::distributed::Vector< double > VectorType
std::shared_ptr< GCTransferType > mg_transfer_gc
Transfer operator for global coarsening.
@@ -2578,39 +2612,39 @@
MGConstrainedDoFs mg_constrained_dofs
MGLevelObject< DoFHandler< dim > > dof_handlers
DoF handlers for each of the levels of the global coarsening algorithm.
unsigned int maxlevel
Max level of the multigrid hierarchy.
-void vmult(VectorType &dst, const VectorType &src) const
Calls the v cycle function of the multigrid object.
+void vmult(VectorType &dst, const VectorType &src) const
Calls the v cycle function of the multigrid object.
const DoFHandler< dim > & dof_handler_fe_q_iso_q1
Describes the layout of DoFs for FE_Q_iso_Q1 elements.
std::shared_ptr< LSTransferType > mg_transfer_ls
Transfer operator for local smoothing.
MGLevelObject< std::shared_ptr< OperatorType > > mg_operators
Level operators for the geometric multigrid.
MGLevelObject< MatrixFreeOperators::MGInterfaceOperator< OperatorType > > ls_mg_interface_in
-void setup_AMG()
Set the up AMG object needed for coarse-grid solver or preconditioning.
-void print_relevant_info() const
Prints relevant multigrid information.
+void setup_AMG()
Set the up AMG object needed for coarse-grid solver or preconditioning.
+void print_relevant_info() const
Prints relevant multigrid information.
ConditionalOStream pcout
Conditional Ostream.
MFNavierStokesPreconditionGMG(const SimulationParameters< dim > &simulation_parameters, const DoFHandler< dim > &dof_handler, const DoFHandler< dim > &dof_handler_fe_q_iso_q1, const std::shared_ptr< Mapping< dim >> &mapping, const std::shared_ptr< Quadrature< dim >> &cell_quadrature, const std::shared_ptr< Function< dim >> forcing_function, const std::shared_ptr< SimulationControl > simulation_control, const std::shared_ptr< FESystem< dim >> fe)
Construct a new precondition GMG object. Sets constraints, operators and transfer objects.
unsigned int minlevel
Min level of the multigrid hierarchy.
A solver for the incompressible Navier-Stokes equations implemented in a matrix-free fashion.
-void solve_system_GMRES(const bool initial_step, const double absolute_residual, const double relative_residual)
GMRES solver with preconditioning.
-virtual void set_initial_condition_fd(Parameters::InitialConditionType initial_condition_type, bool restart=false) override
Set the initial conditions for the solver. If the simulation is restarted from a checkpoint,...
-void define_non_zero_constraints()
Define the non-zero constraints used to solve the problem.
-virtual void assemble_system_matrix() override
Assemble the matrix associated with the solver. Only required for compilation and it is not used for ...
+void solve_system_GMRES(const bool initial_step, const double absolute_residual, const double relative_residual)
GMRES solver with preconditioning.
+virtual void set_initial_condition_fd(Parameters::InitialConditionType initial_condition_type, bool restart=false) override
Set the initial conditions for the solver. If the simulation is restarted from a checkpoint,...
+void define_non_zero_constraints()
Define the non-zero constraints used to solve the problem.
+virtual void assemble_system_matrix() override
Assemble the matrix associated with the solver. Only required for compilation and it is not used for ...
LinearAlgebra::distributed::Vector< double > VectorType
-virtual void solve()
Solve the problem defined by simulation parameters by iterating through time or through the mesh refi...
-void assemble_L2_projection()
Assemble a L2 projection matrix for the velocity and the pressure, which can be used to set the initi...
-void setup_ILU()
Setup the implicit LU preconditioner and call the solve function of the linear solver....
-void calculate_time_derivative_previous_solutions()
Calculate and store time derivatives of previous solutions according to time-stepping scheme to use t...
-void define_zero_constraints()
Define the zero constraints used to solve the problem.
-virtual void setup_dofs_fd() override
Setup the degrees of freedom, system constraints, system operator and solution vectors.
-~MFNavierStokesSolver()
Destructor.
-MFNavierStokesSolver(SimulationParameters< dim > &nsparam)
Constructor that sets the finite element degree and system operator according to simulation parameter...
-void print_mg_setup_times()
Prints the setup times for the geometric multigrid preconditioner.
-virtual void assemble_system_rhs() override
Assemble the system right hand side associated with the solver.
-void update_solutions_for_multiphysics()
Provide present and previous flow solutions to the multiphysics interface. These solutions can be acc...
-void solve_linear_system(const bool initial_step, const bool renewed_matrix=true) override
Solve the linear system of equations using the method specified in the simulation parameters.
+virtual void solve()
Solve the problem defined by simulation parameters by iterating through time or through the mesh refi...
+void assemble_L2_projection()
Assemble a L2 projection matrix for the velocity and the pressure, which can be used to set the initi...
+void setup_ILU()
Setup the implicit LU preconditioner and call the solve function of the linear solver....
+void calculate_time_derivative_previous_solutions()
Calculate and store time derivatives of previous solutions according to time-stepping scheme to use t...
+void define_zero_constraints()
Define the zero constraints used to solve the problem.
+virtual void setup_dofs_fd() override
Setup the degrees of freedom, system constraints, system operator and solution vectors.
+~MFNavierStokesSolver()
Destructor.
+MFNavierStokesSolver(SimulationParameters< dim > &nsparam)
Constructor that sets the finite element degree and system operator according to simulation parameter...
+void print_mg_setup_times()
Prints the setup times for the geometric multigrid preconditioner.
+virtual void assemble_system_rhs() override
Assemble the system right hand side associated with the solver.
+void update_solutions_for_multiphysics()
Provide present and previous flow solutions to the multiphysics interface. These solutions can be acc...
+void solve_linear_system(const bool initial_step, const bool renewed_matrix=true) override
Solve the linear system of equations using the method specified in the simulation parameters.
std::shared_ptr< NavierStokesOperatorBase< dim, double > > system_operator
Matrix-free operator in used for all the matrix-vector multiplications calls (vmult).
-void setup_preconditioner() override
Set up appropriate preconditioner.
-virtual void update_multiphysics_time_average_solution() override
Update the average velocity field solution in the multiphyscics interface.
-void setup_GMG()
Setup the geometric multigrid preconditioner and call the solve function of the linear solver.
-void update_boundary_conditions()
Update non zero constraints if the boundary is time dependent.
+void setup_preconditioner() override
Set up appropriate preconditioner.
+virtual void update_multiphysics_time_average_solution() override
Update the average velocity field solution in the multiphyscics interface.
+void setup_GMG()
Setup the geometric multigrid preconditioner and call the solve function of the linear solver.
+void update_boundary_conditions()
Update non zero constraints if the boundary is time dependent.
std::shared_ptr< FESystem< dim > > fe
virtual void refine_mesh()
Allow the refinement of the mesh according to one of the 2 methods proposed.
@@ -2673,6 +2707,7 @@
enum Parameters::Stabilization::NavierStokesStabilization stabilization
+
diff --git a/doxygen/mf__navier__stokes__operators_8cc_source.html b/doxygen/mf__navier__stokes__operators_8cc_source.html
index f46a46800c..6a2774ad67 100644
--- a/doxygen/mf__navier__stokes__operators_8cc_source.html
+++ b/doxygen/mf__navier__stokes__operators_8cc_source.html
@@ -464,896 +464,917 @@
383 this->matrix_free.cell_loop(
-
- 387 for (
unsigned int i = 0; i < constrained_indices.size(); ++i)
- 388 dst.local_element(constrained_indices[i]) =
- 389 src.local_element(constrained_indices[i]);
-
-
- 392 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
-
- 394 const_cast<LinearAlgebra::distributed::Vector<number> &
>(src)
- 395 .local_element(edge_constrained_indices[i]) =
- 396 edge_constrained_values[i];
- 397 dst.local_element(edge_constrained_indices[i]) =
+
+
+ 388 for (
unsigned int i = 0; i < constrained_indices.size(); ++i)
+ 389 dst.local_element(constrained_indices[i]) =
+ 390 src.local_element(constrained_indices[i]);
+
+
+
+ 394 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
+
+ 396 const_cast<LinearAlgebra::distributed::Vector<number> &
>(src)
+ 397 .local_element(edge_constrained_indices[i]) =
398 edge_constrained_values[i];
-
-
- 401 this->timer.leave_subsection(
"operator::vmult");
-
-
- 404 template <
int dim,
typename number>
-
-
-
-
- 409 this->vmult(dst, src);
-
-
- 412 template <
int dim,
typename number>
-
-
-
-
-
- 418 this->matrix_free.cell_loop(
-
-
-
- 422 for (
unsigned int i = 0; i < constrained_indices.size(); ++i)
- 423 dst.local_element(constrained_indices[i]) =
- 424 src.local_element(constrained_indices[i]);
-
-
- 427 template <
int dim,
typename number>
-
-
-
-
-
- 433 this->timer.enter_subsection(
"operator::vmult_interface_up");
-
- 435 if (has_edge_constrained_indices ==
false)
-
-
-
-
-
-
+ 399 dst.local_element(edge_constrained_indices[i]) =
+ 400 edge_constrained_values[i];
+
+
+ 403 this->timer.leave_subsection(
"operator::vmult");
+
+
+ 406 template <
int dim,
typename number>
+
+
+
+
+ 411 this->vmult(dst, src);
+
+
+ 414 template <
int dim,
typename number>
+
+
+
+
+
+ 420 this->matrix_free.cell_loop(
+
+
+
+ 424 for (
unsigned int i = 0; i < constrained_indices.size(); ++i)
+ 425 dst.local_element(constrained_indices[i]) =
+ 426 src.local_element(constrained_indices[i]);
+
+
+ 429 template <
int dim,
typename number>
+
+
+
+
+
+ 435 this->timer.enter_subsection(
"operator::vmult_interface_up");
+
+ 437 if (has_edge_constrained_indices ==
false)
+
+
+
+
-
-
-
- 446 src_cpy.reinit(src,
false);
-
- 448 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
- 449 src_cpy.local_element(edge_constrained_indices[i]) =
- 450 src.local_element(edge_constrained_indices[i]);
-
-
-
-
-
-
-
-
- 459 this->timer.leave_subsection(
"operator::vmult_interface_up");
-
-
-
- 463 template <
int dim,
typename number>
- 464 const TrilinosWrappers::SparseMatrix &
-
-
- 467 this->timer.enter_subsection(
"operator::get_system_matrix");
-
- 469 if (system_matrix.m() == 0 && system_matrix.n() == 0)
-
- 471 const auto &dof_handler = this->matrix_free.get_dof_handler();
-
- 473 const unsigned int mg_level = this->matrix_free.get_mg_level();
+
+
+
+
+
+ 448 src_cpy.reinit(src,
false);
+
+ 450 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
+ 451 src_cpy.local_element(edge_constrained_indices[i]) =
+ 452 src.local_element(edge_constrained_indices[i]);
+
+
+
+
+
+
+
+
+ 461 this->timer.leave_subsection(
"operator::vmult_interface_up");
+
+
+
+ 465 template <
int dim,
typename number>
+ 466 const TrilinosWrappers::SparseMatrix &
+
+
+ 469 this->timer.enter_subsection(
"operator::get_system_matrix");
+
+ 471 if (system_matrix.m() == 0 && system_matrix.n() == 0)
+
+ 473 const auto &dof_handler = this->matrix_free.get_dof_handler();
- 475 IndexSet locally_relevant_dofs;
- 476 IndexSet locally_owned_dofs;
-
- 478 if (mg_level != numbers::invalid_unsigned_int)
-
- 480 locally_relevant_dofs =
- 481 DoFTools::extract_locally_relevant_level_dofs(dof_handler,
-
- 483 locally_owned_dofs = dof_handler.locally_owned_mg_dofs(mg_level);
-
-
-
- 487 locally_owned_dofs = dof_handler.locally_owned_dofs();
- 488 locally_relevant_dofs =
- 489 DoFTools::extract_locally_relevant_dofs(dof_handler);
-
-
- 492 DynamicSparsityPattern dsp(locally_relevant_dofs);
+ 475 const unsigned int mg_level = this->matrix_free.get_mg_level();
+
+ 477 IndexSet locally_relevant_dofs;
+ 478 IndexSet locally_owned_dofs;
+
+ 480 if (mg_level != numbers::invalid_unsigned_int)
+
+ 482 locally_relevant_dofs =
+ 483 DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+
+ 485 locally_owned_dofs = dof_handler.locally_owned_mg_dofs(mg_level);
+
+
+
+ 489 locally_owned_dofs = dof_handler.locally_owned_dofs();
+ 490 locally_relevant_dofs =
+ 491 DoFTools::extract_locally_relevant_dofs(dof_handler);
+
- 494 if (mg_level != numbers::invalid_unsigned_int)
-
-
-
-
- 499 std::vector<types::global_dof_index> dofs_on_this_cell;
-
- 501 for (
const auto &cell : dof_handler.cell_iterators_on_level(mg_level))
- 502 if (cell->is_locally_owned_on_level())
-
- 504 const unsigned int dofs_per_cell =
- 505 dof_handler.get_fe().n_dofs_per_cell();
- 506 dofs_on_this_cell.resize(dofs_per_cell);
- 507 cell->get_mg_dof_indices(dofs_on_this_cell);
-
- 509 constraints.add_entries_local_to_global(dofs_on_this_cell,
-
-
-
-
-
-
-
-
-
-
- 520 std::vector<types::global_dof_index> dofs_on_this_cell;
-
- 522 for (
const auto &cell : dof_handler.active_cell_iterators())
- 523 if (cell->is_locally_owned())
-
- 525 const unsigned int dofs_per_cell =
- 526 cell->get_fe().n_dofs_per_cell();
- 527 dofs_on_this_cell.resize(dofs_per_cell);
- 528 cell->get_dof_indices(dofs_on_this_cell);
-
- 530 constraints.add_entries_local_to_global(dofs_on_this_cell,
-
-
-
-
-
-
- 537 SparsityTools::distribute_sparsity_pattern(
-
-
- 540 dof_handler.get_triangulation().get_communicator(),
- 541 locally_relevant_dofs);
-
- 543 system_matrix.reinit(locally_owned_dofs,
-
-
- 546 dof_handler.get_triangulation().get_communicator());
-
-
-
+ 494 DynamicSparsityPattern dsp(locally_relevant_dofs);
+
+ 496 if (mg_level != numbers::invalid_unsigned_int)
+
+
+
+
+ 501 std::vector<types::global_dof_index> dofs_on_this_cell;
+
+ 503 for (
const auto &cell : dof_handler.cell_iterators_on_level(mg_level))
+ 504 if (cell->is_locally_owned_on_level())
+
+ 506 const unsigned int dofs_per_cell =
+ 507 dof_handler.get_fe().n_dofs_per_cell();
+ 508 dofs_on_this_cell.resize(dofs_per_cell);
+ 509 cell->get_mg_dof_indices(dofs_on_this_cell);
+
+ 511 constraints.add_entries_local_to_global(dofs_on_this_cell,
+
+
+
+
+
+
+
+
+
+
+ 522 std::vector<types::global_dof_index> dofs_on_this_cell;
+
+ 524 for (
const auto &cell : dof_handler.active_cell_iterators())
+ 525 if (cell->is_locally_owned())
+
+ 527 const unsigned int dofs_per_cell =
+ 528 cell->get_fe().n_dofs_per_cell();
+ 529 dofs_on_this_cell.resize(dofs_per_cell);
+ 530 cell->get_dof_indices(dofs_on_this_cell);
+
+ 532 constraints.add_entries_local_to_global(dofs_on_this_cell,
+
+
+
+
+
+
+ 539 SparsityTools::distribute_sparsity_pattern(
+
+
+ 542 dof_handler.get_triangulation().get_communicator(),
+ 543 locally_relevant_dofs);
+
+ 545 system_matrix.reinit(locally_owned_dofs,
+
+
+ 548 dof_handler.get_triangulation().get_communicator());
+
-
-
-
-
- 555 const auto &lexicographic_numbering =
- 556 matrix_free.get_shape_info().lexicographic_numbering;
-
- 558 unsigned int cell = numbers::invalid_unsigned_int;
- 559 unsigned int column = numbers::invalid_unsigned_int;
-
-
- 562 compute_matrix<dim, -1, 0, dim + 1, number, VectorizedArray<number>>(
- 563 matrix_free, constraints, system_matrix, [&](
auto &integrator) {
- 564 if (cell != integrator.get_current_cell_index())
-
- 566 cell = integrator.get_current_cell_index();
-
-
-
- 570 do_cell_integral_local(integrator);
+
+
+
+
+
+
+ 557 const auto &lexicographic_numbering =
+ 558 matrix_free.get_shape_info().lexicographic_numbering;
+
+ 560 unsigned int cell = numbers::invalid_unsigned_int;
+ 561 unsigned int column = numbers::invalid_unsigned_int;
+
+
+ 564 compute_matrix<dim, -1, 0, dim + 1, number, VectorizedArray<number>>(
+ 565 matrix_free, constraints, system_matrix, [&](
auto &integrator) {
+ 566 if (cell != integrator.get_current_cell_index())
+
+ 568 cell = integrator.get_current_cell_index();
+
+
-
- 573 for (
unsigned int i = 0; i < lexicographic_numbering.size(); ++i)
- 574 if (!bool_dof_mask[lexicographic_numbering[i]]
- 575 [lexicographic_numbering[column]])
- 576 integrator.begin_dof_values()[i] = 0.0;
-
-
-
-
- 581 this->timer.leave_subsection(
"operator::get_system_matrix");
+ 572 do_cell_integral_local(integrator);
+
+
+ 575 for (
unsigned int i = 0; i < lexicographic_numbering.size(); ++i)
+ 576 if (!bool_dof_mask[lexicographic_numbering[i]]
+ 577 [lexicographic_numbering[column]])
+ 578 integrator.begin_dof_values()[i] = 0.0;
+
+
+
- 583 return this->system_matrix;
-
-
- 586 template <
int dim,
typename number>
- 587 const MatrixFree<dim, number> &
-
-
- 590 return this->matrix_free;
-
+
+
+
+ 586 for (
const auto &local_row : constrained_indices)
+
+ 588 const auto global_row =
+ 589 get_vector_partitioner()->local_to_global(local_row);
+ 590 system_matrix.set(global_row, global_row, 1.0);
+
- 593 template <
int dim,
typename number>
- 594 const AlignedVector<VectorizedArray<number>>
-
-
- 597 return this->element_size;
-
+ 593 for (
const auto &local_row : edge_constrained_indices)
+
+ 595 const auto global_row =
+ 596 get_vector_partitioner()->local_to_global(local_row);
+ 597 system_matrix.set(global_row, global_row, 1.0);
+
- 600 template <
int dim,
typename number>
-
-
-
-
- 605 this->timer.enter_subsection(
"operator::evaluate_non_linear_term");
+ 600 system_matrix.compress(VectorOperation::insert);
+
+ 602 this->timer.leave_subsection(
"operator::get_system_matrix");
+
+ 604 return this->system_matrix;
+
- 607 const unsigned int n_cells = matrix_free.n_cell_batches();
-
-
-
- 611 nonlinear_previous_values.reinit(n_cells, integrator.n_q_points);
- 612 nonlinear_previous_gradient.reinit(n_cells, integrator.n_q_points);
- 613 nonlinear_previous_hessian_diagonal.reinit(n_cells, integrator.n_q_points);
- 614 stabilization_parameter.reinit(n_cells, integrator.n_q_points);
- 615 stabilization_parameter_lsic.reinit(n_cells, integrator.n_q_points);
-
-
-
-
-
- 621 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
false;
-
-
-
- 625 const auto time_steps_vector =
- 626 this->simulation_control->get_time_steps_vector();
- 627 const double dt = time_steps_vector[0];
-
-
+ 607 template <
int dim,
typename number>
+ 608 const MatrixFree<dim, number> &
+
+
+ 611 return this->matrix_free;
+
+
+ 614 template <
int dim,
typename number>
+ 615 const AlignedVector<VectorizedArray<number>>
+
+
+ 618 return this->element_size;
+
+
+ 621 template <
int dim,
typename number>
+
+
+
+
+ 626 this->timer.enter_subsection(
"operator::evaluate_non_linear_term");
+
+ 628 const unsigned int n_cells = matrix_free.n_cell_batches();
+
- 631 for (
unsigned int cell = 0; cell < n_cells; ++cell)
-
- 633 integrator.reinit(cell);
- 634 integrator.read_dof_values_plain(newton_step);
-
- 636 if (this->enable_hessians_jacobian)
- 637 integrator.evaluate(EvaluationFlags::values |
- 638 EvaluationFlags::gradients |
- 639 EvaluationFlags::hessians);
-
- 641 integrator.evaluate(EvaluationFlags::values |
- 642 EvaluationFlags::gradients);
+
+ 632 nonlinear_previous_values.reinit(n_cells, integrator.n_q_points);
+ 633 nonlinear_previous_gradient.reinit(n_cells, integrator.n_q_points);
+ 634 nonlinear_previous_hessian_diagonal.reinit(n_cells, integrator.n_q_points);
+ 635 stabilization_parameter.reinit(n_cells, integrator.n_q_points);
+ 636 stabilization_parameter_lsic.reinit(n_cells, integrator.n_q_points);
+
+
+
+
+
+ 642 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
false;
-
- 645 const auto h = integrator.read_cell_data(this->get_element_size());
-
- 647 for (
const auto q : integrator.quadrature_point_indices())
-
- 649 nonlinear_previous_values(cell, q) = integrator.get_value(q);
- 650 nonlinear_previous_gradient(cell, q) = integrator.get_gradient(q);
+
+
+ 646 const auto time_steps_vector =
+ 647 this->simulation_control->get_time_steps_vector();
+ 648 const double dt = time_steps_vector[0];
+
+
- 652 if (this->enable_hessians_jacobian)
- 653 nonlinear_previous_hessian_diagonal(cell, q) =
- 654 integrator.get_hessian_diagonal(q);
-
-
- 657 VectorizedArray<number> u_mag_squared = 1e-12;
- 658 for (
unsigned int k = 0; k < dim; ++k)
-
- 660 Utilities::fixed_power<2>(integrator.get_value(q)[k]);
-
- 662 stabilization_parameter(cell, q) =
- 663 1. / std::sqrt(Utilities::fixed_power<2>(sdt) +
- 664 4. * u_mag_squared / h / h +
- 665 9. * Utilities::fixed_power<2>(
- 666 4. * this->kinematic_viscosity / (h * h)));
+ 652 for (
unsigned int cell = 0; cell < n_cells; ++cell)
+
+ 654 integrator.reinit(cell);
+ 655 integrator.read_dof_values_plain(newton_step);
+
+ 657 if (this->enable_hessians_jacobian)
+ 658 integrator.evaluate(EvaluationFlags::values |
+ 659 EvaluationFlags::gradients |
+ 660 EvaluationFlags::hessians);
+
+ 662 integrator.evaluate(EvaluationFlags::values |
+ 663 EvaluationFlags::gradients);
+
+
+ 666 const auto h = integrator.read_cell_data(this->get_element_size());
- 668 stabilization_parameter_lsic(cell, q) =
- 669 std::sqrt(u_mag_squared) * h * 0.5;
-
-
+ 668 for (
const auto q : integrator.quadrature_point_indices())
+
+ 670 nonlinear_previous_values(cell, q) = integrator.get_value(q);
+ 671 nonlinear_previous_gradient(cell, q) = integrator.get_gradient(q);
- 673 this->timer.leave_subsection(
"operator::evaluate_non_linear_term");
-
-
- 676 template <
int dim,
typename number>
-
-
-
- 680 const VectorType &time_derivative_previous_solutions)
-
- 682 this->timer.enter_subsection(
- 683 "operator::evaluate_time_derivative_previous_solutions");
-
- 685 const unsigned int n_cells = matrix_free.n_cell_batches();
-
-
- 688 time_derivatives_previous_solutions.reinit(n_cells, integrator.n_q_points);
-
- 690 for (
unsigned int cell = 0; cell < n_cells; ++cell)
-
- 692 integrator.reinit(cell);
- 693 integrator.read_dof_values_plain(time_derivative_previous_solutions);
- 694 integrator.evaluate(EvaluationFlags::values);
- 695 for (
const auto q : integrator.quadrature_point_indices())
- 696 time_derivatives_previous_solutions(cell, q) += integrator.get_value(q);
-
-
- 699 this->timer.leave_subsection(
- 700 "operator::evaluate_time_derivative_previous_solutions");
-
-
- 703 template <
int dim,
typename number>
-
-
- 706 const Tensor<1, dim> &beta_force)
-
- 708 for (
unsigned int v = 0; v < VectorizedArray<number>::size(); ++v)
-
- 710 for (
unsigned int d = 0; d < dim; ++d)
- 711 this->beta_force[d][v] = beta_force[d];
-
-
-
- 715 template <
int dim,
typename number>
-
-
-
-
- 720 this->timer.enter_subsection(
"operator::evaluate_residual");
-
- 722 this->matrix_free.cell_loop(
-
-
- 725 this->timer.leave_subsection(
"operator::evaluate_residual");
-
-
- 728 template <
int dim,
typename number>
-
-
-
-
- 733 this->timer.enter_subsection(
"operator::compute_inverse_diagonal");
-
- 735 this->matrix_free.initialize_dof_vector(diagonal);
- 736 MatrixFreeTools::compute_diagonal(
-
-
-
-
-
- 742 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
- 743 diagonal.local_element(edge_constrained_indices[i]) = 0.0;
-
- 745 for (
auto &i : diagonal)
- 746 i = (std::abs(i) > 1.0e-10) ? (1.0 / i) : 1.0;
-
- 748 this->timer.leave_subsection(
"operator::compute_inverse_diagonal");
-
-
- 751 template <
int dim,
typename number>
-
-
- 754 const MatrixFree<dim, number> &matrix_free,
-
-
- 757 const std::pair<unsigned int, unsigned int> &range)
const
-
-
-
- 761 for (
unsigned int cell = range.first; cell < range.second; ++cell)
-
- 763 integrator.reinit(cell);
-
- 765 integrator.read_dof_values(src);
-
- 767 do_cell_integral_local(integrator);
+ 673 if (this->enable_hessians_jacobian)
+ 674 nonlinear_previous_hessian_diagonal(cell, q) =
+ 675 integrator.get_hessian_diagonal(q);
+
+
+ 678 VectorizedArray<number> u_mag_squared = 1e-12;
+ 679 for (
unsigned int k = 0; k < dim; ++k)
+
+ 681 Utilities::fixed_power<2>(integrator.get_value(q)[k]);
+
+ 683 stabilization_parameter(cell, q) =
+ 684 1. / std::sqrt(Utilities::fixed_power<2>(sdt) +
+ 685 4. * u_mag_squared / h / h +
+ 686 9. * Utilities::fixed_power<2>(
+ 687 4. * this->kinematic_viscosity / (h * h)));
+
+ 689 stabilization_parameter_lsic(cell, q) =
+ 690 std::sqrt(u_mag_squared) * h * 0.5;
+
+
+
+ 694 this->timer.leave_subsection(
"operator::evaluate_non_linear_term");
+
+
+ 697 template <
int dim,
typename number>
+
+
+
+ 701 const VectorType &time_derivative_previous_solutions)
+
+ 703 this->timer.enter_subsection(
+ 704 "operator::evaluate_time_derivative_previous_solutions");
+
+ 706 const unsigned int n_cells = matrix_free.n_cell_batches();
+
+
+ 709 time_derivatives_previous_solutions.reinit(n_cells, integrator.n_q_points);
+
+ 711 for (
unsigned int cell = 0; cell < n_cells; ++cell)
+
+ 713 integrator.reinit(cell);
+ 714 integrator.read_dof_values_plain(time_derivative_previous_solutions);
+ 715 integrator.evaluate(EvaluationFlags::values);
+ 716 for (
const auto q : integrator.quadrature_point_indices())
+ 717 time_derivatives_previous_solutions(cell, q) += integrator.get_value(q);
+
+
+ 720 this->timer.leave_subsection(
+ 721 "operator::evaluate_time_derivative_previous_solutions");
+
+
+ 724 template <
int dim,
typename number>
+
+
+ 727 const Tensor<1, dim> &beta_force)
+
+ 729 for (
unsigned int v = 0; v < VectorizedArray<number>::size(); ++v)
+
+ 731 for (
unsigned int d = 0; d < dim; ++d)
+ 732 this->beta_force[d][v] = beta_force[d];
+
+
+
+ 736 template <
int dim,
typename number>
+
+
+
+
+ 741 this->timer.enter_subsection(
"operator::evaluate_residual");
+
+ 743 this->matrix_free.cell_loop(
+
+
+ 746 this->timer.leave_subsection(
"operator::evaluate_residual");
+
+
+ 749 template <
int dim,
typename number>
+
+
+
+
+ 754 this->timer.enter_subsection(
"operator::compute_inverse_diagonal");
+
+ 756 this->matrix_free.initialize_dof_vector(diagonal);
+ 757 MatrixFreeTools::compute_diagonal(
+
+
+
+
+
+ 763 for (
unsigned int i = 0; i < edge_constrained_indices.size(); ++i)
+ 764 diagonal.local_element(edge_constrained_indices[i]) = 0.0;
+
+ 766 for (
auto &i : diagonal)
+ 767 i = (std::abs(i) > 1.0e-10) ? (1.0 / i) : 1.0;
- 769 integrator.distribute_local_to_global(dst);
-
-
-
- 773 template <
int dim,
typename number>
-
-
- 776 const MatrixFree<dim, number> &matrix_free)
-
- 778 const unsigned int level = matrix_free.get_mg_level();
-
- 780 std::vector<IndexSet> refinement_edge_indices;
- 781 refinement_edge_indices.clear();
- 782 const unsigned int nlevels =
- 783 matrix_free.get_dof_handler().get_triangulation().n_global_levels();
- 784 refinement_edge_indices.resize(nlevels);
- 785 for (
unsigned int l = 0; l < nlevels; l++)
- 786 refinement_edge_indices[l] =
- 787 IndexSet(matrix_free.get_dof_handler().n_dofs(l));
-
- 789 MGTools::extract_inner_interface_dofs(matrix_free.get_dof_handler(),
- 790 refinement_edge_indices);
- 791 return refinement_edge_indices[level];
+ 769 this->timer.leave_subsection(
"operator::compute_inverse_diagonal");
+
+
+ 772 template <
int dim,
typename number>
+
+
+ 775 const MatrixFree<dim, number> &matrix_free,
+
+
+ 778 const std::pair<unsigned int, unsigned int> &range)
const
+
+
+
+ 782 for (
unsigned int cell = range.first; cell < range.second; ++cell)
+
+ 784 integrator.reinit(cell);
+
+ 786 integrator.read_dof_values(src);
+
+ 788 do_cell_integral_local(integrator);
+
+ 790 integrator.distribute_local_to_global(dst);
+
-
-
-
- 797 template <
int dim,
typename number>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 813 template <
int dim,
typename number>
-
-
-
-
- 818 if (this->enable_hessians_jacobian)
- 819 integrator.evaluate(EvaluationFlags::values | EvaluationFlags::gradients |
- 820 EvaluationFlags::hessians);
-
- 822 integrator.evaluate(EvaluationFlags::values | EvaluationFlags::gradients);
-
- 824 const unsigned int cell = integrator.get_current_cell_index();
-
-
-
- 828 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
false;
-
-
- 831 const Vector<double> *bdf_coefs;
-
- 833 bdf_coefs = &this->simulation_control->get_bdf_coefficients();
-
- 835 for (
const auto q : integrator.quadrature_point_indices())
-
- 837 Tensor<1, dim, VectorizedArray<number>> source_value;
-
-
- 840 if (this->forcing_function)
-
- 842 Point<dim, VectorizedArray<number>> point_batch =
- 843 integrator.quadrature_point(q);
-
- 845 evaluate_function<dim, number, dim>(*(this->forcing_function),
-
-
-
-
- 850 source_value += this->beta_force;
-
-
- 853 typename FECellIntegrator::value_type value = integrator.get_value(q);
- 854 typename FECellIntegrator::gradient_type gradient =
- 855 integrator.get_gradient(q);
- 856 typename FECellIntegrator::gradient_type hessian_diagonal;
-
- 858 if (this->enable_hessians_jacobian)
- 859 hessian_diagonal = integrator.get_hessian_diagonal(q);
-
-
- 862 typename FECellIntegrator::value_type value_result;
- 863 typename FECellIntegrator::gradient_type gradient_result;
- 864 typename FECellIntegrator::hessian_type hessian_result;
-
-
- 867 auto previous_values = this->nonlinear_previous_values(cell, q);
- 868 auto previous_gradient = this->nonlinear_previous_gradient(cell, q);
- 869 auto previous_hessian_diagonal =
- 870 this->nonlinear_previous_hessian_diagonal(cell, q);
-
- 872 Tensor<1, dim + 1, VectorizedArray<number>> previous_time_derivatives;
-
- 874 previous_time_derivatives =
- 875 this->time_derivatives_previous_solutions(cell, q);
-
-
- 878 const auto tau = this->stabilization_parameter[cell][q];
- 879 const auto tau_lsic = this->stabilization_parameter_lsic[cell][q];
-
-
- 882 for (
unsigned int i = 0; i < dim; ++i)
-
-
- 885 gradient_result[i] = this->kinematic_viscosity * gradient[i];
-
- 887 gradient_result[i][i] += -value[dim];
-
- 889 value_result[dim] += gradient[i][i];
-
- 891 for (
unsigned int k = 0; k < dim; ++k)
-
-
- 894 value_result[i] += gradient[i][k] * previous_values[k] +
- 895 previous_gradient[i][k] * value[k];
-
-
-
- 899 value_result[i] += (*bdf_coefs)[0] * value[i];
-
+ 794 template <
int dim,
typename number>
+
+
+ 797 const MatrixFree<dim, number> &matrix_free)
+
+ 799 const unsigned int level = matrix_free.get_mg_level();
+
+ 801 std::vector<IndexSet> refinement_edge_indices;
+ 802 refinement_edge_indices.clear();
+ 803 const unsigned int nlevels =
+ 804 matrix_free.get_dof_handler().get_triangulation().n_global_levels();
+ 805 refinement_edge_indices.resize(nlevels);
+ 806 for (
unsigned int l = 0; l < nlevels; l++)
+ 807 refinement_edge_indices[l] =
+ 808 IndexSet(matrix_free.get_dof_handler().n_dofs(l));
+
+ 810 MGTools::extract_inner_interface_dofs(matrix_free.get_dof_handler(),
+ 811 refinement_edge_indices);
+ 812 return refinement_edge_indices[level];
+
+
+
+
+
+ 818 template <
int dim,
typename number>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 834 template <
int dim,
typename number>
+
+
+
+
+ 839 if (this->enable_hessians_jacobian)
+ 840 integrator.evaluate(EvaluationFlags::values | EvaluationFlags::gradients |
+ 841 EvaluationFlags::hessians);
+
+ 843 integrator.evaluate(EvaluationFlags::values | EvaluationFlags::gradients);
+
+ 845 const unsigned int cell = integrator.get_current_cell_index();
+
+
+
+ 849 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
false;
+
+
+ 852 const Vector<double> *bdf_coefs;
+
+ 854 bdf_coefs = &this->simulation_control->get_bdf_coefficients();
+
+ 856 for (
const auto q : integrator.quadrature_point_indices())
+
+ 858 Tensor<1, dim, VectorizedArray<number>> source_value;
+
+
+ 861 if (this->forcing_function)
+
+ 863 Point<dim, VectorizedArray<number>> point_batch =
+ 864 integrator.quadrature_point(q);
+
+ 866 evaluate_function<dim, number, dim>(*(this->forcing_function),
+
+
+
+
+ 871 source_value += this->beta_force;
+
+
+ 874 typename FECellIntegrator::value_type value = integrator.get_value(q);
+ 875 typename FECellIntegrator::gradient_type gradient =
+ 876 integrator.get_gradient(q);
+ 877 typename FECellIntegrator::gradient_type hessian_diagonal;
+
+ 879 if (this->enable_hessians_jacobian)
+ 880 hessian_diagonal = integrator.get_hessian_diagonal(q);
+
+
+ 883 typename FECellIntegrator::value_type value_result;
+ 884 typename FECellIntegrator::gradient_type gradient_result;
+ 885 typename FECellIntegrator::hessian_type hessian_result;
+
+
+ 888 auto previous_values = this->nonlinear_previous_values(cell, q);
+ 889 auto previous_gradient = this->nonlinear_previous_gradient(cell, q);
+ 890 auto previous_hessian_diagonal =
+ 891 this->nonlinear_previous_hessian_diagonal(cell, q);
+
+ 893 Tensor<1, dim + 1, VectorizedArray<number>> previous_time_derivatives;
+
+ 895 previous_time_derivatives =
+ 896 this->time_derivatives_previous_solutions(cell, q);
+
+
+ 899 const auto tau = this->stabilization_parameter[cell][q];
+ 900 const auto tau_lsic = this->stabilization_parameter_lsic[cell][q];
-
+
903 for (
unsigned int i = 0; i < dim; ++i)
- 905 for (
unsigned int k = 0; k < dim; ++k)
-
-
- 908 gradient_result[dim][i] +=
- 909 tau * (-this->kinematic_viscosity * hessian_diagonal[i][k] +
- 910 gradient[i][k] * previous_values[k] +
- 911 previous_gradient[i][k] * value[k]);
-
-
-
- 915 gradient_result[dim][i] += tau * (*bdf_coefs)[0] * value[i];
-
-
- 918 gradient_result[dim] += tau * gradient[dim];
-
-
- 921 for (
unsigned int i = 0; i < dim; ++i)
-
- 923 for (
unsigned int k = 0; k < dim; ++k)
-
-
- 926 for (
unsigned int l = 0; l < dim; ++l)
-
-
- 929 gradient_result[i][k] +=
- 930 tau * previous_values[k] *
- 931 (gradient[i][l] * previous_values[l] +
- 932 previous_gradient[i][l] * value[l] -
- 933 this->kinematic_viscosity * hessian_diagonal[i][l]);
-
-
- 936 gradient_result[i][k] +=
- 937 tau * previous_values[k] * (gradient[dim][i]);
-
-
-
- 941 gradient_result[i][k] +=
- 942 tau * previous_values[k] * ((*bdf_coefs)[0] * value[i]);
-
-
-
- 946 for (
unsigned int l = 0; l < dim; ++l)
-
-
- 949 gradient_result[i][k] +=
-
- 951 (previous_gradient[i][l] * previous_values[l] -
- 952 this->kinematic_viscosity *
- 953 previous_hessian_diagonal[i][l]);
-
-
- 956 gradient_result[i][k] +=
- 957 tau * value[k] * (previous_gradient[dim][i] - source_value[i]);
-
-
-
- 961 gradient_result[i][k] += tau * value[k] *
- 962 ((*bdf_coefs)[0] * previous_values[i] +
- 963 previous_time_derivatives[i]);
-
-
-
- 967 if (this->stabilization ==
-
-
-
- 971 for (
unsigned int i = 0; i < dim; ++i)
-
- 973 for (
unsigned int k = 0; k < dim; ++k)
-
- 975 if (this->enable_hessians_jacobian)
-
- 977 for (
unsigned int l = 0; l < dim; ++l)
-
-
- 980 hessian_result[i][k][k] +=
- 981 tau * -this->kinematic_viscosity *
- 982 (gradient[i][l] * previous_values[l] +
- 983 previous_gradient[i][l] * value[l] -
- 984 this->kinematic_viscosity *
- 985 hessian_diagonal[i][l]);
-
+
+ 906 gradient_result[i] = this->kinematic_viscosity * gradient[i];
+
+ 908 gradient_result[i][i] += -value[dim];
+
+ 910 value_result[dim] += gradient[i][i];
+
+ 912 for (
unsigned int k = 0; k < dim; ++k)
+
+
+ 915 value_result[i] += gradient[i][k] * previous_values[k] +
+ 916 previous_gradient[i][k] * value[k];
+
+
+
+ 920 value_result[i] += (*bdf_coefs)[0] * value[i];
+
+
+
+ 924 for (
unsigned int i = 0; i < dim; ++i)
+
+ 926 for (
unsigned int k = 0; k < dim; ++k)
+
+
+ 929 gradient_result[dim][i] +=
+ 930 tau * (-this->kinematic_viscosity * hessian_diagonal[i][k] +
+ 931 gradient[i][k] * previous_values[k] +
+ 932 previous_gradient[i][k] * value[k]);
+
+
+
+ 936 gradient_result[dim][i] += tau * (*bdf_coefs)[0] * value[i];
+
+
+ 939 gradient_result[dim] += tau * gradient[dim];
+
+
+ 942 for (
unsigned int i = 0; i < dim; ++i)
+
+ 944 for (
unsigned int k = 0; k < dim; ++k)
+
+
+ 947 for (
unsigned int l = 0; l < dim; ++l)
+
+
+ 950 gradient_result[i][k] +=
+ 951 tau * previous_values[k] *
+ 952 (gradient[i][l] * previous_values[l] +
+ 953 previous_gradient[i][l] * value[l] -
+ 954 this->kinematic_viscosity * hessian_diagonal[i][l]);
+
+
+ 957 gradient_result[i][k] +=
+ 958 tau * previous_values[k] * (gradient[dim][i]);
+
+
+
+ 962 gradient_result[i][k] +=
+ 963 tau * previous_values[k] * ((*bdf_coefs)[0] * value[i]);
+
+
+
+ 967 for (
unsigned int l = 0; l < dim; ++l)
+
+
+ 970 gradient_result[i][k] +=
+
+ 972 (previous_gradient[i][l] * previous_values[l] -
+ 973 this->kinematic_viscosity *
+ 974 previous_hessian_diagonal[i][l]);
+
+
+ 977 gradient_result[i][k] +=
+ 978 tau * value[k] * (previous_gradient[dim][i] - source_value[i]);
+
+
+
+ 982 gradient_result[i][k] += tau * value[k] *
+ 983 ((*bdf_coefs)[0] * previous_values[i] +
+ 984 previous_time_derivatives[i]);
+
+
-
- 989 hessian_result[i][k][k] +=
- 990 tau * -this->kinematic_viscosity * (gradient[dim][i]);
-
-
-
- 994 hessian_result[i][k][k] += tau *
- 995 -this->kinematic_viscosity *
- 996 ((*bdf_coefs)[0] * value[i]);
-
-
-
-
- 1001 gradient_result[i][i] += tau_lsic * gradient[k][k];
-
-
-
-
- 1006 integrator.submit_gradient(gradient_result, q);
- 1007 integrator.submit_value(value_result, q);
+ 988 if (this->stabilization ==
+
+
+
+ 992 for (
unsigned int i = 0; i < dim; ++i)
+
+ 994 for (
unsigned int k = 0; k < dim; ++k)
+
+ 996 if (this->enable_hessians_jacobian)
+
+ 998 for (
unsigned int l = 0; l < dim; ++l)
+
+
+ 1001 hessian_result[i][k][k] +=
+ 1002 tau * -this->kinematic_viscosity *
+ 1003 (gradient[i][l] * previous_values[l] +
+ 1004 previous_gradient[i][l] * value[l] -
+ 1005 this->kinematic_viscosity *
+ 1006 hessian_diagonal[i][l]);
+
- 1009 if (this->enable_hessians_jacobian)
- 1010 integrator.submit_hessian(hessian_result, q);
-
+
+ 1010 hessian_result[i][k][k] +=
+ 1011 tau * -this->kinematic_viscosity * (gradient[dim][i]);
- 1013 if (this->enable_hessians_jacobian)
- 1014 integrator.integrate(EvaluationFlags::values | EvaluationFlags::gradients |
- 1015 EvaluationFlags::hessians);
-
- 1017 integrator.integrate(EvaluationFlags::values | EvaluationFlags::gradients);
-
-
-
-
-
-
-
-
-
-
-
-
- 1030 template <
int dim,
typename number>
-
-
- 1033 const MatrixFree<dim, number> &matrix_free,
-
-
- 1036 const std::pair<unsigned int, unsigned int> &range)
const
-
-
-
- 1040 for (
unsigned int cell = range.first; cell < range.second; ++cell)
-
- 1042 integrator.reinit(cell);
- 1043 integrator.read_dof_values_plain(src);
-
- 1045 if (this->enable_hessians_residual)
- 1046 integrator.evaluate(EvaluationFlags::values |
- 1047 EvaluationFlags::gradients |
- 1048 EvaluationFlags::hessians);
-
- 1050 integrator.evaluate(EvaluationFlags::values |
- 1051 EvaluationFlags::gradients);
-
-
-
- 1055 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
-
-
-
- 1059 const Vector<double> *bdf_coefs;
-
- 1061 bdf_coefs = &this->simulation_control->get_bdf_coefficients();
-
- 1063 for (
const auto q : integrator.quadrature_point_indices())
-
- 1065 Tensor<1, dim, VectorizedArray<number>> source_value;
-
-
- 1068 if (this->forcing_function)
-
- 1070 Point<dim, VectorizedArray<number>> point_batch =
- 1071 integrator.quadrature_point(q);
-
- 1073 evaluate_function<dim, number, dim>(*(this->forcing_function),
-
-
-
-
-
- 1079 source_value += this->beta_force;
-
-
- 1082 typename FECellIntegrator::value_type value = integrator.get_value(q);
- 1083 typename FECellIntegrator::gradient_type gradient =
- 1084 integrator.get_gradient(q);
- 1085 typename FECellIntegrator::gradient_type hessian_diagonal;
-
- 1087 if (this->enable_hessians_residual)
- 1088 hessian_diagonal = integrator.get_hessian_diagonal(q);
-
-
- 1091 Tensor<1, dim + 1, VectorizedArray<number>> previous_time_derivatives;
-
- 1093 previous_time_derivatives =
- 1094 this->time_derivatives_previous_solutions(cell, q);
-
-
- 1097 const auto tau = this->stabilization_parameter[cell][q];
- 1098 const auto tau_lsic = this->stabilization_parameter_lsic[cell][q];
-
-
- 1101 typename FECellIntegrator::value_type value_result;
- 1102 typename FECellIntegrator::gradient_type gradient_result;
- 1103 typename FECellIntegrator::hessian_type hessian_result;
-
-
- 1106 for (
unsigned int i = 0; i < dim; ++i)
-
-
- 1109 gradient_result[i] = this->kinematic_viscosity * gradient[i];
-
- 1111 gradient_result[i][i] += -value[dim];
-
- 1113 value_result[i] = -source_value[i];
-
-
-
-
- 1118 (*bdf_coefs)[0] * value[i] + previous_time_derivatives[i];
-
+
+
+ 1015 hessian_result[i][k][k] += tau *
+ 1016 -this->kinematic_viscosity *
+ 1017 ((*bdf_coefs)[0] * value[i]);
+
+
+
+
+ 1022 gradient_result[i][i] += tau_lsic * gradient[k][k];
+
+
+
+
+ 1027 integrator.submit_gradient(gradient_result, q);
+ 1028 integrator.submit_value(value_result, q);
+
+ 1030 if (this->enable_hessians_jacobian)
+ 1031 integrator.submit_hessian(hessian_result, q);
+
+
+ 1034 if (this->enable_hessians_jacobian)
+ 1035 integrator.integrate(EvaluationFlags::values | EvaluationFlags::gradients |
+ 1036 EvaluationFlags::hessians);
+
+ 1038 integrator.integrate(EvaluationFlags::values | EvaluationFlags::gradients);
+
+
+
+
+
+
+
+
+
+
+
+
+ 1051 template <
int dim,
typename number>
+
+
+ 1054 const MatrixFree<dim, number> &matrix_free,
+
+
+ 1057 const std::pair<unsigned int, unsigned int> &range)
const
+
+
+
+ 1061 for (
unsigned int cell = range.first; cell < range.second; ++cell)
+
+ 1063 integrator.reinit(cell);
+ 1064 integrator.read_dof_values_plain(src);
+
+ 1066 if (this->enable_hessians_residual)
+ 1067 integrator.evaluate(EvaluationFlags::values |
+ 1068 EvaluationFlags::gradients |
+ 1069 EvaluationFlags::hessians);
+
+ 1071 integrator.evaluate(EvaluationFlags::values |
+ 1072 EvaluationFlags::gradients);
+
+
+
+ 1076 (
is_bdf(this->simulation_control->get_assembly_method())) ?
true :
+
+
+
+ 1080 const Vector<double> *bdf_coefs;
+
+ 1082 bdf_coefs = &this->simulation_control->get_bdf_coefficients();
+
+ 1084 for (
const auto q : integrator.quadrature_point_indices())
+
+ 1086 Tensor<1, dim, VectorizedArray<number>> source_value;
+
+
+ 1089 if (this->forcing_function)
+
+ 1091 Point<dim, VectorizedArray<number>> point_batch =
+ 1092 integrator.quadrature_point(q);
+
+ 1094 evaluate_function<dim, number, dim>(*(this->forcing_function),
+
+
+
+
+
+ 1100 source_value += this->beta_force;
+
+
+ 1103 typename FECellIntegrator::value_type value = integrator.get_value(q);
+ 1104 typename FECellIntegrator::gradient_type gradient =
+ 1105 integrator.get_gradient(q);
+ 1106 typename FECellIntegrator::gradient_type hessian_diagonal;
+
+ 1108 if (this->enable_hessians_residual)
+ 1109 hessian_diagonal = integrator.get_hessian_diagonal(q);
+
+
+ 1112 Tensor<1, dim + 1, VectorizedArray<number>> previous_time_derivatives;
+
+ 1114 previous_time_derivatives =
+ 1115 this->time_derivatives_previous_solutions(cell, q);
+
+
+ 1118 const auto tau = this->stabilization_parameter[cell][q];
+ 1119 const auto tau_lsic = this->stabilization_parameter_lsic[cell][q];
-
- 1122 value_result[dim] += gradient[i][i];
-
- 1124 for (
unsigned int k = 0; k < dim; ++k)
-
-
- 1127 value_result[i] += gradient[i][k] * value[k];
-
-
-
-
- 1132 for (
unsigned int i = 0; i < dim; ++i)
-
- 1134 for (
unsigned int k = 0; k < dim; ++k)
-
-
- 1137 gradient_result[dim][i] +=
- 1138 tau * (-this->kinematic_viscosity * hessian_diagonal[i][k] +
- 1139 gradient[i][k] * value[k]);
-
-
- 1142 gradient_result[dim][i] += tau * (-source_value[i]);
-
-
-
- 1146 gradient_result[dim][i] += tau * ((*bdf_coefs)[0] * value[i] +
- 1147 previous_time_derivatives[i]);
-
-
- 1150 gradient_result[dim] += tau * gradient[dim];
+
+ 1122 typename FECellIntegrator::value_type value_result;
+ 1123 typename FECellIntegrator::gradient_type gradient_result;
+ 1124 typename FECellIntegrator::hessian_type hessian_result;
+
+
+ 1127 for (
unsigned int i = 0; i < dim; ++i)
+
+
+ 1130 gradient_result[i] = this->kinematic_viscosity * gradient[i];
+
+ 1132 gradient_result[i][i] += -value[dim];
+
+ 1134 value_result[i] = -source_value[i];
+
+
+
+
+ 1139 (*bdf_coefs)[0] * value[i] + previous_time_derivatives[i];
+
+
+
+ 1143 value_result[dim] += gradient[i][i];
+
+ 1145 for (
unsigned int k = 0; k < dim; ++k)
+
+
+ 1148 value_result[i] += gradient[i][k] * value[k];
+
+
-
+
1153 for (
unsigned int i = 0; i < dim; ++i)
1155 for (
unsigned int k = 0; k < dim; ++k)
- 1157 for (
unsigned int l = 0; l < dim; ++l)
-
-
- 1160 gradient_result[i][k] +=
- 1161 -tau * this->kinematic_viscosity * value[k] *
- 1162 hessian_diagonal[i][l];
-
-
- 1165 gradient_result[i][k] +=
- 1166 tau * value[k] * gradient[i][l] * value[l];
-
-
- 1169 gradient_result[i][k] +=
- 1170 tau * value[k] * (gradient[dim][i] - source_value[i]);
-
-
-
- 1174 gradient_result[i][k] += tau * value[k] *
- 1175 ((*bdf_coefs)[0] * value[i] +
- 1176 previous_time_derivatives[i]);
-
-
-
- 1180 if (this->stabilization ==
-
-
-
- 1184 for (
unsigned int i = 0; i < dim; ++i)
-
- 1186 for (
unsigned int k = 0; k < dim; ++k)
-
- 1188 if (this->enable_hessians_residual)
-
- 1190 for (
unsigned int l = 0; l < dim; ++l)
-
-
- 1193 hessian_result[i][k][k] +=
- 1194 tau * -this->kinematic_viscosity *
- 1195 (-this->kinematic_viscosity *
- 1196 hessian_diagonal[i][l] +
- 1197 gradient[i][l] * value[l]);
-
-
- 1200 hessian_result[i][k][k] +=
- 1201 tau * -this->kinematic_viscosity *
- 1202 (gradient[dim][i] - source_value[i]);
-
-
-
- 1206 hessian_result[i][k][k] +=
- 1207 tau * -this->kinematic_viscosity *
- 1208 ((*bdf_coefs)[0] * value[i] +
- 1209 previous_time_derivatives[i]);
-
-
-
-
- 1214 gradient_result[i][i] += tau_lsic * gradient[k][k];
-
-
-
-
- 1219 integrator.submit_gradient(gradient_result, q);
- 1220 integrator.submit_value(value_result, q);
- 1221 if (this->enable_hessians_residual)
- 1222 integrator.submit_hessian(hessian_result, q);
-
+
+ 1158 gradient_result[dim][i] +=
+ 1159 tau * (-this->kinematic_viscosity * hessian_diagonal[i][k] +
+ 1160 gradient[i][k] * value[k]);
+
+
+ 1163 gradient_result[dim][i] += tau * (-source_value[i]);
+
+
+
+ 1167 gradient_result[dim][i] += tau * ((*bdf_coefs)[0] * value[i] +
+ 1168 previous_time_derivatives[i]);
+
+
+ 1171 gradient_result[dim] += tau * gradient[dim];
+
+
+ 1174 for (
unsigned int i = 0; i < dim; ++i)
+
+ 1176 for (
unsigned int k = 0; k < dim; ++k)
+
+ 1178 for (
unsigned int l = 0; l < dim; ++l)
+
+
+ 1181 gradient_result[i][k] +=
+ 1182 -tau * this->kinematic_viscosity * value[k] *
+ 1183 hessian_diagonal[i][l];
+
+
+ 1186 gradient_result[i][k] +=
+ 1187 tau * value[k] * gradient[i][l] * value[l];
+
+
+ 1190 gradient_result[i][k] +=
+ 1191 tau * value[k] * (gradient[dim][i] - source_value[i]);
+
+
+
+ 1195 gradient_result[i][k] += tau * value[k] *
+ 1196 ((*bdf_coefs)[0] * value[i] +
+ 1197 previous_time_derivatives[i]);
+
+
+
+ 1201 if (this->stabilization ==
+
+
+
+ 1205 for (
unsigned int i = 0; i < dim; ++i)
+
+ 1207 for (
unsigned int k = 0; k < dim; ++k)
+
+ 1209 if (this->enable_hessians_residual)
+
+ 1211 for (
unsigned int l = 0; l < dim; ++l)
+
+
+ 1214 hessian_result[i][k][k] +=
+ 1215 tau * -this->kinematic_viscosity *
+ 1216 (-this->kinematic_viscosity *
+ 1217 hessian_diagonal[i][l] +
+ 1218 gradient[i][l] * value[l]);
+
+
+ 1221 hessian_result[i][k][k] +=
+ 1222 tau * -this->kinematic_viscosity *
+ 1223 (gradient[dim][i] - source_value[i]);
- 1225 if (this->enable_hessians_residual)
- 1226 integrator.integrate_scatter(EvaluationFlags::values |
- 1227 EvaluationFlags::gradients |
- 1228 EvaluationFlags::hessians,
-
-
- 1231 integrator.integrate_scatter(EvaluationFlags::values |
- 1232 EvaluationFlags::gradients,
-
-
-
-
-
-
+
+
+ 1227 hessian_result[i][k][k] +=
+ 1228 tau * -this->kinematic_viscosity *
+ 1229 ((*bdf_coefs)[0] * value[i] +
+ 1230 previous_time_derivatives[i]);
+
+
+
+
+ 1235 gradient_result[i][i] += tau_lsic * gradient[k][k];
+
+
+
+
+ 1240 integrator.submit_gradient(gradient_result, q);
+ 1241 integrator.submit_value(value_result, q);
+ 1242 if (this->enable_hessians_residual)
+ 1243 integrator.submit_hessian(hessian_result, q);
+
+
+ 1246 if (this->enable_hessians_residual)
+ 1247 integrator.integrate_scatter(EvaluationFlags::values |
+ 1248 EvaluationFlags::gradients |
+ 1249 EvaluationFlags::hessians,
+
+
+ 1252 integrator.integrate_scatter(EvaluationFlags::values |
+ 1253 EvaluationFlags::gradients,
+
+
+
+
+
+
A class that serves as base for all the matrix-free Navier-Stokes operators.
number el(unsigned int, unsigned int) const
Access a particular element in the matrix. Only required for compilation and it is not used.
virtual void local_evaluate_residual(const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const =0
Interface to function in charge of computing the residual using a cell integral in a cell batch with ...
-void evaluate_non_linear_term_and_calculate_tau(const VectorType &newton_step)
Store relevant values of the vector of the last newton step to use it in the Jacobian and pre-calcula...
-void update_beta_force(const Tensor< 1, dim > &beta_force)
Store the values of the source term calculated if dynamic control is enabled in the appropriate struc...
+void evaluate_non_linear_term_and_calculate_tau(const VectorType &newton_step)
Store relevant values of the vector of the last newton step to use it in the Jacobian and pre-calcula...
+void update_beta_force(const Tensor< 1, dim > &beta_force)
Store the values of the source term calculated if dynamic control is enabled in the appropriate struc...
bool enable_hessians_jacobian
Flag to turn hessian terms from jacobian on or off.
AffineConstraints< number > constraints
Object that stores constraints for the matrix free implementation.
bool enable_hessians_residual
Flag to turn hessian terms from residual on or off.
void clear()
Clear the matrix-free object.
-void vmult_interface_down(VectorType &dst, VectorType const &src) const
Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes wi...
+void vmult_interface_down(VectorType &dst, VectorType const &src) const
Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes wi...
void vmult(VectorType &dst, const VectorType &src) const
Perform an operator evaluation dst = A*src by looping with the help of the MatrixFree object over all...
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner() const
Get the vector partitioner object required for local smoothing multigrid preconditioner.
void compute_element_size()
Compute the element size h of the cells required to calculate stabilization parameters.
types::global_dof_index m() const
Get the total number of DoFs.
std::shared_ptr< Function< dim > > forcing_function
Force function or source function for the Navier-Stokes equations.
void reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< number > &constraints, const Quadrature< dim > &quadrature, const std::shared_ptr< Function< dim >> forcing_function, const double kinematic_viscosity, const StabilizationType stabilization, const unsigned int mg_level, std::shared_ptr< SimulationControl > simulation_control, const bool &enable_hessians_jacobian, const bool &enable_hessians_residual)
Initialize the main matrix free object that contains all data and is needed to perform loops over cel...
-void evaluate_residual(VectorType &dst, const VectorType &src)
Evaluate right hand side using the matrix-free operator.
-void evaluate_time_derivative_previous_solutions(const VectorType &time_derivative_previous_solutions)
Store the values of the vector containing the time derivatives of previous solutions to use them in t...
-void do_cell_integral_range(const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const
Loop over all cell batches within certain range and perform a cell integral with access to global vec...
+void evaluate_residual(VectorType &dst, const VectorType &src)
Evaluate right hand side using the matrix-free operator.
+void evaluate_time_derivative_previous_solutions(const VectorType &time_derivative_previous_solutions)
Store the values of the vector containing the time derivatives of previous solutions to use them in t...
+void do_cell_integral_range(const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const
Loop over all cell batches within certain range and perform a cell integral with access to global vec...
FEEvaluation< dim, -1, 0, dim+1, number > FECellIntegrator
-void compute_inverse_diagonal(VectorType &diagonal) const
Compute the diagonal of the operator using an optimized MatrixFree function. Needed for preconditione...
+void compute_inverse_diagonal(VectorType &diagonal) const
Compute the diagonal of the operator using an optimized MatrixFree function. Needed for preconditione...
virtual void do_cell_integral_local(FECellIntegrator &integrator) const =0
Interface to function that performs a cell integral in a cell batch without gathering and scattering ...
double kinematic_viscosity
Kinematic viscosity needed for the operator.
-static IndexSet get_refinement_edges(const MatrixFree< dim, number > &matrix_free)
Get the refinement edges. Only needed if the local smoothing multigrid approach is used.
+static IndexSet get_refinement_edges(const MatrixFree< dim, number > &matrix_free)
Get the refinement edges. Only needed if the local smoothing multigrid approach is used.
StabilizationType stabilization
Stabilization type needed to add or remove terms from operator.
std::shared_ptr< SimulationControl > simulation_control
Object storing the information regarding the time stepping method.
NavierStokesOperatorBase()
Default constructor.
-const AlignedVector< VectorizedArray< number > > get_element_size() const
Get the element size object.
+const AlignedVector< VectorizedArray< number > > get_element_size() const
Get the element size object.
void initialize_dof_vector(VectorType &vec) const
Initialize a given vector by delegating it to the MatrixFree function in charge of this task.
-const MatrixFree< dim, number > & get_system_matrix_free() const
Get the system matrix free object.
-void Tvmult(VectorType &dst, const VectorType &src) const
Perform the transposed operator evaluation.
-void vmult_interface_up(VectorType &dst, VectorType const &src) const
Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes wi...
+const MatrixFree< dim, number > & get_system_matrix_free() const
Get the system matrix free object.
+void Tvmult(VectorType &dst, const VectorType &src) const
Perform the transposed operator evaluation.
+void vmult_interface_up(VectorType &dst, VectorType const &src) const
Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes wi...
LinearAlgebra::distributed::Vector< number > VectorType
-const TrilinosWrappers::SparseMatrix & get_system_matrix() const
Calculate matrix if needed, e.g., by coarse-grid solver when a multigrid algorithm is used.
+const TrilinosWrappers::SparseMatrix & get_system_matrix() const
Calculate matrix if needed, e.g., by coarse-grid solver when a multigrid algorithm is used.
Implements the matrix-free operator to solve steady/transient Navier-Stokes equations using stabiliza...
-void local_evaluate_residual(const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const override
Perform cell integral on a cell batch with gathering and scattering the values, and according to the ...
-void do_cell_integral_local(FECellIntegrator &integrator) const override
Perform cell integral on a cell batch without gathering and scattering the values,...
+void local_evaluate_residual(const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const override
Perform cell integral on a cell batch with gathering and scattering the values, and according to the ...
+void do_cell_integral_local(FECellIntegrator &integrator) const override
Perform cell integral on a cell batch without gathering and scattering the values,...
NavierStokesStabilizedOperator()
const Table< 2, bool > create_bool_dof_mask(const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature)
Creates and fills a table that works as bool dof mask object needed for the sparsity pattern and comp...
VectorizedArray< Number > evaluate_function(const Function< dim > &function, const Point< dim, VectorizedArray< Number >> &p_vectorized)
Matrix free helper function.
diff --git a/doxygen/navier__stokes__base_8cc_source.html b/doxygen/navier__stokes__base_8cc_source.html
index 3dc9e67e69..cb1d48e300 100644
--- a/doxygen/navier__stokes__base_8cc_source.html
+++ b/doxygen/navier__stokes__base_8cc_source.html
@@ -1203,1639 +1203,1643 @@
1122 if (this->simulation_parameters.post_processing.calculate_average_velocities)
1123 average_velocities->post_mesh_adaptation();
- 1125 this->update_multiphysics_time_average_solution();
-
-
- 1128 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 1132 TimerOutput::Scope t(this->computing_timer,
"Refine");
-
-
- 1135 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer(
-
- 1137 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer_m2(
+
+ 1126 if (this->multiphysics->get_active_physics().size() > 1)
+ 1127 this->update_multiphysics_time_average_solution();
+
+
+ 1130 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 1134 TimerOutput::Scope t(this->computing_timer,
"Refine");
+
+
+ 1137 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer(
- 1139 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer_m3(
+ 1139 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer_m2(
-
- 1142 if constexpr (std::is_same_v<VectorType,
- 1143 LinearAlgebra::distributed::Vector<double>>)
- 1144 present_solution.update_ghost_values();
-
- 1146 solution_transfer.prepare_for_coarsening_and_refinement(
- 1147 this->present_solution);
-
- 1149 std::vector<parallel::distributed::SolutionTransfer<dim, VectorType>>
- 1150 previous_solutions_transfer;
-
- 1152 previous_solutions_transfer.reserve(previous_solutions.size());
-
- 1154 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
-
- 1156 previous_solutions_transfer.emplace_back(
- 1157 parallel::distributed::SolutionTransfer<dim, VectorType>(
- 1158 this->dof_handler));
-
- 1160 if constexpr (std::is_same_v<VectorType,
- 1161 LinearAlgebra::distributed::Vector<double>>)
- 1162 previous_solutions[i].update_ghost_values();
-
- 1164 previous_solutions_transfer[i].prepare_for_coarsening_and_refinement(
- 1165 previous_solutions[i]);
-
-
- 1168 multiphysics->prepare_for_mesh_adaptation();
+ 1141 parallel::distributed::SolutionTransfer<dim, VectorType> solution_transfer_m3(
+
+
+ 1144 if constexpr (std::is_same_v<VectorType,
+ 1145 LinearAlgebra::distributed::Vector<double>>)
+ 1146 present_solution.update_ghost_values();
+
+ 1148 solution_transfer.prepare_for_coarsening_and_refinement(
+ 1149 this->present_solution);
+
+ 1151 std::vector<parallel::distributed::SolutionTransfer<dim, VectorType>>
+ 1152 previous_solutions_transfer;
+
+ 1154 previous_solutions_transfer.reserve(previous_solutions.size());
+
+ 1156 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
+
+ 1158 previous_solutions_transfer.emplace_back(
+ 1159 parallel::distributed::SolutionTransfer<dim, VectorType>(
+ 1160 this->dof_handler));
+
+ 1162 if constexpr (std::is_same_v<VectorType,
+ 1163 LinearAlgebra::distributed::Vector<double>>)
+ 1164 previous_solutions[i].update_ghost_values();
+
+ 1166 previous_solutions_transfer[i].prepare_for_coarsening_and_refinement(
+ 1167 previous_solutions[i]);
+
-
- 1171 this->triangulation->refine_global(1);
-
-
+ 1170 multiphysics->prepare_for_mesh_adaptation();
+
+
+ 1173 this->triangulation->refine_global(1);
-
- 1176 VectorType tmp = init_temporary_vector();
-
-
- 1179 solution_transfer.interpolate(tmp);
-
-
- 1182 auto &nonzero_constraints = this->nonzero_constraints;
- 1183 nonzero_constraints.distribute(tmp);
-
-
- 1186 present_solution = tmp;
-
-
- 1189 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
-
- 1191 VectorType tmp_previous_solution = init_temporary_vector();
- 1192 previous_solutions_transfer[i].interpolate(tmp_previous_solution);
- 1193 nonzero_constraints.distribute(tmp_previous_solution);
- 1194 previous_solutions[i] = tmp_previous_solution;
-
-
- 1197 multiphysics->post_mesh_adaptation();
- 1198 if (this->simulation_parameters.post_processing.calculate_average_velocities)
- 1199 average_velocities->post_mesh_adaptation();
-
- 1201 this->update_multiphysics_time_average_solution();
-
-
- 1204 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 1208 auto &present_solution = this->present_solution;
-
-
- 1211 if (this->simulation_parameters.post_processing.calculate_enstrophy)
-
- 1213 TimerOutput::Scope t(this->computing_timer,
"Calculate enstrophy");
-
-
-
- 1217 *this->cell_quadrature,
-
-
- 1220 this->enstrophy_table.add_value(
"time",
- 1221 simulation_control->get_current_time());
- 1222 this->enstrophy_table.add_value(
"enstrophy", enstrophy);
+
+
+
+ 1178 VectorType tmp = init_temporary_vector();
+
+
+ 1181 solution_transfer.interpolate(tmp);
+
+
+ 1184 auto &nonzero_constraints = this->nonzero_constraints;
+ 1185 nonzero_constraints.distribute(tmp);
+
+
+ 1188 present_solution = tmp;
+
+
+ 1191 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
+
+ 1193 VectorType tmp_previous_solution = init_temporary_vector();
+ 1194 previous_solutions_transfer[i].interpolate(tmp_previous_solution);
+ 1195 nonzero_constraints.distribute(tmp_previous_solution);
+ 1196 previous_solutions[i] = tmp_previous_solution;
+
+
+ 1199 multiphysics->post_mesh_adaptation();
+ 1200 if (this->simulation_parameters.post_processing.calculate_average_velocities)
+ 1201 average_velocities->post_mesh_adaptation();
+
+
+ 1204 if (this->multiphysics->get_active_physics().size() > 1)
+ 1205 this->update_multiphysics_time_average_solution();
+
+
+ 1208 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 1212 auto &present_solution = this->present_solution;
+
+
+ 1215 if (this->simulation_parameters.post_processing.calculate_enstrophy)
+
+ 1217 TimerOutput::Scope t(this->computing_timer,
"Calculate enstrophy");
+
+
+
+ 1221 *this->cell_quadrature,
+
-
- 1225 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1228 this->pcout <<
"Enstrophy : " << enstrophy << std::endl;
-
-
-
- 1232 if (simulation_control->get_step_number() %
- 1233 this->simulation_parameters.post_processing.output_frequency ==
-
- 1235 this->this_mpi_process == 0)
-
- 1237 std::string filename =
- 1238 simulation_parameters.simulation_control.output_folder +
- 1239 simulation_parameters.post_processing.enstrophy_output_name +
-
- 1241 std::ofstream output(filename.c_str());
- 1242 enstrophy_table.set_precision(
"time", 12);
- 1243 enstrophy_table.set_precision(
"enstrophy", 12);
- 1244 this->enstrophy_table.write_text(output);
-
-
-
-
- 1249 if (this->simulation_parameters.post_processing.calculate_pressure_power)
-
- 1251 TimerOutput::Scope t(this->computing_timer,
"Calculate pressure power");
-
- 1253 const double pressure_power =
-
-
- 1256 *this->cell_quadrature,
-
-
- 1259 this->pressure_power_table.add_value(
- 1260 "time", simulation_control->get_current_time());
- 1261 this->pressure_power_table.add_value(
"pressure_power", pressure_power);
+ 1224 this->enstrophy_table.add_value(
"time",
+ 1225 simulation_control->get_current_time());
+ 1226 this->enstrophy_table.add_value(
"enstrophy", enstrophy);
+
+
+ 1229 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1232 this->pcout <<
"Enstrophy : " << enstrophy << std::endl;
+
+
+
+ 1236 if (simulation_control->get_step_number() %
+ 1237 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1239 this->this_mpi_process == 0)
+
+ 1241 std::string filename =
+ 1242 simulation_parameters.simulation_control.output_folder +
+ 1243 simulation_parameters.post_processing.enstrophy_output_name +
+
+ 1245 std::ofstream output(filename.c_str());
+ 1246 enstrophy_table.set_precision(
"time", 12);
+ 1247 enstrophy_table.set_precision(
"enstrophy", 12);
+ 1248 this->enstrophy_table.write_text(output);
+
+
+
+
+ 1253 if (this->simulation_parameters.post_processing.calculate_pressure_power)
+
+ 1255 TimerOutput::Scope t(this->computing_timer,
"Calculate pressure power");
+
+ 1257 const double pressure_power =
+
+
+ 1260 *this->cell_quadrature,
+
-
- 1264 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1267 this->pcout <<
"Pressure power : " << pressure_power << std::endl;
-
-
-
- 1271 if (simulation_control->get_step_number() %
- 1272 this->simulation_parameters.post_processing.output_frequency ==
-
- 1274 this->this_mpi_process == 0)
-
- 1276 std::string filename =
- 1277 simulation_parameters.simulation_control.output_folder +
- 1278 simulation_parameters.post_processing.pressure_power_output_name +
-
- 1280 std::ofstream output(filename.c_str());
- 1281 pressure_power_table.set_precision(
"time", 12);
- 1282 pressure_power_table.set_precision(
"pressure_power", 12);
- 1283 this->pressure_power_table.write_text(output);
-
-
-
-
-
- 1289 if (this->simulation_parameters.post_processing.calculate_viscous_dissipation)
-
- 1291 TimerOutput::Scope t(this->computing_timer,
- 1292 "Calculate viscous dissipation");
-
-
-
-
- 1297 *this->cell_quadrature,
-
- 1299 simulation_parameters.physical_properties_manager);
-
- 1301 this->viscous_dissipation_table.add_value(
- 1302 "time", simulation_control->get_current_time());
- 1303 this->viscous_dissipation_table.add_value(
"viscous_dissipation",
- 1304 viscous_dissipation);
-
-
- 1307 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1310 this->pcout <<
"Viscous dissipation : " << viscous_dissipation
-
-
-
-
- 1315 if (simulation_control->get_step_number() %
- 1316 this->simulation_parameters.post_processing.output_frequency ==
-
- 1318 this->this_mpi_process == 0)
-
- 1320 std::string filename =
- 1321 simulation_parameters.simulation_control.output_folder +
- 1322 simulation_parameters.post_processing
- 1323 .viscous_dissipation_output_name +
-
- 1325 std::ofstream output(filename.c_str());
- 1326 viscous_dissipation_table.set_precision(
"time", 12);
- 1327 viscous_dissipation_table.set_precision(
"viscous_dissipation", 12);
- 1328 this->viscous_dissipation_table.write_text(output);
-
-
-
-
-
-
- 1335 if (this->simulation_parameters.post_processing.calculate_average_velocities)
-
- 1337 TimerOutput::Scope t(this->computing_timer,
- 1338 "Calculate average velocities");
-
-
-
- 1342 const double dt = simulation_control->get_time_step();
- 1343 if (simulation_control->get_current_time() >
- 1344 (simulation_parameters.post_processing.initial_time - 1e-6 * dt))
-
- 1346 this->average_velocities->calculate_average_velocities(
- 1347 this->local_evaluation_point,
- 1348 simulation_parameters.post_processing,
- 1349 simulation_control->get_current_time(),
-
-
-
-
- 1354 if (this->simulation_parameters.post_processing.calculate_kinetic_energy)
-
- 1356 TimerOutput::Scope t(this->computing_timer,
"Calculate kinetic energy");
+ 1263 this->pressure_power_table.add_value(
+ 1264 "time", simulation_control->get_current_time());
+ 1265 this->pressure_power_table.add_value(
"pressure_power", pressure_power);
+
+
+ 1268 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1271 this->pcout <<
"Pressure power : " << pressure_power << std::endl;
+
+
+
+ 1275 if (simulation_control->get_step_number() %
+ 1276 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1278 this->this_mpi_process == 0)
+
+ 1280 std::string filename =
+ 1281 simulation_parameters.simulation_control.output_folder +
+ 1282 simulation_parameters.post_processing.pressure_power_output_name +
+
+ 1284 std::ofstream output(filename.c_str());
+ 1285 pressure_power_table.set_precision(
"time", 12);
+ 1286 pressure_power_table.set_precision(
"pressure_power", 12);
+ 1287 this->pressure_power_table.write_text(output);
+
+
+
+
+
+ 1293 if (this->simulation_parameters.post_processing.calculate_viscous_dissipation)
+
+ 1295 TimerOutput::Scope t(this->computing_timer,
+ 1296 "Calculate viscous dissipation");
+
+
+
+
+ 1301 *this->cell_quadrature,
+
+ 1303 simulation_parameters.physical_properties_manager);
+
+ 1305 this->viscous_dissipation_table.add_value(
+ 1306 "time", simulation_control->get_current_time());
+ 1307 this->viscous_dissipation_table.add_value(
"viscous_dissipation",
+ 1308 viscous_dissipation);
+
+
+ 1311 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1314 this->pcout <<
"Viscous dissipation : " << viscous_dissipation
+
+
+
+
+ 1319 if (simulation_control->get_step_number() %
+ 1320 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1322 this->this_mpi_process == 0)
+
+ 1324 std::string filename =
+ 1325 simulation_parameters.simulation_control.output_folder +
+ 1326 simulation_parameters.post_processing
+ 1327 .viscous_dissipation_output_name +
+
+ 1329 std::ofstream output(filename.c_str());
+ 1330 viscous_dissipation_table.set_precision(
"time", 12);
+ 1331 viscous_dissipation_table.set_precision(
"viscous_dissipation", 12);
+ 1332 this->viscous_dissipation_table.write_text(output);
+
+
+
+
+
+
+ 1339 if (this->simulation_parameters.post_processing.calculate_average_velocities)
+
+ 1341 TimerOutput::Scope t(this->computing_timer,
+ 1342 "Calculate average velocities");
+
+
+
+ 1346 const double dt = simulation_control->get_time_step();
+ 1347 if (simulation_control->get_current_time() >
+ 1348 (simulation_parameters.post_processing.initial_time - 1e-6 * dt))
+
+ 1350 this->average_velocities->calculate_average_velocities(
+ 1351 this->local_evaluation_point,
+ 1352 simulation_parameters.post_processing,
+ 1353 simulation_control->get_current_time(),
+
+
+
-
-
- 1360 *this->cell_quadrature,
-
- 1362 this->kinetic_energy_table.add_value(
- 1363 "time", simulation_control->get_current_time());
- 1364 this->kinetic_energy_table.add_value(
"kinetic-energy", kE);
- 1365 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1368 this->pcout <<
"Kinetic energy : " << kE << std::endl;
-
-
-
- 1372 if ((simulation_control->get_step_number() %
- 1373 this->simulation_parameters.post_processing.output_frequency ==
-
- 1375 this->this_mpi_process == 0)
-
- 1377 std::string filename =
- 1378 simulation_parameters.simulation_control.output_folder +
- 1379 simulation_parameters.post_processing.kinetic_energy_output_name +
-
- 1381 std::ofstream output(filename.c_str());
- 1382 kinetic_energy_table.set_precision(
"time", 12);
- 1383 kinetic_energy_table.set_precision(
"kinetic-energy", 12);
- 1384 this->kinetic_energy_table.write_text(output);
-
-
-
-
- 1389 if (this->simulation_parameters.post_processing.calculate_apparent_viscosity)
-
- 1391 TimerOutput::Scope t(this->computing_timer,
- 1392 "Calculate apparent viscosity");
-
-
-
- 1396 this->present_solution,
- 1397 *this->cell_quadrature,
-
- 1399 this->simulation_parameters.physical_properties_manager);
-
- 1401 this->apparent_viscosity_table.add_value(
- 1402 "time", simulation_control->get_current_time());
- 1403 this->apparent_viscosity_table.add_value(
"apparent_viscosity",
- 1404 apparent_viscosity);
- 1405 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1408 this->pcout <<
"Apparent viscosity: " << apparent_viscosity
- 1409 <<
" m^2/s" << std::endl;
-
-
-
- 1413 if (simulation_control->get_step_number() %
- 1414 this->simulation_parameters.post_processing.output_frequency ==
-
- 1416 this->this_mpi_process == 0)
-
- 1418 std::string filename =
- 1419 simulation_parameters.simulation_control.output_folder +
- 1420 simulation_parameters.post_processing
- 1421 .apparent_viscosity_output_name +
-
- 1423 std::ofstream output(filename.c_str());
- 1424 apparent_viscosity_table.set_precision(
"time", 12);
- 1425 apparent_viscosity_table.set_precision(
"apparent_viscosity", 12);
- 1426 this->apparent_viscosity_table.write_text(output);
-
-
-
-
- 1431 if (this->simulation_parameters.post_processing.calculate_pressure_drop)
-
- 1433 TimerOutput::Scope t(this->computing_timer,
"Calculate pressure drop");
-
- 1435 double pressure_drop, total_pressure_drop;
-
-
-
- 1439 this->evaluation_point,
- 1440 *this->cell_quadrature,
- 1441 *this->face_quadrature,
- 1442 this->simulation_parameters.post_processing.inlet_boundary_id,
- 1443 this->simulation_parameters.post_processing.outlet_boundary_id);
- 1444 this->pressure_drop_table.add_value(
- 1445 "time", simulation_control->get_current_time());
- 1446 this->pressure_drop_table.add_value(
"pressure-drop", pressure_drop);
- 1447 this->pressure_drop_table.add_value(
"total-pressure-drop",
- 1448 total_pressure_drop);
- 1449 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1452 this->pcout <<
"Pressure drop: "
- 1453 << std::setprecision(
- 1454 simulation_control->get_log_precision())
- 1455 << this->simulation_parameters.physical_properties_manager
- 1456 .get_density_scale() *
-
- 1458 <<
" Pa" << std::endl;
- 1459 this->pcout <<
"Total pressure drop: "
- 1460 << std::setprecision(
- 1461 simulation_control->get_log_precision())
- 1462 << this->simulation_parameters.physical_properties_manager
- 1463 .get_density_scale() *
-
- 1465 <<
" Pa" << std::endl;
-
-
-
- 1469 if ((simulation_control->get_step_number() %
- 1470 this->simulation_parameters.post_processing.output_frequency ==
-
- 1472 this->this_mpi_process == 0)
-
- 1474 std::string filename =
- 1475 simulation_parameters.simulation_control.output_folder +
- 1476 simulation_parameters.post_processing.pressure_drop_output_name +
-
- 1478 std::ofstream output(filename.c_str());
- 1479 pressure_drop_table.set_precision(
"time", 12);
- 1480 pressure_drop_table.set_precision(
"pressure-drop", 12);
- 1481 pressure_drop_table.set_precision(
"total-pressure-drop", 12);
- 1482 this->pressure_drop_table.write_text(output);
-
-
-
-
- 1487 if (this->simulation_parameters.post_processing.calculate_flow_rate)
-
- 1489 TimerOutput::Scope t(this->computing_timer,
"Calculate flow rate");
-
- 1491 this->flow_rate_table.add_value(
"time",
- 1492 simulation_control->get_current_time());
- 1493 this->flow_rate_table.set_scientific(
"time",
true);
+ 1358 if (this->simulation_parameters.post_processing.calculate_kinetic_energy)
+
+ 1360 TimerOutput::Scope t(this->computing_timer,
"Calculate kinetic energy");
+
+
+
+ 1364 *this->cell_quadrature,
+
+ 1366 this->kinetic_energy_table.add_value(
+ 1367 "time", simulation_control->get_current_time());
+ 1368 this->kinetic_energy_table.add_value(
"kinetic-energy", kE);
+ 1369 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1372 this->pcout <<
"Kinetic energy : " << kE << std::endl;
+
+
+
+ 1376 if ((simulation_control->get_step_number() %
+ 1377 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1379 this->this_mpi_process == 0)
+
+ 1381 std::string filename =
+ 1382 simulation_parameters.simulation_control.output_folder +
+ 1383 simulation_parameters.post_processing.kinetic_energy_output_name +
+
+ 1385 std::ofstream output(filename.c_str());
+ 1386 kinetic_energy_table.set_precision(
"time", 12);
+ 1387 kinetic_energy_table.set_precision(
"kinetic-energy", 12);
+ 1388 this->kinetic_energy_table.write_text(output);
+
+
+
+
+ 1393 if (this->simulation_parameters.post_processing.calculate_apparent_viscosity)
+
+ 1395 TimerOutput::Scope t(this->computing_timer,
+ 1396 "Calculate apparent viscosity");
+
+
+
+ 1400 this->present_solution,
+ 1401 *this->cell_quadrature,
+
+ 1403 this->simulation_parameters.physical_properties_manager);
+
+ 1405 this->apparent_viscosity_table.add_value(
+ 1406 "time", simulation_control->get_current_time());
+ 1407 this->apparent_viscosity_table.add_value(
"apparent_viscosity",
+ 1408 apparent_viscosity);
+ 1409 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1412 this->pcout <<
"Apparent viscosity: " << apparent_viscosity
+ 1413 <<
" m^2/s" << std::endl;
+
+
+
+ 1417 if (simulation_control->get_step_number() %
+ 1418 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1420 this->this_mpi_process == 0)
+
+ 1422 std::string filename =
+ 1423 simulation_parameters.simulation_control.output_folder +
+ 1424 simulation_parameters.post_processing
+ 1425 .apparent_viscosity_output_name +
+
+ 1427 std::ofstream output(filename.c_str());
+ 1428 apparent_viscosity_table.set_precision(
"time", 12);
+ 1429 apparent_viscosity_table.set_precision(
"apparent_viscosity", 12);
+ 1430 this->apparent_viscosity_table.write_text(output);
+
+
+
+
+ 1435 if (this->simulation_parameters.post_processing.calculate_pressure_drop)
+
+ 1437 TimerOutput::Scope t(this->computing_timer,
"Calculate pressure drop");
+
+ 1439 double pressure_drop, total_pressure_drop;
+
+
+
+ 1443 this->evaluation_point,
+ 1444 *this->cell_quadrature,
+ 1445 *this->face_quadrature,
+ 1446 this->simulation_parameters.post_processing.inlet_boundary_id,
+ 1447 this->simulation_parameters.post_processing.outlet_boundary_id);
+ 1448 this->pressure_drop_table.add_value(
+ 1449 "time", simulation_control->get_current_time());
+ 1450 this->pressure_drop_table.add_value(
"pressure-drop", pressure_drop);
+ 1451 this->pressure_drop_table.add_value(
"total-pressure-drop",
+ 1452 total_pressure_drop);
+ 1453 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1456 this->pcout <<
"Pressure drop: "
+ 1457 << std::setprecision(
+ 1458 simulation_control->get_log_precision())
+ 1459 << this->simulation_parameters.physical_properties_manager
+ 1460 .get_density_scale() *
+
+ 1462 <<
" Pa" << std::endl;
+ 1463 this->pcout <<
"Total pressure drop: "
+ 1464 << std::setprecision(
+ 1465 simulation_control->get_log_precision())
+ 1466 << this->simulation_parameters.physical_properties_manager
+ 1467 .get_density_scale() *
+
+ 1469 <<
" Pa" << std::endl;
+
+
+
+ 1473 if ((simulation_control->get_step_number() %
+ 1474 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1476 this->this_mpi_process == 0)
+
+ 1478 std::string filename =
+ 1479 simulation_parameters.simulation_control.output_folder +
+ 1480 simulation_parameters.post_processing.pressure_drop_output_name +
+
+ 1482 std::ofstream output(filename.c_str());
+ 1483 pressure_drop_table.set_precision(
"time", 12);
+ 1484 pressure_drop_table.set_precision(
"pressure-drop", 12);
+ 1485 pressure_drop_table.set_precision(
"total-pressure-drop", 12);
+ 1486 this->pressure_drop_table.write_text(output);
+
+
+
+
+ 1491 if (this->simulation_parameters.post_processing.calculate_flow_rate)
+
+ 1493 TimerOutput::Scope t(this->computing_timer,
"Calculate flow rate");
- 1495 if (this->simulation_parameters.post_processing.verbosity ==
-
-
-
-
-
- 1501 for (
unsigned int boundary_id = 0;
- 1502 boundary_id < simulation_parameters.boundary_conditions.size;
-
-
- 1505 std::pair<double, double> boundary_flow_rate =
-
- 1507 this->present_solution,
-
- 1509 *this->face_quadrature,
-
-
- 1512 this->flow_rate_table.add_value(
- 1513 "flow-rate-" + Utilities::int_to_string(boundary_id, 2),
- 1514 boundary_flow_rate.first);
- 1515 this->flow_rate_table.set_scientific(
- 1516 "flow-rate-" + Utilities::int_to_string(boundary_id, 2),
true);
- 1517 if (this->simulation_parameters.post_processing.verbosity ==
-
-
- 1520 this->pcout <<
"Flow rate at boundary " +
- 1521 std::to_string(boundary_id) +
": "
- 1522 << std::setprecision(
- 1523 simulation_control->get_log_precision())
- 1524 << boundary_flow_rate.first <<
" m^3/s" << std::endl;
-
-
-
-
- 1529 if ((simulation_control->get_step_number() %
- 1530 this->simulation_parameters.post_processing.output_frequency ==
-
- 1532 this->this_mpi_process == 0)
-
- 1534 std::string filename =
- 1535 simulation_parameters.simulation_control.output_folder +
- 1536 simulation_parameters.post_processing.flow_rate_output_name +
-
- 1538 std::ofstream output(filename.c_str());
- 1539 flow_rate_table.set_precision(
"time", 12);
- 1540 for (
unsigned int boundary_id = 0;
- 1541 boundary_id < simulation_parameters.boundary_conditions.size;
-
- 1543 flow_rate_table.set_precision(
- 1544 "flow-rate-" + Utilities::int_to_string(boundary_id, 2), 12);
- 1545 this->flow_rate_table.write_text(output);
-
-
-
-
-
-
-
-
- 1554 if (this->simulation_parameters.forces_parameters.calculate_force)
-
- 1556 if (simulation_control->get_step_number() %
- 1557 this->simulation_parameters.forces_parameters
- 1558 .calculation_frequency ==
-
- 1560 this->postprocessing_forces(present_solution);
- 1561 if (simulation_control->get_step_number() %
- 1562 this->simulation_parameters.forces_parameters
- 1563 .output_frequency ==
-
- 1565 this->write_output_forces();
-
-
-
- 1569 if (this->simulation_parameters.forces_parameters.calculate_torque)
-
- 1571 if (simulation_control->get_step_number() %
- 1572 this->simulation_parameters.forces_parameters
- 1573 .calculation_frequency ==
-
- 1575 this->postprocessing_torques(present_solution);
- 1576 if (simulation_control->get_step_number() %
- 1577 this->simulation_parameters.forces_parameters
- 1578 .output_frequency ==
-
- 1580 this->write_output_torques();
-
-
-
- 1584 if (this->simulation_parameters.analytical_solution->calculate_error())
-
- 1586 TimerOutput::Scope t(this->computing_timer,
- 1587 "Calculate error w.r.t. analytical solution");
-
-
- 1590 this->exact_solution->set_time(
- 1591 simulation_control->get_current_time());
+ 1495 this->flow_rate_table.add_value(
"time",
+ 1496 simulation_control->get_current_time());
+ 1497 this->flow_rate_table.set_scientific(
"time",
true);
+
+ 1499 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+
+
+
+ 1505 for (
unsigned int boundary_id = 0;
+ 1506 boundary_id < simulation_parameters.boundary_conditions.size;
+
+
+ 1509 std::pair<double, double> boundary_flow_rate =
+
+ 1511 this->present_solution,
+
+ 1513 *this->face_quadrature,
+
+
+ 1516 this->flow_rate_table.add_value(
+ 1517 "flow-rate-" + Utilities::int_to_string(boundary_id, 2),
+ 1518 boundary_flow_rate.first);
+ 1519 this->flow_rate_table.set_scientific(
+ 1520 "flow-rate-" + Utilities::int_to_string(boundary_id, 2),
true);
+ 1521 if (this->simulation_parameters.post_processing.verbosity ==
+
+
+ 1524 this->pcout <<
"Flow rate at boundary " +
+ 1525 std::to_string(boundary_id) +
": "
+ 1526 << std::setprecision(
+ 1527 simulation_control->get_log_precision())
+ 1528 << boundary_flow_rate.first <<
" m^3/s" << std::endl;
+
+
+
+
+ 1533 if ((simulation_control->get_step_number() %
+ 1534 this->simulation_parameters.post_processing.output_frequency ==
+
+ 1536 this->this_mpi_process == 0)
+
+ 1538 std::string filename =
+ 1539 simulation_parameters.simulation_control.output_folder +
+ 1540 simulation_parameters.post_processing.flow_rate_output_name +
+
+ 1542 std::ofstream output(filename.c_str());
+ 1543 flow_rate_table.set_precision(
"time", 12);
+ 1544 for (
unsigned int boundary_id = 0;
+ 1545 boundary_id < simulation_parameters.boundary_conditions.size;
+
+ 1547 flow_rate_table.set_precision(
+ 1548 "flow-rate-" + Utilities::int_to_string(boundary_id, 2), 12);
+ 1549 this->flow_rate_table.write_text(output);
+
+
+
+
+
+
+
+
+ 1558 if (this->simulation_parameters.forces_parameters.calculate_force)
+
+ 1560 if (simulation_control->get_step_number() %
+ 1561 this->simulation_parameters.forces_parameters
+ 1562 .calculation_frequency ==
+
+ 1564 this->postprocessing_forces(present_solution);
+ 1565 if (simulation_control->get_step_number() %
+ 1566 this->simulation_parameters.forces_parameters
+ 1567 .output_frequency ==
+
+ 1569 this->write_output_forces();
+
+
+
+ 1573 if (this->simulation_parameters.forces_parameters.calculate_torque)
+
+ 1575 if (simulation_control->get_step_number() %
+ 1576 this->simulation_parameters.forces_parameters
+ 1577 .calculation_frequency ==
+
+ 1579 this->postprocessing_torques(present_solution);
+ 1580 if (simulation_control->get_step_number() %
+ 1581 this->simulation_parameters.forces_parameters
+ 1582 .output_frequency ==
+
+ 1584 this->write_output_torques();
+
+
+
+ 1588 if (this->simulation_parameters.analytical_solution->calculate_error())
+
+ 1590 TimerOutput::Scope t(this->computing_timer,
+ 1591 "Calculate error w.r.t. analytical solution");
- 1593 present_solution.update_ghost_values();
-
- 1595 const std::pair<double, double> errors =
-
-
-
- 1599 *this->cell_quadrature,
-
- 1601 const double error_velocity = errors.first;
- 1602 const double error_pressure = errors.second;
- 1603 if (simulation_parameters.simulation_control.method ==
-
-
- 1606 this->error_table.add_value(
- 1607 "cells", this->triangulation->n_global_active_cells());
- 1608 this->error_table.add_value(
"error_velocity", error_velocity);
- 1609 this->error_table.add_value(
"error_pressure", error_pressure);
- 1610 auto summary = computing_timer.get_summary_data(
- 1611 computing_timer.total_wall_time);
- 1612 double total_time = 0;
- 1613 for (
auto it = summary.begin(); it != summary.end(); ++it)
-
- 1615 total_time += summary[it->first];
-
-
- 1618 this->error_table.add_value(
"total_time", total_time);
-
-
-
- 1622 this->error_table.add_value(
- 1623 "time", simulation_control->get_current_time());
- 1624 this->error_table.add_value(
"error_velocity", error_velocity);
-
- 1626 if (this->simulation_parameters.timer.write_time_in_error_table)
-
- 1628 auto summary = computing_timer.get_summary_data(
- 1629 computing_timer.total_wall_time);
- 1630 double total_time = 0;
- 1631 for (
auto it = summary.begin(); it != summary.end(); ++it)
-
- 1633 total_time += summary[it->first];
-
- 1635 this->error_table.add_value(
"total_time", total_time);
-
-
-
-
- 1640 if (this->simulation_parameters.multiphysics.VOF ||
- 1641 this->simulation_parameters.multiphysics.cahn_hilliard)
- 1642 this->error_table.add_value(
"error_pressure", error_pressure);
-
- 1644 if (this->simulation_parameters.analytical_solution->verbosity ==
-
-
- 1647 this->pcout <<
"L2 error velocity : "
- 1648 << std::setprecision(
- 1649 simulation_control->get_log_precision())
- 1650 << error_velocity << std::endl;
- 1651 if (this->simulation_parameters.multiphysics.cahn_hilliard)
-
- 1653 this->pcout <<
"L2 error pressure : "
- 1654 << std::setprecision(
- 1655 simulation_control->get_log_precision())
- 1656 << error_pressure << std::endl;
-
-
-
-
- 1661 if (this->simulation_control->is_output_iteration())
-
- 1663 this->write_output_results(present_solution);
+
+ 1594 this->exact_solution->set_time(
+ 1595 simulation_control->get_current_time());
+
+ 1597 present_solution.update_ghost_values();
+
+ 1599 const std::pair<double, double> errors =
+
+
+
+ 1603 *this->cell_quadrature,
+
+ 1605 const double error_velocity = errors.first;
+ 1606 const double error_pressure = errors.second;
+ 1607 if (simulation_parameters.simulation_control.method ==
+
+
+ 1610 this->error_table.add_value(
+ 1611 "cells", this->triangulation->n_global_active_cells());
+ 1612 this->error_table.add_value(
"error_velocity", error_velocity);
+ 1613 this->error_table.add_value(
"error_pressure", error_pressure);
+ 1614 auto summary = computing_timer.get_summary_data(
+ 1615 computing_timer.total_wall_time);
+ 1616 double total_time = 0;
+ 1617 for (
auto it = summary.begin(); it != summary.end(); ++it)
+
+ 1619 total_time += summary[it->first];
+
+
+ 1622 this->error_table.add_value(
"total_time", total_time);
+
+
+
+ 1626 this->error_table.add_value(
+ 1627 "time", simulation_control->get_current_time());
+ 1628 this->error_table.add_value(
"error_velocity", error_velocity);
+
+ 1630 if (this->simulation_parameters.timer.write_time_in_error_table)
+
+ 1632 auto summary = computing_timer.get_summary_data(
+ 1633 computing_timer.total_wall_time);
+ 1634 double total_time = 0;
+ 1635 for (
auto it = summary.begin(); it != summary.end(); ++it)
+
+ 1637 total_time += summary[it->first];
+
+ 1639 this->error_table.add_value(
"total_time", total_time);
+
+
+
+
+ 1644 if (this->simulation_parameters.multiphysics.VOF ||
+ 1645 this->simulation_parameters.multiphysics.cahn_hilliard)
+ 1646 this->error_table.add_value(
"error_pressure", error_pressure);
+
+ 1648 if (this->simulation_parameters.analytical_solution->verbosity ==
+
+
+ 1651 this->pcout <<
"L2 error velocity : "
+ 1652 << std::setprecision(
+ 1653 simulation_control->get_log_precision())
+ 1654 << error_velocity << std::endl;
+ 1655 if (this->simulation_parameters.multiphysics.cahn_hilliard)
+
+ 1657 this->pcout <<
"L2 error pressure : "
+ 1658 << std::setprecision(
+ 1659 simulation_control->get_log_precision())
+ 1660 << error_pressure << std::endl;
+
+
+
-
-
- 1667 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 1671 const FEValuesExtractors::Vector velocities(0);
- 1672 const FEValuesExtractors::Scalar
pressure(dim);
- 1673 VectorTools::interpolate(*this->mapping,
-
- 1675 this->simulation_parameters.initial_condition->uvwp,
- 1676 this->newton_update,
- 1677 this->fe->component_mask(velocities));
- 1678 VectorTools::interpolate(*this->mapping,
-
- 1680 this->simulation_parameters.initial_condition->uvwp,
- 1681 this->newton_update,
- 1682 this->fe->component_mask(
pressure));
- 1683 this->nonzero_constraints.distribute(this->newton_update);
- 1684 this->present_solution = this->newton_update;
- 1685 if (this->simulation_parameters.simulation_control.bdf_startup_method ==
-
-
- 1688 for (
unsigned int i = 1; i < this->previous_solutions.size(); ++i)
-
- 1690 double previous_solution_time =
- 1691 -this->simulation_parameters.simulation_control.dt * i;
- 1692 this->simulation_parameters.initial_condition->uvwp.set_time(
- 1693 previous_solution_time);
- 1694 const FEValuesExtractors::Vector velocities(0);
- 1695 const FEValuesExtractors::Scalar
pressure(dim);
- 1696 VectorTools::interpolate(
-
-
- 1699 this->simulation_parameters.initial_condition->uvwp,
- 1700 this->newton_update,
- 1701 this->fe->component_mask(velocities));
- 1702 VectorTools::interpolate(
-
-
- 1705 this->simulation_parameters.initial_condition->uvwp,
- 1706 this->newton_update,
- 1707 this->fe->component_mask(
pressure));
- 1708 this->previous_solutions[i - 1] = this->newton_update;
-
-
-
-
-
- 1714 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 1718 TimerOutput::Scope timer(this->computing_timer,
"Read checkpoint");
- 1719 std::string prefix =
- 1720 this->simulation_parameters.simulation_control.output_folder +
- 1721 this->simulation_parameters.restart_parameters.filename;
- 1722 this->simulation_control->read(prefix);
- 1723 this->pvdhandler.read(prefix);
-
- 1725 const std::string filename = prefix +
".triangulation";
- 1726 std::ifstream in(filename.c_str());
-
-
-
-
- 1731 "You are trying to restart a previous computation, "
- 1732 "but the restart file <") +
- 1733 filename +
"> does not appear to exist!"));
-
-
-
- 1737 if (
auto tria =
dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
- 1738 this->triangulation.get()))
- 1739 tria->load(filename.c_str());
-
-
-
-
- 1744 ExcMessage(
"Cannot open snapshot mesh file or read the "
- 1745 "triangulation stored there."));
-
-
- 1748 enable_dynamic_zero_constraints_fd();
-
-
-
-
-
-
-
-
-
- 1758 std::vector<VectorType *> x_system(1 + previous_solutions.size());
-
- 1760 VectorType distributed_system(locally_owned_dofs,
- 1761 this->locally_relevant_dofs,
- 1762 this->mpi_communicator);
- 1763 x_system[0] = &(distributed_system);
-
- 1765 std::vector<VectorType> distributed_previous_solutions;
- 1766 distributed_previous_solutions.reserve(previous_solutions.size());
- 1767 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
-
- 1769 distributed_previous_solutions.emplace_back(
- 1770 VectorType(locally_owned_dofs,
- 1771 this->locally_relevant_dofs,
- 1772 this->mpi_communicator));
- 1773 x_system[i + 1] = &distributed_previous_solutions[i];
-
- 1775 parallel::distributed::SolutionTransfer<dim, VectorType> system_trans_vectors(
-
-
- 1778 if (simulation_parameters.post_processing.calculate_average_velocities)
-
- 1780 std::vector<VectorType *> sum_vectors =
- 1781 this->average_velocities->read(prefix);
-
- 1783 x_system.insert(x_system.end(), sum_vectors.begin(), sum_vectors.end());
-
-
- 1786 system_trans_vectors.deserialize(x_system);
- 1787 this->present_solution = distributed_system;
- 1788 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
-
- 1790 previous_solutions[i] = distributed_previous_solutions[i];
-
-
- 1793 if (simulation_parameters.post_processing.calculate_average_velocities)
-
- 1795 this->average_velocities->calculate_average_velocities(
- 1796 this->local_evaluation_point,
- 1797 simulation_parameters.post_processing,
- 1798 simulation_control->get_current_time(),
- 1799 simulation_control->get_time_step());
-
-
- 1802 if (simulation_parameters.flow_control.enable_flow_control)
-
- 1804 this->flow_control.read(prefix);
-
-
- 1807 multiphysics->read_checkpoint();
-
-
-
-
- 1812 this->simulation_parameters.post_processing;
- 1813 std::string prefix =
- 1814 this->simulation_parameters.simulation_control.output_folder;
- 1815 std::string suffix =
".checkpoint";
-
-
-
-
-
-
-
+ 1665 if (this->simulation_control->is_output_iteration())
+
+ 1667 this->write_output_results(present_solution);
+
+
+
+ 1671 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 1675 const FEValuesExtractors::Vector velocities(0);
+ 1676 const FEValuesExtractors::Scalar
pressure(dim);
+ 1677 VectorTools::interpolate(*this->mapping,
+
+ 1679 this->simulation_parameters.initial_condition->uvwp,
+ 1680 this->newton_update,
+ 1681 this->fe->component_mask(velocities));
+ 1682 VectorTools::interpolate(*this->mapping,
+
+ 1684 this->simulation_parameters.initial_condition->uvwp,
+ 1685 this->newton_update,
+ 1686 this->fe->component_mask(
pressure));
+ 1687 this->nonzero_constraints.distribute(this->newton_update);
+ 1688 this->present_solution = this->newton_update;
+ 1689 if (this->simulation_parameters.simulation_control.bdf_startup_method ==
+
+
+ 1692 for (
unsigned int i = 1; i < this->previous_solutions.size(); ++i)
+
+ 1694 double previous_solution_time =
+ 1695 -this->simulation_parameters.simulation_control.dt * i;
+ 1696 this->simulation_parameters.initial_condition->uvwp.set_time(
+ 1697 previous_solution_time);
+ 1698 const FEValuesExtractors::Vector velocities(0);
+ 1699 const FEValuesExtractors::Scalar
pressure(dim);
+ 1700 VectorTools::interpolate(
+
+
+ 1703 this->simulation_parameters.initial_condition->uvwp,
+ 1704 this->newton_update,
+ 1705 this->fe->component_mask(velocities));
+ 1706 VectorTools::interpolate(
+
+
+ 1709 this->simulation_parameters.initial_condition->uvwp,
+ 1710 this->newton_update,
+ 1711 this->fe->component_mask(
pressure));
+ 1712 this->previous_solutions[i - 1] = this->newton_update;
+
+
+
+
+
+ 1718 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 1722 TimerOutput::Scope timer(this->computing_timer,
"Read checkpoint");
+ 1723 std::string prefix =
+ 1724 this->simulation_parameters.simulation_control.output_folder +
+ 1725 this->simulation_parameters.restart_parameters.filename;
+ 1726 this->simulation_control->read(prefix);
+ 1727 this->pvdhandler.read(prefix);
+
+ 1729 const std::string filename = prefix +
".triangulation";
+ 1730 std::ifstream in(filename.c_str());
+
+
+
+
+ 1735 "You are trying to restart a previous computation, "
+ 1736 "but the restart file <") +
+ 1737 filename +
"> does not appear to exist!"));
+
+
+
+ 1741 if (
auto tria =
dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
+ 1742 this->triangulation.get()))
+ 1743 tria->load(filename.c_str());
+
+
+
+
+ 1748 ExcMessage(
"Cannot open snapshot mesh file or read the "
+ 1749 "triangulation stored there."));
+
+
+ 1752 enable_dynamic_zero_constraints_fd();
+
+
+
+
+
+
+
+
+
+ 1762 std::vector<VectorType *> x_system(1 + previous_solutions.size());
+
+ 1764 VectorType distributed_system(locally_owned_dofs,
+ 1765 this->locally_relevant_dofs,
+ 1766 this->mpi_communicator);
+ 1767 x_system[0] = &(distributed_system);
+
+ 1769 std::vector<VectorType> distributed_previous_solutions;
+ 1770 distributed_previous_solutions.reserve(previous_solutions.size());
+ 1771 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
+
+ 1773 distributed_previous_solutions.emplace_back(
+ 1774 VectorType(locally_owned_dofs,
+ 1775 this->locally_relevant_dofs,
+ 1776 this->mpi_communicator));
+ 1777 x_system[i + 1] = &distributed_previous_solutions[i];
+
+ 1779 parallel::distributed::SolutionTransfer<dim, VectorType> system_trans_vectors(
+
+
+ 1782 if (simulation_parameters.post_processing.calculate_average_velocities)
+
+ 1784 std::vector<VectorType *> sum_vectors =
+ 1785 this->average_velocities->read(prefix);
+
+ 1787 x_system.insert(x_system.end(), sum_vectors.begin(), sum_vectors.end());
+
+
+ 1790 system_trans_vectors.deserialize(x_system);
+ 1791 this->present_solution = distributed_system;
+ 1792 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
+
+ 1794 previous_solutions[i] = distributed_previous_solutions[i];
+
+
+ 1797 if (simulation_parameters.post_processing.calculate_average_velocities)
+
+ 1799 this->average_velocities->calculate_average_velocities(
+ 1800 this->local_evaluation_point,
+ 1801 simulation_parameters.post_processing,
+ 1802 simulation_control->get_current_time(),
+ 1803 simulation_control->get_time_step());
+
+
+ 1806 if (simulation_parameters.flow_control.enable_flow_control)
+
+ 1808 this->flow_control.read(prefix);
+
+
+ 1811 multiphysics->read_checkpoint();
+
+
+
+
+ 1816 this->simulation_parameters.post_processing;
+ 1817 std::string prefix =
+ 1818 this->simulation_parameters.simulation_control.output_folder;
+ 1819 std::string suffix =
".checkpoint";
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
- 1846 if (this->simulation_parameters.forces_parameters.calculate_force)
- 1847 for (
unsigned int boundary_id = 0;
- 1848 boundary_id < this->simulation_parameters.boundary_conditions.size;
-
-
-
- 1852 this->forces_tables[boundary_id],
-
- 1854 this->simulation_parameters.forces_parameters.force_output_name +
- 1855 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
-
- 1857 if (this->simulation_parameters.forces_parameters.calculate_torque)
- 1858 for (
unsigned int boundary_id = 0;
- 1859 boundary_id < this->simulation_parameters.boundary_conditions.size;
-
-
-
- 1863 this->torques_tables[boundary_id],
-
- 1865 this->simulation_parameters.forces_parameters.torque_output_name +
- 1866 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
-
- 1868 if (this->simulation_parameters.analytical_solution->calculate_error())
-
-
-
- 1872 this->simulation_parameters.analytical_solution->get_filename() +
-
-
-
-
- 1877 template <
int dim,
typename VectorType,
typename DofsType>
-
-
- 1880 const bool non_zero_constraints)
-
-
-
- 1884 if (simulation_parameters.physical_properties_manager
- 1885 .get_number_of_solids() == 0)
-
-
- 1888 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
- 1889 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
-
-
-
- 1893 std::unordered_set<types::global_dof_index> dofs_are_connected_to_fluid;
+
+
+
+
+ 1850 if (this->simulation_parameters.forces_parameters.calculate_force)
+ 1851 for (
unsigned int boundary_id = 0;
+ 1852 boundary_id < this->simulation_parameters.boundary_conditions.size;
+
+
+
+ 1856 this->forces_tables[boundary_id],
+
+ 1858 this->simulation_parameters.forces_parameters.force_output_name +
+ 1859 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
+
+ 1861 if (this->simulation_parameters.forces_parameters.calculate_torque)
+ 1862 for (
unsigned int boundary_id = 0;
+ 1863 boundary_id < this->simulation_parameters.boundary_conditions.size;
+
+
+
+ 1867 this->torques_tables[boundary_id],
+
+ 1869 this->simulation_parameters.forces_parameters.torque_output_name +
+ 1870 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
+
+ 1872 if (this->simulation_parameters.analytical_solution->calculate_error())
+
+
+
+ 1876 this->simulation_parameters.analytical_solution->get_filename() +
+
+
+
+
+ 1881 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+ 1884 const bool non_zero_constraints)
+
+
+
+ 1888 if (simulation_parameters.physical_properties_manager
+ 1889 .get_number_of_solids() == 0)
+
+
+ 1892 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
+ 1893 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
-
-
-
-
- 1899 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 1901 if (cell->is_locally_owned() || cell->is_ghost())
-
- 1903 cell->get_dof_indices(local_dof_indices);
-
-
- 1906 if (cell->material_id() > 0)
-
- 1908 constrain_solid_cell_velocity_dofs(non_zero_constraints,
-
- 1910 this->zero_constraints);
-
-
-
-
-
-
- 1917 flag_dofs_connected_to_fluid(local_dof_indices,
- 1918 dofs_are_connected_to_fluid);
-
-
-
-
-
-
- 1925 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 1927 if (cell->is_locally_owned() || cell->is_ghost())
-
- 1929 cell->get_dof_indices(local_dof_indices);
-
- 1931 if (cell->material_id() > 0)
-
-
-
-
- 1936 bool connected_to_fluid =
- 1937 check_cell_is_connected_to_fluid(dofs_are_connected_to_fluid,
-
-
-
-
-
- 1943 if (!connected_to_fluid)
-
- 1945 constrain_pressure(non_zero_constraints,
-
- 1947 this->zero_constraints);
-
-
-
-
-
-
- 1954 template <
int dim,
typename VectorType,
typename DofsType>
-
-
- 1957 const DoFHandler<dim> *dof_handler_ht)
-
- 1959 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
- 1960 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
-
-
-
-
- 1965 this->stasis_constraint_structs[0];
-
-
- 1968 const auto temperature_solution =
-
- 1970 std::vector<double> local_temperature_values(this->cell_quadrature->size());
-
- 1972 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 1974 if (cell->is_locally_owned() || cell->is_ghost())
-
- 1976 cell->get_dof_indices(local_dof_indices);
- 1977 get_cell_temperature_values(cell,
-
- 1979 temperature_solution,
- 1980 local_temperature_values);
- 1981 add_flags_and_constrain_velocity(local_dof_indices,
- 1982 local_temperature_values,
- 1983 stasis_constraint_struct);
-
-
- 1986 check_and_constrain_pressure(stasis_constraint_struct, local_dof_indices);
-
-
- 1989 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 1993 const DoFHandler<dim> *dof_handler_ht)
-
- 1995 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
- 1996 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
-
-
- 1999 const auto filtered_phase_fraction_solution =
-
- 2001 std::vector<double> local_filtered_phase_fraction_values(
- 2002 this->cell_quadrature->size());
-
-
- 2005 const auto temperature_solution =
-
- 2007 std::vector<double> local_temperature_values(this->cell_quadrature->size());
-
-
-
-
- 2012 this->stasis_constraint_structs)
-
- 2014 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 2016 if (cell->is_locally_owned() || cell->is_ghost())
-
- 2018 cell->get_dof_indices(local_dof_indices);
- 2019 bool cell_is_in_right_fluid =
true;
-
- 2021 get_cell_filtered_phase_fraction_values(
-
-
- 2024 filtered_phase_fraction_solution,
- 2025 local_filtered_phase_fraction_values);
-
-
-
-
- 2030 for (
const double &filtered_phase_fraction :
- 2031 local_filtered_phase_fraction_values)
-
- 2033 if (abs(stasis_constraint_struct.fluid_id -
- 2034 filtered_phase_fraction) >=
- 2035 stasis_constraint_struct
- 2036 .filtered_phase_fraction_tolerance)
-
- 2038 cell_is_in_right_fluid =
false;
-
-
-
-
-
-
-
- 2046 if (!cell_is_in_right_fluid)
-
- 2048 flag_dofs_connected_to_fluid(
-
- 2050 stasis_constraint_struct.dofs_are_connected_to_fluid);
-
-
-
- 2054 get_cell_temperature_values(cell,
-
- 2056 temperature_solution,
- 2057 local_temperature_values);
- 2058 add_flags_and_constrain_velocity(local_dof_indices,
- 2059 local_temperature_values,
- 2060 stasis_constraint_struct);
-
-
- 2063 check_and_constrain_pressure(stasis_constraint_struct, local_dof_indices);
-
-
-
- 2067 template <
int dim,
typename VectorType,
typename DofsType>
-
-
- 2070 const std::vector<types::global_dof_index> &local_dof_indices,
- 2071 const std::vector<double> &local_temperature_values,
-
-
- 2074 for (
const double &
temperature : local_temperature_values)
-
-
-
-
-
-
- 2081 flag_dofs_connected_to_fluid(
-
-
-
-
-
-
- 2088 flag_dofs_in_solid(local_dof_indices,
-
- 2090 constrain_solid_cell_velocity_dofs(
false,
-
- 2092 this->dynamic_zero_constraints);
-
-
-
- 2096 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 2100 std::vector<types::global_dof_index> &local_dof_indices)
-
- 2102 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 2104 if (cell->is_locally_owned() || cell->is_ghost())
-
- 2106 cell->get_dof_indices(local_dof_indices);
- 2107 bool cell_is_solid =
-
-
-
-
- 2112 bool connected_to_fluid = check_cell_is_connected_to_fluid(
-
-
- 2115 if (!connected_to_fluid)
-
-
-
- 2119 constrain_pressure(
false,
-
- 2121 this->dynamic_zero_constraints);
-
-
-
-
-
-
- 2128 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
-
-
- 2134 template <
int dim,
typename VectorType,
typename DofsType>
-
-
- 2137 const VectorType &solution)
-
- 2139 TimerOutput::Scope t(this->computing_timer,
"Output VTU");
-
- 2141 const std::string folder = simulation_control->get_output_path();
- 2142 const std::string solution_name = simulation_control->get_output_name();
- 2143 const unsigned int iter = simulation_control->get_step_number();
- 2144 const double time = simulation_control->get_current_time();
- 2145 const unsigned int subdivision = simulation_control->get_number_subdivision();
- 2146 const unsigned int group_files = simulation_control->get_group_files();
-
-
-
- 2150 std::vector<std::string> solution_names(dim,
"velocity");
- 2151 solution_names.push_back(
"pressure");
- 2152 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2153 data_component_interpretation(
- 2154 dim, DataComponentInterpretation::component_is_part_of_vector);
- 2155 data_component_interpretation.push_back(
- 2156 DataComponentInterpretation::component_is_scalar);
-
- 2158 DataOut<dim> data_out;
-
-
- 2161 DataOutBase::VtkFlags flags;
- 2162 if (this->velocity_fem_degree > 1)
- 2163 flags.write_higher_order_cells =
true;
- 2164 data_out.set_flags(flags);
-
-
- 2167 data_out.attach_dof_handler(this->dof_handler);
- 2168 data_out.add_data_vector(solution,
-
- 2170 DataOut<dim>::type_dof_data,
- 2171 data_component_interpretation);
-
- 2173 if (this->simulation_parameters.post_processing.calculate_average_velocities)
-
-
-
-
- 2178 std::vector<std::string> average_solution_names(dim,
"average_velocity");
- 2179 average_solution_names.push_back(
"average_pressure");
-
- 2181 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2182 average_data_component_interpretation(
- 2183 dim, DataComponentInterpretation::component_is_part_of_vector);
- 2184 average_data_component_interpretation.push_back(
- 2185 DataComponentInterpretation::component_is_scalar);
-
- 2187 data_out.add_data_vector(
- 2188 this->average_velocities->get_average_velocities(),
- 2189 average_solution_names,
- 2190 DataOut<dim>::type_dof_data,
- 2191 average_data_component_interpretation);
-
-
-
-
- 2196 std::vector<std::string> reynolds_normal_stress_names(
- 2197 dim,
"reynolds_normal_stress");
- 2198 reynolds_normal_stress_names.push_back(
"turbulent_kinetic_energy");
- 2199 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2200 reynolds_normal_stress_data_component_interpretation(
- 2201 dim, DataComponentInterpretation::component_is_part_of_vector);
- 2202 reynolds_normal_stress_data_component_interpretation.push_back(
- 2203 DataComponentInterpretation::component_is_scalar);
-
-
- 2206 std::vector<std::string> reynolds_shear_stress_names = {
- 2207 "reynolds_shear_stress_uv"};
-
-
- 2210 reynolds_shear_stress_names.push_back(
"dummy_rss_2d");
-
-
+
+
+ 1897 std::unordered_set<types::global_dof_index> dofs_are_connected_to_fluid;
+
+
+
+
+
+ 1903 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 1905 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 1907 cell->get_dof_indices(local_dof_indices);
+
+
+ 1910 if (cell->material_id() > 0)
+
+ 1912 constrain_solid_cell_velocity_dofs(non_zero_constraints,
+
+ 1914 this->zero_constraints);
+
+
+
+
+
+
+ 1921 flag_dofs_connected_to_fluid(local_dof_indices,
+ 1922 dofs_are_connected_to_fluid);
+
+
+
+
+
+
+ 1929 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 1931 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 1933 cell->get_dof_indices(local_dof_indices);
+
+ 1935 if (cell->material_id() > 0)
+
+
+
+
+ 1940 bool connected_to_fluid =
+ 1941 check_cell_is_connected_to_fluid(dofs_are_connected_to_fluid,
+
+
+
+
+
+ 1947 if (!connected_to_fluid)
+
+ 1949 constrain_pressure(non_zero_constraints,
+
+ 1951 this->zero_constraints);
+
+
+
+
+
+
+ 1958 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+ 1961 const DoFHandler<dim> *dof_handler_ht)
+
+ 1963 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
+ 1964 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
+
+
+
+
+ 1969 this->stasis_constraint_structs[0];
+
+
+ 1972 const auto temperature_solution =
+
+ 1974 std::vector<double> local_temperature_values(this->cell_quadrature->size());
+
+ 1976 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 1978 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 1980 cell->get_dof_indices(local_dof_indices);
+ 1981 get_cell_temperature_values(cell,
+
+ 1983 temperature_solution,
+ 1984 local_temperature_values);
+ 1985 add_flags_and_constrain_velocity(local_dof_indices,
+ 1986 local_temperature_values,
+ 1987 stasis_constraint_struct);
+
+
+ 1990 check_and_constrain_pressure(stasis_constraint_struct, local_dof_indices);
+
+
+ 1993 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 1997 const DoFHandler<dim> *dof_handler_ht)
+
+ 1999 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
+ 2000 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
+
+
+ 2003 const auto filtered_phase_fraction_solution =
+
+ 2005 std::vector<double> local_filtered_phase_fraction_values(
+ 2006 this->cell_quadrature->size());
+
+
+ 2009 const auto temperature_solution =
+
+ 2011 std::vector<double> local_temperature_values(this->cell_quadrature->size());
+
+
+
+
+ 2016 this->stasis_constraint_structs)
+
+ 2018 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 2020 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 2022 cell->get_dof_indices(local_dof_indices);
+ 2023 bool cell_is_in_right_fluid =
true;
+
+ 2025 get_cell_filtered_phase_fraction_values(
+
+
+ 2028 filtered_phase_fraction_solution,
+ 2029 local_filtered_phase_fraction_values);
+
+
+
+
+ 2034 for (
const double &filtered_phase_fraction :
+ 2035 local_filtered_phase_fraction_values)
+
+ 2037 if (abs(stasis_constraint_struct.fluid_id -
+ 2038 filtered_phase_fraction) >=
+ 2039 stasis_constraint_struct
+ 2040 .filtered_phase_fraction_tolerance)
+
+ 2042 cell_is_in_right_fluid =
false;
+
+
+
+
+
+
+
+ 2050 if (!cell_is_in_right_fluid)
+
+ 2052 flag_dofs_connected_to_fluid(
+
+ 2054 stasis_constraint_struct.dofs_are_connected_to_fluid);
+
+
+
+ 2058 get_cell_temperature_values(cell,
+
+ 2060 temperature_solution,
+ 2061 local_temperature_values);
+ 2062 add_flags_and_constrain_velocity(local_dof_indices,
+ 2063 local_temperature_values,
+ 2064 stasis_constraint_struct);
+
+
+ 2067 check_and_constrain_pressure(stasis_constraint_struct, local_dof_indices);
+
+
+
+ 2071 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+ 2074 const std::vector<types::global_dof_index> &local_dof_indices,
+ 2075 const std::vector<double> &local_temperature_values,
+
+
+ 2078 for (
const double &
temperature : local_temperature_values)
+
+
+
+
+
+
+ 2085 flag_dofs_connected_to_fluid(
+
+
+
+
+
+
+ 2092 flag_dofs_in_solid(local_dof_indices,
+
+ 2094 constrain_solid_cell_velocity_dofs(
false,
+
+ 2096 this->dynamic_zero_constraints);
+
+
+
+ 2100 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 2104 std::vector<types::global_dof_index> &local_dof_indices)
+
+ 2106 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 2108 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 2110 cell->get_dof_indices(local_dof_indices);
+ 2111 bool cell_is_solid =
+
+
+
+
+ 2116 bool connected_to_fluid = check_cell_is_connected_to_fluid(
+
+
+ 2119 if (!connected_to_fluid)
+
+
+
+ 2123 constrain_pressure(
false,
+
+ 2125 this->dynamic_zero_constraints);
+
+
+
+
+
+
+ 2132 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+
+
+ 2138 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+ 2141 const VectorType &solution)
+
+ 2143 TimerOutput::Scope t(this->computing_timer,
"Output VTU");
+
+ 2145 const std::string folder = simulation_control->get_output_path();
+ 2146 const std::string solution_name = simulation_control->get_output_name();
+ 2147 const unsigned int iter = simulation_control->get_step_number();
+ 2148 const double time = simulation_control->get_current_time();
+ 2149 const unsigned int subdivision = simulation_control->get_number_subdivision();
+ 2150 const unsigned int group_files = simulation_control->get_group_files();
+
+
+
+ 2154 std::vector<std::string> solution_names(dim,
"velocity");
+ 2155 solution_names.push_back(
"pressure");
+ 2156 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2157 data_component_interpretation(
+ 2158 dim, DataComponentInterpretation::component_is_part_of_vector);
+ 2159 data_component_interpretation.push_back(
+ 2160 DataComponentInterpretation::component_is_scalar);
+
+ 2162 DataOut<dim> data_out;
+
+
+ 2165 DataOutBase::VtkFlags flags;
+ 2166 if (this->velocity_fem_degree > 1)
+ 2167 flags.write_higher_order_cells =
true;
+ 2168 data_out.set_flags(flags);
+
+
+ 2171 data_out.attach_dof_handler(this->dof_handler);
+ 2172 data_out.add_data_vector(solution,
+
+ 2174 DataOut<dim>::type_dof_data,
+ 2175 data_component_interpretation);
+
+ 2177 if (this->simulation_parameters.post_processing.calculate_average_velocities)
+
+
+
+
+ 2182 std::vector<std::string> average_solution_names(dim,
"average_velocity");
+ 2183 average_solution_names.push_back(
"average_pressure");
+
+ 2185 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2186 average_data_component_interpretation(
+ 2187 dim, DataComponentInterpretation::component_is_part_of_vector);
+ 2188 average_data_component_interpretation.push_back(
+ 2189 DataComponentInterpretation::component_is_scalar);
+
+ 2191 data_out.add_data_vector(
+ 2192 this->average_velocities->get_average_velocities(),
+ 2193 average_solution_names,
+ 2194 DataOut<dim>::type_dof_data,
+ 2195 average_data_component_interpretation);
+
+
+
+
+ 2200 std::vector<std::string> reynolds_normal_stress_names(
+ 2201 dim,
"reynolds_normal_stress");
+ 2202 reynolds_normal_stress_names.push_back(
"turbulent_kinetic_energy");
+ 2203 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2204 reynolds_normal_stress_data_component_interpretation(
+ 2205 dim, DataComponentInterpretation::component_is_part_of_vector);
+ 2206 reynolds_normal_stress_data_component_interpretation.push_back(
+ 2207 DataComponentInterpretation::component_is_scalar);
+
+
+ 2210 std::vector<std::string> reynolds_shear_stress_names = {
+ 2211 "reynolds_shear_stress_uv"};
+
- 2214 reynolds_shear_stress_names.push_back(
"reynolds_shear_stress_vw");
- 2215 reynolds_shear_stress_names.push_back(
"reynolds_shear_stress_uw");
-
- 2217 reynolds_shear_stress_names.push_back(
"dummy_rss");
-
- 2219 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2220 reynolds_shear_stress_data_component_interpretation(
- 2221 dim, DataComponentInterpretation::component_is_scalar);
- 2222 reynolds_shear_stress_data_component_interpretation.push_back(
- 2223 DataComponentInterpretation::component_is_scalar);
-
- 2225 data_out.add_data_vector(
- 2226 this->average_velocities->get_reynolds_normal_stresses(),
- 2227 reynolds_normal_stress_names,
- 2228 DataOut<dim>::type_dof_data,
- 2229 reynolds_normal_stress_data_component_interpretation);
-
- 2231 data_out.add_data_vector(
- 2232 this->average_velocities->get_reynolds_shear_stresses(),
- 2233 reynolds_shear_stress_names,
- 2234 DataOut<dim>::type_dof_data,
- 2235 reynolds_shear_stress_data_component_interpretation);
-
-
- 2238 Vector<float> subdomain(this->triangulation->n_active_cells());
- 2239 for (
unsigned int i = 0; i < subdomain.size(); ++i)
- 2240 subdomain(i) = this->triangulation->locally_owned_subdomain();
- 2241 data_out.add_data_vector(subdomain,
"subdomain");
-
-
-
-
-
-
-
-
-
- 2251 data_out.add_data_vector(solution, vorticity);
-
-
- 2254 std::vector<std::shared_ptr<DensityModel>> density_models =
- 2255 this->simulation_parameters.physical_properties_manager
- 2256 .get_density_vector();
- 2257 std::vector<std::shared_ptr<RheologicalModel>> rheological_models =
- 2258 this->simulation_parameters.physical_properties_manager
- 2259 .get_rheology_vector();
-
- 2261 const double n_fluids = this->simulation_parameters
- 2262 .physical_properties_manager.get_number_of_fluids();
-
- 2264 std::vector<DensityPostprocessor<dim>> density_postprocessors;
- 2265 density_postprocessors.reserve(n_fluids);
- 2266 std::vector<KinematicViscosityPostprocessor<dim>>
- 2267 kinematic_viscosity_postprocessors;
- 2268 kinematic_viscosity_postprocessors.reserve(n_fluids);
- 2269 std::vector<DynamicViscosityPostprocessor<dim>>
- 2270 dynamic_viscosity_postprocessors;
- 2271 dynamic_viscosity_postprocessors.reserve(n_fluids);
-
- 2273 for (
unsigned int f_id = 0; f_id < n_fluids; ++f_id)
-
- 2275 density_postprocessors.push_back(
-
- 2277 kinematic_viscosity_postprocessors.push_back(
-
- 2279 dynamic_viscosity_postprocessors.push_back(
-
- 2281 rheological_models[f_id],
- 2282 density_models[f_id]->get_density_ref(),
-
-
-
-
- 2287 if (!density_models[f_id]->is_constant_density_model() ||
- 2288 this->simulation_parameters.multiphysics.VOF ||
- 2289 this->simulation_parameters.multiphysics.cahn_hilliard)
- 2290 data_out.add_data_vector(solution, density_postprocessors[f_id]);
-
-
- 2293 if (rheological_models[f_id]->is_non_newtonian_rheological_model())
-
- 2295 data_out.add_data_vector(solution,
- 2296 kinematic_viscosity_postprocessors[f_id]);
-
-
- 2299 if (this->simulation_parameters.multiphysics.VOF ||
- 2300 this->simulation_parameters.multiphysics.cahn_hilliard)
- 2301 data_out.add_data_vector(solution,
- 2302 dynamic_viscosity_postprocessors[f_id]);
-
-
-
-
- 2307 if (this->simulation_parameters.physical_properties_manager
- 2308 .is_non_newtonian())
- 2309 data_out.add_data_vector(solution, shear_rate_processor);
-
-
-
- 2313 *this->triangulation,
- 2314 this->simulation_parameters,
- 2315 number_quadrature_points);
-
-
- 2318 *this->triangulation,
- 2319 this->simulation_parameters,
- 2320 number_quadrature_points);
-
-
-
-
+ 2214 reynolds_shear_stress_names.push_back(
"dummy_rss_2d");
+
+
+
+ 2218 reynolds_shear_stress_names.push_back(
"reynolds_shear_stress_vw");
+ 2219 reynolds_shear_stress_names.push_back(
"reynolds_shear_stress_uw");
+
+ 2221 reynolds_shear_stress_names.push_back(
"dummy_rss");
+
+ 2223 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2224 reynolds_shear_stress_data_component_interpretation(
+ 2225 dim, DataComponentInterpretation::component_is_scalar);
+ 2226 reynolds_shear_stress_data_component_interpretation.push_back(
+ 2227 DataComponentInterpretation::component_is_scalar);
+
+ 2229 data_out.add_data_vector(
+ 2230 this->average_velocities->get_reynolds_normal_stresses(),
+ 2231 reynolds_normal_stress_names,
+ 2232 DataOut<dim>::type_dof_data,
+ 2233 reynolds_normal_stress_data_component_interpretation);
+
+ 2235 data_out.add_data_vector(
+ 2236 this->average_velocities->get_reynolds_shear_stresses(),
+ 2237 reynolds_shear_stress_names,
+ 2238 DataOut<dim>::type_dof_data,
+ 2239 reynolds_shear_stress_data_component_interpretation);
+
+
+ 2242 Vector<float> subdomain(this->triangulation->n_active_cells());
+ 2243 for (
unsigned int i = 0; i < subdomain.size(); ++i)
+ 2244 subdomain(i) = this->triangulation->locally_owned_subdomain();
+ 2245 data_out.add_data_vector(subdomain,
"subdomain");
+
+
+
+
+
+
+
+
+
+ 2255 data_out.add_data_vector(solution, vorticity);
+
+
+ 2258 std::vector<std::shared_ptr<DensityModel>> density_models =
+ 2259 this->simulation_parameters.physical_properties_manager
+ 2260 .get_density_vector();
+ 2261 std::vector<std::shared_ptr<RheologicalModel>> rheological_models =
+ 2262 this->simulation_parameters.physical_properties_manager
+ 2263 .get_rheology_vector();
+
+ 2265 const double n_fluids = this->simulation_parameters
+ 2266 .physical_properties_manager.get_number_of_fluids();
+
+ 2268 std::vector<DensityPostprocessor<dim>> density_postprocessors;
+ 2269 density_postprocessors.reserve(n_fluids);
+ 2270 std::vector<KinematicViscosityPostprocessor<dim>>
+ 2271 kinematic_viscosity_postprocessors;
+ 2272 kinematic_viscosity_postprocessors.reserve(n_fluids);
+ 2273 std::vector<DynamicViscosityPostprocessor<dim>>
+ 2274 dynamic_viscosity_postprocessors;
+ 2275 dynamic_viscosity_postprocessors.reserve(n_fluids);
+
+ 2277 for (
unsigned int f_id = 0; f_id < n_fluids; ++f_id)
+
+ 2279 density_postprocessors.push_back(
+
+ 2281 kinematic_viscosity_postprocessors.push_back(
+
+ 2283 dynamic_viscosity_postprocessors.push_back(
+
+ 2285 rheological_models[f_id],
+ 2286 density_models[f_id]->get_density_ref(),
+
+
+
+
+ 2291 if (!density_models[f_id]->is_constant_density_model() ||
+ 2292 this->simulation_parameters.multiphysics.VOF ||
+ 2293 this->simulation_parameters.multiphysics.cahn_hilliard)
+ 2294 data_out.add_data_vector(solution, density_postprocessors[f_id]);
+
+
+ 2297 if (rheological_models[f_id]->is_non_newtonian_rheological_model())
+
+ 2299 data_out.add_data_vector(solution,
+ 2300 kinematic_viscosity_postprocessors[f_id]);
+
+
+ 2303 if (this->simulation_parameters.multiphysics.VOF ||
+ 2304 this->simulation_parameters.multiphysics.cahn_hilliard)
+ 2305 data_out.add_data_vector(solution,
+ 2306 dynamic_viscosity_postprocessors[f_id]);
+
+
+
+
+ 2311 if (this->simulation_parameters.physical_properties_manager
+ 2312 .is_non_newtonian())
+ 2313 data_out.add_data_vector(solution, shear_rate_processor);
+
+
+
+ 2317 *this->triangulation,
+ 2318 this->simulation_parameters,
+ 2319 number_quadrature_points);
+
+
+ 2322 *this->triangulation,
+ 2323 this->simulation_parameters,
+ 2324 number_quadrature_points);
- 2326 if (this->simulation_parameters.post_processing.smoothed_output_fields)
-
-
-
-
-
-
-
-
- 2335 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2336 data_component_interpretation(
- 2337 1, DataComponentInterpretation::component_is_scalar);
+
+
+
+
+ 2330 if (this->simulation_parameters.post_processing.smoothed_output_fields)
+
+
+
+
+
+
+
- 2339 std::vector<std::string> qcriterion_name = {
"qcriterion"};
- 2340 const DoFHandler<dim> &dof_handler_qcriterion =
-
- 2342 data_out.add_data_vector(dof_handler_qcriterion,
-
-
- 2345 data_component_interpretation);
-
-
-
-
-
-
-
-
- 2354 std::vector<DataComponentInterpretation::DataComponentInterpretation>
- 2355 data_component_interpretation(
- 2356 1, DataComponentInterpretation::component_is_scalar);
+ 2339 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2340 data_component_interpretation(
+ 2341 1, DataComponentInterpretation::component_is_scalar);
+
+ 2343 std::vector<std::string> qcriterion_name = {
"qcriterion"};
+ 2344 const DoFHandler<dim> &dof_handler_qcriterion =
+
+ 2346 data_out.add_data_vector(dof_handler_qcriterion,
+
+
+ 2349 data_component_interpretation);
+
+
+
+
+
+
+
- 2358 std::vector<std::string> continuity_name = {
"velocity_divergence"};
- 2359 const DoFHandler<dim> &dof_handler_qcriterion =
-
- 2361 data_out.add_data_vector(dof_handler_qcriterion,
-
-
- 2364 data_component_interpretation);
-
-
-
-
-
- 2370 data_out.add_data_vector(solution, divergence);
- 2371 data_out.add_data_vector(solution, qcriterion);
-
-
-
-
- 2376 simulation_parameters.velocity_sources.omega_y,
- 2377 simulation_parameters.velocity_sources.omega_z);
+ 2358 std::vector<DataComponentInterpretation::DataComponentInterpretation>
+ 2359 data_component_interpretation(
+ 2360 1, DataComponentInterpretation::component_is_scalar);
+
+ 2362 std::vector<std::string> continuity_name = {
"velocity_divergence"};
+ 2363 const DoFHandler<dim> &dof_handler_qcriterion =
+
+ 2365 data_out.add_data_vector(dof_handler_qcriterion,
+
+
+ 2368 data_component_interpretation);
+
+
+
+
+
+ 2374 data_out.add_data_vector(solution, divergence);
+ 2375 data_out.add_data_vector(solution, qcriterion);
+
+
- 2379 if (simulation_parameters.velocity_sources.rotating_frame_type ==
-
- 2381 data_out.add_data_vector(solution, srf);
+
+ 2380 simulation_parameters.velocity_sources.omega_y,
+ 2381 simulation_parameters.velocity_sources.omega_z);
- 2383 output_field_hook(data_out);
-
- 2385 multiphysics->attach_solution_to_output(data_out);
+ 2383 if (simulation_parameters.velocity_sources.rotating_frame_type ==
+
+ 2385 data_out.add_data_vector(solution, srf);
-
+ 2387 output_field_hook(data_out);
- 2389 data_out.build_patches(*this->mapping,
-
- 2391 DataOut<dim>::curved_inner_cells);
+ 2389 multiphysics->attach_solution_to_output(data_out);
+
+
- 2393 write_vtu_and_pvd<dim>(this->pvdhandler,
-
-
-
-
-
-
- 2400 this->mpi_communicator);
-
- 2402 if (simulation_control->get_output_boundaries() &&
- 2403 simulation_control->get_step_number() == 0)
-
- 2405 DataOutFaces<dim> data_out_faces;
-
-
-
- 2409 DataOutBase::VtkFlags flags;
- 2410 if (this->velocity_fem_degree > 1)
- 2411 flags.write_higher_order_cells =
true;
- 2412 data_out_faces.set_flags(flags);
-
-
- 2415 data_out_faces.attach_dof_handler(this->dof_handler);
- 2416 data_out_faces.add_data_vector(solution, boundary_id);
- 2417 data_out_faces.build_patches(*this->mapping, subdivision);
-
- 2419 write_boundaries_vtu<dim>(
- 2420 data_out_faces, folder, time, iter, this->mpi_communicator);
-
-
-
- 2424 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 2428 TimerOutput::Scope t(this->computing_timer,
"Output forces");
- 2429 if (this->this_mpi_process == 0)
-
- 2431 for (
unsigned int boundary_id = 0;
- 2432 boundary_id < simulation_parameters.boundary_conditions.size;
-
-
- 2435 std::string filename =
- 2436 simulation_parameters.simulation_control.output_folder +
- 2437 simulation_parameters.forces_parameters.force_output_name +
"." +
- 2438 Utilities::int_to_string(boundary_id, 2) +
".dat";
- 2439 std::ofstream output(filename.c_str());
-
- 2441 forces_tables[boundary_id].write_text(output);
-
-
-
-
- 2446 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 2450 TimerOutput::Scope t(this->computing_timer,
"Output torques");
- 2451 if (this->this_mpi_process == 0)
-
- 2453 for (
unsigned int boundary_id = 0;
- 2454 boundary_id < simulation_parameters.boundary_conditions.size;
-
-
- 2457 std::string filename =
- 2458 simulation_parameters.simulation_control.output_folder +
- 2459 simulation_parameters.forces_parameters.torque_output_name +
"." +
- 2460 Utilities::int_to_string(boundary_id, 2) +
".dat";
- 2461 std::ofstream output(filename.c_str());
-
- 2463 this->torques_tables[boundary_id].write_text(output);
-
-
-
-
- 2468 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
- 2472 TimerOutput::Scope timer(this->computing_timer,
"Write checkpoint");
- 2473 std::string prefix =
- 2474 this->simulation_parameters.simulation_control.output_folder +
- 2475 this->simulation_parameters.restart_parameters.filename;
- 2476 if (Utilities::MPI::this_mpi_process(this->mpi_communicator) == 0)
-
- 2478 simulation_control->save(prefix);
- 2479 this->pvdhandler.save(prefix);
-
- 2481 if (simulation_parameters.flow_control.enable_flow_control)
- 2482 this->flow_control.save(prefix);
-
+ 2393 data_out.build_patches(*this->mapping,
+
+ 2395 DataOut<dim>::curved_inner_cells);
+
+ 2397 write_vtu_and_pvd<dim>(this->pvdhandler,
+
+
+
+
+
+
+ 2404 this->mpi_communicator);
+
+ 2406 if (simulation_control->get_output_boundaries() &&
+ 2407 simulation_control->get_step_number() == 0)
+
+ 2409 DataOutFaces<dim> data_out_faces;
+
+
+
+ 2413 DataOutBase::VtkFlags flags;
+ 2414 if (this->velocity_fem_degree > 1)
+ 2415 flags.write_higher_order_cells =
true;
+ 2416 data_out_faces.set_flags(flags);
+
+
+ 2419 data_out_faces.attach_dof_handler(this->dof_handler);
+ 2420 data_out_faces.add_data_vector(solution, boundary_id);
+ 2421 data_out_faces.build_patches(*this->mapping, subdivision);
+
+ 2423 write_boundaries_vtu<dim>(
+ 2424 data_out_faces, folder, time, iter, this->mpi_communicator);
+
+
+
+ 2428 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 2432 TimerOutput::Scope t(this->computing_timer,
"Output forces");
+ 2433 if (this->this_mpi_process == 0)
+
+ 2435 for (
unsigned int boundary_id = 0;
+ 2436 boundary_id < simulation_parameters.boundary_conditions.size;
+
+
+ 2439 std::string filename =
+ 2440 simulation_parameters.simulation_control.output_folder +
+ 2441 simulation_parameters.forces_parameters.force_output_name +
"." +
+ 2442 Utilities::int_to_string(boundary_id, 2) +
".dat";
+ 2443 std::ofstream output(filename.c_str());
+
+ 2445 forces_tables[boundary_id].write_text(output);
+
+
+
+
+ 2450 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 2454 TimerOutput::Scope t(this->computing_timer,
"Output torques");
+ 2455 if (this->this_mpi_process == 0)
+
+ 2457 for (
unsigned int boundary_id = 0;
+ 2458 boundary_id < simulation_parameters.boundary_conditions.size;
+
+
+ 2461 std::string filename =
+ 2462 simulation_parameters.simulation_control.output_folder +
+ 2463 simulation_parameters.forces_parameters.torque_output_name +
"." +
+ 2464 Utilities::int_to_string(boundary_id, 2) +
".dat";
+ 2465 std::ofstream output(filename.c_str());
+
+ 2467 this->torques_tables[boundary_id].write_text(output);
+
+
+
+
+ 2472 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+ 2476 TimerOutput::Scope timer(this->computing_timer,
"Write checkpoint");
+ 2477 std::string prefix =
+ 2478 this->simulation_parameters.simulation_control.output_folder +
+ 2479 this->simulation_parameters.restart_parameters.filename;
+ 2480 if (Utilities::MPI::this_mpi_process(this->mpi_communicator) == 0)
+
+ 2482 simulation_control->save(prefix);
+ 2483 this->pvdhandler.save(prefix);
- 2485 std::vector<const VectorType *> sol_set_transfer;
- 2486 sol_set_transfer.push_back(&this->present_solution);
- 2487 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
-
- 2489 sol_set_transfer.push_back(&previous_solutions[i]);
-
-
- 2492 if (simulation_parameters.post_processing.calculate_average_velocities)
-
- 2494 std::vector<const VectorType *> av_set_transfer =
- 2495 this->average_velocities->save(prefix);
-
-
- 2498 sol_set_transfer.insert(sol_set_transfer.end(),
- 2499 av_set_transfer.begin(),
- 2500 av_set_transfer.end());
-
-
- 2503 parallel::distributed::SolutionTransfer<dim, VectorType> system_trans_vectors(
-
- 2505 system_trans_vectors.prepare_for_serialization(sol_set_transfer);
+ 2485 if (simulation_parameters.flow_control.enable_flow_control)
+ 2486 this->flow_control.save(prefix);
+
+
+ 2489 std::vector<const VectorType *> sol_set_transfer;
+ 2490 sol_set_transfer.push_back(&this->present_solution);
+ 2491 for (
unsigned int i = 0; i < previous_solutions.size(); ++i)
+
+ 2493 sol_set_transfer.push_back(&previous_solutions[i]);
+
+
+ 2496 if (simulation_parameters.post_processing.calculate_average_velocities)
+
+ 2498 std::vector<const VectorType *> av_set_transfer =
+ 2499 this->average_velocities->save(prefix);
+
+
+ 2502 sol_set_transfer.insert(sol_set_transfer.end(),
+ 2503 av_set_transfer.begin(),
+ 2504 av_set_transfer.end());
+
- 2507 multiphysics->write_checkpoint();
-
- 2509 if (
auto tria =
dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
- 2510 this->triangulation.get()))
-
- 2512 std::string triangulationName = prefix +
".triangulation";
- 2513 tria->save(prefix +
".triangulation");
-
-
-
-
-
- 2519 this->simulation_parameters.post_processing;
- 2520 std::string prefix =
- 2521 this->simulation_parameters.simulation_control.output_folder;
- 2522 std::string suffix =
".checkpoint";
-
-
-
-
-
-
-
-
-
-
+ 2507 parallel::distributed::SolutionTransfer<dim, VectorType> system_trans_vectors(
+
+ 2509 system_trans_vectors.prepare_for_serialization(sol_set_transfer);
+
+ 2511 multiphysics->write_checkpoint();
+
+ 2513 if (
auto tria =
dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
+ 2514 this->triangulation.get()))
+
+ 2516 std::string triangulationName = prefix +
".triangulation";
+ 2517 tria->save(prefix +
".triangulation");
+
+
+
+
+
+ 2523 this->simulation_parameters.post_processing;
+ 2524 std::string prefix =
+ 2525 this->simulation_parameters.simulation_control.output_folder;
+ 2526 std::string suffix =
".checkpoint";
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
- 2549 if (this->simulation_parameters.forces_parameters.calculate_force)
- 2550 for (
unsigned int boundary_id = 0;
- 2551 boundary_id < this->simulation_parameters.boundary_conditions.size;
-
-
-
- 2555 this->forces_tables[boundary_id],
-
- 2557 this->simulation_parameters.forces_parameters.force_output_name +
- 2558 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
-
- 2560 if (this->simulation_parameters.forces_parameters.calculate_torque)
- 2561 for (
unsigned int boundary_id = 0;
- 2562 boundary_id < this->simulation_parameters.boundary_conditions.size;
-
-
-
- 2566 this->torques_tables[boundary_id],
-
- 2568 this->simulation_parameters.forces_parameters.torque_output_name +
- 2569 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
-
- 2571 if (this->simulation_parameters.analytical_solution->calculate_error())
-
-
-
- 2575 this->simulation_parameters.analytical_solution->get_filename() +
-
-
-
-
- 2580 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
-
- 2585 const double pressure_scaling_factor =
- 2586 simulation_parameters.stabilization.pressure_scaling_factor;
-
-
- 2589 if (abs(pressure_scaling_factor - 1) < 1e-8)
-
+
+
+
+
+
+
+
+
+
+
+
+ 2553 if (this->simulation_parameters.forces_parameters.calculate_force)
+ 2554 for (
unsigned int boundary_id = 0;
+ 2555 boundary_id < this->simulation_parameters.boundary_conditions.size;
+
+
+
+ 2559 this->forces_tables[boundary_id],
+
+ 2561 this->simulation_parameters.forces_parameters.force_output_name +
+ 2562 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
+
+ 2564 if (this->simulation_parameters.forces_parameters.calculate_torque)
+ 2565 for (
unsigned int boundary_id = 0;
+ 2566 boundary_id < this->simulation_parameters.boundary_conditions.size;
+
+
+
+ 2570 this->torques_tables[boundary_id],
+
+ 2572 this->simulation_parameters.forces_parameters.torque_output_name +
+ 2573 "_" + Utilities::int_to_string(boundary_id, 2) + suffix);
+
+ 2575 if (this->simulation_parameters.analytical_solution->calculate_error())
+
+
+
+ 2579 this->simulation_parameters.analytical_solution->get_filename() +
+
+
+
+
+ 2584 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+
+ 2589 const double pressure_scaling_factor =
+ 2590 simulation_parameters.stabilization.pressure_scaling_factor;
- 2592 TimerOutput::Scope t(this->computing_timer,
"rescale_pressure");
-
- 2594 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
- 2595 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
-
- 2597 std::unordered_set<unsigned int> rescaled_dofs_set;
- 2598 rescaled_dofs_set.clear();
- 2599 for (
const auto &cell : dof_handler.active_cell_iterators())
-
- 2601 if (cell->is_locally_owned() || cell->is_ghost())
-
- 2603 cell->get_dof_indices(local_dof_indices);
- 2604 for (
unsigned int j = 0; j < local_dof_indices.size(); ++j)
-
- 2606 const unsigned int global_id = local_dof_indices[j];
-
- 2608 auto iterator = rescaled_dofs_set.find(global_id);
- 2609 if (iterator == rescaled_dofs_set.end())
-
- 2611 const unsigned int component_index =
- 2612 this->fe->system_to_component_index(j).first;
- 2613 if (this->dof_handler.locally_owned_dofs().is_element(
-
- 2615 component_index == dim)
-
- 2617 this->newton_update(global_id) =
- 2618 this->newton_update(global_id) *
- 2619 pressure_scaling_factor;
-
- 2621 rescaled_dofs_set.insert(global_id);
-
-
-
-
-
-
- 2628 template <
int dim,
typename VectorType,
typename DofsType>
-
-
- 2631 const unsigned int display_precision)
-
- 2633 TimerOutput::Scope t(this->computing_timer,
- 2634 "Calculate and output norms after Newton its");
-
- 2636 if constexpr (std::is_same_v<VectorType, GlobalVectorType> ||
- 2637 std::is_same_v<VectorType,
- 2638 LinearAlgebra::distributed::Vector<double>>)
-
- 2640 FEValuesExtractors::Vector velocities(0);
- 2641 FEValuesExtractors::Scalar
pressure(dim);
-
- 2643 ComponentMask velocity_mask = fe->component_mask(velocities);
- 2644 ComponentMask pressure_mask = fe->component_mask(
pressure);
-
- 2646 const std::vector<IndexSet> index_set_velocity =
- 2647 DoFTools::locally_owned_dofs_per_component(dof_handler, velocity_mask);
- 2648 const std::vector<IndexSet> index_set_pressure =
- 2649 DoFTools::locally_owned_dofs_per_component(dof_handler, pressure_mask);
-
- 2651 double local_sum = 0.0;
- 2652 double local_max = std::numeric_limits<double>::lowest();
-
- 2654 for (
unsigned int d = 0; d < dim; ++d)
-
- 2656 for (
auto j = index_set_velocity[d].begin();
- 2657 j != index_set_velocity[d].end();
-
-
- 2660 double dof_newton_update = newton_update[*j];
-
- 2662 local_sum += dof_newton_update * dof_newton_update;
-
- 2664 local_max = std::max(local_max, std::abs(dof_newton_update));
-
-
+
+ 2593 if (abs(pressure_scaling_factor - 1) < 1e-8)
+
+
+ 2596 TimerOutput::Scope t(this->computing_timer,
"rescale_pressure");
+
+ 2598 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
+ 2599 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
+
+ 2601 std::unordered_set<unsigned int> rescaled_dofs_set;
+ 2602 rescaled_dofs_set.clear();
+ 2603 for (
const auto &cell : dof_handler.active_cell_iterators())
+
+ 2605 if (cell->is_locally_owned() || cell->is_ghost())
+
+ 2607 cell->get_dof_indices(local_dof_indices);
+ 2608 for (
unsigned int j = 0; j < local_dof_indices.size(); ++j)
+
+ 2610 const unsigned int global_id = local_dof_indices[j];
+
+ 2612 auto iterator = rescaled_dofs_set.find(global_id);
+ 2613 if (iterator == rescaled_dofs_set.end())
+
+ 2615 const unsigned int component_index =
+ 2616 this->fe->system_to_component_index(j).first;
+ 2617 if (this->dof_handler.locally_owned_dofs().is_element(
+
+ 2619 component_index == dim)
+
+ 2621 this->newton_update(global_id) =
+ 2622 this->newton_update(global_id) *
+ 2623 pressure_scaling_factor;
+
+ 2625 rescaled_dofs_set.insert(global_id);
+
+
+
+
+
+
+ 2632 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+ 2635 const unsigned int display_precision)
+
+ 2637 TimerOutput::Scope t(this->computing_timer,
+ 2638 "Calculate and output norms after Newton its");
+
+ 2640 if constexpr (std::is_same_v<VectorType, GlobalVectorType> ||
+ 2641 std::is_same_v<VectorType,
+ 2642 LinearAlgebra::distributed::Vector<double>>)
+
+ 2644 FEValuesExtractors::Vector velocities(0);
+ 2645 FEValuesExtractors::Scalar
pressure(dim);
+
+ 2647 ComponentMask velocity_mask = fe->component_mask(velocities);
+ 2648 ComponentMask pressure_mask = fe->component_mask(
pressure);
+
+ 2650 const std::vector<IndexSet> index_set_velocity =
+ 2651 DoFTools::locally_owned_dofs_per_component(dof_handler, velocity_mask);
+ 2652 const std::vector<IndexSet> index_set_pressure =
+ 2653 DoFTools::locally_owned_dofs_per_component(dof_handler, pressure_mask);
+
+ 2655 double local_sum = 0.0;
+ 2656 double local_max = std::numeric_limits<double>::lowest();
+
+ 2658 for (
unsigned int d = 0; d < dim; ++d)
+
+ 2660 for (
auto j = index_set_velocity[d].begin();
+ 2661 j != index_set_velocity[d].end();
+
+
+ 2664 double dof_newton_update = newton_update[*j];
+
+ 2666 local_sum += dof_newton_update * dof_newton_update;
- 2668 double global_velocity_l2_norm =
- 2669 std::sqrt(Utilities::MPI::sum(local_sum, this->mpi_communicator));
- 2670 double global_velocity_linfty_norm =
- 2671 Utilities::MPI::max(local_max, this->mpi_communicator);
-
-
- 2674 local_max = std::numeric_limits<double>::lowest();
-
- 2676 for (
auto j = index_set_pressure[dim].begin();
- 2677 j != index_set_pressure[dim].end();
-
-
- 2680 double dof_newton_update = newton_update[*j];
-
- 2682 local_sum += dof_newton_update * dof_newton_update;
-
- 2684 local_max = std::max(local_max, std::abs(dof_newton_update));
-
-
- 2687 double global_pressure_l2_norm =
- 2688 std::sqrt(Utilities::MPI::sum(local_sum, this->mpi_communicator));
- 2689 double global_pressure_linfty_norm =
- 2690 Utilities::MPI::max(local_max, this->mpi_communicator);
-
- 2692 this->pcout << std::setprecision(display_precision)
- 2693 <<
"\n\t||du||_L2 = " << std::setw(6)
- 2694 << global_velocity_l2_norm << std::setw(6)
- 2695 <<
"\t||du||_Linfty = "
- 2696 << std::setprecision(display_precision)
- 2697 << global_velocity_linfty_norm << std::endl;
- 2698 this->pcout << std::setprecision(display_precision)
- 2699 <<
"\t||dp||_L2 = " << std::setw(6) << global_pressure_l2_norm
- 2700 << std::setw(6) <<
"\t||dp||_Linfty = "
- 2701 << std::setprecision(display_precision)
- 2702 << global_pressure_linfty_norm << std::endl;
-
- 2704 if constexpr (std::is_same_v<VectorType, GlobalBlockVectorType>)
-
- 2706 this->pcout << std::setprecision(display_precision)
- 2707 <<
"\t||du||_L2 = " << std::setw(6)
- 2708 << newton_update.block(0).l2_norm() << std::setw(6)
- 2709 <<
"\t||du||_Linfty = "
- 2710 << std::setprecision(display_precision)
- 2711 << newton_update.block(0).linfty_norm() << std::endl;
- 2712 this->pcout << std::setprecision(display_precision)
- 2713 <<
"\t||dp||_L2 = " << std::setw(6)
- 2714 << newton_update.block(1).l2_norm() << std::setw(6)
- 2715 <<
"\t||dp||_Linfty = "
- 2716 << std::setprecision(display_precision)
- 2717 << newton_update.block(1).linfty_norm() << std::endl;
-
-
-
- 2721 template <
int dim,
typename VectorType,
typename DofsType>
-
-
-
-
-
- 2727 if constexpr (std::is_same_v<VectorType, GlobalVectorType> ||
- 2728 std::is_same_v<VectorType, GlobalBlockVectorType>)
- 2729 tmp.reinit(locally_owned_dofs, this->mpi_communicator);
+ 2668 local_max = std::max(local_max, std::abs(dof_newton_update));
+
+
+
+ 2672 double global_velocity_l2_norm =
+ 2673 std::sqrt(Utilities::MPI::sum(local_sum, this->mpi_communicator));
+ 2674 double global_velocity_linfty_norm =
+ 2675 Utilities::MPI::max(local_max, this->mpi_communicator);
+
+
+ 2678 local_max = std::numeric_limits<double>::lowest();
+
+ 2680 for (
auto j = index_set_pressure[dim].begin();
+ 2681 j != index_set_pressure[dim].end();
+
+
+ 2684 double dof_newton_update = newton_update[*j];
+
+ 2686 local_sum += dof_newton_update * dof_newton_update;
+
+ 2688 local_max = std::max(local_max, std::abs(dof_newton_update));
+
+
+ 2691 double global_pressure_l2_norm =
+ 2692 std::sqrt(Utilities::MPI::sum(local_sum, this->mpi_communicator));
+ 2693 double global_pressure_linfty_norm =
+ 2694 Utilities::MPI::max(local_max, this->mpi_communicator);
+
+ 2696 this->pcout << std::setprecision(display_precision)
+ 2697 <<
"\n\t||du||_L2 = " << std::setw(6)
+ 2698 << global_velocity_l2_norm << std::setw(6)
+ 2699 <<
"\t||du||_Linfty = "
+ 2700 << std::setprecision(display_precision)
+ 2701 << global_velocity_linfty_norm << std::endl;
+ 2702 this->pcout << std::setprecision(display_precision)
+ 2703 <<
"\t||dp||_L2 = " << std::setw(6) << global_pressure_l2_norm
+ 2704 << std::setw(6) <<
"\t||dp||_Linfty = "
+ 2705 << std::setprecision(display_precision)
+ 2706 << global_pressure_linfty_norm << std::endl;
+
+ 2708 if constexpr (std::is_same_v<VectorType, GlobalBlockVectorType>)
+
+ 2710 this->pcout << std::setprecision(display_precision)
+ 2711 <<
"\t||du||_L2 = " << std::setw(6)
+ 2712 << newton_update.block(0).l2_norm() << std::setw(6)
+ 2713 <<
"\t||du||_Linfty = "
+ 2714 << std::setprecision(display_precision)
+ 2715 << newton_update.block(0).linfty_norm() << std::endl;
+ 2716 this->pcout << std::setprecision(display_precision)
+ 2717 <<
"\t||dp||_L2 = " << std::setw(6)
+ 2718 << newton_update.block(1).l2_norm() << std::setw(6)
+ 2719 <<
"\t||dp||_Linfty = "
+ 2720 << std::setprecision(display_precision)
+ 2721 << newton_update.block(1).linfty_norm() << std::endl;
+
+
+
+ 2725 template <
int dim,
typename VectorType,
typename DofsType>
+
+
+
+
- 2731 else if constexpr (std::is_same_v<VectorType,
- 2732 LinearAlgebra::distributed::Vector<double>>)
- 2733 tmp.reinit(locally_owned_dofs,
- 2734 locally_relevant_dofs,
- 2735 this->mpi_communicator);
-
-
-
-
-
-
-
-
-
- 2745 std::vector<IndexSet>>;
-
-
- 2748 std::vector<IndexSet>>;
-
- 2750 #ifndef LETHE_USE_LDV
-
- 2752 LinearAlgebra::distributed::Vector<double>,
-
-
- 2755 LinearAlgebra::distributed::Vector<double>,
-
-
+ 2731 if constexpr (std::is_same_v<VectorType, GlobalVectorType> ||
+ 2732 std::is_same_v<VectorType, GlobalBlockVectorType>)
+ 2733 tmp.reinit(locally_owned_dofs, this->mpi_communicator);
+
+ 2735 else if constexpr (std::is_same_v<VectorType,
+ 2736 LinearAlgebra::distributed::Vector<double>>)
+ 2737 tmp.reinit(locally_owned_dofs,
+ 2738 locally_relevant_dofs,
+ 2739 this->mpi_communicator);
+
+
+
+
+
+
+
+
+
+ 2749 std::vector<IndexSet>>;
+
+
+ 2752 std::vector<IndexSet>>;
+
+ 2754 #ifndef LETHE_USE_LDV
+
+ 2756 LinearAlgebra::distributed::Vector<double>,
+
+
+ 2759 LinearAlgebra::distributed::Vector<double>,
+
+
unsigned int maximum_number_of_previous_solutions()
Get the maximum number of previous time steps supposed by the BDF schemes implemented in Lethe.
BoundaryPostprocessor Post-processor class used to attach the boundary id to the faces when outputtin...
@@ -2845,26 +2849,26 @@
Compute the dynamic viscosity scalar field of a fluid within a domain.
Compute the kinematic viscosity scalar field of a fluid within a domain.
-void constrain_stasis_with_temperature(const DoFHandler< dim > *dof_handler_ht)
Constrain a fluid's subdomains according to the temperature field to null velocity and pressure field...
+void constrain_stasis_with_temperature(const DoFHandler< dim > *dof_handler_ht)
Constrain a fluid's subdomains according to the temperature field to null velocity and pressure field...
void box_refine_mesh(const bool restart)
Allow the initial refinement of all cells of the principal mesh that are partially contained in one o...
void refine_mesh_kelly()
Allow the refinement of the mesh based on the Kelly error estimator. See : https://www....
std::shared_ptr< FESystem< dim > > fe
Function< dim > * exact_solution
bool check_existance_of_bc(BoundaryConditions::BoundaryType bc)
Check if a specifique boundary condition exist.
std::shared_ptr< Quadrature< dim > > cell_quadrature
-void write_output_results(const VectorType &solution)
write_output_results Post-processing as parallel VTU files
+void write_output_results(const VectorType &solution)
write_output_results Post-processing as parallel VTU files
MPI_Comm mpi_communicator
-void add_flags_and_constrain_velocity(const std::vector< types::global_dof_index > &local_dof_indices, const std::vector< double > &local_temperature_values, StasisConstraintWithTemperature &stasis_constraint_struct)
Flag cell DOFs (either "solid" or "connected to fluid") and constrain velocity DOFs with homogeneous ...
+void add_flags_and_constrain_velocity(const std::vector< types::global_dof_index > &local_dof_indices, const std::vector< double > &local_temperature_values, StasisConstraintWithTemperature &stasis_constraint_struct)
Flag cell DOFs (either "solid" or "connected to fluid") and constrain velocity DOFs with homogeneous ...
NavierStokesBase(SimulationParameters< dim > &nsparam)
unsigned int number_quadrature_points
-void rescale_pressure_dofs_in_newton_update()
rescale_pressure_dofs_in_newton_update This function is used to rescale pressure DOFs in the newton c...
-void constrain_stasis_with_temperature_vof(const DoFHandler< dim > *dof_handler_vof, const DoFHandler< dim > *dof_handler_ht)
Constrain fluids' subdomains according to the temperature field to null velocity and pressure fields ...
-void write_output_torques()
write_output_torques Writes the torques per boundary condition to a text file output
+void rescale_pressure_dofs_in_newton_update()
rescale_pressure_dofs_in_newton_update This function is used to rescale pressure DOFs in the newton c...
+void constrain_stasis_with_temperature_vof(const DoFHandler< dim > *dof_handler_vof, const DoFHandler< dim > *dof_handler_ht)
Constrain fluids' subdomains according to the temperature field to null velocity and pressure fields ...
+void write_output_torques()
write_output_torques Writes the torques per boundary condition to a text file output
std::shared_ptr< Quadrature< dim - 1 > > face_quadrature
-void write_output_forces()
write_output_forces Writes the forces per boundary condition to a text file output
+void write_output_forces()
write_output_forces Writes the forces per boundary condition to a text file output
DoFHandler< dim > dof_handler
virtual void refine_mesh()
Allow the refinement of the mesh according to one of the 2 methods proposed.
-virtual void read_checkpoint()
read_checkpoint
+virtual void read_checkpoint()
read_checkpoint
std::vector< std::vector< Tensor< 1, dim > > > forces_on_boundaries
virtual void enable_dynamic_zero_constraints_fd()
Enable the use of dynamic zero constraints by initializing required FEValues objects.
void postprocessing_torques(const VectorType &evaluation_point)
postprocessing_torques Post-processing function Outputs the torque acting on each boundary condition
@@ -2872,28 +2876,28 @@
std::vector< TableHandler > forces_tables
virtual void dynamic_flow_control()
dynamic_flow_control If set to enable, dynamic_flow_control allows to control the flow by executing s...
SimulationParameters< dim > simulation_parameters
-void check_and_constrain_pressure(const StasisConstraintWithTemperature &stasis_constraint_struct, std::vector< types::global_dof_index > &local_dof_indices)
Check if solid cells are connected to fluid ones and constrain null pressure DOFs if they are not.
-virtual void output_field_hook(DataOut< dim > &)
output_field_hook This function is to be redefined in specialized classes to adapt the output to each...
+void check_and_constrain_pressure(const StasisConstraintWithTemperature &stasis_constraint_struct, std::vector< types::global_dof_index > &local_dof_indices)
Check if solid cells are connected to fluid ones and constrain null pressure DOFs if they are not.
+virtual void output_field_hook(DataOut< dim > &)
output_field_hook This function is to be redefined in specialized classes to adapt the output to each...
virtual void iterate()
iterate Do a regular CFD iteration
void finish_simulation_fd()
finish_simulation Finishes the simulation for fluid dynamics by calling the post-processing elements ...
-virtual void postprocess_fd(bool first_iteration)
postprocess Post-process fluid dynamics after an iteration
+virtual void postprocess_fd(bool first_iteration)
postprocess Post-process fluid dynamics after an iteration
TimerOutput computing_timer
-void establish_solid_domain(const bool non_zero_constraints)
Turn regions of the mesh where the material_id>0 into a solid block by injecting velocity and pressur...
+void establish_solid_domain(const bool non_zero_constraints)
Turn regions of the mesh where the material_id>0 into a solid block by injecting velocity and pressur...
std::shared_ptr< Function< dim > > forcing_function
std::vector< VectorType > previous_solutions
-VectorType init_temporary_vector()
init_temporary_vector This function initializes correctly a temporary vector depending on the vector ...
+VectorType init_temporary_vector()
init_temporary_vector This function initializes correctly a temporary vector depending on the vector ...
std::shared_ptr< SimulationControl > simulation_control
std::vector< TableHandler > torques_tables
-void refine_mesh_uniform()
Allow the uniform refinement of all the mesh.
+void refine_mesh_uniform()
Allow the uniform refinement of all the mesh.
std::shared_ptr< MultiphysicsInterface< dim > > multiphysics
std::vector< Tensor< 1, 3 > > torques_on_boundaries
virtual void percolate_time_vectors_fd()
finish_time_step Finishes the time step of the fluid dynamics Post-processing and time stepping
std::shared_ptr< AverageVelocities< dim, VectorType, DofsType > > average_velocities
std::shared_ptr< Mapping< dim > > mapping
-virtual void output_newton_update_norms(const unsigned int display_precision) override
Output the L2 and Linfty norms of the correction vector.
+virtual void output_newton_update_norms(const unsigned int display_precision) override
Output the L2 and Linfty norms of the correction vector.
void postprocessing_forces(const VectorType &evaluation_point)
postprocessing_forces Post-processing function Outputs the forces acting on each boundary condition
-void set_nodal_values()
set_nodal_values Set the nodal values of velocity and pressure
-virtual void write_checkpoint()
write_checkpoint
+void set_nodal_values()
set_nodal_values Set the nodal values of velocity and pressure
+virtual void write_checkpoint()
write_checkpoint
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
const unsigned int velocity_fem_degree
Class that has all the common elements of a physics solver. It creates the nonlinear solver as specif...