카테고리 없음2017. 5. 31. 10:43

http://www.ozeninc.com/apdl-arrays-tables-quickreference/



ARRAYS


array-cheatsheet_fig1



Arrays are a good way to hold vector or matrix data. As shown above, you can define arrays with the *DIM command. This defines the overall dimensions of the array (you can actually have up to 5 dimensions using special forms of the *DIM command, refer to the documentation for more). You can fill arrays yourself as below but I typically have ANSYS fill in arrays for me for postprocessing purposes, using commands like *VGET (to fill arrays prior to writing a file with *VWRITE) and VGET (sends time/frequency history curves from POST26 to arrays).

Below are examples of a vector and a matrix complete definition in APDL:

*dim,ntemp,array,3
ntemp(1) = -5.2, 25, 86.5
*dim,compstrs,array,4,2
compstrs(1,1) = 814, 1057, 1033, 786
compstrs(1,2) = -386, -704, -713, -348

TABLES

Did you know you can apply a curve or contour instead of a constant in many places in ANSYS? These can vary based on position, time, temperature and more. Tables are how this is accomplished. Tables are like arrays but with labels on the rows and columns that are not just the row/column number.

array-cheatsheet_fig2

As you can see, you can get some nice interpolation functionality very quickly. Just like arrays you can do this in up to 5 dimensions! Many times you will use a *DO loop to define arrays in terms of an expression as well.

The row/col/plane_var fields are for labeling your axis. If you intend to send a varying load or property later, this is where you tell it what it varies by. Check the *DIM command documentation for a list of what you can vary it by. For load or property commands like D and RMODIF, the documentation will need to say that you can pass a table and you do so by passing the table name enclosed in %’s as below. If you are using spatially varying loads, you probably will want to specify a custom coordinate system using the coord_sys_id field.

*dim,tab1d,table,5,,,time
tab1d(1) = 0,3,3.5,3.75,3.875
tab1d(1,0) = 0,0.25,0.5,0.75,1

! Apply time varying x displacement
d,component1,ux,%tab1d%
*dim,tab2d,table,5,3,,y,x,,13
tab2d(1,1) = 0,0.125,0.25,0.375,0.5
tab2d(1,2) = 0.05,0.175,0.3,0.425,0.55
tab2d(1,3) = 0.1,0.225,0.35,0.475,0.6
*taxis,tab2d(1,1),1,0,0.25,0.5,0.75,1
*taxis,tab2d(1,1),2,0,0.5,1

!Apply spatially varying temperature
!Aligned with coordinate system 13
d,component2,temp,%tab2d%

If you are like me, you may be slightly perturbed by the lack of units in the above plots. This is intentional. These commands are unitless, just like APDL. It is highly recommended that you set Analysis Settings -> Analysis Data Management -> Solver Units from Active System to the correct unit system for your APDL. Doing this will make sure that your unit system is consistent and will prevent several types of errors.

The list of available variables for tables is below:

PRIMARY VARIABLELABEL FOR VAR1, VAR2, VAR3
TimeTIME
FrequencyFREQ
X-coordinate locationX
Y-coordinate locationY
Z-coordinate locationZ
TemperatureTEMP
VelocityVELOCITY
PressurePRESSURE
Geometric gap/penetrationGAP
Cyclic sector numberSECTOR
Amplitude of the rotational velocity vectorOMEGS
EccentricityECCENT
Phase shiftTHETA


Posted by 오늘보다 나은 내일
카테고리 없음2017. 4. 12. 08:19

let us establish a relation among the elastic constants E,G and u. Consider a cube of material of side ‘a' subjected to the action of the shear and complementary shear stresses as shown in the figure and producing the strained shape as shown in the figure below.

Assuming that the strains are small and the angle A C B may be taken as 45deg



Posted by 오늘보다 나은 내일
카테고리 없음2017. 2. 23. 10:39

Function is not defined for 'matlab.ui.Figure' inputs.   OTL....


Graphics Functions Return Objects, not Numeric Handles

I mentioned this briefly in Part 2 of this series. Graphics functions now return objects, not numeric handles. The R2014b documentation has detailed information about this subject in the section called Graphics Handles Are Now Objects, Not Doubles. I will give a couple of simple examples to illustrate what can happen with code written before R2014b.

Prior to R2014b, you could store a set of handles to graphics objects in an array and then add some numeric data to that array. In R2014b, that will cause an error.

x = -pi:0.1:pi ;
y1 = sin(x);
y2 = cos(x);
myLines = plot(x,y1,x,y2)    % plot returns an array of two Line objects

If you then try to set myLines(3) = 1.2, you get the following error.

  Cannot convert double value 1.2 to a handle

MATLAB won't let you add numeric values to an array of graphics objects. A similar problem occurs if you try to use an object handle in a function where MATLAB expects a numeric value. A simple example of this happens with the sprintf function.

a = sprintf('You clicked on figure %d\n', gcf);

The %d specification in the sprintf format string expects an integer value. However, since gcf is a figure object, you get the following error.

  Error using sprintf
  Function is not defined for 'matlab.ui.Figure' inputs.

Here is one final example. Because graphics handles used to be numbers, you could use them in logical expressions.

if (get(0, 'CurrentFigure'))
  disp(['Figure ' get(gcf, 'Name')'])    % display the figure name for gcf
else
  disp('No open figures')                % there is no open figure
end

This worked in earlier versions of MATLAB because get(0,'CurrentFigure') would return either an empty array or a numeric figure handle. Both of these values are valid in the logical test of the if statement above. In R2014b, this will cause an error.

  Conversion to logical from matlab.ui.Figure is not possible.

We have tried to maintain compatibility with previous releases in some cases. For example, you can still use 0 to refer to the graphics root in functions like get and set. As a best practice, however, we now recommend using the groot function to get the graphics root. Similarly, we still support the use of literal integer values to refer to figures in functions like setget, and figure. Again, the best practice is to use a variable which contains the object when using these functions.

If you find yourself really stuck, it is possible to cast object handles to numeric handles using the double function. You can then cast the number back to an object handle using the handle function. We don't recommend this as a long term solution. Be aware that we may choose to remove this feature in a future version of MATLAB. If we do, we'll let you know in advance.



Posted by 오늘보다 나은 내일