# Use of r,theta,phi in function for Initial composition model

**URL:** <https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316>\
**Category:** ASPECT\
**Created:** [June 30, 2020, 12:41pm UTC](https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316 "2020-06-30T12:41:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedrict](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/cedrict/32/344_2.png) [@cedrict](https://community.geodynamics.org/u/cedrict)\
**Post date:** [June 30, 2020, 12:41pm UTC](https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316/1 "2020-06-30T12:41:42Z")

</div>

Hi all,  
I am trying to build a 3D spherical model. In the subsection Initial composition model, I have then set Variable names = r,theta,phi, and then set Function expression = if (r\<=R2-mydepth && r\>=R2-mydepth-250e3 , 1,0).  
It runs fine, but when I look at the vtu file, it is clear that r is actually interpreted as x (see screenshot). Am I doing something wrong?

 ![Screenshot from 2020-06-30 14-30-45](https://canada1.discourse-cdn.com/flex036/uploads/geodynamics/original/1X/a764d2d742b2c1e15bf410be3c136a9dbb261aec.png)

---

<div class="post-metadata">

**Author:** ![LudovicJnnt](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/ludovicjnnt/32/56_2.png) [@LudovicJnnt](https://community.geodynamics.org/u/LudovicJnnt)\
**Post date:** [June 30, 2020, 12:49pm UTC](https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316/2 "2020-06-30T12:49:13Z")

</div>

Hi Cedric, don’t you have something like  
`set coordinate system = spherical`  
to also specify ? at least in the minimum mesh refinement strategy, it is there.

---

<div class="post-metadata">

**Author:** ![anne-glerum](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/anne-glerum/32/283_2.png) [@anne-glerum](https://community.geodynamics.org/u/anne-glerum)\
**Post date:** [June 30, 2020, 1:05pm UTC](https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316/3 "2020-06-30T13:05:12Z")

</div>

Try setting ‘Coordinate system’ to ‘spherical’, default is ‘cartesian’ 🙂

---

<div class="post-metadata">

**Author:** ![cedrict](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/cedrict/32/344_2.png) [@cedrict](https://community.geodynamics.org/u/cedrict)\
**Post date:** [June 30, 2020, 1:32pm UTC](https://community.geodynamics.org/t/use-of-r-theta-phi-in-function-for-initial-composition-model/1316/4 "2020-06-30T13:32:20Z")

</div>

Thanks guys! 🙂
