> 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/material/material1d/viscosity/nonlinearviscosity.md).

# NonlinearViscosity

Nonlinear Viscosity Model

The `NonlinearViscosity` class is an abstract class that provides a general nonlinear framework for implementations of various viscous type material, such as a dashpot.

The stress shall be computed by

$$
\sigma=\text{sign}\left(\dot\varepsilon\right)\cdot\eta\left(\varepsilon,\dot\varepsilon\right)
\cdot|\dot\varepsilon|^\alpha.
$$

The so-called viscosity $$\eta\left(\varepsilon,\dot\varepsilon\right)$$ can be a general function of strain and/or strain rate.

If the target material is not characterized by the classic power-law, it is possible to pass $$\alpha=0$$ to the `NonlinearViscosity` class so that the response becomes

$$
\sigma=\eta\left(\varepsilon,\dot\varepsilon\right)
$$

that can be purely determined by the derived class.

## Things to Pass to Ctor

The default constructor is defined to be

```cpp
 NonlinearViscosity(unsigned, // tag
                    double,   // alpha
                    double    // cut-off
 );
```

The second parameter is the exponent $$\alpha$$. The third parameter is a non-negative parameter that defines a segment of cubic function that approximates the original exponential function to achieve a better numerical performance.

## Things to Override

Three private methods need to be overridden.

```cpp
 [[nodiscard]] virtual double compute_du(double, double) const = 0; // compute derivative w.r.t. strain
 [[nodiscard]] virtual double compute_dv(double, double) const = 0; // compute derivative w.r.t. strain rate
 [[nodiscard]] virtual double compute_damping_coefficient(double, double) const = 0; // compute \eta
```

All three methods take strain and strain rate to be two input arguments.

## Derived Material Models

1. [`Viscosity01`](/suanpan-manual/material/material1d/viscosity/viscosity01.md)
2. [`Viscosity02`](/suanpan-manual/material/material1d/viscosity/viscosity02.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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tlcfem.gitbook.io/suanpan-manual/material/material1d/viscosity/nonlinearviscosity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
