> For the complete documentation index, see [llms.txt](https://wiki.solids.group/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.solids.group/alamo/common-errors.md).

# Common Errors

<details>

<summary><code>MLLinOp: grids not coarsenable between AMR levels</code></summary>

This is a conflict in the multigrid solver because the grid size is not a power of 2.

Fix this by changing the domain dimensions, `amr.n_cell`, so that they are powers of two.

</details>

<details>

<summary><code>static_cast&#x3C;long>(i) &#x3C; this->size() failed</code></summary>

One common reason this happens is that Dirichlet or Neumann boundaries are specified but no boundary values are provided.

</details>

<details>

<summary><code>error: lvalue required as left operand of assignment</code></summary>

This can happen when using the `()` operator with an `Isotropic` `Matrix4`-type object.

Because this data structure only stores two constants, it is not possible to define any of the values using indices. Similarly, you cannot set an `Isotropic` 4-matrix to a `Cubic` 4-matrix because the cubic matrix has lower symmetry.

If you get this error, use a lower-symmetry 4-matrix.

</details>

<details>

<summary><code>Inconsistent box arrays</code></summary>

This is known to happen when using an `Operator::Elastic` inside an `Integrator`, for example in `TimeStepBegin`.

Typically this happens when the elastic operator is not initialized within the routine in which it is used. One example is declaring it as a member variable inside an `Integrator`-derived class. The reason is that there are AMReX-specific functions that only get called by the constructor.

Fix this by initializing the operator object inside the routine in which it is used. Either make the member variable a pointer and use the `new` keyword, or create the variable inside the function.

</details>

<details>

<summary>MLMG converges in serial but diverges in parallel</summary>

MLMG sometimes fails to converge in VoronoiElastic in parallel, even if it converges just fine in serial. This generally seems to appear at a C/F boundary (see figure below).

<img src="/files/dadWYXrOF3WW9hSuULL9" alt="" data-size="original">\
\
Note that the solution actually appears to be just fine, it’s just that the residual persists. Also note that this only happens when there is a variable model, like in polycrystal elasticity.\
Also, keep in mind that the residual persists whether in parallel or in serial, it’s just that convergence fails in parallel only. So it seems this is a communication issue, not an actual parallel convergence issue.

**Fix**: this is also a temporary fix, mostly, and that is to just increase amr.blocking\_factor. In this particular case it was 4 and I increased it to 8. The reason why this makes some sense is that it seems the residual issue occurs when there are two fine patches separated by a very narrow course patch (as in the figure above). Increasing the blocking factor reduces that effect - and in fact, it actually doesn’t hurt performance much either.

</details>

<details>

<summary>MLMG fails to converge</summary>

Many things can cause failure of convergence. Here are some of the causes and fixes.

* One of the issues that can cause problems with MLMG is if a regrid operation occurs and there is a C/F boundary at the domain boundary. The cause appears to be that regridding can do odd things to the RHS fab. For instance, in the process of averaging, some of the RHS stuff can leak from the boundary into the interior. This obviously causes problems.
  * **Fix**: a temporary appears to be to simply zero out and re-initialize the RHS fab before doing an elastic solve.

</details>


---

# 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, and the optional `goal` query parameter:

```
GET https://wiki.solids.group/alamo/common-errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
