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 geometry files
  • establish a sequence of ConstructClause items for those geometries
  • apply the results of the ConstructClause items in a subsequent reading of other geometry files
A construct statement may look as follows:
begin_boundary_elements{} include{FileName} offset{ CONSTRUCT(%CONSTRUCT_...%, , , , ) } end_boundary_elements
The possible CONSTRUCT-keywords can be found at the very bottom in the List of members. Note: Whenever there is a construction based on an alias list "alias1", "alias2", ..., also wildcards can be used. For example, "alias*" matches "alias1", "alias2", ..., see AliasForGeometryItems.

Construct Environments

If the construct result is used in several places of the USER_common_variables, a construct environment is preferred:
begin_construct{} "xMeanInflow" = CONSTRUCT( %CONSTRUCT_...%, , , , ) end_construct
The result can be referenced by the name given on the left hand side in the same way as an ALIAS, see also Variables. Notes:

(Experimental) begin_construct_always{

Another way to read in construct statements is using the begin_construct_always{ environment. This allows to define construct variables for regular startup and restart runs in the same environment. MESHFREE internally identifies if its a restarted run and automatically overwrites the updated construct variables which might be based on the updated boundary. Warning: Using begin_construct_always{ and begin_construct{ in the same setup or, respectively, begin_construct_always{ and begin_construct_atRestart{ is not recommended. There is a workaround to support this if CONTROL_ConstructClauses > 0. If CONTROL_ConstructClauses = 0 (default), this will result in an error termination.

Examples

Example 1: Using construct to manipulate the read-in of other geometry parts
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
Example 2: 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.
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 a vectorial ALIAS on the right hand side of construct statements
begin_alias{} "GeoGroup" = "front,back,top,bottom,in,out" # group 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& ) end_construct
Warning: When using version 2, make sure to stick to the correct syntax, e.g. putting "&GeoGroup&" instead of &GeoGroup& on the right hand side will lead to an incorrect result. Example 4: Using a vectorial ALIAS on the left hand side 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!
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_TriangulationInfo% useful information about the triangulation
%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