Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Problem of using femtime() in COMSOL 3.5a

Please login with a confirmed email address before reporting spam

Hello all,

I use femtime() in matlab to solve a dynamic FE problem as follow:

fem.sol = femtime(fem,'Tlist',tspan);
where tspan is an equally distributed time list. tspan = [t0,t1,t2,...tn].

Now, I am trying to break this long time list into a for-loop

for ii = 1:length(tspan)
u0 = fem.sol.u(:,end);
u_dot0 = fem.sol.u(:,end);
fem_temp = fem;
fem_temp.sol = femsol({u0 u_do0},'tlist',tspan(ii-1));
fem_temp = femtime(fem_temp,'init',u0,[tspan(ii-1) tspan(ii)]);
fem.sol = femsol({[fem.sol.u fem_temp.sol.u(:,end)] [fem.sol.ut fem_temp.sol.ut(:,end)},'tlist',[fem.time.tlist tspan(ii)]);
end

However, the for-loop is not equivalent to the original command, because I get totally different results for the same input.

Is it the correct to add initial conditions like this? How to add initial velocity to femtime()?

Thanks

Dan

0 Replies Last Post Dec 5, 2013, 3:15 p.m. EST
COMSOL Moderator

Hello Zhangxian Deng

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.