source: issm/trunk/src/mex/TimeAdapt/TimeAdapt.cpp@ 6130

Last change on this file since 6130 was 6130, checked in by Eric.Larour, 14 years ago

New time stepping, using CFL criterion. Just set time_adapt=1, and set cfl_coefficient (usually 1/2),
and off we go computing new time steps at every iteration.

File size: 1.5 KB
RevLine 
[6130]1/*\file TimeAdapt.c
2*\brief: update time steps to respect CFL condition
3*/
4
5#include "./TimeAdapt.h"
6
7void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
8
9/*input datasets: */
10Elements* elements = NULL;
11Nodes *nodes = NULL;
12Vertices *vertices = NULL;
13Loads *loads = NULL;
14Materials *materials = NULL;
15Parameters *parameters = NULL;
16
17/*output*/
18double dt;
19
20/*Boot module: */
21MODULEBOOT();
22
23/*checks on arguments on the matlab side: */
24CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TimeAdaptUsage);
25
26/*Input datasets: */
27FetchData((DataSet**)&elements,ELEMENTSIN);
28FetchData((DataSet**)&nodes,NODESIN);
29FetchData((DataSet**)&vertices,VERTICESIN);
30FetchData((DataSet**)&loads,LOADSIN);
31FetchData((DataSet**)&materials,MATERIALSIN);
32FetchParams(&parameters,PARAMETERSIN);
33
34/*configure: */
35elements-> Configure(elements,loads, nodes,vertices, materials,parameters);
36nodes-> Configure(elements,loads, nodes,vertices, materials,parameters);
37loads-> Configure(elements, loads, nodes,vertices, materials,parameters);
38
39/*call "x" code layer*/
40TimeAdaptx(&dt,elements,nodes,vertices,loads, materials,parameters);
41
42/*write output datasets: */
43WriteData(DT,dt);
44
45/*Free ressources: */
46delete elements;
47delete nodes;
48delete vertices;
49delete loads;
50delete materials;
51delete parameters;
52
53/*end module: */
54MODULEEND();
55}
56
57void TimeAdaptUsage(void)
58{
59 _printf_("\n");
60 _printf_(" usage: dt = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
61 _printf_("\n");
62}
Note: See TracBrowser for help on using the repository browser.