GiD - The personal pre and post processor

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A unit of measurement is a definite magnitude of a physical quantity, defined and adopted by convention or by law, that is used as a standard for measurement of the same physical quantity. Any other value of the physical quantity can be expressed as a simple multiple of the unit of measurement. For example, length is a physical quantity, and metre is a unit of length that represents a definite predetermined length.
The node <units> in the *.spd file can be used to change some defaults or to add specialized units, which in principle are not supported. The structure and contents of this subtree <units> requires to have the format as further detailed in this document. The following attributes are available:

  • p - Priority of the unit, it is regarded as more important than others units. The possible values for 'p' are 1, 2 and 3, as follows,

1 - It gives maximum priority, and therefore a unit with p="1" is the default unit in the GUI.
2 - A unit with p="2" is always shown in the combobox of below to facilitate the selection of the most used units.
3 - It gives lowest priority, and therefore a unit with p="3" could only be chosen when clicking on 'More units...' option in the combobox of below, which enables the user to choose the unit from a table.

Example of combobox items

Table to select the unit to insert

  • factor - The conversion factor used to multiply a quantity when converting from one system of units to another. It is the mathematical tool for converting between units of measurement [1 unit=factor*unit(SI)]. Example: 1mm=10e-3 m.
  • help - To make easier to the user to identify the unit.


Example of <units> field: Species concentration and reference variable are not supported and therefore, both magnitudes are defined in the *.spd file, as follows,
<units>
<unit_magnitude n="Reference_variable_unit" pn="Reference variable unit" default="U" SI_base="U" active="1">
<unit n="U" pn="ReferenceUnit" p="2" factor="1.0"/>
<unit n="ppm" pn="parts-per-million" p="2" factor="1.0e-6" help="parts-per-million"/>
<unit n="ppb" pn="parts-per-billion" p="2" factor="1.0e-9" help="parts-per-billion"/>
<unit n="%" pn="per-one-hundred" p="2" factor="0.01" help="per-one-hundred"/>
<unit n="%0" pn="per-one-thousand" p="2" factor="0.001" help="per-one-thousand"/>
<unit n="Np" pn="Nepper" p="2" factor="1.0" help="Nepper"/>
</unit_magnitude>
<unit_magnitude n="Species_concentration" pn="Species concentration" default="C" SI_base="C" active="1">
<unit n="C" pn="ReferenceUnit" p="2" factor="1"/>
<unit n="ppm" pn="parts-per-million" p="2" factor="1.0e-6" help="parts-per-million"/>
<unit n="ppb" pn="parts-per-billion" p="2" factor="1.0e-9" help="parts-per-billion"/>
<unit n="%" pn="per-one-hundred" p="2" factor="0.01" help="per-one-hundred"/>
<unit n="%0" pn="per-one-thousand" p="2" factor="0.001" help="per-one-thousand"/>
<unit n="mol" pn="mole" p="2" factor="1.0"/>
</unit_magnitude>
</units>
Unit system definition
The field used to choose the unit system is special. It has the attribute units_system_definition="1", it does not contain any "v" attribute, and it contains a unique dependency related to the units fields.
The field used to choose the mesh unit is also special. It has the attribute unit_mesh_definition="1", and it does not contain any "v" attribute or dependencies.
The fields used to choose the default units in the GUI are also special. They contain the attribute called unit_definition="magnitude" being magnitude the name 'n' to be used in that field. It is important to note that these kind of fields does not contain dependencies.
Here's an example of node type "container" in the .spd file, which allows to choose the geometry units and the general units, as follows,
<container n="units" pn="Units" icon="units-16" help="Units definition">
<value n="units_mesh" pn="Geometry units" unit_mesh_definition="1" icon="units-16"/>
<value n="units_system" pn="Unit system" units_system_definition="1" icon="units-16" state="hidden">
<dependencies node="//*[@unit_definition or @unit_mesh_definition='1']" att1="change_units_system" v1="{@v}"/>
</value>
<container n="basic_units" pn="General units" icon="units-16" state="normal">
<value n="units_length" pn="Length" unit_definition="L"/>
<value n="units_mass" pn="Mass" unit_definition="M"/>
<value n="units_force" pn="Force" unit_definition="F"/>
<value n="units_pressure" pn="Pressure" unit_definition="P"/>
<value n="units_temperature" pn="Temperature" unit_definition="Temp"/>
<value n="units_time" pn="Time" unit_definition="T"/>
</container>
</container>

Example of window to specify the selection of units

International and Imperial systems
There are two primary systems used to define units: the international and imperial systems, as seen below. The international system of units is the modern standardized form of the metric system. It sets standard measurements and conversions, and is the most commonly and universally accepted system of units. The imperial system, also known as British Imperial, is the system of units first defined in the British Weights and Measures Act of 1824, which was later refined and reduced.

Unit system

n

Int. system (SI)

SI

Imperial system

imperial


The fields of type <unit> can contain the attribute called units_system, as follows,

  • units_system - There are two systems used to define units, the possible values are:

SI - International system
imperial - Imperial system
Defining magnitudes and units
The attributes involved in any field of the .spd file are 'unit_magnitude' and 'units'.

  • unit_magnitude: Its value relates to the name 'n' used to reference the unit field. Please see the table below for a complete list of all the names available.
  • units: Its value is the default unit shown in the GUI, which could be changed, if desired.

Some functions are useful for writing data with units defined into the calculation file. For more information about this issue, see the section called Writing the input file for calculation.
Example:
<value n="ini_temp" pn="Initial temperature" v="20.0" unit_magnitude="Temp" units="°C"/>
Note: For instance, it is convenient to change magnitudes like unit_magnitude="F/L^2" by unit_magnitude="P".
The table below gives a summary of the names used for all units available.

pn

n

Unit by default

Length

L

m

Mass

M

kg

Time

T

s

Temperature

Temp

K

Frequency

Frequency

Hz

Force

F

N

Pressure

P

Pa

Energy

Energy

J

Power

Power

W

Angle

Angle

rad

Solid_angle

Solid_angle

sr

Velocity

Velocity

m/s

Acceleration

Acceleration

m/s^2

Area

Area

m^2

Volume

Volume

m^3

Density

Density

kg/m^3

Electric current

Electric_current

A

Amount of substance

Amount_of_substance

mol

Luminous intensity

Luminous_intensity

cd

Electric charge

Electric_charge

C

Electric potential

Electric_potential

V

Capacitance

Capacitance

F

Electric resistance

Electric_resistance

?

Electric conductance

Electric_conductance

S

Magnetic flux

Magnetic_flux

Wb

Magnetic flux density

Magnetic_flux_density

T

Inductance

Inductance

H

Delta phi

DeltaPhi

Δφ

Delta temperature

DeltaTemp

ΔK

Luminous flux

Luminous_flux

lm

Illuminance

Illuminance

lx

KinematicViscosity

KinematicViscosity

m^2/s

Viscosity

Viscosity

Pa*s

Permeability

Permeability

m^2


The magnitudes available to be used with the problem type in XML format are also listed below.
To change the priority 'p' for a given unit, it is necessary to add a field of type 'unit_magnitude' in the node <units/> of the .spd file, together with the values of the priorities, for each 'unit ' considered. Here is shown an example of <units/> node in the .spd file, where kN and MPa will be the units by default for the force and pressure respectively:
<units>
<unit_magnitude n="F" pn="Force" default="N" SI_base="N" active="kN">
<unit n="kN" pn="kilonewton" p="1" units_system="SI"/>
</unit_magnitude>
<unit_magnitude n="P" pn="Pressure" default="Pa" SI_base="Pa" active="MPa">
<unit n="MPa" pn="megapascal" p="1" units_system="SI"/>
</unit_magnitude>
</units>

The default magnitudes and conversion factors could be seen at the file scripts\customLib\customLib\units.xml

  • No labels