# Problem about initial temperature model

**URL:** <https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139>\
**Category:** ASPECT\
**Created:** [October 7, 2023, 12:47pm UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139 "2023-10-07T12:47:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HangWu](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@HangWu](https://community.geodynamics.org/u/HangWu)\
**Post date:** [October 7, 2023, 12:47pm UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/1 "2023-10-07T12:47:57Z")

</div>

Hi there,  
I am a beginner of ASPECT.  
Now,i want to test a simple model with initial topography .  
I want to set a initial temperature that increasing with depth.  
But I found that the result seems wrong ：  
1、 Initial temperature changes only at the bottom of the model, not throughout the model

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/7/76934e2c571ef7bc22eef72f37addee7e518fd7e.png)  
2、 I’m not sure if P represents pressure, and if so, why does it have a positive value. Normally, at surface pressure is zero.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/8/8bc707b6e8bae5bce7946292c1338976d21cbedd.png)  
[gravity-box.prm](https://community.geodynamics.org/uploads/short-url/i3S8vU4GY4hwrWODkV4xFZAaTed.prm) (6.2 KB)  
[simple-geometry.txt](https://community.geodynamics.org/uploads/short-url/alci043bfUalI3D0eKYPvDZimIr.txt) (211 Bytes)  
[temperature.txt](https://community.geodynamics.org/uploads/short-url/AaYLGydVc1yqP3QqKCe4r5AG0uW.txt) (1.9 KB)

I look forward to your reply.  
Best regards,  
HangWu

---

<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:** [October 7, 2023, 2:28pm UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/2 "2023-10-07T14:28:25Z")

</div>

Hi Hang,

Welcome! Thank you for posting the question to the forum and all of the files needed to examine the issue. A few answers below.

First, I imagine you have already seen the tests that use the same the method for the initial temperature (ascii profile):  
[temperature profile](https://github.com/geodynamics/aspect/blob/main/data/initial-temperature/ascii-profile/tests/simple_test.txt)  
[initial temperature profile test prm file](https://github.com/geodynamics/aspect/blob/main/tests/initial_temperature_profile.prm)

> 1、 Initial temperature changes only at the bottom of the model, not throughout the model

To start, what you have implemented looks correct for the initial temperature.

```auto
subsection Initial temperature model
  set Model name = ascii profile

  subsection Ascii data model
     set Data directory = /home/aspect/aspect/build/test-gravity/
     set Data file name = temperature.txt
     set Scale factor = 1
  end
end

```

Likewise, the depth values in temperature.txt are consistent with your model geometry.

Request - can you also post the log.txt from your simulation to ensure that the correct temperature.txt is in fact being read? I can’t imagine it is not (an error should be thrown), but it would be good to check.

What appears to be happening is that the bottom and top temperatures are set from the boundary temperature model section, but the initial temperature values are not read in correctly.

Can you try the following:

1. Remove the initial topography from the simulation (flat upper boundary)? That may produce an issue, as the reference point for the starting depth is not constant in this model. However, I would have expected a different issue to arise.

2. See what happens when the boundary temperatures are set by the initial conditions via?:

> subsection Boundary temperature model  
> set Fixed temperature boundary indicators = bottom, top  
> set List of model names = initial temperature  
> end

> I’m not sure if P represents pressure, and if so, why does it have a positive value. Normally, at surface pressure is zero.

Yes, `p` represents pressure. I think what you must be seeing is entirely some sort of dynamic effect (what does flow field look like?), as you have a normal value of gravity (9.8), but the material properties are those that would normally be used for a nondimensional simulation:

> subsection Gravity model  
> set Model name = vertical
> 
> subsection Vertical  
> set Magnitude = 9.8  
> end  
> end
> 
> subsection Material model  
> set Model name = simple
> 
> subsection Simple model  
> set Reference density = 1  
> set Reference specific heat = 1  
> set Reference temperature = 0  
> set Thermal conductivity = 1  
> set Thermal expansion coefficient = 1  
> set Viscosity = 1  
> end  
> end

To summarize, I think there may be a combination of factors producing the odd results.

A suggestion - I would try starting from this example, and piece by piece change the model design (initial temperature, geometry, etc) towards your desired model design. After changing each parameter, rerun the model to make sure it is behaving in the expected manner:

> <https://github.com/geodynamics/aspect/blob/main/tests/ascii_data_initial_temperature_2d_box.prm>

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![HangWu](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@HangWu](https://community.geodynamics.org/u/HangWu)\
**Post date:** [October 8, 2023, 4:47am UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/3 "2023-10-08T04:47:07Z")

</div>

Hi,John  
Based on your suggestion, I ran some tests.  
1、remove the initial topography and retain original boundary temperature conditions

 ![屏幕截图 2023-10-08 123037](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/f/f9b4063526d106317474cc5b7c9bfb702390286a.png)  
2、set boundary temperature by the initial condition and retain the initial topography  
 ![屏幕截图 2023-10-08 122334](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/6/6a2ab24643eae7d1df2b4016db9c160791713620.png)

So， I think there may be a problem reading the initial temperature file .  
log file as follows ( original model )：  
[log.txt](https://community.geodynamics.org/uploads/short-url/oox6AaMZnRfIccAmKwYxwlLkZxW.txt) (2.9 MB)

---

<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:** [October 9, 2023, 8:22pm UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/4 "2023-10-09T20:22:44Z")

</div>

Hi Hang,

Sorry for the delayed reply and I think I’ve sorted out the issues with the parameter file, which are as follows.

The `Initial temperature model` portion of the prm file you posted contained the following:

```auto
subsection Initial temperature model
  set Model name = ascii profile

  subsection Ascii data model
     set Data directory = /home/aspect/aspect/build/test-gravity/
     set Data file name = temperature.txt
     set Scale factor = 1
  end
end

```

The issue here is that what you provided beneath `set Model name = ascii profile` is `subsection Ascii data model` rather than `subsection Ascii profile`

As a result, the code used the default file for the Ascii profile (see relevant code [here](https://github.com/geodynamics/aspect/blob/main/source/initial_temperature/ascii_profile.cc#L62)).

This is actually the same file I linked to earlier along with the associated test prm file:

- [temperature profile](https://github.com/geodynamics/aspect/blob/main/data/initial-temperature/ascii-profile/tests/simple_test.txt)
- [initial temperature profile test prm file](https://github.com/geodynamics/aspect/blob/main/tests/initial_temperature_profile.prm).

Given the scale difference between this setup and your setup, the initial temperature was effectively uniform everywhere in your model, except at the boundaries where you had specified different values.

After switching to using `subsection Ascii profile`, an additional error appeared when reading the file due to periods being located after `e+02.` and `e+03.` The model ran successfully after removing those periods, and the min/max temperature were correct. On the latter point, I also switched to the following parameters for the boundary temperature to make sure the reported boundary temperature was consistent with the imposed initial temperatures.

```auto
subsection Boundary temperature model
  set Fixed temperature boundary indicators = bottom, top
  set List of model names = initial temperature
end

```

Can you try implementing these changes on your end, and report back if it resolves the issue?

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![HangWu](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@HangWu](https://community.geodynamics.org/u/HangWu)\
**Post date:** [October 10, 2023, 11:00am UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/5 "2023-10-10T11:00:57Z")

</div>

Hi，John  
Thanks for your answer!  
I succeeded in setting the initial temperature through your suggestion ！  
But now，I have a new question:  
I found that there was some error in dividing different compositions with the initial topography, and when I removed the initial topography, the error disappeared ：  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/5/55e51a44e81623ce3979c907aa6442a95b07620a.png)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/b/b68a87e4022ccd381e9edb60fbb8a58ecfd213f6.png)

You can see that at depths of 20km and 40km, there are some prominent changes(the yellow line).  
Is this a bug? The strange variation affects density, pressure, and thus local viscosity.

Best regards  
HangWu  
[gravity-box.prm](https://community.geodynamics.org/uploads/short-url/pknYKL69DEVy6jhZusbB05zPlkH.prm) (4.4 KB)  
[log.txt](https://community.geodynamics.org/uploads/short-url/eOAHGDpjSl9tk2QbkJ1jD160e6y.txt) (59.5 KB)  
[simple-geometry.txt](https://community.geodynamics.org/uploads/short-url/h55yu54pKnXGeXYYW9dlfwqJLoP.txt) (232 Bytes)  
[temperature.txt](https://community.geodynamics.org/uploads/short-url/mNJMbYEUR9bP0kys5VAfbsCLDWm.txt) (2.2 KB)

---

<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:** [October 10, 2023, 9:50pm UTC](https://community.geodynamics.org/t/problem-about-initial-temperature-model/3139/6 "2023-10-10T21:50:49Z")

</div>

Glad to hear that the initial temperature setup is now working as intended.

> [@HangWu](#):
>
> I found that there was some error in dividing different compositions with the initial topography, and when I removed the initial topography, the error disappeared ：

This is due to the added initial topography, and the fact that you are defining the compositional field layering in terms of depth (i.e., `h-y`). If you define the compositional field layering in terms of just model height, it should resolve the issue (potential fix to try below):

```auto
set Function expression = if ( h<=60.e3, 1, 0); \
                          if (h>60.e3 && h<=80.e3, 1, 0); \
                          if (h>80.e3, 1, 0);

```
