Skip to content

Commit

Permalink
Add estimate for initial interface size
Browse files Browse the repository at this point in the history
  • Loading branch information
davidscn committed Feb 8, 2021
1 parent 15fee79 commit 75827bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions include/mf_elasticity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 2 - CG iterations
* 3 - GMG iterations
*/
static const unsigned int debug_level = 1;
static const unsigned int debug_level = 0;

// We start by including all the necessary deal.II header files and some C++
// related ones. They have been discussed in detail in previous tutorial
Expand Down Expand Up @@ -1707,7 +1707,7 @@ namespace FSI

system_rhs = 0.0;

const bool assemble_fast = it_nr < 4;
const bool assemble_fast = it_nr < 5;

if (!assemble_fast)
{
Expand Down Expand Up @@ -2009,7 +2009,6 @@ namespace FSI
double cond_number = 1.0;

// reset solution vector each iteration
// TODO: We use zero dst anyway, so this can be removed
newton_update = 0.;

// We solve for the incremental displacement $d\mathbf{u}$.
Expand Down Expand Up @@ -2143,8 +2142,9 @@ namespace FSI
degree,
DataOut<dim>::curved_inner_cells);

const std::string filename = parameters.output_folder + "solution-" +
std::to_string(result_number) + ".vtu";
const std::string filename = parameters.output_folder + "solution_" +
Utilities::int_to_string(result_number, 3) +
".vtu";

data_out.write_vtu_in_parallel(filename, mpi_communicator);

Expand Down
12 changes: 10 additions & 2 deletions include/precice_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,9 @@ namespace Adapter
const unsigned int mesh_id = is_read_mesh ? read_mesh_id : write_mesh_id;
auto &interface_nodes_ids = is_read_mesh ? read_nodes_ids : write_nodes_ids;

// TODO: Find a suitable guess for the number of interface points (optional)
interface_nodes_ids.reserve(20);
// Initial guess: half of the boundary is part of the coupling interface
interface_nodes_ids.reserve(mf_data_reference->n_boundary_face_batches() *
0.5);
// TODO: n_qpoints_1D is hard coded
FEFaceEvaluation<dim,
fe_degree,
Expand All @@ -517,6 +518,7 @@ namespace Adapter

std::array<double, dim * VectorizedArrayType::size()> unrolled_vertices;
std::array<int, VectorizedArrayType::size()> node_ids;
unsigned int size = 0;

for (unsigned int face = mf_data_reference->n_inner_face_batches();
face < mf_data_reference->n_boundary_face_batches() +
Expand All @@ -538,6 +540,9 @@ namespace Adapter
const auto local_vertex = phi.quadrature_point(q);

// Transform Point<Vectorized> into preCICE conform format
// We store here also the potential 'dummy'/empty lanes (not only
// active_faces), but it allows us to use a static loop as well as a
// static array for the indices
for (int d = 0; d < dim; ++d)
for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
unrolled_vertices[d + dim * v] = local_vertex[d][v];
Expand All @@ -547,7 +552,10 @@ namespace Adapter
unrolled_vertices.data(),
node_ids.data());
interface_nodes_ids.emplace_back(node_ids);
++size;
}
// resize the IDs in case the initial guess was too large
interface_nodes_ids.resize(size);
}
}

Expand Down

0 comments on commit 75827bb

Please sign in to comment.