Skip to content

Gradient energy calculation seems wrong #769

@jijn

Description

@jijn

In file applications/allen_cahn_explicit/equations.cc

  ScalarValue f_grad = 0.0;
  for (unsigned int i = 0; i < dim; i++)
    {
      for (unsigned int j = 0; j < dim; j++)
        {
          f_grad += 0.5 * KnV * nx[i] * nx[j];
        }
    }

Note that this is not the dot product. The correct way should be:

  ScalarValue f_grad = 0.0;
  for (unsigned int i = 0; i < dim; i++)
    {
      f_grad += nx[i] * nx[i];
    }
  f_grad *= 0.5 * KnV;

This also affects other applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions