comphy-lab/Viscoelastic3D

Full Tensor Implementation

Open

#16 opened on Nov 23, 2024

 (0 comments) (0 reactions) (1 assignee)C (1 fork)auto 404
help wanted

Repository metrics

Stars
 (5 stars)
PR merge metrics
 (PR metrics pending)

Description

Issue: Full Tensor Implementation as a Pre-requisite to #6 and #12

Description: As a pre-requisite to issues #6 and #12, it would be beneficial to implement a full tensor framework. The current challenge lies in the incompatibility between 3D implementations and symmetric tensors.

Reference Code: Link to source code

tensor new_symmetric_tensor (const char * name)
{
  struct { char * x, * y, * z; } ext = {".x.x", ".y.y", ".z.z"};
  tensor t;
  foreach_dimension()
    t.x.x = alloc_block_scalar (name, ext.x, 1);
  #if dimension > 1
    t.x.y = alloc_block_scalar (name, ".x.y", 1);
    t.y.x = t.x.y;
  #endif
  #if dimension > 2
    t.x.z = alloc_block_scalar (name, ".x.z", 1);
    t.z.x = t.x.z;
    t.y.z = alloc_block_scalar (name, ".y.z", 1);
    t.z.y = t.y.z;
  #endif
  /* fixme: boundary conditions don't work!  This is because boundary
     attributes depend on the index and should (but cannot) be
     different for t.x.y and t.y.x */
  init_tensor (t, NULL);
  return t;
}

TODO:

  • Ideally, we would like to consistently use tensor formulation to leverage ease of readability and maintainability.
  • However, this is currently blocked by a limitation in Basilisk's core implementation (see basilisk/src/grid/cartesian-common.h line ~246: "fixme: boundary conditions don't work!").
  • Once this limitation is resolved in Basilisk's core, we can:
  • Convert scalar implementation to use tensors
  • Make the code generally compatible using foreach_dimensions
  • Improve code maintainability and readability
  • Potentially merge with the 2D tensor-based implementation

Related Issues:

Contributor guide