Skip to content

Commit 756f6c3

Browse files
authored
Merge pull request #4044 from roystgnr/slit_jumps
JumpErrorEstimator::integrate_slits option
2 parents feea4b0 + 9ec7943 commit 756f6c3

20 files changed

Lines changed: 636 additions & 92 deletions

Makefile.in

Lines changed: 81 additions & 0 deletions
Large diffs are not rendered by default.

examples/transient/transient_ex3/Makefile.in

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ example_dbg_OBJECTS = $(am_example_dbg_OBJECTS)
184184
AM_V_lt = $(am__v_lt_@AM_V@)
185185
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
186186
am__v_lt_0 = --silent
187-
am__v_lt_1 =
187+
am__v_lt_1 =
188188
example_dbg_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
189189
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(example_dbg_CXXFLAGS) \
190190
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
@@ -253,11 +253,11 @@ am__v_P_1 = :
253253
AM_V_GEN = $(am__v_GEN_@AM_V@)
254254
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
255255
am__v_GEN_0 = @echo " GEN " $@;
256-
am__v_GEN_1 =
256+
am__v_GEN_1 =
257257
AM_V_at = $(am__v_at_@AM_V@)
258258
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
259259
am__v_at_0 = @
260-
am__v_at_1 =
260+
am__v_at_1 =
261261
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
262262
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
263263
am__maybe_remake_depfiles = depfiles
@@ -286,15 +286,15 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
286286
AM_V_CXX = $(am__v_CXX_@AM_V@)
287287
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
288288
am__v_CXX_0 = @echo " CXX " $@;
289-
am__v_CXX_1 =
289+
am__v_CXX_1 =
290290
CXXLD = $(CXX)
291291
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
292292
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
293293
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
294294
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
295295
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
296296
am__v_CXXLD_0 = @echo " CXXLD " $@;
297-
am__v_CXXLD_1 =
297+
am__v_CXXLD_1 =
298298
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
299299
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
300300
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -304,15 +304,15 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
304304
AM_V_CC = $(am__v_CC_@AM_V@)
305305
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
306306
am__v_CC_0 = @echo " CC " $@;
307-
am__v_CC_1 =
307+
am__v_CC_1 =
308308
CCLD = $(CC)
309309
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
310310
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
311311
$(AM_LDFLAGS) $(LDFLAGS) -o $@
312312
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
313313
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
314314
am__v_CCLD_0 = @echo " CCLD " $@;
315-
am__v_CCLD_1 =
315+
am__v_CCLD_1 =
316316
SOURCES = $(example_dbg_SOURCES) $(example_devel_SOURCES) \
317317
$(example_oprof_SOURCES) $(example_opt_SOURCES) \
318318
$(example_prof_SOURCES)
@@ -841,23 +841,23 @@ clean-checkPROGRAMS:
841841
echo " rm -f" $$list; \
842842
rm -f $$list
843843

844-
example-dbg$(EXEEXT): $(example_dbg_OBJECTS) $(example_dbg_DEPENDENCIES) $(EXTRA_example_dbg_DEPENDENCIES)
844+
example-dbg$(EXEEXT): $(example_dbg_OBJECTS) $(example_dbg_DEPENDENCIES) $(EXTRA_example_dbg_DEPENDENCIES)
845845
@rm -f example-dbg$(EXEEXT)
846846
$(AM_V_CXXLD)$(example_dbg_LINK) $(example_dbg_OBJECTS) $(example_dbg_LDADD) $(LIBS)
847847

848-
example-devel$(EXEEXT): $(example_devel_OBJECTS) $(example_devel_DEPENDENCIES) $(EXTRA_example_devel_DEPENDENCIES)
848+
example-devel$(EXEEXT): $(example_devel_OBJECTS) $(example_devel_DEPENDENCIES) $(EXTRA_example_devel_DEPENDENCIES)
849849
@rm -f example-devel$(EXEEXT)
850850
$(AM_V_CXXLD)$(example_devel_LINK) $(example_devel_OBJECTS) $(example_devel_LDADD) $(LIBS)
851851

852-
example-oprof$(EXEEXT): $(example_oprof_OBJECTS) $(example_oprof_DEPENDENCIES) $(EXTRA_example_oprof_DEPENDENCIES)
852+
example-oprof$(EXEEXT): $(example_oprof_OBJECTS) $(example_oprof_DEPENDENCIES) $(EXTRA_example_oprof_DEPENDENCIES)
853853
@rm -f example-oprof$(EXEEXT)
854854
$(AM_V_CXXLD)$(example_oprof_LINK) $(example_oprof_OBJECTS) $(example_oprof_LDADD) $(LIBS)
855855

856-
example-opt$(EXEEXT): $(example_opt_OBJECTS) $(example_opt_DEPENDENCIES) $(EXTRA_example_opt_DEPENDENCIES)
856+
example-opt$(EXEEXT): $(example_opt_OBJECTS) $(example_opt_DEPENDENCIES) $(EXTRA_example_opt_DEPENDENCIES)
857857
@rm -f example-opt$(EXEEXT)
858858
$(AM_V_CXXLD)$(example_opt_LINK) $(example_opt_OBJECTS) $(example_opt_LDADD) $(LIBS)
859859

860-
example-prof$(EXEEXT): $(example_prof_OBJECTS) $(example_prof_DEPENDENCIES) $(EXTRA_example_prof_DEPENDENCIES)
860+
example-prof$(EXEEXT): $(example_prof_OBJECTS) $(example_prof_DEPENDENCIES) $(EXTRA_example_prof_DEPENDENCIES)
861861
@rm -f example-prof$(EXEEXT)
862862
$(AM_V_CXXLD)$(example_prof_LINK) $(example_prof_OBJECTS) $(example_prof_LDADD) $(LIBS)
863863

include/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ include_HEADERS = \
775775
ghosting/ghost_point_neighbors.h \
776776
ghosting/ghosting_functor.h \
777777
ghosting/non_manifold_coupling.h \
778+
ghosting/overlap_coupling.h \
778779
ghosting/point_neighbor_coupling.h \
779780
ghosting/sibling_coupling.h \
780781
mesh/abaqus_io.h \

include/error_estimation/jump_error_estimator.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class JumpErrorEstimator : public ErrorEstimator
5656
: ErrorEstimator(),
5757
scale_by_n_flux_faces(false),
5858
use_unweighted_quadrature_rules(false),
59+
integrate_slits(false),
5960
integrate_boundary_sides(false),
6061
fine_context(),
6162
coarse_context(),
@@ -112,6 +113,22 @@ class JumpErrorEstimator : public ErrorEstimator
112113
*/
113114
bool use_unweighted_quadrature_rules;
114115

116+
/**
117+
* A boolean flag, by default false, to be set to true if integrations
118+
* should be performed on "slits" where two elements' faces overlap
119+
* even if those elements are not connected by neighbor links.
120+
*
121+
* This may only be useful for flex-IGA meshes, where
122+
* highly-nonconforming meshes are given pseudo-conforming solutions
123+
* via nodal constraints.
124+
*
125+
* Note that, to safely use this option in parallel, it is also
126+
* necessary to expand the default algebraic ghosting requirements
127+
* to include elements on the opposite sides of slits from local
128+
* elements.
129+
*/
130+
bool integrate_slits;
131+
115132
protected:
116133
/**
117134
* A utility function to reinit the finite element data on elements sharing a
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// The libMesh Finite Element Library.
2+
// Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3+
4+
// This library is free software; you can redistribute it and/or
5+
// modify it under the terms of the GNU Lesser General Public
6+
// License as published by the Free Software Foundation; either
7+
// version 2.1 of the License, or (at your option) any later version.
8+
9+
// This library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
// Lesser General Public License for more details.
13+
14+
// You should have received a copy of the GNU Lesser General Public
15+
// License along with this library; if not, write to the Free Software
16+
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+
18+
19+
20+
#ifndef LIBMESH_OVERLAP_COUPLING_H
21+
#define LIBMESH_OVERLAP_COUPLING_H
22+
23+
// Local Includes
24+
#include "libmesh/ghosting_functor.h"
25+
26+
#include "libmesh/fe_map.h"
27+
#include "libmesh/quadrature.h"
28+
29+
// C++ Includes
30+
#include <memory>
31+
32+
namespace libMesh
33+
{
34+
35+
// Forward declarations
36+
class PeriodicBoundaries;
37+
38+
39+
/**
40+
* This class implements ghosting of elements that overlap or touch at
41+
* at least one sampled point, even if no topological connection
42+
* between the elements exists. This may be useful for immersed
43+
* methods, or for integration along both sides of mesh "slits" with
44+
* no neighbor information.
45+
*
46+
* \author Roy H. Stogner
47+
* \date 2025
48+
*/
49+
class OverlapCoupling : public GhostingFunctor
50+
{
51+
public:
52+
53+
/**
54+
* Constructor. Defaults to using a Simpson's Rule quadrature to
55+
* choose sampling points. Users may wish to attach custom
56+
* quadrature rules matching those used for their system
57+
* integration.
58+
*/
59+
OverlapCoupling();
60+
61+
/**
62+
* Copy constructor.
63+
*/
64+
OverlapCoupling(const OverlapCoupling & other);
65+
66+
/**
67+
* A clone() is needed because GhostingFunctor can not be shared between
68+
* different meshes. The operations in GhostingFunctor are mesh dependent.
69+
*/
70+
virtual std::unique_ptr<GhostingFunctor> clone () const override
71+
{ return std::make_unique<OverlapCoupling>(*this); }
72+
73+
// Change coupling matrix after construction
74+
void set_dof_coupling(const CouplingMatrix * dof_coupling)
75+
{ _dof_coupling = dof_coupling; }
76+
77+
// Change quadrature rule after construction. This function takes
78+
// ownership of the rule object and uses it for elements of the
79+
// appropriate dimension.
80+
void set_quadrature_rule(std::unique_ptr<QBase> new_q_rule);
81+
82+
/**
83+
* We need an updated point locator to see what other elements might
84+
* share each quadrature point.
85+
*/
86+
virtual void mesh_reinit () override;
87+
88+
virtual void redistribute () override
89+
{ this->mesh_reinit(); }
90+
91+
virtual void delete_remote_elements() override
92+
{ this->mesh_reinit(); }
93+
94+
/**
95+
* For the specified range of active elements, find the elements
96+
* which will be coupled to them in the sparsity pattern.
97+
*
98+
* This will include whatever the point locator finds at each
99+
* quadrature point in the range.
100+
*/
101+
virtual void operator() (const MeshBase::const_element_iterator & range_begin,
102+
const MeshBase::const_element_iterator & range_end,
103+
processor_id_type p,
104+
map_type & coupled_elements) override;
105+
106+
private:
107+
108+
const CouplingMatrix * _dof_coupling;
109+
110+
// Quadrature rules for different element dimensions
111+
std::array<std::unique_ptr<QBase>, 3> _q_rules;
112+
113+
// FE Map from quadrature space to physical space
114+
FEMap _fe_map;
115+
};
116+
117+
} // namespace libMesh
118+
119+
#endif // LIBMESH_OVERLAP_COUPLING_H

include/include_HEADERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ include_HEADERS = \
174174
ghosting/ghost_point_neighbors.h \
175175
ghosting/ghosting_functor.h \
176176
ghosting/non_manifold_coupling.h \
177+
ghosting/overlap_coupling.h \
177178
ghosting/point_neighbor_coupling.h \
178179
ghosting/sibling_coupling.h \
179180
mesh/abaqus_io.h \

include/libmesh/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ BUILT_SOURCES = \
164164
ghost_point_neighbors.h \
165165
ghosting_functor.h \
166166
non_manifold_coupling.h \
167+
overlap_coupling.h \
167168
point_neighbor_coupling.h \
168169
sibling_coupling.h \
169170
abaqus_io.h \
@@ -1082,6 +1083,9 @@ ghosting_functor.h: $(top_srcdir)/include/ghosting/ghosting_functor.h
10821083
non_manifold_coupling.h: $(top_srcdir)/include/ghosting/non_manifold_coupling.h
10831084
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
10841085

1086+
overlap_coupling.h: $(top_srcdir)/include/ghosting/overlap_coupling.h
1087+
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
1088+
10851089
point_neighbor_coupling.h: $(top_srcdir)/include/ghosting/point_neighbor_coupling.h
10861090
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
10871091

include/libmesh/Makefile.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,13 @@ BUILT_SOURCES = auto_ptr.h dirichlet_boundaries.h dof_map.h \
571571
plane.h point.h reference_elem.h remote_elem.h side.h sphere.h \
572572
stored_range.h surface.h default_coupling.h \
573573
ghost_point_neighbors.h ghosting_functor.h \
574-
non_manifold_coupling.h point_neighbor_coupling.h \
575-
sibling_coupling.h abaqus_io.h boundary_info.h boundary_mesh.h \
576-
checkpoint_io.h distributed_mesh.h dyna_io.h ensight_io.h \
577-
exodusII_io.h exodusII_io_helper.h exodus_header_info.h \
578-
fro_io.h gmsh_io.h gmv_io.h gnuplot_io.h inf_elem_builder.h \
579-
matlab_io.h medit_io.h mesh.h mesh_base.h mesh_communication.h \
574+
non_manifold_coupling.h overlap_coupling.h \
575+
point_neighbor_coupling.h sibling_coupling.h abaqus_io.h \
576+
boundary_info.h boundary_mesh.h checkpoint_io.h \
577+
distributed_mesh.h dyna_io.h ensight_io.h exodusII_io.h \
578+
exodusII_io_helper.h exodus_header_info.h fro_io.h gmsh_io.h \
579+
gmv_io.h gnuplot_io.h inf_elem_builder.h matlab_io.h \
580+
medit_io.h mesh.h mesh_base.h mesh_communication.h \
580581
mesh_function.h mesh_generation.h mesh_input.h \
581582
mesh_inserter_iterator.h mesh_modification.h \
582583
mesh_netgen_interface.h mesh_output.h mesh_refinement.h \
@@ -1415,6 +1416,9 @@ ghosting_functor.h: $(top_srcdir)/include/ghosting/ghosting_functor.h
14151416
non_manifold_coupling.h: $(top_srcdir)/include/ghosting/non_manifold_coupling.h
14161417
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
14171418

1419+
overlap_coupling.h: $(top_srcdir)/include/ghosting/overlap_coupling.h
1420+
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
1421+
14181422
point_neighbor_coupling.h: $(top_srcdir)/include/ghosting/point_neighbor_coupling.h
14191423
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
14201424

include/systems/system_norm.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ enum FEMNormType : int;
3939
* Discrete vector norms and weighted l2 combinations of Sobolev norms and
4040
* seminorms are representable.
4141
*
42+
* For ease of use, if a norm or weight is queried for variable n but
43+
* has not been set for variable n, then the norm or weight set for
44+
* the highest-numbered variable below n is returned.
45+
*
4246
* \author Roy H. Stogner
4347
* \date 2008
4448
*/
@@ -47,7 +51,7 @@ class SystemNorm
4751
public:
4852

4953
/**
50-
* Constructor, defaults to DISCRETE_L2
54+
* Constructor, defaults to DISCRETE_L2 with weight of 1.0.
5155
*/
5256
SystemNorm();
5357

@@ -125,21 +129,31 @@ class SystemNorm
125129

126130
/**
127131
* \returns The type of the norm in variable \p var
132+
*
133+
* If no norm has been explicitly set for \p var, then the
134+
* highest-index norm explicitly set is returned, or DISCRETE_L2
135+
* is returned if no norms have been explicitly set.
128136
*/
129137
FEMNormType type(unsigned int var) const;
130138

131139
/**
132-
* Sets the type of the norm in variable \p var
140+
* Sets the type of the norm in variable \p var, as well as for any
141+
* unset variables with index less than \p var
133142
*/
134143
void set_type(unsigned int var, const FEMNormType & t);
135144

136145
/**
137146
* \returns The weight corresponding to the norm in variable \p var
147+
*
148+
* If no weight has been explicitly set for \p var, then the
149+
* highest-index weight explicitly set is returned, or 1.0 is
150+
* returned if no weights have been explicitly set.
138151
*/
139152
Real weight(unsigned int var) const;
140153

141154
/**
142-
* Sets the weight corresponding to the norm in variable \p var
155+
* Sets the weight corresponding to the norm in variable \p var, as
156+
* well as for any unset variables with index less than \p var.
143157
*/
144158
void set_weight(unsigned int var, Real w);
145159

include/utils/point_locator_base.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ class PointLocatorBase : public ReferenceCountedObject<PointLocatorBase>
9898
const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const = 0;
9999

100100
/**
101-
* Locates a set of elements in proximity to the point with global coordinates
102-
* \p p Pure virtual. Optionally allows the user to restrict the subdomains searched.
101+
* Finds elements in proximity to the point with global coordinates
102+
* \p p and adds them to a set of candidate elements. Pure virtual.
103+
* Optionally allows the user to restrict the subdomains searched.
103104
*/
104105
virtual void operator() (const Point & p,
105106
std::set<const Elem *> & candidate_elements,

0 commit comments

Comments
 (0)