Dear Experts,
I hope this email finds you well.
I am currently using the Ubuntu 23.1 system and have recently downloaded the ASPECT 2.6-pre version code for numerical simulation of continental rifting. The versions of other software I am using are deal.II 9.5.2, Trilinos 13.2.0, and p4est 2.3.2.
I am trying to output a background field to visualize it in Paraview software. I added an asthenosphere field in the output function and assigned it the value of volume_fractions[0] (as noted in the commented code in the first image). Although the compilation of ASPECT is successful, I encounter an error during the iteration (as shown in the second image). It seems that the array I created is not initialized properly. If convenient, could you check my visco_plastic_grain.cc file and advise me on how to modify the assignment process for this array to allow smooth iteration and output of the background field?
I would like to mention that I have provided the modified plugin polygon_temp_comp_topo.zip, which is based on the work of Anne Glerum, Derek Neuharth and other experts. I have changed the plugin’s name, added middle crust compositions, and modified the temperature field calculation method.
Best regards,
Chenghui Zeng
20240823.prm (31.8 KB)
polygon_temp_comp_topo.zip (6.3 MB)
visco_plastic_melt.zip (6.2 MB)
@zengchenghui The screen message you show starts with the text “End of error message” Would you mind showing us what the error actually is (a bit higher up on the screen)?
As a general rule, this isn’t going to be the last time you encounter an error of this sort. The way to figure out what is going on in these situations is to run your program in a debugger and to look around at what values local variables have. What happens if you do that?
Best
Wolfgang
Dear Wolfgang
I hope this email finds you well.
In my tests, when I fill the asthenosphere
array in the fill_plastic_outputs
function using the lines plastic_out->asthenosphere[i] = 0;
and plastic_out->asthenosphere[i] = volume_fractions[0];
, it leads to an error. If I comment out these lines, the model can iterate normally.
The key issue seems to be with the initialization of the asthenosphere
array that I added, but I am unsure how to modify it. I’ve attached the relevant code related to the asthenosphere
array (Figures 1, 2, and 3), along with the log.txt
file that details the error messages. Unfortunately, the log.txt
does not clearly indicate the cause of the error.
As for debugging, I am currently not familiar with using a debugger, as I am a beginner in C++ and numerical simulations. Are there any tutorials or resources you could recommend?
log.txt (77.9 KB)
Best regards,
Chenghui Zeng
@zengchenghui The error message says that you had a “segmentation fault”. That means that at some point you are accessing a memory location you are not allowed to access – perhaps, for example, you are writing past the end of an array.
As I mentioned, this is a situation you will encounter many times in your career, and the solution to it is to learn how to use a debugger. In your case, I assume that the problem also appears when you run with just a single MPI process? That is much easier to debug. For resources, you might be interested in lectures 18 and 25 here: Wolfgang Bangerth's video lectures But there are also many other resources on the internet if you search for things such as “How to use a debugger” or “How to use gdb”.
Separately, whenever you encounter a problem, you should always run ASPECT in DEBUG mode (you are running it in RELEASE/OPTIMIZED mode). What happens if you execute your program in DEBUG mode?
Best
W.
@zengchenghui
I try not to question coding choices too much on these boards, but this time I will make an exception…
If you want to visualise the amount of the background field, why not use Paraview’s ability to do arithmetics on fields? If you load the data in paraview, select it in the LHS window, and then click on the Calculator symbol, an interface opens up that allows you to apply standard math to the scalar and vector fields in the pvd file. In the image below, I’ve calculated the solid_fraction (background field) from the melt_fraction:
Best wishes,
Bob
If I use DEBUG mode, the errors are still same. Thanks again for your answer, I will learn how to debug the code and find a solution.
Best regards,
Chenghui Zeng
Thank you for providing me with a very good way to achieve my purpose. But I still prefer to make changes in the code, because I still need to output various other parameters later. Thanks again for your advice.
Best regards,
Chenghui Zeng
Dear Chenghui,
Good luck in finding the source of the bug, and the fix.
I still prefer to make changes in the code, because I still need to output various other parameters later.
Of course you are very welcome to do this, and we’ll support you where reasonable. My comment was primarily to save you some time so that you could dedicate it to implementing new functionality.
Best wishes,
Bob