Example a_backup/view_stress: Viewing a stress tensor field.

fem update gauss stress;
fem export gauss;FILE yg as LABEL

Screenshot of example a_backup/view_stress


The comfile run by this example is as follows:

#cmgui script to view a stress field

gfx define tessellation default minimum_divisions "1" refinement_factors "10";

gfx create material bluey ambient 0 0.25 0.5 diffuse 0 0.4 1 specular 0.5 0.5 0.5 shininess 0.3
gfx create material gold ambient 1 0.4 0 diffuse 1 0.7 0 specular 0.5 0.5 0.5 shininess 0.8
gfx create material jade ambient 0.1 0.56 0 diffuse 0.1 0.39 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8
gfx create material blue ambient 0 0 0 diffuse 0 0.2 1 emission 0 0 0 specular 0.5 0.5 0.5 alpha 1 shininess 0.3
gfx create material green ambient 0 1 0 diffuse 0 1 0 emission 0 0 0 specular 0 0 0 alpha 1 shininess 0
gfx create material red ambient 1 0 0 diffuse 1 0 0 emission 0 0 0 specular 0 0 0 alpha 1 shininess 0

gfx create spectrum stress;

sub setupgroup {
  my $region = shift;
  my $material = shift;
  my $vis = shift;
  my $coord = shift
  #my $glyph = shift;
  gfx modify g_element $region general clear;
  gfx modify g_element $region lines coordinate $coord select_on material default selected_material default_selected;
  #gfx modify g_element $region element_points coordinate $coord glyph point general size "1*1*1" centre 0,0,0 label cmiss_number use_elements cell_centres discretization "1*1*1" native_discretization NONE select_on material default selected_material default_selected;
  gfx modify g_element $region element_points coordinate $coord glyph point general size "1*1*1" centre 0,0,0 use_elements cell_centres discretization "1*1*1" native_discretization NONE select_on material default selected_material default_selected;
  #gfx modify g_element $region cylinders coordinate $coord circle_discretization 6 constant_radius 0.3 select_on material default selected_material default_selected;
  gfx modify g_element $region node_points coordinate $coord glyph point label cmiss_number general size "1*1*1" centre 0,0,0 select_on material $material selected_material default_selected;
  #gfx modify g_element $region data_points coordinate $coord glyph sphere general size "1*1*1" centre 0,0,0 select_on material $material selected_material default_selected;
  gfx modify g_element $region surfaces coordinate $coord select_on material $material selected_material default_selected render_wireframe;

  #gfx set vis $group $vis;

}


# deformed mesh
$filename = "deformed";
$region = "deformed";
gfx read node $example/$filename.exnode;
gfx read elem $example/$filename.exelem;

setupgroup( $region , "green", "on", "deformed");

gfx read data $example/$filename.exdata;

# To view the data points, need an 'embedded' field returning the deformed field
# from the host mesh evaluated at the element_xi location read in from the data points: 
gfx define field deformed/element_xi_coordinate embedded element_xi element_xi field deformed;

# The stress tensor is a symmetric matrix of the following six components
# 1 4 5
# 4 2 6
# 5 6 3

#If the fields were named by just a number then the composite field
#would interpret these as constant numbers so we could use a scale
#field to give them a better name. cm used to name the fields using
#numbers but this has now been corrected and it prepends 'yg' to the
#field names. Leaving this here but commented out for reference.

#gfx define field deformed/V composite 1 4 5 4 2 6 5 6 3 # doesn't work

# gfx define field deformed/stress11 scale field 1 scale_factor 1.0;
# gfx define field deformed/stress22 scale field 2 scale_factor 1.0;
# gfx define field deformed/stress33 scale field 3 scale_factor 1.0;
# gfx define field deformed/stress12 scale field 4 scale_factor 1.0;
# gfx define field deformed/stress13 scale field 5 scale_factor 1.0;
# gfx define field deformed/stress23 scale field 6 scale_factor 1.0;
# gfx define field deformed/T composite stress11 stress12 stress13 stress12 stress22 stress23 stress13 stress23 stress33;

gfx define field deformed/T composite yg1 yg4 yg5 yg4 yg2 yg6 yg5 yg6 yg3 
gfx define field deformed/principal_stress eigenvalues field T
gfx define field deformed/principal_stress_vectors coordinate_system rectangular_cartesian eigenvectors eigenvalues principal_stress

gfx define field deformed/principal_stress1 composite principal_stress.1
gfx define field deformed/principal_stress2 composite principal_stress.2
gfx define field deformed/principal_stress3 composite principal_stress.3

gfx define field deformed/principal_stress_vector1 coordinate_system rectangular_cartesian composite principal_stress_vectors.1 principal_stress_vectors.2 principal_stress_vectors.3

gfx define field deformed/principal_stress_vector2 coordinate_system rectangular_cartesian composite principal_stress_vectors.4 principal_stress_vectors.5 principal_stress_vectors.6

gfx define field deformed/principal_stress_vector3 coordinate_system rectangular_cartesian composite principal_stress_vectors.7 principal_stress_vectors.8 principal_stress_vectors.9


# normalise principal stress vectors
gfx define field deformed/norm_def_principal_stress_vector1 coordinate_system rectangular_cartesian normalise field principal_stress_vector1

gfx define field deformed/norm_def_principal_stress_vector2 coordinate_system rectangular_cartesian normalise field principal_stress_vector2

gfx define field deformed/norm_def_principal_stress_vector3 coordinate_system rectangular_cartesian normalise field principal_stress_vector3

$gsize="0*0.05*0.05";
$sf="0.05*0*0";
gfx modify g_element $region data_points coordinate element_xi_coordinate glyph mirror_cone size $gsize centre 0,0,0 orientation principal_stress_vector1 variable_scale principal_stress1 scale_factors $sf select_on material bluey data principal_stress1 spectrum stress selected_material default_selected

gfx modify g_element $region data_points coordinate element_xi_coordinate glyph mirror_cone size $gsize centre 0,0,0 orientation principal_stress_vector2 variable_scale principal_stress2 scale_factors $sf select_on material bluey data principal_stress2 spectrum stress selected_material default_selected

gfx modify g_element $region data_points coordinate element_xi_coordinate glyph mirror_cone size $gsize centre 0,0,0 orientation principal_stress_vector3 variable_scale principal_stress3 scale_factors $sf select_on material bluey data principal_stress3 spectrum stress selected_material default_selected


if (! $TESTING)
  {
	 gfx create window;
	 gfx edit scene;
	 gfx modify window 1 layout width 800 height 700;
	 gfx modify g_element "/" point as axes glyph axes size "0.5*0.5*0.5" centre 0.1,0.1,0.1 material default;
	 gfx modify spectrum stress autorange;
  }




Files used by this example are:

Name             Modified     Size

view_stress.com 20-Apr-2012 6.4k COPYRIGHT 19-Apr-2012 504 deformed.exdata 20-Apr-2012 20k deformed.exelem 20-Apr-2012 11k deformed.exnode 20-Apr-2012 10k

Download the entire example:

Name                                  Modified     Size

examples_a_backup_view_stress.tar.gz 12-Aug-2014 80k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxSuccessSun Mar 6 00:06:55 20161
cmgui-wx-debugSuccessSun Mar 6 00:06:56 20161
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:06:56 20161
cmgui-wx-debug-valgrindSuccessSun Mar 6 00:32:08 201617
x86_64-linux
cmgui-wxSuccessThu Jan 7 00:01:31 20160
cmgui-wx-debugSuccessThu Jan 7 00:01:32 20161
cmgui-wx-debug-memorycheckSuccessThu Jan 7 00:01:32 20161
cmgui-wx-debug-valgrindFailureSun Mar 6 00:04:01 201615
last breakSun Mar 6 00:03:00 201615
last successWed Jun 3 00:15:00 201514
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:04:34 201614

Testing status by file:


Html last generated: Sun Mar 6 05:51:03 2016

Input last modified: Fri Apr 20 16:02:53 2012


CMISS Help / Examples / a_backup / view_stress