[13971] | 1 | import numpy
|
---|
| 2 | import sys
|
---|
| 3 | from model import *
|
---|
| 4 | from triangle import *
|
---|
| 5 | from setmask import *
|
---|
| 6 | from parameterize import *
|
---|
| 7 | from setflowequation import *
|
---|
| 8 | from EnumDefinitions import *
|
---|
| 9 | from solve import *
|
---|
| 10 | from MatlabFuncs import *
|
---|
| 11 |
|
---|
| 12 | md=triangle(model(),'../Exp/Square.exp',150000.)
|
---|
| 13 | md=setmask(md,'../Exp/SquareShelf.exp','')
|
---|
| 14 | md=parameterize(md,'../Par/SquareSheetShelf.py')
|
---|
| 15 | md.extrude(5,1.)
|
---|
[16137] | 16 | md=setflowequation(md,'HO','all')
|
---|
| 17 | md.stressbalance.spcvx[numpy.nonzero(md.mesh.y>0.)]=float('NaN')
|
---|
[13971] | 18 | md.initialization.vx[:]=0.
|
---|
| 19 | md.initialization.vy[:]=0.
|
---|
| 20 | md.initialization.vel=numpy.zeros_like(md.initialization.vx)
|
---|
| 21 |
|
---|
| 22 | md.cluster=generic('name',oshostname(),'np',3)
|
---|
[16137] | 23 | md=solve(md,StressbalanceSolutionEnum())
|
---|
| 24 | vel0=md.results.StressbalanceSolution.Vel
|
---|
[13971] | 25 |
|
---|
| 26 | theta=30.*numpy.pi/180.
|
---|
| 27 | x=md.mesh.x
|
---|
| 28 | y=md.mesh.y
|
---|
| 29 | md.mesh.x=numpy.cos(theta)*x-numpy.sin(theta)*y
|
---|
| 30 | md.mesh.y=numpy.sin(theta)*x+numpy.cos(theta)*y
|
---|
| 31 |
|
---|
[16137] | 32 | md.stressbalance.referential[:,0:3]=numpy.tile([numpy.cos(theta),numpy.sin(theta),0],(md.mesh.numberofvertices,1))
|
---|
| 33 | md.stressbalance.referential[:,3: ]=numpy.tile([0,0,1],(md.mesh.numberofvertices,1))
|
---|
| 34 | md=solve(md,StressbalanceSolutionEnum())
|
---|
| 35 | vel1=md.results.StressbalanceSolution.Vel
|
---|
[13971] | 36 |
|
---|
| 37 | #plotmodel(md,'data',vel0,'data',vel1,'data',vel1-vel0,'title','Cartesian CS','title','Rotated CS','title','difference','view#all',2)
|
---|
| 38 | print "Error between Cartesian and rotated CS: %g" % (numpy.max(numpy.abs(vel0-vel1))/(numpy.max(numpy.abs(vel0))+sys.float_info.epsilon))
|
---|
| 39 |
|
---|
| 40 | #Fields and tolerances to track changes
|
---|
| 41 | field_names =['vel1']
|
---|
| 42 | field_tolerances=[1e-9]
|
---|
| 43 | field_values=[\
|
---|
| 44 | vel1, \
|
---|
| 45 | ];
|
---|