comphy-lab / comphy-lab/Viscoelastic3D

Full Tensor Implementation

Open
#16 0 comments 0 reactions 1 assignee Claimed by @VatsalSy View on GitHub
help wanted
Dominant language
Jupyter Notebook
Stars
6
Forks
1
Avg merge
1h 16m
Merged PRs (30d)
1

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](https://github.com/comphy-lab/Viscoelastic3D/blob/main/basilisk/src/grid/cartesian-common.h#L230-L251)
```c
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:**
- [[Issue #11](https://github.com/comphy-lab/Viscoelastic3D/issues/11)](https://github.com/comphy-lab/Viscoelastic3D/issues/11)
- [[Issue #5](https://github.com/comphy-lab/Viscoelastic3D/issues/5)](https://github.com/comphy-lab/Viscoelastic3D/issues/5)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.