|
Last change
on this file since 12878 was 12878, checked in by cborstad, 13 years ago |
|
merged trunk-jpl into trunk-jpl-damage through revision 12877
|
-
Property svn:executable
set to
*
|
|
File size:
757 bytes
|
| Line | |
|---|
| 1 | function maxtime=cfl_step(md,vx,vy);
|
|---|
| 2 | %CFL_STEP - return the maximum time step for the model in years
|
|---|
| 3 | %
|
|---|
| 4 | % Dt < 0.5 / ( u/Dx +v/Dy )
|
|---|
| 5 | %
|
|---|
| 6 | % Usage:
|
|---|
| 7 | % maxtime=cfl_step(md,vx,vy);
|
|---|
| 8 | %
|
|---|
| 9 | % Example:
|
|---|
| 10 | % dt=cfl_step(md,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy)
|
|---|
| 11 |
|
|---|
| 12 | %Check length of velocities
|
|---|
| 13 | if size(vx,1)~=md.mesh.numberofvertices & size(vy,1)~=md.mesh.numberofvertices,
|
|---|
| 14 | error('timestpes error message: size of velocity components must be the same as md.mesh.numberofvertices');
|
|---|
| 15 | end
|
|---|
| 16 |
|
|---|
| 17 | index=md.mesh.elements;
|
|---|
| 18 | edgex=max(md.mesh.x(index),[],2)-min(md.mesh.x(index),[],2);
|
|---|
| 19 | edgey=max(md.mesh.y(index),[],2)-min(md.mesh.y(index),[],2);
|
|---|
| 20 | vx=max(abs(vx(index)),[],2);
|
|---|
| 21 | vy=max(abs(vy(index)),[],2);
|
|---|
| 22 |
|
|---|
| 23 | maxtime=1/2*min(1./(vx./edgex+vy./edgey));
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.