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.

Using deformation results as initial conditions for the next study

Please login with a confirmed email address before reporting spam

Hi all,

I have a linear elastic model with a stationary study whereby I apply a boundary load and deform the model domain - this is simple and works fine.

Next, I would like to use the deformed results from the first solution as the initial condition for a second solution where I re-apply the same boundary load. I hope to be able to see that the deformation builds up with each successive solution/load (I plan to repeat this 10 times eventually).

**However, I would like to know how to take the deformed results from the first solution and set them as the initial condition for the next solution?** and **Is it possible to alter the geometry as part of this, as the boundary with the boundary load is bound to deform too?**

Any help would be greatly appreciated!

Cheers, James.

"Using deformation results as initial conditions for the next study"

5 Replies Last Post 28.06.2016, 08:37 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28.08.2012, 06:02 GMT-4
Hi,


You can try an extract of my code below. It will work. The important commands to remember are:

mphgetu - which essentially extracts all degrees of freedom after you run a model.
setU - which helps you set up your own solution vector which can be used in the next step

The next important step is to tell comsol to use the solution vector in the initmethod.

Uinc is incremental displacement and Utotal is total displacement.

Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know.


Suresh




%Code extract:
% Set the new solution vector back into comsol, reset only the last time
% % step value
for i = 1:nstep

Uinc(i,:)=mphgetu(model);
if(i==1)
Utotal(i,:) = Uinc(i,:);
else
Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:);
end
model.sol('sol1').setU(Utotal(i,:));
model.sol('sol1').createSolution;
model.sol('sol1').feature('v1').set('initmethod', 'sol');
model.sol('sol1').feature('v1').set('initsol', 'sol1');

en
Hi, You can try an extract of my code below. It will work. The important commands to remember are: mphgetu - which essentially extracts all degrees of freedom after you run a model. setU - which helps you set up your own solution vector which can be used in the next step The next important step is to tell comsol to use the solution vector in the initmethod. Uinc is incremental displacement and Utotal is total displacement. Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know. Suresh %Code extract: % Set the new solution vector back into comsol, reset only the last time % % step value for i = 1:nstep Uinc(i,:)=mphgetu(model); if(i==1) Utotal(i,:) = Uinc(i,:); else Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:); end model.sol('sol1').setU(Utotal(i,:)); model.sol('sol1').createSolution; model.sol('sol1').feature('v1').set('initmethod', 'sol'); model.sol('sol1').feature('v1').set('initsol', 'sol1'); en

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 09.11.2012, 12:28 GMT-5

Hi,


You can try an extract of my code below. It will work. The important commands to remember are:

mphgetu - which essentially extracts all degrees of freedom after you run a model.
setU - which helps you set up your own solution vector which can be used in the next step

The next important step is to tell comsol to use the solution vector in the initmethod.

Uinc is incremental displacement and Utotal is total displacement.

Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know.


Suresh



Suresh and others:

On the topic above, I have essentially the same question, i.e., I would like to take the deformed shape from an initial study and then remesh the resulting deformed geometry in order to run a second study. (For my particular purposes in this study, I am not concerned with the stress and strain states that develop from the first study; I'm just interested in the deformed shape as the starting point for a new study.)

I ran across the attached instructions from one of the other consultants (Goran ??), and it appears to lay out a guide for doing exactly what I want to do. BUT it does not work as laid out here in my version of 4.3a. And one of the other writers into the forum mentions that he found that it also did not work 4.2a although it did in 4.1 Any suggestions on how to accomplish this goal in 4.3a?

And by the way, on the code offered by Suresh, where would this code be inserted in my workflow in 4.3a?

Thanks in advance, John


%Code extract:
% Set the new solution vector back into comsol, reset only the last time
% % step value
for i = 1:nstep

Uinc(i,:)=mphgetu(model);
if(i==1)
Utotal(i,:) = Uinc(i,:);
else
Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:);
end
model.sol('sol1').setU(Utotal(i,:));
model.sol('sol1').createSolution;
model.sol('sol1').feature('v1').set('initmethod', 'sol');
model.sol('sol1').feature('v1').set('initsol', 'sol1');

en


[QUOTE] Hi, You can try an extract of my code below. It will work. The important commands to remember are: mphgetu - which essentially extracts all degrees of freedom after you run a model. setU - which helps you set up your own solution vector which can be used in the next step The next important step is to tell comsol to use the solution vector in the initmethod. Uinc is incremental displacement and Utotal is total displacement. Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know. Suresh Suresh and others: On the topic above, I have essentially the same question, i.e., I would like to take the deformed shape from an initial study and then remesh the resulting deformed geometry in order to run a second study. (For my particular purposes in this study, I am not concerned with the stress and strain states that develop from the first study; I'm just interested in the deformed shape as the starting point for a new study.) I ran across the attached instructions from one of the other consultants (Goran ??), and it appears to lay out a guide for doing exactly what I want to do. BUT it does not work as laid out here in my version of 4.3a. And one of the other writers into the forum mentions that he found that it also did not work 4.2a although it did in 4.1 Any suggestions on how to accomplish this goal in 4.3a? And by the way, on the code offered by Suresh, where would this code be inserted in my workflow in 4.3a? Thanks in advance, John %Code extract: % Set the new solution vector back into comsol, reset only the last time % % step value for i = 1:nstep Uinc(i,:)=mphgetu(model); if(i==1) Utotal(i,:) = Uinc(i,:); else Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:); end model.sol('sol1').setU(Utotal(i,:)); model.sol('sol1').createSolution; model.sol('sol1').feature('v1').set('initmethod', 'sol'); model.sol('sol1').feature('v1').set('initsol', 'sol1'); en [/QUOTE]


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 09.11.2012, 12:31 GMT-5
By the way, on my earlier post, the Comsol person who supplied the attached file that I mentioned was Zoran (not Goran) Vidakovic, COMSOL Employee, Switzerland

Thanks, John
By the way, on my earlier post, the Comsol person who supplied the attached file that I mentioned was Zoran (not Goran) Vidakovic, COMSOL Employee, Switzerland Thanks, John

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 13.03.2015, 05:27 GMT-4

Hi,


You can try an extract of my code below. It will work. The important commands to remember are:

mphgetu - which essentially extracts all degrees of freedom after you run a model.
setU - which helps you set up your own solution vector which can be used in the next step

The next important step is to tell comsol to use the solution vector in the initmethod.

Uinc is incremental displacement and Utotal is total displacement.

Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know.


Suresh




%Code extract:
% Set the new solution vector back into comsol, reset only the last time
% % step value
for i = 1:nstep

Uinc(i,:)=mphgetu(model);
if(i==1)
Utotal(i,:) = Uinc(i,:);
else
Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:);
end
model.sol('sol1').setU(Utotal(i,:));
model.sol('sol1').createSolution;
model.sol('sol1').feature('v1').set('initmethod', 'sol');
model.sol('sol1').feature('v1').set('initsol', 'sol1');

en


I evaluated my new material properties in Matlab and now I want to implement it with Comsol, but in every loop that material was updated the code can't evaluate initial variables of the model as calculated in Matlab. I use different methods to do that but in every loop the variables are the same in initial loop. I try to use your code but it doesn't work, the error message is:

Exception:
com.comsol.util.exceptions.FlException: Size of time list 0 must equal
the number of solution vectors 1
Messages:
Size of time list 0 must equal the number of solution vectors 1
[QUOTE] Hi, You can try an extract of my code below. It will work. The important commands to remember are: mphgetu - which essentially extracts all degrees of freedom after you run a model. setU - which helps you set up your own solution vector which can be used in the next step The next important step is to tell comsol to use the solution vector in the initmethod. Uinc is incremental displacement and Utotal is total displacement. Of course, I never pursued with this problem due to other priorities. If it works for you, please let me know. Suresh %Code extract: % Set the new solution vector back into comsol, reset only the last time % % step value for i = 1:nstep Uinc(i,:)=mphgetu(model); if(i==1) Utotal(i,:) = Uinc(i,:); else Utotal(i,:)=Utotal(i-1,:)+Uinc(i,:); end model.sol('sol1').setU(Utotal(i,:)); model.sol('sol1').createSolution; model.sol('sol1').feature('v1').set('initmethod', 'sol'); model.sol('sol1').feature('v1').set('initsol', 'sol1'); en [/QUOTE] I evaluated my new material properties in Matlab and now I want to implement it with Comsol, but in every loop that material was updated the code can't evaluate initial variables of the model as calculated in Matlab. I use different methods to do that but in every loop the variables are the same in initial loop. I try to use your code but it doesn't work, the error message is: Exception: com.comsol.util.exceptions.FlException: Size of time list 0 must equal the number of solution vectors 1 Messages: Size of time list 0 must equal the number of solution vectors 1

Mani sekaran Santhanakrishnan

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 28.06.2016, 08:37 GMT-4
Hi,
I want to loop the comsol solution through Matlab, I like to modify the solution vector and return it to comsol for further iterations in a transient coupled simulation. Total number of solution variables 2, one variable from stationary simulation and other variable from transient simulation. I am using comsol 5.1.
The matlab modified solution vector is updated using below given commands.
model.sol('sol1').setU(u0);
model.sol('sol1').createSolution;
While executing "createSolution" command I get the following error message.
Error:Size of time list 0 must equal the number of solution vectors 1

What is this meaning of this message and how to overcome this?

I even tried to return the solution vector, without any manipulation, meaning
u0 = mphgetu(model); % get the solution variables/vector
model.sol('sol1').setU(u0); % without modifying return the solution vector to comsol model
model.sol('sol1').createSolution;

even then I get the same error.

Any one, could you please share your knowledge?

Thanks
Mani S
Hi, I want to loop the comsol solution through Matlab, I like to modify the solution vector and return it to comsol for further iterations in a transient coupled simulation. Total number of solution variables 2, one variable from stationary simulation and other variable from transient simulation. I am using comsol 5.1. The matlab modified solution vector is updated using below given commands. model.sol('sol1').setU(u0); model.sol('sol1').createSolution; While executing "createSolution" command I get the following error message. Error:Size of time list 0 must equal the number of solution vectors 1 What is this meaning of this message and how to overcome this? I even tried to return the solution vector, without any manipulation, meaning u0 = mphgetu(model); % get the solution variables/vector model.sol('sol1').setU(u0); % without modifying return the solution vector to comsol model model.sol('sol1').createSolution; even then I get the same error. Any one, could you please share your knowledge? Thanks Mani S

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.