diff --git a/include/solvers/multiphysics_interface.h b/include/solvers/multiphysics_interface.h index 5a5fbe21a2..163fc1d5e4 100644 --- a/include/solvers/multiphysics_interface.h +++ b/include/solvers/multiphysics_interface.h @@ -567,14 +567,16 @@ class MultiphysicsInterface /** * @brief Request immersed solid signed distance function */ - std::shared_ptr> + Function * get_immersed_solid_signed_distance_function(); /** * @brief Share immersed solid signed distance function + * + * @param function The immersed solid signed distance function */ void - set_immersed_solid_signed_distance_function(std::shared_ptr>); + set_immersed_solid_signed_distance_function(Function *function); /** * @brief Request the previous solutions of a given physics @@ -921,7 +923,7 @@ class MultiphysicsInterface GlobalVectorType *reynolds_stress_solutions; // Immersed solid signed distance function to be used by auxiliary physics - std::shared_ptr> immersed_solid_signed_distance_function; + Function *immersed_solid_signed_distance_function; // past (minus 1) solution std::map physics_solutions_m1; diff --git a/include/solvers/tracer.h b/include/solvers/tracer.h index f2a95e0008..b762fa5351 100644 --- a/include/solvers/tracer.h +++ b/include/solvers/tracer.h @@ -432,9 +432,6 @@ class Tracer : public AuxiliaryPhysics AffineConstraints zero_constraints; TrilinosWrappers::SparseMatrix system_matrix; - // Immersed solid signed distance function with immersed solid solver - std::shared_ptr> immersed_solid_signed_distance_function; - // Previous solutions vectors std::vector previous_solutions; diff --git a/include/solvers/tracer_scratch_data.h b/include/solvers/tracer_scratch_data.h index 98db668c32..ad0c90ed0a 100644 --- a/include/solvers/tracer_scratch_data.h +++ b/include/solvers/tracer_scratch_data.h @@ -159,8 +159,16 @@ class TracerScratchData auto &fe_tracer = this->fe_values_tracer.get_fe(); source_function->value_list(quadrature_points, source); + if (properties_manager.field_is_required(field::levelset)) - levelset_function->value_list(quadrature_points, sdf_values); + { + Assert( + levelset_function != nullptr, + ExcMessage( + "Levelset function is required for tracer assembly, but the level set function is a nullptr")); + + levelset_function->value_list(quadrature_points, sdf_values); + } if (dim == 2) this->cell_size = diff --git a/source/core/lethe_grid_tools.cc b/source/core/lethe_grid_tools.cc index 1c4f41b2af..964849d66f 100644 --- a/source/core/lethe_grid_tools.cc +++ b/source/core/lethe_grid_tools.cc @@ -870,7 +870,6 @@ LetheGridTools::cell_cut_by_flat( if (condition_B2) { bool condition_C2 = false; - manifold_points.clear(); for (const auto face : cell->face_indices()) { auto face_iter = cell->face(face); diff --git a/source/fem-dem/fluid_dynamics_sharp.cc b/source/fem-dem/fluid_dynamics_sharp.cc index c2b404a429..eb546a0e4f 100644 --- a/source/fem-dem/fluid_dynamics_sharp.cc +++ b/source/fem-dem/fluid_dynamics_sharp.cc @@ -817,7 +817,7 @@ FluidDynamicsSharp::define_particles() combined_shapes = std::make_shared>(all_shapes, Point(), Point<3>()); this->multiphysics->set_immersed_solid_signed_distance_function( - combined_shapes); + &(*combined_shapes)); } @@ -4341,15 +4341,15 @@ FluidDynamicsSharp::read_checkpoint() std::map> restart_data; fill_vectors_from_file(restart_data, filename); - // Implement the data in the particles. + // Implement the data in the particles. if constexpr (dim == 2) { unsigned int row = 0; for (unsigned int p_i = 0; p_i < particles.size(); ++p_i) { unsigned int j = 0; - while (restart_data["ID"][row] == p_i and - row < restart_data["ID"].size()) + while (row < restart_data["ID"].size() && + restart_data["ID"][row] == p_i) { if (j == 0) { @@ -4415,8 +4415,8 @@ FluidDynamicsSharp::read_checkpoint() for (unsigned int p_i = 0; p_i < particles.size(); ++p_i) { unsigned int j = 0; - while (restart_data["ID"][row] == p_i and - row < restart_data["ID"].size()) + while (row < restart_data["ID"].size() && + restart_data["ID"][row] == p_i) { if (j == 0) { diff --git a/source/solvers/multiphysics_interface.cc b/source/solvers/multiphysics_interface.cc index 3c4b9f3614..e98ed1942e 100644 --- a/source/solvers/multiphysics_interface.cc +++ b/source/solvers/multiphysics_interface.cc @@ -217,20 +217,20 @@ MultiphysicsInterface::get_projected_phase_fraction_gradient_dof_handler() } template -std::shared_ptr> +Function * MultiphysicsInterface::get_immersed_solid_signed_distance_function() { // This pointer is also used to check if an immersed boundary solid method is // being used, depending on whether the pointer is assigned. - return this->immersed_solid_signed_distance_function; + return immersed_solid_signed_distance_function; } template void MultiphysicsInterface::set_immersed_solid_signed_distance_function( - std::shared_ptr> function) + Function *function) { - this->immersed_solid_signed_distance_function = function; + immersed_solid_signed_distance_function = function; } template diff --git a/source/solvers/tracer.cc b/source/solvers/tracer.cc index 6889290459..52eb7d78fd 100644 --- a/source/solvers/tracer.cc +++ b/source/solvers/tracer.cc @@ -51,10 +51,9 @@ Tracer::assemble_system_matrix() this->system_matrix = 0; setup_assemblers(); - // We get the immersed function, which is null when no immersed solids are - // involved. - immersed_solid_signed_distance_function = - this->multiphysics->get_immersed_solid_signed_distance_function(); + // Update the source term time + simulation_parameters.source_term.tracer_source->set_time( + simulation_control->get_current_time()); const DoFHandler *dof_handler_fluid = multiphysics->get_dof_handler(PhysicsID::fluid_dynamics); @@ -89,14 +88,13 @@ Tracer::assemble_local_system_matrix( if (!cell->is_locally_owned()) return; - auto source_term = simulation_parameters.source_term.tracer_source; - source_term->set_time(simulation_control->get_current_time()); - scratch_data.reinit(cell, - this->evaluation_point, - this->previous_solutions, - &(*source_term), - &(*immersed_solid_signed_distance_function)); + scratch_data.reinit( + cell, + this->evaluation_point, + this->previous_solutions, + &(*simulation_parameters.source_term.tracer_source), + &(*this->multiphysics->get_immersed_solid_signed_distance_function())); const DoFHandler *dof_handler_fluid = multiphysics->get_dof_handler(PhysicsID::fluid_dynamics); @@ -193,10 +191,9 @@ Tracer::assemble_system_rhs() this->system_rhs = 0; setup_assemblers(); - // We get the immersed function, which is null when no immersed solids are - // involved - immersed_solid_signed_distance_function = - this->multiphysics->get_immersed_solid_signed_distance_function(); + // Update the source term time + simulation_parameters.source_term.tracer_source->set_time( + simulation_control->get_current_time()); const DoFHandler *dof_handler_fluid = multiphysics->get_dof_handler(PhysicsID::fluid_dynamics); @@ -234,11 +231,12 @@ Tracer::assemble_local_system_rhs( auto source_term = simulation_parameters.source_term.tracer_source; source_term->set_time(simulation_control->get_current_time()); - scratch_data.reinit(cell, - this->evaluation_point, - this->previous_solutions, - &(*source_term), - &(*immersed_solid_signed_distance_function)); + scratch_data.reinit( + cell, + this->evaluation_point, + this->previous_solutions, + &(*source_term), + (this->multiphysics->get_immersed_solid_signed_distance_function())); const DoFHandler *dof_handler_fluid = multiphysics->get_dof_handler(PhysicsID::fluid_dynamics); @@ -650,11 +648,9 @@ Tracer::postprocess_tracer_flow_rate(const VectorType ¤t_solution_fd) n_q_points_face)); face_quadrature_points = fe_face_values_tracer.get_quadrature_points(); - immersed_solid_signed_distance_function = - this->multiphysics - ->get_immersed_solid_signed_distance_function(); - this->immersed_solid_signed_distance_function->value_list( - face_quadrature_points, levelset_values); + this->multiphysics + ->get_immersed_solid_signed_distance_function() + ->value_list(face_quadrature_points, levelset_values); set_field_vector(field::levelset, levelset_values, fields); diff --git a/tests/core/lethe_grid_tool_mesh_cut_by_flat_2.cc b/tests/core/lethe_grid_tool_mesh_cut_by_flat_2.cc index 1cc7a47451..84ded63d2d 100644 --- a/tests/core/lethe_grid_tool_mesh_cut_by_flat_2.cc +++ b/tests/core/lethe_grid_tool_mesh_cut_by_flat_2.cc @@ -111,15 +111,10 @@ test() << std::endl; } - // Printing the final position for all the vertices - -#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4) - Legacy::DataOut<2> data_out; - Legacy::DataOut<1, DoFHandler<1, 2>> flat_data_out; -#else + // Printing the final position for all the vertices DataOut<2> data_out; DataOut<1, 2> flat_data_out; -#endif + data_out.attach_dof_handler(dof_handler); data_out.add_data_vector(subdomain, "subdomain"); data_out.build_patches(); diff --git a/tests/tests.h b/tests/tests.h index 43f0cd45b2..d3a2642009 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -20,7 +20,6 @@ #include -#include #include #include #include