# Solution value at the flux point

**URL:** <https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007>\
**Category:** Development\
**Created:** [22 December 2023 12:34 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007 "2023-12-22T12:34:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [22 December 2023 12:34 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/1 "2023-12-22T12:34:45Z")

</div>

Hello everyone,  
I want to calculate the solution value at the flux point, Q\_{i,FP} = Q\_{i,j}\*L\_{i,j}(x\_{i,FP},y\_{i,FP}), where Q\_{i,j} is solution at solution point, x\_{i,FP} and y\_{i,FP} is the coordinate of the flux point. Could someone give me some insight?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [22 December 2023 15:25 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/2 "2023-12-22T15:25:19Z")

</div>

Solution to flux point interpolation is usually handled by the `m0` operator. From this it is just a case of tracing through the flux point you want (the `fpts` and `upts` members of the shape will help you here).

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [24 December 2023 12:33 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/3 "2023-12-24T12:33:40Z")

</div>

Thanks a lot.

And which mako file is kernel mul defined in? Is this solution to flux point interpolation? I need to calculate the solution to all flux points in one element? Is there anything I can refer to?

 ![V8(_1U%GHL4J8~DEZ)G@0OI](https://global.discourse-cdn.com/free1/uploads/pyfr/original/1X/26f3cca6debe3ff953cd8498718a04b85fc25d70.jpeg)

Best regards

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [24 December 2023 17:33 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/4 "2023-12-24T17:33:44Z")

</div>

Just apply M0 the operator to your array (one operator per element type). The mul kernel itself is not implemented in Mako and falls back to either GiMMiK or BLAS.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [25 January 2024 14:32 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/5 "2024-01-25T14:32:35Z")

</div>

> [@fdw](#):
>
> Just apply M0 the operator to your array (one operator per element type).

I want to loop the solution value at the flux point in the current element in the Mako file. First, I use m0=self.basis.m0 to get m0 operator marix in the euler/element.py. Then how to get the value at the solution points(state matrix)? Could you give me some more details?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [25 January 2024 14:50 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/6 "2024-01-25T14:50:42Z")

</div>

Just look at how `m0` is used in the code! Usually this forms a kernel called `disu`. We can apply it as:

> <https://github.com/PyFR/PyFR/blob/09eff9370758d4ea1e3d853978949f30933a6bb2/pyfr/solvers/baseadvec/system.py#L21>

which adds the interpolation operator to each element type in our domain to our graph. After this kernel has run the result is put in `_scal_fpts` for each element type as per:

> <https://github.com/PyFR/PyFR/blob/09eff9370758d4ea1e3d853978949f30933a6bb2/pyfr/solvers/baseadvec/elements.py#L73>

so if you want to loop over these flux points (a highly dubious operation which is probably not justified mathematically…) you can do so with a 1D kernel which is passed `_scal_fpts` as an input. Just make sure that when this kernel is added to the graph it is marked as a dependency of `eles/disu`.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [29 January 2024 15:19 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/7 "2024-01-29T15:19:05Z")

</div>

for l in k[‘eles/disu’]:  
g1.add(l, deps=deps(l, ‘eles/limiter’)). I use this code to add the grdph. Then in the euler/element.py I passed `_scal_fpts` as an input in the kenrnel function. Last, I set f[{str(nfpts)}][{str(nvars)}] to receive `_scal_fpts`, and I do loop in f[{str(nfpts)}][{str(nvars)}]. But there are still questions about the results.

Am I right about the above?

Best regards

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [29 January 2024 17:00 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/8 "2024-01-29T17:00:06Z")

</div>

Yes, that looks about right. Just be sure that your kernel is not scheduled to run after another kernel which overrides `_scal_fpts` (such as the common flux kernels).

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![fei](https://avatars.discourse-cdn.com/v4/letter/f/59ef9b/32.png) [@fei](https://pyfr.discourse.group/u/fei)\
**Post date:** [30 January 2024 02:01 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/9 "2024-01-30T02:01:09Z")

</div>

> [@fdw](#):
>
> Just be sure that your kernel is not scheduled to run after another kernel which overrides `_scal_fpts` (such as the common flux kernels).

That means I have to set `limiter` before the `rhs_with_postproc` in the std/steppers.py? and that’s what I have done.

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [30 January 2024 12:48 UTC](https://pyfr.discourse.group/t/solution-value-at-the-flux-point/1007/10 "2024-01-30T12:48:20Z")

</div>

When you run the graph is up to you. However, the disu kernel must run before the limiter kernel in the graph.

Regards, Freddie.
