Impossible to creare an inner core using the dynamic_core.cc (fixed by me) function. Wrong unit of measure?

Dear developers

In a future paper I absolutely need to cool my CMB using the dynamic core temperature model:

###################################################
# SUBSECTION: Boundary temperature model
###################################################
# The CMB temperature will evolve and cool 
subsection Boundary temperature model
  set Fixed temperature boundary indicators   = inner, outer
  set List of model names                    = dynamic core

  ###################################################
  # SUBSECTION: Dynamic core
  ###################################################
  subsection Dynamic core
    set Inner temperature                 = 4412  # We explore 4 different initial temperatures: 5912, 5412, 4912 and 4412 (Nakagawa and Tackley; 2010)
    set Outer temperature                 = 300   # We keep this temperature fixed at 300 K.
    set Core density                      = 12.5e3
    set Gravity acceleration              = 10.682   # Gravity value at CMB according to the PREM model (ascii file used in ASPECT).
    set CMB pressure                      = 0.14e12
    set Initial light composition         = 0.0526211   # wt for light elements (Zhang et al. 2016).
    set Max iteration                     = 30000
    set Core heat capacity                = 840
    set K0                                = 4.111e11
    set Alpha                             = 1.35e-5 # Thermal expansivity for the core
    set Core conductivity                 = 64      # Experimental data from Pozzo et al. (2022).

    subsection Geotherm parameters
      set Tm0                      = 1695
      set Tm1                      = 10.9
      set Tm2                      = -8.0
      set Theta                    = 0.11
      set Composition dependency   = true
      set Use BW11                 = false
    end

    ###################################################
    # SUBSECTION: Radioactive heat source
    ###################################################
    subsection Radioactive heat source
      #                                            K in core
      set Number of radioactive heating elements = 1
      set Heating rates                          = 2.8761e-5  # Same value used in Citron et al. 2020
      set Half life times                        = 1.25       # Unit: Gyr
      set Initial concentrations                 = 4.0e-4          # Unit: ppm - We try 0, 200, 400, 600, 800 ppm.
    end
  end
end

the aim should be that, while the CMB cool, the solidus condition for the inner core should be satisfied, but they are never…

In the test directory, values are:

  subsection Dynamic core
    set Inner temperature                 = 4100
    set Outer temperature                 = 300
    set Core density                      = 12.5e3
    set Gravity acceleration              = 9.81    # For the core
    set CMB pressure                      = 0.14e12
    set Initial light composition         = 0.042   # wt% for light elements
    set Max iteration                     = 30
    set Core heat capacity                = 840
    set K0                                = 4.111e11
    set Alpha                             = 1.35e-5 # Thermal expansivity for the core
    set Core conductivity                 = 50

    subsection Geotherm parameters
      set Tm0= 1695
      set Tm1= 10.9e-12
      set Tm2= -8.0e-24
      set Theta= 0.11
      set Composition dependency= false
    end

They are in agreement with Nimmo et al. (2004), the paper used to do this .cc

https://academic.oup.com/gji/article/156/2/363/2046212

If I use these e-12 and e-24 values, i got an inner core, but in an anomalous way: it start to grow from the beginnig, which is wrong according to the literature, and the T_CMB drop very slowly.

If you check the manual there is written that:

Parameter name: Tm0
Default value: 1695.

Pattern: [Double 0…MAX_DOUBLE (inclusive)]

Documentation: Melting curve ([Nimmo et al., 2004] eq. (40)) parameter Tm0. Units: \si{\kelvin}.

Parameter name: Tm1
Default value: 10.9

Pattern: [Double -MAX_DOUBLE…MAX_DOUBLE (inclusive)]

Documentation: Melting curve ([Nimmo et al., 2004] eq. (40)) parameter Tm1. Units: \si{\per\tera\pascal}.

Parameter name: Tm2
Default value: -8.0

Pattern: [Double -MAX_DOUBLE…MAX_DOUBLE (inclusive)]

Documentation: Melting curve ([Nimmo et al., 2004] eq. (40)) parameter Tm2. Units: \si{\per\tera\pascal\squared}.

So values should be INTEGERS as input, and not like the test. dynamic_core.cc agrees (?)

 prm.enter_subsection("Geotherm parameters");
          {
            prm.declare_entry ("Tm0","1695.",
                               Patterns::Double (0.),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Tm0. Units: \\si{\\kelvin}.");
            prm.declare_entry ("Tm1","10.9",
                               Patterns::Double (),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Tm1. "
                               "Units: \\si{\\per\\tera\\pascal}.");
            prm.declare_entry ("Tm2","-8.0",
                               Patterns::Double (),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Tm2. "
                               "Units: \\si{\\per\\tera\\pascal\\squared}.");
            prm.declare_entry ("Theta","0.11",
                               Patterns::Double (),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Theta.");
            prm.declare_entry ("Composition dependency","true",
                               Patterns::Bool (),
                               "If melting curve dependent on composition.");
            prm.declare_entry ("Use BW11","false",
                               Patterns::Bool (),
                               "If using the Fe-FeS system solidus from Buono \\& Walker (2011) instead.");
          }

but if I use integers, not only i CANNOT, NEVER get an inner core (even with a 300 K surface and T CMB temperature), the only thing that it’s been fixed is that the temperature drops fine (another simulation):

I can’t figure out where is my problem. The cooling and inner core growth should be similar to this:

https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2010GC003031

If i plot the equation of the paper, i’d get a full freezing of the core at around 3000K

I attach the updated dynamic_core.cc (which is stucked in pull request).

dynamic_core.zip (9.3 KB)

and here a minimum working example (just to check if the inner core instantaneously form or not):

# A simple setup for convection in a quarter of a 2d shell. See the
# manual for more information.


set Dimension                              = 2
set Use years in output instead of seconds = true
set End time                               = 1.5e9
set Output directory                       = output-shell_simple_2d

subsection Material model
  set Model name = simple
  set Material averaging = harmonic average only viscosity

  subsection Simple model
    set Thermal expansion coefficient = 4e-5
    set Viscosity                     = 1e22
  end
end

subsection Boundary velocity model
  set Tangential velocity boundary indicators = bottom, top
end

###################################################
# SUBSECTION: Geometry model
###################################################
# We run the simulation in a quarter of a shell with periodic boundaries.
subsection Geometry model
  set Model name = spherical shell
  subsection Spherical shell
    set Inner radius   = 3481000
    set Opening angle  = 90
    set Outer radius   = 6371000
  end
end



###################################################
# SUBSECTION: Boundary temperature model
###################################################
# The CMB temperature will evolve and cool 
subsection Boundary temperature model
  set Fixed temperature boundary indicators   = inner, outer
  set List of model names                    = dynamic core

  ###################################################
  # SUBSECTION: Dynamic core
  ###################################################
  subsection Dynamic core
    set Inner temperature                 = 2000  # We explore 4 different initial temperatures: 5912, 5412, 4912 and 4412 (Nakagawa and Tackley; 2010)
    set Outer temperature                 = 300   # We keep this temperature fixed at 300 K.
    set Core density                      = 12.5e3
    set Gravity acceleration              = 10.682   # Gravity value at CMB according to the PREM model (ascii file used in ASPECT).
    set CMB pressure                      = 0.14e12
    set Initial light composition         = 0.1 #0.01 #0.0526211   # wt for light elements (Zhang et al. 2016).
    set Max iteration                     = 30000
    set Core heat capacity                = 840
    set K0                                = 4.111e11
    set Alpha                             = 1.35e-5 # Thermal expansivity for the core
    set Core conductivity                 = 64      # Experimental data from Pozzo et al. (2022).

    subsection Geotherm parameters
      set Tm0                      = 1695
      set Tm1                      = 10.9
      set Tm2                      = -8.0
      set Theta                    = 0.11
      set Composition dependency   = true
      set Use BW11                 = false
    end

    ###################################################
    # SUBSECTION: Radioactive heat source
    ###################################################
    subsection Radioactive heat source
      #                                            K in core
      set Number of radioactive heating elements = 1
      set Heating rates                          = 2.8761e-5  # Same value used in Citron et al. 2020
      set Half life times                        = 1.25       # Unit: Gyr
      set Initial concentrations                 = 0         # Unit: ppm - We try 0, 200, 400, 600, 800 ppm.
    end
  end
end
subsection Heating model
  set List of model names =  shear heating
end

###################################################
# SUBSECTION: Initial temperature model
###################################################
# The temperature at the boundaries evolves according to the "half space cooling model" and we set an age of 5e8 years to give a temperature contrast to the simulation and initiate convection as soon as possible.
subsection Initial temperature model
  set Model name = function


  # It's given a 200 K harmonic perturbation to initiate convection.
  subsection Function
    set Coordinate system     = spherical
    set Variable names        = r, theta
    set Function constants    = r_inner=3481000, r_outer=6371000, w=2*pi, p=200.0, frequency=25
    set Function expression   = p * sin(pi * (r - r_inner) / (r_outer - r_inner)) * sin(frequency * w * theta)
  end
end

subsection Boundary temperature model
  set Fixed temperature boundary indicators = 0,1
end

subsection Gravity model
  set Model name = ascii data
end

subsection Mesh refinement
  set Initial global refinement          = 5
  set Initial adaptive refinement        = 4
  set Strategy                           = temperature
  set Time steps between mesh refinement = 15
end

subsection Postprocess
  set List of postprocessors = visualization, velocity statistics, temperature statistics, heat flux statistics, depth average, core statistics

  subsection Visualization
    set Output format                 = vtu
    set Time between graphical output = 1e6
    set Number of grouped files       = 0
  end

  subsection Depth average
    set Time between graphical output = 1e6
  end
end

subsection Solver parameters
  subsection Stokes solver parameters
    set Stokes solver type = block GMG
  end
end


So… Where is the problem? In the code? I misunderstood something? Please let me know and thank you in advance.

Hi @Francyrad,

I will anwer your questions below, but let me start with a general comment. I understand implementing a numerical model can be stressful, in particular if it is tied to a proposal or thesis and there is a lot of time pressure. However, please refrain from using ALL CAPS in your messages and demand people’s attention to solve a problem. No one in this forum is paid to answer your questions, the people reading your comments are volunteers and take a part of their time that they could have used for their own research problems to reply to your messages. Demanding an answer will only lead to others not replying to your messages.

That being said, here is how I understand your problem at the moment:

I think your pull request 6168 correctly fixes a bug in the dynamic core plugin for the case of a fully molten or fully frozen core. These cases were apparently not tested by the original author. Unfortunately the changes I made in 6177 and 6187 to improve that plugin led to some conflicts with your PR. The version of the PR you updated is still correct, but also still contains some conflicts with the main branch. I have opened a new PR 6224 in which I took your original commit and modified it so it works with the current ASPECT and also added two new tests for fully molten and fully frozen cores. The reason I waited so long to do this was that you didnt reply to my question here for how to reproduce the problem you are having. Without being able to reproduce the problem it can easily take days to even understand the problem of another scientist and spending my time this way is simply not efficient.

While creating the test cases for the new PR I also noticed that there are two more bugs for the fully frozen case (a division by zero). I fixed those too. Note, that I am not working on core models, and have not compared the implementation of these cases with the original Nimmo paper. Therefore, as is the case for most open-source software: There is no guaranty that this implementation correctly reproduces the paper. It is the responsibility of every user to make sure that the software works for the application case you are considering. I think you are aware of this, since you already tried to reproduce the figure by the paper above.

Now to your question about input parameters: This is indeed confusing and I am not sure what the correct solution is. The input parameter is documented as being in the unit of 1/TPa, and 1/TPa^2 respectively, but if I check the code (e.g. in the get_solidus function) the value is actually multiplied with pressure in GPa, so maybe it should be converted into 1/GPa? Can you give this a try, and if it is indeed incorrectly documented we should fix the documentation (and possibly wrong values).

Best,
Rene

1 Like

Thank you for your answer

I’m sorry for the miss interpretation, I used a caps lock “CANNOT NEVER” to evidence the main problem / bug, I will avoid that in the future.

Thank you for your help, I’ll test everything as soon as possible.

Francesco

Hi. I did a test and checking the code, the cc file accept values as they are (except for the 1/Gpa thing, but is the other model), so it’s not like in the decumentation where the value to insert is are small float that will be converted in 1/Tpa or 1/TPa^2, it’s just 1/Pa and 1/Pa^2. So you have to insert these values (like in the test) to make everything works. The documentation need to be changed about that.

Regarding my bug, i’m using a thermochemical Steinberger model, and i’m doing a test with an initial temperature of 4412 K for my CMB.

I don’t know if the material model changes the things a lot (it shouldn’t for what I saw in the code), but when the simulation start my simulation has an inner core of 2675 Kms

*** Timestep 14:  t=1.37816e+07 years, dt=829233 years
   Dynamic core data updated.
     Tc(K)          Ri(km)         Xi             dT/dt(K/year)  dR/dt(km/year) dX/dt(1/year)  
     4411.44        2675.89        0.0680847      -4.01857e-08   1.11584e-07    2.5028e-12     
   Solving temperature system... 8 iterations.
   Advecting particles...  done.
   Copying properties into prescribed compositional field density_field... done.
   Rebuilding Stokes preconditioner...
   Solving Stokes system (AMG)... 48+0 iterations.

While the test (and the equation plotted in python with correct values) says that at the CMB the temperature should still give a fully molten core for 4200 K and start to create it at lower temperatures. I know that the file has something to do with compressibility and material model. I checked the code and if the material is compressible, there are no changes in the function (like in the test). So I don’t get why for that temperature and an initial adiabatic surface temperature of 2000K I get very big inner core…

I’m trying to study the core and track the temperature profile for it and check how it intersects with the solidus temperature

Thank you a lot for your help

Edit: I digged deeply in the code and I plotted both the solidus curve and the adiabatic curve of the Core. I got my unwanted result because is just the correct calculation for that solution, so now it’s just my scientific problem, so thank you for all the help.


Also, the Buono and Walker solution is not bugged, is just for small planets like mercury, which the EOS is been investigated up to 10 GPa. Can you please add the following label?:

Documentation: If using the Fe-FeS system solidus from Buono & Walker (2011) instead (useful only for small planet with a maximum pressure of 10 Gpa in the core, like Mercury)

Dear @Francyrad,

Glad to hear you’ve figured out the problems.

  • Could you very briefly bullet-point the bugs you think you’ve found in the code (what you think the code does and what you think it should do)?

  • The information in your suggested documentation change is already in the title and the abstract of Buono and Walker’s paper (The Fe-rich liquidus in the Fe–FeS system from 1 bar to 10 GPa). All users should aim to understand (at least at a basic level) the papers underlying the ASPECT implementation before attempting to run their simulations, so the doc change wouldn’t add much.

  • Nevertheless, if you wanted to raise a Pull Request with wording like:

    If using the Fe-FeS system solidus from Buono & Walker (2011) instead (suitable for planets with maximum pressures up to 10 GPa).

    we would almost certainly accept it.

Best wishes,
Bob

The code works fine, i’ll have to play with the function in python (that replicate the ASPECT outcome) to solve my scientific problem, but the code works perfectly.

What is not correct is what there is written in the documentation (and also in dynamic_core.cc)

The documentation says:

Parameter name: Tm1
Default value: 10.9

Pattern: [Double -MAX_DOUBLE…MAX_DOUBLE (inclusive)]

Documentation: Melting curve ([Nimmo et al., 2004] eq. (40)) parameter Tm1. Units: \si{\per\tera\pascal}.

Parameter name: Tm2
Default value: -8.0

Pattern: [Double -MAX_DOUBLE…MAX_DOUBLE (inclusive)]

Documentation: Melting curve ([Nimmo et al., 2004] eq. (40)) parameter Tm2. Units: \si{\per\tera\pascal\squared}.


That is not true, the unit is not 1/TeraPascal or 1/TeraPascal^2. is just 1/Pa or 1/Pa^2.

So the values to insert are not 10.9 and -8 that will be converted to 10.9e-12 and 8e-24 by dynamic_core.cc like the documentation suggest, but are directly 10.9e-12 and 8e-24, because the code doesn’t apply any conversion, so:

    subsection Geotherm parameters
      set Tm0                      = 1695
      set Tm1                      = 10.9e-12
      set Tm2                      = -8.0e-24
      set Theta                    = 0.11
      set Composition dependency   = true
      set Use BW11                 = false
    end

Also, in dynamic_core.cc there’s written:

prm.declare_entry ("Tm1","10.9",
                               Patterns::Double (),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Tm1. "
                               "Units: \\si{\\per\\tera\\pascal}.");
            prm.declare_entry ("Tm2","-8.0",
                               Patterns::Double (),
                               "Melting curve (\\cite{NPB+04} eq. (40)) parameter Tm2. "
                               "Units: \\si{\\per\\tera\\pascal\\squared}.");

Same as before. I don’t know if changing these lines makes changing in the documentation, but these declarations doesn’t affect the conversion.

Brilliant, thank you for the detailed response. I’ve raised an issue here: Incorrect units in dynamic core documentation · Issue #6227 · geodynamics/aspect · GitHub

Thanks,
Bob

you are welcome, I’ll give you updates if I discover some other things that doesn’t make sense

Here I’m again. I did a small mistake in my script and i’m trying to plot correctly the temperature profile of the core to see if there are further problems. According to the Code, the temeperatura in the center is calculated according to this formula:

Where Tc is the mantle core boundary temperature and Rc the radius of the Core, so at the center you have a temperature of:

The part of the code that do the calculation is:

template <int dim>
double
DynamicCore<dim>::get_T(const double Tc, const double r) const
{
  return Tc * std::exp((Utilities::fixed_power<2>(Rc) - Utilities::fixed_power<2>(r)) /
                         Utilities::fixed_power<2>(D));
}

But it’s not clear where this D is defined, at least i cannot see it in the code. Is it calculated elsewhere? How can I calculate it?

It is defined here: aspect/source/boundary_temperature/dynamic_core.cc at f1f024547a64002127561ccd0e9240eb1c0a1fab · geodynamics/aspect · GitHub

Best wishes,
Bob