# Source term for some particular solution points

**URL:** <https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821>\
**Category:** Development\
**Created:** [1 June 2023 08:10 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821 "2023-06-01T08:10:21Z")\
**Posts on this page:** 7\
**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:** [1 June 2023 08:10 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/1 "2023-06-01T08:10:21Z")

</div>

Hello,  
The source-terms-plugin adds the source term to all solution points, but I want to add source term for some particular solution points, could someone give me some tips?

---

<div class="post-metadata">

**Author:** ![WillT](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@WillT](https://pyfr.discourse.group/u/WillT)\
**Post date:** [1 June 2023 08:38 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/2 "2023-06-01T08:38:30Z")

</div>

Is it that you want to add a source term at a specific point in space? If so, the best thing to do is probably to use a sharp Gaussian something like exp(-a((x - x\_p)^2 + (y-y\_p)^2)), where a is large and (x\_p, y\_p) is the point you want the source term at.

---

<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:** [1 June 2023 13:05 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/3 "2023-06-01T13:05:53Z")

</div>

Yes. but my point (x\_p, y\_p) is chosen by some conditions, and I write a plugin to get these points. So I think I should change something in some .py file.

---

<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:** [1 June 2023 13:21 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/4 "2023-06-01T13:21:06Z")

</div>

I highly doubt you want this. If you can’t express what you want as a smooth function, it is highly likely to be erroneous and order-of-accuracy destroying.

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:** [1 June 2023 15:37 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/5 "2023-06-01T15:37:53Z")

</div>

I don’t quite understand your saying. I identify certain points by some conditions and then I apply source terms to those points. So I need to control the selection of points in a file, which need to add source term.

---

<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:** [1 June 2023 15:50 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/6 "2023-06-01T15:50:23Z")

</div>

I am saying this is not a sensible thing to do. Your source term needs to be a smooth function for things to work as expected. Anything which turns on for one point but off for another implies a discontinuous first derivative. This is not what you want.

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:** [5 June 2023 11:32 UTC](https://pyfr.discourse.group/t/source-term-for-some-particular-solution-points/821/7 "2023-06-05T11:32:38Z")

</div>

No rho, u, v, w can be added to the source term, is it possible to implement?
