> For the complete documentation index, see [llms.txt](https://tlcfem.gitbook.io/suanpan-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tlcfem.gitbook.io/suanpan-manual/element/special/contact2d.md).

# Contact2D

2D Node(Slave)-Line(Master) Contact Element

* Number of DoFs: 2
* DoF Label: U1, U2

## Syntax

```
element Contact2D (1) (2) (3) [4]
# (1) int, unique element tag
# (2) int, master group tag
# (3) int, slave group tag
# [4] double, penalty factor
```

## Remarks

1. The contact algorithm is implemented via penalty function method as an element. The parameter `[4]` controls the magnitude of penalty.
2. No matter whether the `nlgeom` switch is on or off for connected elements, the contact detection itself is always conducted in a nonlinear manner, similar to the total Lagrangian formulation.
3. The node-line contact detection is performed for all nodes defined in slave group and lines defined by nodes in master group. There are $n-1$ line segments for $n$ nodes in master group.
4. Master nodes can penetrate lines formed in slave group. To prevent this, define a new `Contact2D` element by swapping the order of slave and master groups.
5. Example usage can be seen in the [example](/suanpan-manual/example/structural/contact/contact-between-beam-and-block.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tlcfem.gitbook.io/suanpan-manual/element/special/contact2d.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
