# What is signed distance function (SDF) doing in integral continuity planes?

In the Scalar Transport: 2D Advection Diffusion example, I am confused with how the integral continuity planes have been implemented.

``````# integral continuity
integral_continuity = IntegralBoundaryConstraint(
nodes=nodes,
geometry=integral_line,
outvar={"normal_dot_vel": 1},
batch_size=cfg.batch_size.num_integral_continuity,
integral_batch_size=cfg.batch_size.integral_continuity,
lambda_weighting={"normal_dot_vel": 0.1},
criteria=geo.sdf > 0,
param_ranges=x_pos_range,
)
``````

Here, I understand that `batch_size` denotes the number of integral continuity planes and `integral_batch_size` denotes the number of points to be sampled in each integral continuity plane. These things can be changed in the config file.

I also understand that a very low priority has been given to the targeted mass flow rate with a `lambda_weighting` of `0.1`.

However, I am confused with what `criteria=geo.sdf > 0` is doing.

Here `geo = channel section - 3 rectangular fins`

Is there a way to plot the sdf values, as an example `plt.scatter(x,y,c=geo.sdf)` to see where it goes negative.

I pulled out the definition of `Line` as integral continuity planes are `Line` object, but could not get any strong conclusion.

``````class Line(ConstructiveSolidGeometry):
"""
2D Line parallel to y-axis

Parameters
==========
point_1 : tuple with 2 ints or floats
lower bound point of line segment
point_2 : tuple with 2 ints or floats
upper bound point of line segment
normal : int or float
normal direction of line (+1 or -1)
"""

def __init__(self, point_1, point_2, normal):
assert point_1 == point_2, "Points must have same x-coordinate"

# make sympy symbols to use
l = Symbol(csg_curve_naming(0))
x = Symbol("x")

# curves for each side
ranges = {l: (0, 1)}
dist_y = point_2 - point_1
line_1 = Curve(
functions={
"x": point_1,
"y": point_1 + l * dist_y,
"normal_x": 1e-10 + normal,  # TODO rm 1e-10
"normal_y": 0,
},
ranges=ranges,
area=dist_y,
)
curves = [line_1]

# calculate SDF
sdf = normal * (point_1 - x)

# initialize Line
super(Line, self).__init__(curves, sdf)
``````

Hello, so one tip is to visualize the integral constraint in paraview. When you run this it will make a file in the network directory call `constraints`. This will have `vtp` files for a single batch of all the constraints. You can load these into Paraview to see them. The reason we have that `criteria=geo.sdf > 0` is we don’t want to integrate points that are inside those 3 fins. When you plot them you will see that if the integral line intersects the fins then it will not sample points there. This allows the integral to properly be computed.