# Loading problem of initial composition txt

**URL:** <https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591>\
**Category:** ASPECT\
**Created:** [August 7, 2024, 3:31am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591 "2024-08-07T03:31:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xie](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/xie/32/707_2.png) [@Xie](https://community.geodynamics.org/u/Xie)\
**Post date:** [August 7, 2024, 3:31am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/1 "2024-08-07T03:31:19Z")

</div>

Hi all,

I am trying to load an initial composition txt file in a 3D chunk geometry. The file is formated as suggested in Parameter Documentation/Initial composition model/ascii data.  
However, every time I ran the test, there was no further progress except to print out the message ‘Loading Ascii data initial file /xx/xx/xx.txt’ on the screen, as if the program were stuck there.  
I’ve also tested some more complex initial composition files obtained from open-source sources, and they were loaded smoothly. So far, I can only suspect that there is something wrong with my file, but I can not figure out what is wrong.  
When creating the composition file, I only had crustal data consisting of (lon,lat,depth). Therefore, I respectively divided the geometry between the surface and the crust and between the crust and the lithosphere into multiple layers to make up the composition txt. For the .prm file, I just modified the ascii\_data\_initial\_composition\_3d\_chunk.prm located in $ASPECT\_DIR/tests.  
I attach the necessary files and hope it helps.

[initial\_compositions.txt](https://community.geodynamics.org/uploads/short-url/pcidsYvdPIwVLlbS49MMrORhC8Z.txt) (8.3 KB)  
[initial\_composition\_3D\_chunk\_test.prm](https://community.geodynamics.org/uploads/short-url/kv1r3hs3CjycAW9avSohzRIsyAb.prm) (2.0 KB)

Best,  
JC

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [August 7, 2024, 3:50am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/2 "2024-08-07T03:50:02Z")

</div>

@Xie What happens if you make the file _simpler_ – say only having two lines?  
Best  
W.

---

<div class="post-metadata">

**Author:** ![Xie](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/xie/32/707_2.png) [@Xie](https://community.geodynamics.org/u/Xie)\
**Post date:** [August 7, 2024, 4:03am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/3 "2024-08-07T04:03:42Z")

</div>

Hi Wolfgang,

Thanks for your quick reply. Unfortunately, a simpler file makes no difference.

 ![Screenshot 2024-08-07 at 12.02.49 PM](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/3/3a9fdbbf3033677cd7bcc8b91eeb76063ade8a4e.jpeg)

Best,  
JC

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [August 8, 2024, 3:16am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/4 "2024-08-08T03:16:18Z")

</div>

@Xie I don’t have the time right now to actually look whether that seems correct, but running your input files, I get the following error:

```auto
--------------------------------------------------------
An error occurred in line <513> of file </home/bangerth/p/deal.II/1/projects/aspect/source/structured_data.cc> in function
    void aspect::Utilities::StructuredDataLookup<dim>::load_ascii(const string&, MPI_Comm) [with int dim = 3; std::string = std::__cxx11::basic_string<char>; MPI_Comm = ompi_communicator_t*]
The violated condition was: 
    old_value == 0. || (std::abs(old_value-temp_data) < 1e-8*std::abs(old_value))
Additional information: 
    Invalid coordinate in column 1 in row 4 in file
    ./initial_compositions.txt
    This class expects the coordinates to be structured, meaning the
    coordinate values in each coordinate direction repeat exactly each
    time. This also means each row in the data file has to have the same
    number of columns as the first row containing data.

```

Does this help?  
Best  
W.

---

<div class="post-metadata">

**Author:** ![Xie](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/xie/32/707_2.png) [@Xie](https://community.geodynamics.org/u/Xie)\
**Post date:** [August 8, 2024, 2:25pm UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/5 "2024-08-08T14:25:28Z")

</div>

@bangerth I am afraid not. Still very confused. ☹

Best,  
JC

---

<div class="post-metadata">

**Author:** ![bangerth](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bangerth/32/52_2.png) [@bangerth](https://community.geodynamics.org/u/bangerth)\
**Post date:** [August 8, 2024, 9:28pm UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/6 "2024-08-08T21:28:12Z")

</div>

@Xie I wished I could help further, but not being able to reproduce the error I don’t know what to suggest. Anyone else?

Best  
W.

---

<div class="post-metadata">

**Author:** ![Xie](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/xie/32/707_2.png) [@Xie](https://community.geodynamics.org/u/Xie)\
**Post date:** [August 10, 2024, 5:55am UTC](https://community.geodynamics.org/t/loading-problem-of-initial-composition-txt/3591/7 "2024-08-10T05:55:02Z")

</div>

@bangerth Aftering reviewing other authors’ ascii files and the error information you posted above, I guess the problem lies in that the coordinate values in each coordinate direction should be the same for each set. More specifically, for my initial\_compositions.txt, in the r direction, every four values consist of one repetable coordinate set, for example, the first set is [2270000, 2343641, 2416922, 2440000], and the second one is [2270000,2343037.5,2416075.0,2440000.0], and so on. They are apprently not the same, which may lead to the error or the loading problem. However, if I correct the coordinate sets, it is hard to say if the corresponding composition field is the one I want, as I expect a composition field with changable crust, and the only thing I can provide is the crustal thickness data.   
  
Although I still did not bypass the above error, I found an alternative way is to use '' **ascii data layered**". It only requires the coordinates of the interface between different fields. As a test, I ran a simplified simulation in 2D, and it worked.

 ![Crust](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/8/888344a6bd3196f103d84e96897f70da86a15199.png)  
 ![Lith](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/2X/3/3de623ff752b9980e153e6d67e5224bcff292767.png)
