ConstructClause

mathematical construction of scalars and vectors

Construct statements offer the possibility to automatically construct quantities based on previously read in boundary elements for GeometryManipulations like offset{, scale{, rotate{ .

The construct statements are evaluated sequentially in the startup phase together with the reading of the geometry files and this evaluation is depending on the order. A typical order can be: read in a subset of files, establish a sequence of the ConstructClause items, and apply the results of the ConstructClause items in a subsequent read-of-file.

A construct statement may look as follows:

begin_boundary_elements{} include{FileName} offset{ CONSTRUCT(%CONSTRUCT_...%, , , , ) } end_boundary_elements

Construct Environments

If the construct result is to be used at several occasions, it is worthwhile putting it into a construct environment:

begin_construct{} "xMeanInflow" = CONSTRUCT( %CONSTRUCT_...%, , , , ) end_construct

It can then be referenced by the name given on the left hand side in the same way as an ALIAS. See also Variables.

begin_boundary_elements{ and begin_construct{ blocks are read sequentially. All geometry parts used in a construct statement must be defined beforehand.

The begin_construct{ environment is only evaluated at regular startup, not if a restart is performed. Hence, for construct results that are supposed to be computed during restart, use

These are not read during normal initialization. Thus, to update values, you need to use both.

Examples

Example 1:
begin_boundary_elements{} ... include{FileNameA} # contains (at least) geometry part inflow ... end_boundary_elements begin_construct{} "xMeanInflow" = CONSTRUCT( %CONSTRUCT_BoxMidPoint%, 0.5, "inflow" ) # mid point of geometry part inflow end_construct begin_boundary_elements{} ... include{FileNameB} offset{&xMeanInflow&} # contains other geometry parts include{FileNameC} offset{&xMeanInflow(1)&, &xMeanInflow(2)&, &xMeanInflow(3)&} # contains other geometry parts ... end_boundary_elements

In addition, any RightHandSideExpression can be used to save the result of a calculation during the initialization phase into an alias, for example to create new boundary elements from scratch after reading in other geometry.

Example 2: Using construct to define aliases
begin_construct{} "Nnode" = "real(%BND_count_NP%)" end_construct begin_boundary_elements{} BND_node [&Nnode&+1] [0] [0] [0] BND_node [&Nnode&+2] [0] [0] [1] BND_node [&Nnode&+3] [0] [1] [1] BND_node [&Nnode&+4] [1] [0] [0] BND_tria &inflow& [&Nnode&+1] [&Nnode&+2] [&Nnode&+3] BND_tria &inflow& [&Nnode&+3] [&Nnode&+4] [&Nnode&+1] end_boundary_elements
Example 3: Using vectorial aliases on the RHS of construct statements
begin_alias{} "GeoGroup" = "front,back,top,bottom,in,out" #groups geometry aliases together end_alias{} begin_construct{} # Version 1: This may become tedious for large groups "xGG_Max_v1" = CONSTRUCT(%CONSTRUCT_BoxMax%, "&GeoGroup(1)&", "&GeoGroup(2)&", "&GeoGroup(3)&", "&GeoGroup(4)&", "&GeoGroup(5)&", "&GeoGroup(6)&") # Version 2: This is much shorter and does not need to be modified when changing the length of the vectorial alias "xGG_Max_v2" = CONSTRUCT(%CONSTRUCT_BoxMax%, &GeoGroup& ) # Version 3: This does NOT provide the correct result! "xGG_Max_v3" = CONSTRUCT(%CONSTRUCT_BoxMax%, "&GeoGroup&" ) end_construct
Example 4: Using vectorial aliases on the LHS of construct statements
begin_construct{} begin_loop{"i",1,1,5} "vecAlias(&i&)" = "(&i&^2)" end_loop "vecAlias(3)" = "&vecAlias(5)&" "vecAlias_min" = "(min(&vecAlias&))" # Minimum entry in vecAlias "vecAlias_max" = "(max(&vecAlias&))" # Maximum entry in vecAlias end_construct
If parenthesis are found on the left hand side of a construct statement, MESHFREE will interpret this as an indexing into a vectorial ALIAS. The right hand side result will be placed at the specified location within the comma-separated vectorial ALIAS string. In the above example a vectorial ALIAS "vecAlias" with (at least) the first five components (1,4,9,16,25) will be created and susequently the third component will be overwritten to give (1,4,25,16,25). The example also shows how certain functions can be evaluated on the list of values stored in "vecAlias". Here, we determine the minimum and maximum values, which is possible since the comma-seperated list of values in "vecAlias" is simply put into the min() or max() function as a string when the alias reference &vecAlias& is resolved. Warning : Do not mix double definitions of aliases outside of construct statements with the above indexing!

Notes

  • begin_boundary_elements{ and begin_construct{ blocks are read sequentially. All geometry parts used in a construct statement need to be defined beforehand. Values that are saved into an alias stay constant throughout the simulation, irrespective of for example geometry movements.

  • By default, CONSTRUCT-aliases are not recomputed on RESTART. If recomputation is desired, the begin_construct_atRestart{-functionality has to be used.

  • Whenever there is a construction based on an alias list, "alias1", "alias2", also wildcards can be used. For example, "alias*" would then already match "alias1", "alias2", ... .

The possible CONSTRUCT-keywords can be found below.
List of members:
%CONSTRUCT_Area% area of given alias-entities
%CONSTRUCT_BoxMax% maximum of enclosing box around given alias-entities
%CONSTRUCT_BoxMidPoint% mid point of enclosing box around given alias-entities
%CONSTRUCT_BoxMin% minimum of enclosing box around given alias-entities
%CONSTRUCT_COG% center of gravity for given alias-entities
%CONSTRUCT_EstablishCurveVolumeVersusHeight% establish a 2-row-curve that provides the height-volume-relation of a closed part of geometry
%CONSTRUCT_Normal% normal with respect to given alias-entities
%CONSTRUCT_NormalDividedByArea% area-averaged normal with respect to given alias-entities
%CONSTRUCT_PointBasedOnAbsoluteVolume% Computes a point that defines a given volume inside a closed structure
%CONSTRUCT_PointBasedOnRelativeVolume% compute a point that defines a given volume inside a closed structure
%CONSTRUCT_Tangent1% first tangent with respect to given normal vector and alias-entities
%CONSTRUCT_Tangent2% second tangent with respect to given normal vector and alias-entities
%CONSTRUCT_Volume% volume of a (necessarily) closed geometrical part
%CONSTRUCT_VolumeForGivenHeight% compute the volume of a closed body restricted by a certain height
%CONVERT_TO_INTEGER% convert a set of construct variables to integer