Heating model plugin

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:

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

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?
  2. Would the radioactive decay heating model provide the functionality you need?

Cheers,
John

@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.

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 (4.3 KB)
This is the error I am getting on compiling.

Thanks
Arnab

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

              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.

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:

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:

set Additional shared libraries = ./libcompositional_heating_decay.so 

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

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 (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

@arnie94 The error message is

    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.

Screenshot 2025-04-22 at 1.31.14 PM
These are the files in the comp_heat_decay directory.

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.

This is the directory where I am running aspect.


This is the directory in which I compiled aspect.
image

Thanks
Arnab

@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.