Interface2DBC#
- class pinnx.icbc.Interface2DBC(func, on_boundary1=<function Interface2DBC.<lambda>>, on_boundary2=<function Interface2DBC.<lambda>>, direction='normal')[source]#
2D interface boundary condition.
This BC applies to the case with the following conditions: (1) the network output has two elements, i.e., output = [y1, y2], (2) the 2D geometry is
pinnx.geometry.Rectangleorpinnx.geometry.Polygon, which has two edges of the same length, (3) uniform boundary points are used, i.e., inpinnx.problem.PDEorpinnx.problem.TimePDE,train_distribution="uniform". For a pair of points on the two edges, compute <output_1, d1> for the point on the first edge and <output_2, d2> for the point on the second edge in the n/t direction (‘n’ for normal or ‘t’ for tangent). Here, <v1, v2> is the dot product between vectors v1 and v2; and d1 and d2 are the n/t vectors of the first and second edges, respectively. In the normal case, d1 and d2 are the outward normal vectors; and in the tangent case, d1 and d2 are the outward normal vectors rotated 90 degrees clockwise. The points on the two edges are paired as follows: the boundary points on one edge are sampled clockwise, and the points on the other edge are sampled counterclockwise. Then, compare the sum with ‘values’, i.e., the error is calculated as <output_1, d1> + <output_2, d2> - values, where ‘values’ is the argument func evaluated on the first edge.- Parameters:
func (
Union[Callable[[Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]],...],Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]]],Callable[[Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]]],Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]]]]) – the target discontinuity between edges, evaluated on the first edge, e.g.,func=lambda x: 0means no discontinuity is wanted.on_boundary1 (
Callable[[Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]],array],array]) – First edge func. (x, Geometry.on_boundary(x)) -> True/False.on_boundary2 (
Callable[[Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]],array],array]) – Second edge func. (x, Geometry.on_boundary(x)) -> True/False.direction (
str) – “normal” or “tangent”.