# Single and double derivative of variables

**URL:** <https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639>\
**Category:** ParaView Support\
**Created:** [May 14, 2025, 11:03pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639 "2025-05-14T23:03:50Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [May 20, 2025, 11:23pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/21 "2025-05-20T23:23:57Z")

</div>

Hi Sean, thanks for your comments. No i did not add ghost layers, at block boundaries. How to add them? Also doing gradient filter twice is the only way to compute 2nd derivative in Paraview right?

---

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [May 20, 2025, 11:38pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/22 "2025-05-20T23:38:11Z")

</div>

Also by block boundaries do u mean the walls of the pipe or the intermediate boundaries of the O-grid mesh in the middle portion? Please see O-grid mesh picture above to see the boundaries., thanks

---

<div class="post-metadata">

**Author:** ![ahernsean](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ahernsean/32/13743_2.png) [@ahernsean](https://discourse.paraview.org/u/ahernsean)\
**Post date:** [May 21, 2025, 12:59pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/23 "2025-05-21T12:59:11Z")

</div>

By “block boundaries”, I mean the boundaries of VTK multiblock datasets. Open up ParaView’s “MultiBlock Inspector”. You’ll see all of the blocks (if any) that your dataset is decomposed into. Any algorithm that requires data from some spatial region beyond just a single cell (like a spatial derivative) will need some way of borrowing the data from other blocks. Ghost cells are one way to do it. If your data is not large, applying a MergeBlocks filter unifies all of your blocks into a single block, which would also work around the issue. Without the ability to include data from other blocks, many algorithms could potentially give inaccurate results at the boundaries between blocks.

 ![image](https://discourse.paraview.org/uploads/default/original/3X/6/8/68b8cfbf006bb2049be4dc9dade97c933ad5fcad.png)

---

<div class="post-metadata">

**Author:** ![ahernsean](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ahernsean/32/13743_2.png) [@ahernsean](https://discourse.paraview.org/u/ahernsean)\
**Post date:** [May 29, 2025, 9:22pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/24 "2025-05-29T21:22:23Z")

</div>

@scabo, in your case, block boundaries likely lie at the intermediate boundaries of your O-grid where the logical mesh structures abut. Have you tried applying the Merge Blocks filter to see how it affects your problem?

---

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [May 29, 2025, 9:24pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/25 "2025-05-29T21:24:59Z")

</div>

Hi Sean many thanks. yes i saw the block inspector, there were no blocks for the core region as you are expecting. It is already merged.

---

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [May 30, 2025, 6:54pm UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/26 "2025-05-30T18:54:59Z")

</div>

Hi Can you just briefly explain how to use this code in Paraview?

---

<div class="post-metadata">

**Author:** ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)\
**Post date:** [May 31, 2025, 11:10am UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/27 "2025-05-31T11:10:40Z")

</div>

VMTK is difficult to use within ParaView because pip installation is no longer supported. It should be possible to use it as a Python program within an Anaconda environment. Please refer to the link below.

> [@Calculating double derivatives options](https://discourse.paraview.org/t/calculating-double-derivatives-options/16678/2):
>
> Calculating higher-order precision gradients using vmtk’s vtkvmtkUnstructuredGridGradientFilter in Python is relatively straightforward. For an Anaconda environment, first create a virtual environment and install vmtk using the following commands: conda create -n vmtk python=3.11 conda activate vmtk conda install conda-forge::vmtk Next, you can create a Hessian matrix by applying vtkvmtkUnstructuredGridGradientFilter twice to a variable with a Python program like the one below. However, this …

---

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [June 1, 2025, 11:00am UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/28 "2025-06-01T11:00:14Z")

</div>

Hi, thanks. I am unfamiliar with how to use these things in Paraview. Do we have to do programmable filter or something else to implement this?

---

<div class="post-metadata">

**Author:** ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)\
**Post date:** [June 1, 2025, 11:24am UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/29 "2025-06-01T11:24:13Z")

</div>

No, I don’t think it is easy to call the vmtk library within ParaView.

---

<div class="post-metadata">

**Author:** ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)\
**Post date:** [June 1, 2025, 11:26am UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/30 "2025-06-01T11:26:35Z")

</div>

SO i need to open a python and write these there and then open paraview from there? Is there a detailed explanation on how to implement python environment in Paraview? I do not know anything about opening Paraview from python, thanks

---

<div class="post-metadata">

**Author:** ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)\
**Post date:** [June 1, 2025, 11:53am UTC](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639/31 "2025-06-01T11:53:10Z")

</div>

The method I am proposing to use the VMTK library is not directly related to ParaView.

The general steps for performing high-precision second-order differentiation are as follows:

- Load the Fluent output result into ParaView.
- Convert the data into an Unstructured Grid Data using the `Merge Blocks` filter.
- Export the data as a VTU file from ParaView.
- Execute the source code provided in the previously mentioned link within Anaconda’s Python environment. The source code may require appropriate modifications.
- Load the result obtained from Python into ParaView and verify the outcome of the high-precision second-order differentiation

[Previous page](https://discourse.paraview.org/t/single-and-double-derivative-of-variables/16639.md?page=1)
