21.01.2015 Views

COMSOL Multiphysics™

COMSOL Multiphysics™

COMSOL Multiphysics™

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

postglobaleval<br />

Purpose<br />

postglobaleval<br />

Evaluate globally defined expressions, such as solutions to ODEs.<br />

Syntax<br />

Description<br />

data = postglobaleval(fem,...)<br />

data = postglobaleval(fem,expr,...)<br />

postglobaleval(fem,expr,...) is the evaluation function for globally defined<br />

expressions, such as ODE solution variables.<br />

The input expr contains the expressions to plot. It must be a cell array of strings. If<br />

omitted, the expressions in fem.ode.dim are evaluated.<br />

data = postglobaleval(fem,...) returns a structure with fields x, y, and legend.<br />

This structure is compatible with the import/export structure used by <strong>COMSOL</strong><br />

Reaction Engineering Lab. The values can be plotted with<br />

plot(data.x, data.y)<br />

legend(data.legend)<br />

Valid property/value pairs for postglobaleval are given in the following table.<br />

TABLE 1-26: VALID PROPERTY/VALUE PAIRS<br />

PROPERTY NAME PROPERTY VALUE DEFAULT DESCRIPTION<br />

Const cell array Definition of constants<br />

Phase scalar 0 Phase angle<br />

Solnum integer vector | all | all<br />

Solution number<br />

end<br />

T vector Times for evaluation<br />

U<br />

solution object or<br />

vector<br />

fem.sol or 0 Solution for evaluation<br />

The property Phase is described in posteval.<br />

Examples<br />

Example: Solve the Lotka-Volterra equations for two populations r and f<br />

clear fem<br />

fem.ode.dim={'r','f'};<br />

fem.ode.f={'r*(1-2*f)-rt','-f*(3-r)-ft'};<br />

fem.ode.init={'10','1'};<br />

fem.ode.dinit={'0','0'};<br />

fem.geom=solid1([0,1]);<br />

fem.mesh = meshinit(fem);<br />

fem.xmesh = meshextend(fem);<br />

fem.sol = femtime(fem,'tlist',[0,1]);<br />

% Evaluate 'r' and 'f' for all time steps<br />

data = postglobaleval(fem);<br />

338 | CHAPTER 1: COMMAND REFERENCE

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!