# Units for mass, length and time

**URL:** <https://pyfr.discourse.group/t/units-for-mass-length-and-time/100>\
**Category:** General\
**Created:** [1 February 2016 11:52 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100 "2016-02-01T11:52:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Garlick](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Paul\_Garlick](https://pyfr.discourse.group/u/Paul_Garlick)\
**Post date:** [1 February 2016 11:52 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/1 "2016-02-01T11:52:09Z")

</div>

Hi Developers,

A current feature of PyFR is that it can operate in any consistent system of units. Would it be possible to add the ability to use a specific system of units; SI, for example?

At present, any scale factors used to non-dimensionalize a given PyFR case must be recorded separately. The .ini file has no means of recording and communicating the factors used. To give an example of the kind of question that can arise, one might be interested to know the viscosity of the gas used in a previous case. To ascertain the answer, it is necessary to have both the figure specified in the .ini file and a list of the scale factors.

The cylinder flow case in the paper ‘Heterogeneous computing on mixed unstructured grids with PyFR’ provides a good example of a snag with separate records; the .ini file is included in the supplementary material but the list of scale factors is not.

Best regards,

Paul Garlick

---

<div class="post-metadata">

**Author:** ![p.vincent](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/p.vincent/32/225_2.png) [@p.vincent](https://pyfr.discourse.group/u/p.vincent)\
**Post date:** [1 February 2016 13:27 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/2 "2016-02-01T13:27:04Z")

</div>

Hi Paul,

Thanks for your interest in PyFR.

> A current feature of PyFR is that it can operate in any consistent system of units.

Yes.

> Would it be possible to add the ability to use a specific system of units; SI, for example?

I believe that this capability is a subset of the above? If you enter everything consistently in SI you should be fine.

> At present, any scale factors used to non-dimensionalize a given PyFR case must be recorded separately. The .ini file has no means of recording and communicating the factors used. To give an example of the kind of question that can arise, one might be interested to know the viscosity of the gas used in a previous case. To ascertain the answer, it is necessary to have both the figure specified in the .ini file and a list of the scale factors.

Not sure I fully follow here? If you non-dimensionalise a given setup, then indeed you would need to remember what you did if you wanted to back out dimensional values again. But these values are not required to specify the simulation - you just need to get Mach/Reynolds number correct?

> The cylinder flow case in the paper ‘Heterogeneous computing on mixed unstructured grids with PyFR’ provides a good example of a snag with separate records; the .ini file is included in the supplementary material but the list of scale factors is not.

I believe that the .ini file fully specifies the simulation (Mach and Reynolds number). There are no other scale factors required?

Apologies if I have misunderstood something.

Cheers

Peter

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [1 February 2016 13:35 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/3 "2016-02-01T13:35:52Z")

</div>

Hi Paul,

Although the scale factors are indeed required to reverse the  
non-dimensionalisation they are not needed if one wishes to make a  
comparison with experimental data. All that matters is that the  
numerical simulation have dynamic similitude with the experimental data.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Paul\_Garlick](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Paul\_Garlick](https://pyfr.discourse.group/u/Paul_Garlick)\
**Post date:** [1 February 2016 16:29 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/4 "2016-02-01T16:29:44Z")

</div>

Hi Peter, Hi Freddie,

Yes, this is correct; any consistent system of units is valid. However, the scale factors are significant if one has questions such as: ‘how big is the cylinder?’

To give a concrete example, the value for viscosity in the .ini file for the cylinder case is 6.07e-05. However, the units are not Pas, since the length scale has been non-dimensionalized by the diameter of the cylinder (d=1 in the .msh file). I guess mass and time have also been scaled since pressure and density are both equal to one.

Best regards,

Paul.

---

<div class="post-metadata">

**Author:** ![Paul\_Garlick](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Paul\_Garlick](https://pyfr.discourse.group/u/Paul_Garlick)\
**Post date:** [2 February 2016 12:15 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/5 "2016-02-02T12:15:03Z")

</div>

Hi,

On the subject of the structure of the .ini file, a related question is; is it possible to include variables in the [constants] section that are not used in the simulation?

I think in the cylinder case, the variable M (Mach number) is in this category–the velocity is used directly. Perhaps this mechanism could be used for storing the scale factors, should the user wish. They would not be used in the simulation itself but would serve as a record for any conversion to or from non-dimensional units that might be needed subsequently.

Best regards,

Paul.

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [2 February 2016 12:16 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/6 "2016-02-02T12:16:55Z")

</div>

Hi Paul,

> On the subject of the structure of the .ini file, a related question is;  
> is it possible to include variables in the [constants] section that are  
> not used in the simulation?
> 
> I think in the cylinder case, the variable M (Mach number) is in this  
> category--the velocity is used directly. Perhaps this mechanism could  
> be used for storing the scale factors, should the user wish. They would  
> not be used in the simulation itself but would serve as a record for any  
> conversion to or from non-dimensional units that might be needed  
> subsequently.

You can indeed use the constants section to define additional variables.  
Or, if you prefer, you can create your own section

[my-section]  
foo = "some text"  
bar = "some other text"

to record anything you wish.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Paul\_Garlick](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Paul\_Garlick](https://pyfr.discourse.group/u/Paul_Garlick)\
**Post date:** [2 February 2016 12:41 UTC](https://pyfr.discourse.group/t/units-for-mass-length-and-time/100/7 "2016-02-02T12:41:16Z")

</div>

Hi Freddie,

That’s a very useful feature. It covers the units question, for sure. A new section could contain something along the lines of:

[input-scaling]  
scaleFactor\_length = “…”  
scalefactor\_mass = “…”  
scalefactor\_time = “…”

Then a reader could make calculations such as:

length(in original unit) = PYFR\_length\*scaleFactor\_length.

Regards,

Paul.
