# The ascii data model for initial composition model setting does not function well

**URL:** <https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009>\
**Category:** ASPECT\
**Created:** [September 27, 2021, 9:36pm UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009 "2021-09-27T21:36:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShaozhuoLiu](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/shaozhuoliu/32/808_2.png) [@ShaozhuoLiu](https://community.geodynamics.org/u/ShaozhuoLiu)\
**Post date:** [September 27, 2021, 9:36pm UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/1 "2021-09-27T21:36:35Z")

</div>

Hello folks,

**I tried to run a test similar to the jellyfish case (geomIO.prm for section 5.2.12 in the manual) but for a 3D case. Indeed, geomIO.prm works well. But, my 3D case doesn’t work through.**

**The relevant settings in the prm file:**  
subsection Initial composition model  
set Model name = ascii data  
subsection Ascii data model  
set Data directory =/home/dealii/aspect/model\_input/aspect/model\_input/data/  
set Data file name = test3D\_composition.txt  
end  
end

**Here is the file test3D\_composition.txt:**  
#POINTS: 2 2 3  
#x y z phases  
0.0 0.0 0.0 0.0  
3.0 0.0 0.0 0.0  
0.0 3.0 0.0 0.0  
3.0 3.0 0.0 0.0  
0.0 0.0 2.0 1.0  
3.0 0.0 2.0 1.0  
0.0 3.0 2.0 1.0  
3.0 3.0 2.0 1.0  
0.0 0.0 4.0 2.0  
3.0 0.0 4.0 2.0  
0.0 3.0 4.0 2.0  
3.0 3.0 4.0 2.0

**The output looks like**  
#----------------------------------------------------  
Exception ‘ExcMessage("Invalid coordinate " + Utilities::int\_to\_string(column\_num) + " in row " + Utilities::int\_to\_string(row\_num) + " in file " + filename + "\nThis class expects the coordinates to be structured, meaning " "the coordinate values in each coordinate direction repeat exactly " “each time.”)’ on rank 4 on processing:

#--------------------------------------------------------  
An error occurred in line \<364\> of file \</home/dealii/aspect/source/structured\_data.cc\> in function  
void aspect::Utilities::StructuredDataLookup::load\_file(const string&, const MPI\_Comm&) [with int dim = 3; std::\_\_cxx11::string = std::\_\_cxx11::basic\_string; MPI\_Comm = int]  
The violated condition was:  
old\_value == 0. || (std::abs(old\_value-temp\_data) \< 1e-8\*std::abs(old\_value))  
Additional information:  
Invalid coordinate 2 in row 3 in file /home/dealii/aspect/model\_input/aspect/model\_input/data/C\_3D\_MohoErosion.txt  
This class expects the coordinates to be structured, meaning the coordinate values in each coordinate direction repeat exactly each time.  
#--------------------------------------------------------

Aborting!  
#----------------------------------------------------

\*\*The coordinates make sense. The system gives such hints. Weird. \*\*

**Has anybody met similar issue?**

Best,  
Shaozhuo

---

<div class="post-metadata">

**Author:** ![bobmyhill](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bobmyhill/32/38_2.png) [@bobmyhill](https://community.geodynamics.org/u/bobmyhill)\
**Post date:** [September 27, 2021, 10:01pm UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/2 "2021-09-27T22:01:52Z")

</div>

Dear Shaozhuo,

Have you tried adding a single whitespace between # and POINTS:, i.e.  
`# POINTS: 2 2 3`?

The version of ASPECT that I have installed at the moment requires the single space, but I don’t know whether that will solve your problem.

---

<div class="post-metadata">

**Author:** ![ShaozhuoLiu](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/shaozhuoliu/32/808_2.png) [@ShaozhuoLiu](https://community.geodynamics.org/u/ShaozhuoLiu)\
**Post date:** [September 28, 2021, 7:24am UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/3 "2021-09-28T07:24:53Z")

</div>

Dear Bob,

The original format used in the simulation has a single whitespace between # and POINTS. When I typeset it in this forum, I make such a mistake, missing the whitespace.

The ascii data model for setting 3D temperature variations works well. The ascii data model for 3D composition model has similar format. But, it doesn’t work. Why is it so weird?

Best,  
Shaozhuo

---

<div class="post-metadata">

**Author:** ![bobmyhill](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bobmyhill/32/38_2.png) [@bobmyhill](https://community.geodynamics.org/u/bobmyhill)\
**Post date:** [September 28, 2021, 9:31am UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/4 "2021-09-28T09:31:36Z")

</div>

I can’t recreate the issue using the current master branch. I have tried the file with and without CR as the last byte in the file.

I’ve attached the prm file I used to test your input. I changed the location and the name of the file, so you’ll need to make sure that you have files in the correct places.

Could you test this?

- If it doesn’t work, could you post the version of ASPECT that you’re using?
- If it does work, we’ll need more data to work out exactly what your problem is (i.e. a minimum non-working example prm)

[ascii\_data\_initial\_composition\_3d\_box.prm](https://community.geodynamics.org/uploads/short-url/dCVsbTXSK01odurKVGNNBICzpoS.prm) (2.2 KB)  
[box\_3d.txt](https://community.geodynamics.org/uploads/short-url/mVDR5RpXvEiszU5G10EaIY1aV9e.txt) (239 Bytes)

---

<div class="post-metadata">

**Author:** ![bobmyhill](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bobmyhill/32/38_2.png) [@bobmyhill](https://community.geodynamics.org/u/bobmyhill)\
**Post date:** [September 28, 2021, 9:42am UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/5 "2021-09-28T09:42:37Z")

</div>

> [@ShaozhuoLiu](#):
>
> Invalid coordinate 2 in row 3 in file /home/dealii/aspect/model\_input/aspect/model\_input/data/ **C\_3D\_MohoErosion.txt**

Another possibility: maybe this file is the one with the problem?

---

<div class="post-metadata">

**Author:** ![ShaozhuoLiu](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/shaozhuoliu/32/808_2.png) [@ShaozhuoLiu](https://community.geodynamics.org/u/ShaozhuoLiu)\
**Post date:** [September 28, 2021, 10:01am UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/6 "2021-09-28T10:01:45Z")

</div>

I sincerely thank you for helping me fixing this issue!  
Your prm file can be tested. Before getting your files, I used a similar ascii data file as your box\_3d.txt, but I got the same errors. Let me compare your and my prm files carefully and then I will post my issues. The issue might lie in the prm file.

I am curious about the setting in your prm file:  
subsection Compositional fields  
set Number of fields = 1  
end

Why does the number of field equate to 1?  
In my case, it should be equate to 2. That is, three materials: the background and the other two.

Best,  
Shaozhuo

---

<div class="post-metadata">

**Author:** ![bobmyhill](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/bobmyhill/32/38_2.png) [@bobmyhill](https://community.geodynamics.org/u/bobmyhill)\
**Post date:** [September 28, 2021, 10:38am UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/7 "2021-09-28T10:38:04Z")

</div>

Ah, your question is a good one, explains why you’re having problems.

In ASPECT, each compositional field is a scalar field; that is, the “composition” has a float value at every point in the domain. So in your `test3D_composition.txt`, you are currently defining a single compositional field which has a value between 0 and 2. ASPECT will interpolate between the grid points in the file and then the appropriate plug-in(s) will interpret what that value means.

ASPECT doesn’t currently allow users to specify material type by integer value in a single compositional field. This would potentially be a good thing to have (it would be less-memory intensive), but such changes would require careful treatment to ensure that mass conservation is (approximately) satisfied. Instead, ASPECT allows implementation of three-material models using **two** compositional fields which represent the proportions of the non-background materials:

```auto
# POINTS: 2 2 3
# x y z proportion_material_1 proportion_material_2
0.0 0.0 0.0 0.0 0.0
3.0 0.0 0.0 0.0 0.0
0.0 3.0 0.0 0.0 0.0
3.0 3.0 0.0 0.0 0.0
0.0 0.0 2.0 1.0 0.0
3.0 0.0 2.0 1.0 0.0
0.0 3.0 2.0 1.0 0.0
3.0 3.0 2.0 1.0 0.0
0.0 0.0 4.0 0.0 1.0
3.0 0.0 4.0 0.0 1.0
0.0 3.0 4.0 0.0 1.0
3.0 3.0 4.0 0.0 1.0

```

If you use this layout, ASPECT should run fine.

---

<div class="post-metadata">

**Author:** ![ShaozhuoLiu](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/shaozhuoliu/32/808_2.png) [@ShaozhuoLiu](https://community.geodynamics.org/u/ShaozhuoLiu)\
**Post date:** [September 28, 2021, 3:38pm UTC](https://community.geodynamics.org/t/the-ascii-data-model-for-initial-composition-model-setting-does-not-function-well/2009/8 "2021-09-28T15:38:30Z")

</div>

Yes. Your sharp eyes find the solution!!!

I set three materials in the Material model subsection, using the subsection Multicomponent option. I believed that the numbers for the last column, even though they are float number, have a one-to-one correspondence with the materials. In that case, I always got the errors as shown at the very beginning of this post.

Now, following your suggestion, everything goes well. This issue puzzled me in the last 1-2 months. I hope others, who meet similar issue, will learn from this post.

Thank you very very much!

Shaozhuo
