﻿ Sample Problems > Usage > CAD_Import > helix_OBJimport

helix_OBJimport   { HELIX_OBJIMPORT.PDE

This sample demonstrates the import of a bounding mesh in OBJ file format.

It uses the MATERIALS and BOUNDARY CONDITIONS sections to tie names stated

in the OBJ file to FlexPDE properties.

The OBJ file contains :

one object named 'helix' that will be bound to a material property set.

two groups named 'top', and 'bottom' that will be bound to BC sets.

}

title 'Import OBJ Helix'

coordinates cartesian3

select order=2

variables U V W

definitions

E           { Young's Modulus }

nu = 0.3   { Poisson's Ratio }

{ define the constitutive relations }

G = E/((1+nu)*(1-2*nu))

C11 = G*(1-nu)

C12 = G*nu

C13 = G*nu

C22 = G*(1-nu)

C23 = G*nu

C33 = G*(1-nu)

C44 = G*(1-2*nu)/2

{ Strains }

ex = dx(U)

ey = dy(V)

ez = dz(W)

gxy = dy(U) + dx(V)

gyz = dz(V) + dy(W)

gzx = dx(W) + dz(U)

{ Stresses }

Sx  =  C11*ex + C12*ey + C13*ez

Sy  =  C12*ex + C22*ey + C23*ez

Sz  =  C13*ex + C23*ey + C33*ez

Txy =  C44*gxy

Tyz =  C44*gyz

Tzx =  C44*gzx

{ find mean translation and rotation }

Vol = Integral(1)

Tx = integral(U)/Vol                   { X-motion }

Ty = integral(V)/Vol                   { Y-motion }

Tz = integral(W)/Vol                   { Z-motion }

Rz = 0.5*integral(dx(V) - dy(U))/Vol   { Z-rotation }

Rx = 0.5*integral(dy(W) - dz(V))/Vol   { X-rotation }

Ry = 0.5*integral(dz(U) - dx(W))/Vol   { Y-rotation }

{ displacements with translation and rotation removed }

{ This is necessary only if all boundaries are free }

Up = U - Tx + Rz*y - Ry*z

Vp = V - Ty + Rx*z - Rz*x

Wp = W - Tz + Ry*x - Rx*y

{ scaling factors for displacement plots }

Mx = 0.1*globalmax(magnitude(y,z))/globalmax(magnitude(Vp,Wp))

My = 0.1*globalmax(magnitude(x,z))/globalmax(magnitude(Up,Wp))

Mz = 0.1*globalmax(magnitude(x,y))/globalmax(magnitude(Up,Vp))

Mt = 0.2*globalmax(magnitude(x,y,z))/globalmax(magnitude(Up,Vp,Wp))

equations

U:  dx(Sx) + dy(Txy) + dz(Tzx) = 0   { the U-displacement equation }

V:  dx(Txy) + dy(Sy) + dz(Tyz) = 0   { the V-displacement equation }

W:  dx(Tzx) + dy(Tyz) + dz(Sz) = 0   { the W-displacement equation }

materials 'helix' : E  = 2.0e11 { Young's Modulus for Steel (N/M^2) }

boundary conditions

'top'    : natural(w) = -1e-3

'bottom' : natural(w) = 1e-3

boundaries import OBJ 'helix.obj'

plots

contour(Up) on y=0 as "X-displacement"

contour(Vp) on x=0 as "Y-displacement"

contour(Wp) on y=0 as "Z-displacement"

grid(x+Mt*Up,y+Mt*Vp,z+Mt*Wp) as "Shape"

grid(x+My*Up,z+My*Wp) on y=0 as "XZ Shape"

grid(y+Mx*Vp,z+Mx*Wp) on x=0 as "YZ Shape"

contour(Sx) on y=0 as "X-stress"

contour(Sy) on y=0 as "Y-stress"

contour(Sz) on y=0 as "Z-stress"

contour(Txy) on y=0 as "XY Shear stress"

contour(Tyz) on y=0 as "YZ Shear stress"

contour(Tzx) on y=0 as "ZX Shear stress"

end