Contents  
Functions  
Index
 
 PDF |
def=fe_time(model)
def=fe_time(TimeOpt,model)
[def,model,opt]=fe_time(TimeOpt,model)
model=fe_time('TimeOpt...',model)
TimeOpt=fe_time('TimeOpt...')
Description
and
, and
non linear problems are supported.
[model,Case]=fe_time('demo bar'); % build the model
% set the time options in model.Stack
model=fe_time('TimeOpt Newmark .25 .5 0 1e-4 100',model);
def=fe_time(model); % compute the response
fe_time can also be called with TimeOpt as the first argument. This is often more convenient when the user modifies options fields by hand
def=fe_time(TimeOpt,model);The TimeOpt data structure has fields
| Method | selection of the solver |
| Opt | if any, for example for Newmark [beta alpha t0 deltaT Nstep Nf] |
| OutInd | DOF output indices (see 2D example). This selection is based on the state DOFs which can be found using fe_case(model,'GettDof'). |
| MaxIter | maximum number of iterations |
| nf | optional value of the forst residual norm |
| IterInit,IterEnd | see the non linear solvers. |
| Jacobian | string to be evaluated to generate a factored jacobian matrix in matrix or ofact object ki. The default jacobian matrix is 'ki=ofact(model.K{3}+2/dt*model.K{2} +4/(dt*dt)*model.K{1});' for the dynamic case and 'ki=ofact(model.K{3});' for the static case. |
| JacobianUpdate | (only for newton) : default is 0, 0 if modified Newton (no update in Newton iterations), 1 if update in Newton iteration |
| Residual | The default residual is method dependent. |
| InitAcceleration | optional field to be evaluated to initialize the acceleration field. |
| OutputFcn | string to be evaluated for post-processing or time vector containing the output time steps |
c_u, c_v, c_a |
optional observation matrices for displacement, velocity and acceleration outputs. |
| lab_u, lab_v, lab_a | optional cell array containing labels describing each ouput (lines of observation matrices) |
| NeedUVA | [NeedU NeedV NeedA], if NeedU is equal to 1, output displacement, etc. |
| OutputInit | optional string to be evaluated to initialize the output (before the time loop) |
| SaveTimes | optional time vector, saves time steps on disk |
| TimeVector | optional value of computed time steps, if exists TimeVector is used instead of time parameters |
| RelTol | threshold for convergence tests. The default is the OpenFEM preference getpref('OpenFEM','THRESHOLD',1e-6); |
model=fe_time('demo bar');
TimeOpt=fe_time('TimeOpt Newmark .25 .5 0 1e-4 100');
TimeOpt.NeedUVA=[1 1 0];
% first computation to determine initital conditions
def=fe_time(TimeOpt,model);
% no input force
model=fe_case(model,'remove','Point load 1');
% Setting initial conditions
q0=struct('def',[def.def(:,end) def.v(:,end)],'DOF',def.DOF);
model=stack_set(model,'info','q0',q0);
def=fe_time(TimeOpt,model);
An alternative call is possible using input arguments
def=fe_time(TimeOpt,model,Case,q0)In this case, it is the input argument q0 which is used instead of a eventual stack entry.
TimeOpt=struct('Method','Newmark','Opt',[.25 .5 ],...
'TimeVector',linspace(0,100e-4,101));
This is usefull if you want to use non constant time steps. There is no current implementation for self adaptive time steps.
model=fe_time('demo 2d');
TimeOpt=fe_time('TimeOpt Newmark .25 .5 0 1e-4 50 10');
You may specify specific output by selecting DOF indices as below
i1=fe_case(model,'GettDof'); i2=feutil('findnode y==0',model)+.02;
TimeOpt.OutInd=fe_c(i1,i2,'ind');
model=stack_set(model,'info','TimeOpt',TimeOpt);
def=fe_time(model);
You may select specific output time step using TimeOpt.OutputFcn as a vector
TimeOpt.OutputFcn=[11e-4 12e-4]; model=stack_set(model,'info','TimeOpt',TimeOpt); def=fe_time(model);or as a string to evaluate. The ouput is the out local variable in the fe_timefunction and the current step is j1+1. In this example the default output function (for TimeOpt.NeedUVA=[1 1 1]) is used but specified for illustration
TimeOpt.OutputFcn=['out.def(:,j1+1)=u;' ...
'out.v(:,j1+1)=v;out.a(:,j1+1)=a;'];
model=stack_set(model,'info','TimeOpt',TimeOpt);
def=fe_time(model);
This example illustrates how to display the result (see feplot) and make a movie
cf=feplot(model,def);
fecom('colordataa');
cf.ua.clim=[0 2e-6];fecom(';view2;animtime;ch20;scd1e-2;');
st=fullfile(getpref('SDT','tempdir'),'test.avi');
fecom(['animavi ' st]);
end
Note that you must choose the Anim:Time option in the feplotGUI.
model=fe_time('demo bar'); Case=fe_case('gett',model);
i1=feutil('findnode x>30',model);
TimeOpt=fe_time('TimeOpt Newmark .25 .5 0 1e-4 100');
TimeOpt.c_u=fe_c(Case.DOF,i1+.01); % observation matrix
TimeOpt.lab_u=fe_c(Case.DOF,i1+.01,'dofs'); % labels
def=fe_time(TimeOpt,model);
If you want to specialize the output time and function you can specify the SaveTimesas a time vector indicating at which time the SaveFcn string will be evaluated.
A typical TimeOpt would contain
TimeOpt.SaveTimes=[0:Ts:TotalTime];
TimeOpt.SaveFcn='My_function(''Output'',u,v,a,opt,out,j1,t);';
TimeOpt=struct('Method','Newmark','Opt',Opt)
where TimeOpt.Opt is defined by
[beta gamma t0 deltaT Nstep Nf]beta and gamma are the standard Newmark parameters [34], t0 the initial time, deltaT the fixed time step, Nstep the number of steps and Nf the optional number of time step of the input force.
model=fe_time('demo bar');
data=struct('DOF',2.01,'def',1e6,...
'curve',fe_curve('test ricker 10e-4 100 1 100e-4'));
model = fe_case(model,'DOFLoad','Point load 1',data);
TimeOpt=struct('Method','Newmark','Opt',[.25 .5 3e-4 1e-4 100],'NeedUVA',[1 1 0]);
def=fe_time(TimeOpt,model);
% plotting velocity (propagation of the signal)
def_v=def;def_v.def=def_v.v; def_v.DOF=def.DOF+.01;
feplot(model,def_v);
if sp_util('issdt'); fecom(';view2;animtime;ch30;scd3'); ...
else; fecom(';view2;scaledef3'); end
model=fe_time('demo bar');
TimeOpt=fe_time('TimeOpt DG Inf Inf 0. 1e-4 100');
TimeOpt.NeedUVA=[1 1 0];
def=fe_time(TimeOpt,model);
def_v=def;def_v.def=def_v.v; def_v.DOF=def.DOF+.01;
feplot(model,def_v);
if sp_util('issdt'); fecom(';view2;animtime;ch30;scd3'); ...
else; fecom(';view2;scaledef3'); end
| Jacobian | string to be evaluated to generate a factored
jacobian matrix in matrix or ofact object ki. The default
jacobian matrix is 'ki=ofact(model.K{3}+2/dt*model.K{2} +4/(dt*dt)*model.K{1});' |
| Residual | Defines the residual used for the Newton iterations of each type step. It is typically a call to an external function. The default residual is 'r = model.K{1}*a+model.K{2}*v+model.K{3}*u-fc;' where fc is the current external load, obtained using (ft(j1,:)*fc')' at each time step. |
| IterInit | evaluated when entering the Newton solver. This can be used to initialize tolerances, change mode in a co-simulation scheme, etc. |
| IterEnd | evaluated when exiting the Newton solver. This can be used to save specific data, ... |
| Jacobian | string to be evaluated to generate a factored
jacobian matrix in matrix or ofact object ki. The default
jacobian matrix is 'ki=ofact(model.K{3};' |
| Residual | Defines the residual used for the Newton iterations of each type step. It is typically a call to an external function. The default residual is 'r = model.K{3}*u-fc;' |
| IterInit | evaluated when entering the Newton solver. This can be used to initialize tolerances, change mode in a co-simulation scheme, etc. |
| IterEnd | evaluated when exiting the Newton solver. This can be used to save specific data, ... |
-HHT scheme, TimeOpt has the form
TimeOpt=struct('Method','hht','Opt',Opt)
where TimeOpt.Opt is defined by
[beta gamma t0 deltaT Nstep Nf]beta and gamma are the standard Newmark parameters [34], t0 the initial time, deltaT the fixed time step, Nstep the number of steps and Nf the optional number of time step of the input force.
model=fe_time('demo bar');
TimeOpt=struct('Method','hht','Opt',[.25 .5 3e-4 1e-4 100]);
TimeOpt.NeedUVA=[1 1 0];
def=fe_time(TimeOpt,model);
| lininterp | linear interpolation |
| storelaststep | pre-allocated saving of a time step |
| newmarkinterp | Newmark interpolation (low level call) |
out=of_time('lininterp',[0 0 1;1 1 2;2 2 4],linspace(0,2,10)',[0 0 0])
The storelaststep command makes a deep copy of the
displacement, celerity and acceleration fields (stored in each column
of the variable uva in the preallocated
variables u, v and a following the syntax:| OutInd | Output indice, must be given |
| cur | [Step dt], must be given |
| def | must be preallocated |