festim-dev / festim-dev/FESTIM

PointValue quantity in FESTIM2

Open
#970 7 comments 0 reactions 0 assignees View on GitHub
enhancement fenicsx good first issue
Dominant language
Python
Stars
135
Forks
45
Avg merge
3d 23h
Merged PRs (30d)
14

Description

We would need the equivalent of `PointValue` in FESTIM2. This should be sufficient:

```python
import festim as F

from dolfinx.geometry import bb_tree, compute_colliding_cells, compute_collisions_points

class PointValue(F.VolumeQuantity):
def __init__(self, field, volume, x0, filename = None):
super().__init__(field, volume, filename)
self.x0 = x0

def compute(self):
u = self.field.solution
mesh = u.function_space.mesh
tree = bb_tree(mesh, mesh.geometry.dim)
cell_candidates = compute_collisions_points(tree, self.x0)
cell = compute_colliding_cells(mesh, cell_candidates, self.x0).array
assert len(cell) > 0
first_cell = cell[0]

self.value = self.field.solution.eval(self.x0, first_cell)
self.data.append(self.value)
```

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.