Grain size model with density compositional fields

@bangerth Sure -

frame #3: 0x00000001009c1964 aspect-debug`aspect::MaterialModel::GrainSize<2>::initialize(this=0x000000014462dd30) at grain_size.cc:97:37
   94  	          else if (material_file_format == hefesto)
   95  	            material_lookup
   96  	            .push_back(std::make_unique<MaterialModel::MaterialUtilities::Lookup::HeFESToReader>(datadirectory+material_file_names[i],
-> 97  	                       datadirectory+derivatives_file_names[i],
   98  	                       use_bilinear_interpolation,
   99  	                       this->get_mpi_communicator()));
   100 	          else
(lldb) print i
(unsigned int) 0
(lldb) print derivatives_file_names.size()
(std::vector<std::basic_string<char> >::size_type) 0

@maxqcollins OK, good work already! Now you know that derivatives_file_names is an array with zero elements, so derivative_file_names[0] (accessing the first element of the array) is not a valid operation. I don’t know anything about the specific material model you’re using, but apparently it is expecting that derivatives_file_names is an array of the same size as material_file_names. You probably want to read through the code in this file to figure out where the derivatives_file_names array is created. My best guess is that it contains information that is read from the input file and that perhaps you are not providing this information? In any case, tracing back why it is that you have an empty array in this place is going to help you find out what the problem is!

Good job figuring out how to use the compiler!

Best

W.

@bangerth Thanks for the help. It seems I need to set derivative file names as well. The only example I can find is here - aspect/tests/steinberger_phases_hefesto.prm at 164dc4495254fe39f16c517d68473b314366e039 · geodynamics/aspect · GitHub . I’m not sure what the headers are beyond the first three which I assume are temperature, pressure, and specific heat. Just copying aspect/data/material-model/steinberger/test-steinberger-compressible/constant_material_small_hefesto_derivatives.txt at 164dc4495254fe39f16c517d68473b314366e039 · geodynamics/aspect · GitHub and adapting it to my own data (temperature, pressure, and specific heat) and keeping the other columns the same causes errors.

As an update (sorry for so many :grimacing: ) - I think there’s some formatting issues with reading in hefesto files so I switched to perplex but recieve this error:

----------------------------------------------------
Exception 'ExcMessage("This formalism is only implemented for one material " "table.")' on rank 0 on processing: 

--------------------------------------------------------
An error occurred in line <487> of file </Users/maxcollins/Documents/Research/Ice Dynamics/aspect_updated/source/material_model/grain_size.cc> in function
    std::array<std::pair<double, unsigned int>, 2> aspect::MaterialModel::GrainSize<2>::enthalpy_derivative(const typename Interface<dim>::MaterialModelInputs &) const [dim = 2]
The violated condition was: 
    material_lookup.size() == 1
Additional information: 
    This formalism is only implemented for one material table.

Stacktrace:
-----------
#0  2   aspect-debug                        0x00000001009c4d64 _ZNK6aspect13MaterialModel9GrainSizeILi2EE19enthalpy_derivativeERKNS0_19MaterialModelInputsILi2EEE + 1196: 2   aspect-debug                        0x00000001009c4d64 _ZNK6aspect13MaterialModel9GrainSizeILi2EE19enthalpy_derivativeERKNS0_19MaterialModelInputsILi2EEE 
#1  3   aspect-debug                        0x00000001009c30e0 _ZNK6aspect13MaterialModel9GrainSizeILi2EE8evaluateERKNS0_19MaterialModelInputsILi2EEERNS0_20MaterialModelOutputsILi2EEE + 3884: 3   aspect-debug                        0x00000001009c30e0 _ZNK6aspect13MaterialModel9GrainSizeILi2EE8evaluateERKNS0_19MaterialModelInputsILi2EEERNS0_20MaterialModelOutputsILi2EEE 
#2  4   aspect-debug                        0x000000010052aacc _ZNK6aspect9SimulatorILi2EE24get_artificial_viscosityIdEEvRN6dealii6VectorIT_EERKNS_14AdvectionFieldEb + 4128: 4   aspect-debug                        0x000000010052aacc _ZNK6aspect9SimulatorILi2EE24get_artificial_viscosityIdEEvRN6dealii6VectorIT_EERKNS_14AdvectionFieldEb 
#3  5   aspect-debug                        0x0000000100529298 _ZN6aspect9SimulatorILi2EE25assemble_advection_systemERKNS_14AdvectionFieldE + 560: 5   aspect-debug                        0x0000000100529298 _ZN6aspect9SimulatorILi2EE25assemble_advection_systemERKNS_14AdvectionFieldE 
#4  6   aspect-debug                        0x00000001001479a8 _ZN6aspect9SimulatorILi2EE30assemble_and_solve_temperatureERKdPd + 852: 6   aspect-debug                        0x00000001001479a8 _ZN6aspect9SimulatorILi2EE30assemble_and_solve_temperatureERKdPd 
#5  7   aspect-debug                        0x0000000100149804 _ZN6aspect9SimulatorILi2EE36solve_single_advection_single_stokesEv + 40: 7   aspect-debug                        0x0000000100149804 _ZN6aspect9SimulatorILi2EE36solve_single_advection_single_stokesEv 
#6  8   aspect-debug                        0x000000010055047c _ZN6aspect9SimulatorILi2EE14solve_timestepEv + 160: 8   aspect-debug                        0x000000010055047c _ZN6aspect9SimulatorILi2EE14solve_timestepEv 
#7  9   aspect-debug                        0x00000001005527b0 _ZN6aspect9SimulatorILi2EE3runEv + 960: 9   aspect-debug                        0x00000001005527b0 _ZN6aspect9SimulatorILi2EE3runEv 
#8  10  aspect-debug                        0x0000000100b8b0ec main + 7776: 10  aspect-debug                        0x0000000100b8b0ec main 
#9  11  dyld                                0x0000000197696b98 start + 6076: 11  dyld                                0x0000000197696b98 start 
--------------------------------------------------------

Does this mean it’s not configured to use multiple material tables?

@maxqcollins I don’t actually know anything about the HeFESTO readers. I just know that if you use it, you need to provide as many derivatives files as you provide material files. In your case, you apparently do not list any derivatives files in your input file, and that leads to the error. I posted a patch to at least make that clear with a useful error message:

As for what needs to be in these derivatives files, I have no idea. Someone else will have to help out with that. The same applies to the limitations of the Perple_X reader.

Best

W.

Hi Max,

You can choose if you want to compute the thermal expansivity and specific heat from the derivatives of the enthalpy (in that case, you need the derivatives file), or if you want to use the thermal expansivity and specific heat values directly from the table you use. If you want the latter, you need to set Use enthalpy for material properties = false and you should then be able to use more than one look-up table again.

Best,
Juliane

Hi Juliane,

Thank you, that worked!!

Cheers,

Max