# Heating model plugin

**URL:** <https://community.geodynamics.org/t/heating-model-plugin/4072>\
**Category:** ASPECT\
**Created:** [April 14, 2025, 11:38pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072 "2025-04-14T23:38:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnie94](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/arnie94/32/3019_2.png) [@arnie94](https://community.geodynamics.org/u/arnie94)\
**Post date:** [April 14, 2025, 11:38pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/1 "2025-04-14T23:38:45Z")

</div>

Hello All,

I’m trying to implement decay heating using the _compositional heating_ model via a plugin. To do this, I copied `compositional_heating.h` and `compositional_heating.cc` from the ASPECT source code into my plugin folder. My goal is to modify the `evaluate()` function to include decay heating.

However, when I try to compile the plugin, I keep encountering the following error:

 ![Screenshot 2025-04-14 162533](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/e/e0fbf1afdc0459ee623c988f559e59ad4071f844.png)

Has anyone run into a similar issue or have suggestions on what might be going wrong? Any guidance on how to resolve this would be greatly appreciated!

Thanks,  
Arnab

---

<div class="post-metadata">

**Author:** ![jbnaliboff](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jbnaliboff](https://community.geodynamics.org/u/jbnaliboff)\
**Post date:** [April 15, 2025, 3:27am UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/2 "2025-04-15T03:27:54Z")

</div>

Hi @arnie94,

I’m not exactly sure what the error is related to without seeing the files, but a few quick thoughts:

1. Just to be sure, have you seen the documentation on how to [write a plugin](https://aspect-documentation.readthedocs.io/en/latest/user/extending/write-a-plugin.html)?
2. Would the [radioactive decay heating model](https://aspect-documentation.readthedocs.io/en/latest/parameters/Heating_20model.html#subsection-heating-model-radioactive-decay) provide the functionality you need?

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [April 15, 2025, 2:25pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/3 "2025-04-15T14:25:58Z")

</div>

@arnie94 It would be useful to see the code you’re trying to compile. But from the error message, I believe that what is happening is that in line 59, you are implementing a function `CompositionalHeating::get_required_properties()`. But `CompositionalHeating` is a class that is declared inside ASPECT – it does not have such a function. I _assume_ that you are trying to implement a class of your own, and perhaps that class has a `get_required_properties()` function that you are trying to implement? As said, it would be easier to say for sure if we saw your code.  
Best  
W.

---

<div class="post-metadata">

**Author:** ![arnie94](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/arnie94/32/3019_2.png) [@arnie94](https://community.geodynamics.org/u/arnie94)\
**Post date:** [April 15, 2025, 6:15pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/4 "2025-04-15T18:15:50Z")

</div>

Thank you so much for your response. In my model setup, I am working with three different compositions, each of which should be assigned a total amount of heat (H) that decays over time throughout the simulation. I initially considered using the `radioactive_decay` heating model; however, this requires specifying initial isotopic concentrations, which I would prefer to avoid. Additionally, it appears that this model does not support partitioning the total heat among multiple compositions, which is a key requirement for my case.  
What I need is functionality similar to the `compositional_heating` model—where heat can be assigned and tracked for each composition individually—but with a decay component rather than constant heating. So I thought of creating a plugin based on the compositional heating model.  
These are the files which I created for the plugin (based on the compositional heating model):  
[compositional\_heating\_decay\_plugin.zip](https://community.geodynamics.org/uploads/short-url/p0Ys9ev4rxrqmuNPNePnSkVTzKU.zip) (4.3 KB)  
This is the error I am getting on compiling.

 ![Screenshot 2025-04-15 110226](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/4/4394f1b7e35ac40bd79fe27c800342cdabb0591c.png)

Thanks  
Arnab

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [April 15, 2025, 11:15pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/5 "2025-04-15T23:15:27Z")

</div>

@arnie94 The error message you get is about line 46, which reads

```auto
              compositional_heat_production += volume_fractions[c] * heating_values[c] * std::exp(-decay_constants[c] * current_time);

```

Specifically, the compiler says that it knows nothing about `heating_values` and `decay_constants`, and in fact that is correct: You do not ever declare these variables in your class declaration in the `.h` file. In other words, the error message is correct – you need to declare these member variables.  
Best  
W.

---

<div class="post-metadata">

**Author:** ![arnie94](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/arnie94/32/3019_2.png) [@arnie94](https://community.geodynamics.org/u/arnie94)\
**Post date:** [April 22, 2025, 8:10pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/6 "2025-04-22T20:10:30Z")

</div>

Thank you so much for the correction — I can now run the plugin in serial mode without any issues. However, I’m encountering an error when running it on the HPC. Here’s what I did:

I created a folder named `comp_heat_decay`, where I placed the `compositional_heating_decay.cc` and `compositional_heating_decay.h` files along with the `CMakeLists.txt`. I then compiled the plugin using:

```bash
cmake -DAspect_DIR=$ASPECT_source$ .
make

```

After that, I placed my `.prm` file in the same folder and loaded the plugin into the .prm file using:

```auto
set Additional shared libraries = ./libcompositional_heating_decay.so 

```

Finally, I tried running the model with the following command:

```bash
mpirun -np 32 ./aspect/build/aspect-release /lfs/arnabroy.ui/comp_heat_decay/my_prm.prm

```

Despite everything working fine in serial on my desktop, this setup throws this error in parallel on the HPC.  
[test-results-935729.txt](https://community.geodynamics.org/uploads/short-url/OjcgOtluVbBYtg5y4zoGst3jdk.txt) (54.1 KB)  
I have checked the spelling of the plugin and the .so file is there in the comp\_heat\_decay directory. Any guidance would be greatly appreciated!

Thanks  
Arnab

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [April 22, 2025, 8:27pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/7 "2025-04-22T20:27:53Z")

</div>

@arnie94 The error message is

```auto
    Could not successfully load shared library
    <./libcompositional_heating_decay.release.so>. The operating system
    reports that the error is this:
    <./libcompositional_heating_decay.release.so: cannot open shared
    object file: No such file or directory>. Did you call 'cmake' and then
    compile the plugin library you are trying to load, and did you check
    the spelling of the library's name? Are you running ASPECT in a
    directory so that the path to the library in question is as specified
    in the .prm file?

```

Can you show us a listing of the files in the directory in which you run ASPECT?  
Best  
W.

---

<div class="post-metadata">

**Author:** ![arnie94](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/arnie94/32/3019_2.png) [@arnie94](https://community.geodynamics.org/u/arnie94)\
**Post date:** [April 22, 2025, 8:32pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/8 "2025-04-22T20:32:39Z")

</div>

![Screenshot 2025-04-22 at 1.31.14 PM](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/optimized/2X/6/6155cefdc6cfc6b30e8dd7c12cbf68b63e31624b_2_690x41.png)  
These are the files in the comp\_heat\_decay directory.

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [April 22, 2025, 8:58pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/9 "2025-04-22T20:58:16Z")

</div>

Right, but is this the directory in which you _run_ ASPECT? That is, is this the directory in which you instruct the scheduler to run the executable? Or the directory where you execute `mpirun`?  
Best  
W.

---

<div class="post-metadata">

**Author:** ![arnie94](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/arnie94/32/3019_2.png) [@arnie94](https://community.geodynamics.org/u/arnie94)\
**Post date:** [April 22, 2025, 9:27pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/10 "2025-04-22T21:27:51Z")

</div>

This is the directory where I am running aspect.

 ![sceenshot_aspect](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/6/62e303aee53b21d060b67296547c5029c269f43d.jpeg)  
This is the directory in which I compiled aspect.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/optimized/2X/7/7d9bb24639164c9741563cd5a8b67a9552ccd550_2_690x30.png)

Thanks  
Arnab

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [April 22, 2025, 9:44pm UTC](https://community.geodynamics.org/t/heating-model-plugin/4072/11 "2025-04-22T21:44:00Z")

</div>

@arnie94 Well, the directory in which you _run_ ASPECT does not have the shared library. The error message of course says that already. In your `.prm` file, you have to list the shared library with the correct path, not with `./`.  
Best  
W.
