1012 *
pcout <<
" - determine closest point iteratively" << std::endl;
1013 *
constexpr int max_iter = 30;
1059 *
Utilities::MPI::reduce<std::vector<Point<dim>>>(
1068 *
std::ofstream file(
"example_2_" + std::to_string(
it) +
".csv");
1077 *
ExcMessage(
"Processed point is outside domain."));
1080 *
VectorTools::point_values<1>(rpe, dof_handler, signed_distance);
1083 *
VectorTools::point_gradients<1>(rpe, dof_handler, signed_distance);
1113 *
<<
" points is not yet attained." << std::endl;
1124 *
pcout <<
" - determine distance in narrow band" << std::endl;
1143 *
pcout <<
" - perform extrapolation in narrow band" << std::endl;
1145 *
solution.update_ghost_values();
1146 *
const auto vals = VectorTools::point_values<1>(rpe, dof_handler, solution);
1159 *
pcout <<
" - output results" << std::endl;
1161 *
data_out.add_data_vector(dof_handler, signed_distance,
"signed_distance");
1162 *
data_out.add_data_vector(dof_handler, solution,
"solution");
1163 *
data_out.add_data_vector(dof_handler,
1165 *
"solution_distance");
1166 *
data_out.add_data_vector(dof_handler,
1168 *
"solution_extrapolated");
1169 *
data_out.build_patches(mapping);
1170 *
data_out.write_vtu_in_parallel(
"example_2.vtu",
MPI_COMM_WORLD);
1172 *
pcout << std::endl;
1178 * <a name=
"step_87-Miniexample3Sharpinterfacemethodontheexampleofsurfacetensionforfronttracking"></a>
1246 *
constexpr unsigned int dim = 2;
1247 *
const double dt = 0.01;
1255 *
static_assert(dim == 2 || dim == 3,
"Only implemented for 2D or 3D.");
1261 *
pcout <<
"Running: example 3" << std::endl;
1269 *
pcout <<
" - creating background mesh" << std::endl;
1286 *
pcout <<
" - creating immersed mesh" << std::endl;
1288 *
Point<dim>(0.5, 0.75, 0.5));
1289 *
const double radius = 0.15;
1344 * points
of the surface
mesh in a vector.
1368 *
double time = 0.0;
1371 *
pcout <<
"time: " << time << std::endl;
1374 *
pcout <<
" - move support points (immersed mesh)" << std::endl;
1386 *
"Immersed domain leaves background domain!"));
1390 *
VectorTools::point_values<dim>(rpe,
1393 *
velocity.zero_out_ghost_values();
1395 *
for (
unsigned int i = 0, c = 0;
1398 *
for (
unsigned int d = 0;
d < dim; ++
d, ++c)
1438 *
pcout <<
" - compute to be tested values (immersed mesh)" << std::endl;
1457 *
std::vector<unsigned int> component_to_system_index(
1460 *
for (
unsigned int i = 0, c = 0;
1463 *
for (
unsigned int d = 0;
d < dim; ++
d, ++c)
1464 *
component_to_system_index[c] =
1467 *
for (
const auto &cell :
tria_immersed.active_cell_iterators() |
1470 *
fe_values.
reinit(cell);
1473 *
for (
const auto &
q : fe_values.quadrature_point_indices())
1477 *
const auto sigma = 1.0;
1479 *
const auto normal = fe_values.normal_vector(
q);
1481 *
for (
unsigned int i = 0, c = 0;
1484 *
for (
unsigned int d = 0;
d < dim; ++
d, ++c)
1485 *
curvature += fe_values.shape_grad_component(
1486 *
component_to_system_index[c],
q, d)[
d] *
1489 *
const auto FxJxW =
1504 *
pcout <<
" - test values (background mesh)" << std::endl;
1515 * background
mesh.
Within this function,
we initialize a
1535 *
const auto &cell_data) {
1541 *
std::vector<types::global_dof_index> local_dof_indices;
1543 *
for (
const auto cell : cell_data.cell_indices())
1546 *
cell_data.get_active_cell_iterator(cell)
1549 *
const auto unit_points = cell_data.get_unit_points(cell);
1550 *
const auto FxJxW = cell_data.get_data_view(cell, values);
1554 *
for (
const auto q :
phi_force.quadrature_point_indices())
1560 *
local_dof_indices.resize(
cell_dofs->get_fe().n_dofs_per_cell());
1561 *
cell_dofs->get_dof_indices(local_dof_indices);
1594 *
pcout <<
" - write data (background mesh)" << std::endl;
1602 *
std::vector<std::string>(dim,
"force"),
1607 *
std::vector<std::string>(dim,
"velocity"),
1611 *
std::to_string(
it) +
1615 *
pcout <<
" - write mesh (immersed mesh)" << std::endl;
1620 *
std::to_string(
it) +
1624 *
pcout << std::endl;
1631 * <a name=
"step_87-Utilityfunctionsdefinition"></a>
1635 *
template <
int spacedim>
1636 *
std::vector<Point<spacedim>>
1639 *
const unsigned int n_subdivisions)
1641 *
Assert(n_subdivisions >= 1, ExcInternalError());
1643 *
std::vector<Point<spacedim>> points;
1644 *
points.reserve(n_subdivisions + 1);
1646 *
points.emplace_back(
p0);
1647 *
for (
unsigned int i = 1; i < n_subdivisions; ++i)
1648 *
points.emplace_back(
p0 + (
p1 -
p0) *
static_cast<double>(i) /
1649 *
static_cast<double>(n_subdivisions));
1650 *
points.emplace_back(
p1);
1655 *
template <
int spacedim,
typename T0,
typename T1>
1663 *
ExcMessage(
"The provided vectors must have the same length."));
1667 *
for (
unsigned int i = 0; i < points.size(); ++i)
1669 *
file << std::fixed << std::right << std::setw(5) << std::setprecision(3)
1670 *
<< points[0].distance(points[i]);
1672 *
for (
unsigned int d = 0;
d < spacedim; ++
d)
1673 *
file << std::fixed << std::right << std::setw(10)
1674 *
<< std::setprecision(3) << points[i][
d];
1676 *
file << std::fixed << std::right << std::setw(10)
1677 *
<< std::setprecision(3) <<
values_0[i];
1680 *
file << std::fixed << std::right << std::setw(10)
1681 *
<< std::setprecision(3) <<
values_1[i];
1682 *
file << std::endl;
1686 *
template <
int dim,
int spacedim>
1694 *
dof_handler.get_mpi_communicator());
1696 *
const auto &fe = dof_handler.get_fe();
1701 *
fe.base_element(0).get_unit_support_points(),
1704 *
std::vector<types::global_dof_index> local_dof_indices(
1705 *
fe.n_dofs_per_cell());
1707 *
std::vector<unsigned int> component_to_system_index(
1708 *
fe_values.n_quadrature_points * spacedim);
1710 *
for (
unsigned int q = 0, c = 0;
q < fe_values.n_quadrature_points; ++
q)
1711 *
for (
unsigned int d = 0;
d < spacedim; ++
d, ++c)
1712 *
component_to_system_index[c] = fe.component_to_system_index(d,
q);
1714 *
for (
const auto &cell : dof_handler.active_cell_iterators() |
1717 *
fe_values.
reinit(cell);
1718 *
cell->get_dof_indices(local_dof_indices);
1720 *
for (
unsigned int q = 0, c = 0;
q < fe_values.n_quadrature_points; ++
q)
1721 *
for (
unsigned int d = 0;
d < spacedim; ++
d, ++c)
1722 *
support_points[local_dof_indices[component_to_system_index[c]]] =
1723 *
fe_values.quadrature_point(
q)[
d];
1727 *
template <
int dim,
int spacedim,
typename T>
1728 *
std::tuple<std::vector<Point<spacedim>>, std::vector<types::global_dof_index>>
1737 *
ExcMessage(
"The narrow band threshold"
1738 *
" must be larger than or equal to 0."));
1742 *
.get_unit_support_points());
1755 *
std::vector<types::global_dof_index> local_dof_indices(
1761 *
const bool has_ghost_elements = signed_distance.has_ghost_elements();
1767 *
if (has_ghost_elements ==
false)
1768 *
signed_distance.update_ghost_values();
1770 *
for (
const auto &cell :
1781 *
cell_req->get_dof_indices(local_dof_indices);
1783 *
for (
const auto q :
req_values.quadrature_point_indices())
1799 *
if (has_ghost_elements ==
false)
1800 *
signed_distance.zero_out_ghost_values();
1805 *
template <
int spacedim>
1806 *
std::vector<Point<spacedim>>
convert(
1809 *
const unsigned int n_points =
1812 *
std::vector<Point<spacedim>> points(n_points);
1814 *
for (
unsigned int i = 0, c = 0; i < n_points; ++i)
1815 *
for (
unsigned int d = 0;
d < spacedim; ++
d, ++c)
1826 * <a name=
"step_87-Driver"></a>
1836 *
using namespace dealii;
1838 *
std::cout.precision(5);
1862 - in cell
with vertices: (0 0.4) (0.2 0.4) (0 0.6) (0.2 0.6)
1870 - in cell
with vertices: (0 0.4) (0.2 0.4) (0 0.6) (0.2 0.6)
1880 - in cell
with vertices: (0.8 0.4) (1 0.4) (0.8 0.6) (1 0.6)
1894values at
those points.
18970.000 0.000 0.500 0.250
18980.050 0.050 0.500 0.200
18990.100 0.100 0.500 0.150
19000.150 0.150 0.500 0.100
19010.200 0.200 0.500 0.050
19020.250 0.250 0.500 0.000
19030.300 0.300 0.500 -0.050
19040.350 0.350 0.500 -0.100
19050.400 0.400 0.500 -0.149
19060.450 0.450 0.500 -0.200
19070.500 0.500 0.500 -0.222
19080.550 0.550 0.500 -0.200
19090.600 0.600 0.500 -0.149
19100.650 0.650 0.500 -0.100
19110.700 0.700 0.500 -0.050
19120.750 0.750 0.500 0.000
19130.800 0.800 0.500 0.050
19140.850 0.850 0.500 0.100
19150.900 0.900 0.500 0.150
19160.950 0.950 0.500 0.200
19171.000 1.000 0.500 0.250
19360.000 0.000 0.500 0.250 0.000
19370.050 0.050 0.500 0.200 0.050
19380.100 0.100 0.500 0.150 0.100
19390.150 0.150 0.500 0.100 0.150
19400.200 0.200 0.500 0.050 0.200
19410.250 0.250 0.500 0.000 0.250
19420.300 0.300 0.500 -0.050 0.300
19430.350 0.350 0.500 -0.100 0.350
19440.400 0.400 0.500 -0.149 0.400
19450.450 0.450 0.500 -0.200 0.450
19460.500 0.500 0.500 -0.222 0.500
19470.550 0.550 0.500 -0.200 0.550
19480.600 0.600 0.500 -0.149 0.600
19490.650 0.650 0.500 -0.100 0.650
19500.700 0.700 0.500 -0.050 0.700
19510.750 0.750 0.500 0.000 0.750
19520.800 0.800 0.500 0.050 0.800
19530.850 0.850 0.500 0.100 0.850
19540.900 0.900 0.500 0.150 0.900
19550.950 0.950 0.500 0.200 0.950
19561.000 1.000 0.500 0.250 1.000
2028 - test values (background
mesh)
2035 - test values (background
mesh)
2040 - test values (background
mesh)
2047 - test values (background
mesh)
2088Particles::ParticleHandler::insert_global_particles() function
uses
2116grids via surfaces (example: fluid-structure interaction, independently created
2121GridTools::internal::distributed\_compute_intersection_locations().
2128<a name="step_87-PlainProg"></a>
void test_and_sum(const StridedArrayView< ScalarNumber, stride_view > &solution_values, const EvaluationFlags::EvaluationFlags &integration_flags, const bool sum_into_values=false)
void process_and_evaluate(const std::vector< T > &input, std::vector< T > &buffer, const std::function< void(const ArrayView< const T > &, const CellData &)> &evaluation_function, const bool sort_data=true) const
#define Assert(cond, exc)
#define AssertThrow(cond, exc)
void loop(IteratorType begin, std_cxx20::type_identity_t< IteratorType > end, DOFINFO &dinfo, INFOBOX &info, const std::function< void(std_cxx20::type_identity_t< DOFINFO > &, typename INFOBOX::CellInfo &)> &cell_worker, const std::function< void(std_cxx20::type_identity_t< DOFINFO > &, typename INFOBOX::CellInfo &)> &boundary_worker, const std::function< void(std_cxx20::type_identity_t< DOFINFO > &, std_cxx20::type_identity_t< DOFINFO > &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, AssemblerType &assembler, const LoopControl &lctrl=LoopControl())
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
std::vector< index_type > data
DataComponentInterpretation
@ component_is_part_of_vector
void support_point_wise(DoFHandler< dim, spacedim > &dof_handler)
void hyper_sphere(Triangulation< spacedim - 1, spacedim > &tria, const Point< spacedim > ¢er=Point< spacedim >(), const double radius=1.)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
@ valid
Iterator points to a valid object.
constexpr types::blas_int zero
constexpr types::blas_int one
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
VectorType::value_type * end(VectorType &V)
T sum(const T &t, const MPI_Comm mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
std::string compress(const std::string &input)
int(&) functions(const void *v1, const void *v2)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)