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.

Initial conditons extracted from a saved file

Please login with a confirmed email address before reporting spam

I am wondering if someone know about the following

1. I have two time dependent models, modeled and saved in two separate m-files, let's say the file names are m1 and m2
2. From a third matlab window I would like to run m1 for 0:0.01:4, save the output(Solved data), use this solved data as an initial condition of m2, run m2.

I will definitely appreciate if someone can advise me how to save the solved post-processing data of m1 and used that as an initial condition of m2 and run m2.

14 Replies Last Post Nov 23, 2010, 10:30 a.m. EST
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 23, 2010, 4:58 a.m. EST
Hi

My way would be to do it in the COMSOL GUI (you can l,oad in from Matlab), but this means that you have to have exactly the same geometry in both cases (fiddle with solve intitiaisation and sequensing window), because otherwise you have a solution mapping issue, that indeed you can only perform in matlab, but this means that you must know exactly which sub-domain/boundary/edge/point index element is referring to what in "m1" and to where to go in "m2".

Good luck
Ivar
Hi My way would be to do it in the COMSOL GUI (you can l,oad in from Matlab), but this means that you have to have exactly the same geometry in both cases (fiddle with solve intitiaisation and sequensing window), because otherwise you have a solution mapping issue, that indeed you can only perform in matlab, but this means that you must know exactly which sub-domain/boundary/edge/point index element is referring to what in "m1" and to where to go in "m2". Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 25, 2010, 11:55 a.m. EST
Thank you for the reply, I appreciate your time.

m1 and m2 are same geometry. I exported solution result from m1 to a text file from Comsol window by following File > Export > Postprocessing data > last time step > directed to the text file (result.txt). Now what would be the process of loading result.txt to m2 ? I am not sure about how to do this. I will appreciate your help.
Thank you for the reply, I appreciate your time. m1 and m2 are same geometry. I exported solution result from m1 to a text file from Comsol window by following File > Export > Postprocessing data > last time step > directed to the text file (result.txt). Now what would be the process of loading result.txt to m2 ? I am not sure about how to do this. I will appreciate your help.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 25, 2010, 1:41 p.m. EST
I think I should have added for clear understanding:

1. I can make sure that I have understood the process of loading initial values correctly. In this regard m1 was opened in comsol window (as per your advice), exported the result (pressure p2) to result.txt.
2. I reopened m1 in comsol window added the result as a function (Options > functions > new > Interpolation > File > result.txt (browsed to destination) > store data in model > ok, and then kept the default (linear and constant) > ok.
3. m1 was rerun and no effect found on the result. The solution should start from saved p2 but it seemed not.

I was wondering the wrong things that I were doing.

Have fun

Aziz
I think I should have added for clear understanding: 1. I can make sure that I have understood the process of loading initial values correctly. In this regard m1 was opened in comsol window (as per your advice), exported the result (pressure p2) to result.txt. 2. I reopened m1 in comsol window added the result as a function (Options > functions > new > Interpolation > File > result.txt (browsed to destination) > store data in model > ok, and then kept the default (linear and constant) > ok. 3. m1 was rerun and no effect found on the result. The solution should start from saved p2 but it seemed not. I was wondering the wrong things that I were doing. Have fun Aziz

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 26, 2010, 3:41 a.m. EST
Hi

I'm not familiar with exporting and importing this way via text files. I usually play with the solve parameters performing one simulations, then restarting with saved values and performing further analysis (even other physics by selecting the appropriate ones) all in the COMSOL GUI, or with the segregated solver settings. Have a look in the different tabs of the Solver Manager. But probably this means that you must only have "one " geometry, but different physics.

Good luck
Ivar
Hi I'm not familiar with exporting and importing this way via text files. I usually play with the solve parameters performing one simulations, then restarting with saved values and performing further analysis (even other physics by selecting the appropriate ones) all in the COMSOL GUI, or with the segregated solver settings. Have a look in the different tabs of the Solver Manager. But probably this means that you must only have "one " geometry, but different physics. Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 28, 2010, 12:41 p.m. EST
Hi Ivar,

I hope you are doing good. Thank you for replying me, I appreciate your time. I thought I could get the opportunity to share the following with you.

I ran/solved a time dependent ALE model in comsol and got postprocessing data, deformed geometry, etc. I am interested in this deformed geometry if I could use this as a geometry of another model. I will take the opportunity to make this more clear.

1. I would like to extract / export (or any other process/advice) the deformed geometry from the output of the ALE model at the end of the solution time.
2. I will make another model with this geometry. In this case the deformed geometry is the initial geometry of the new model.
3. Is this possible ? How ?

Any advice will be highly appreciated.

Have fun.

Aziz
Hi Ivar, I hope you are doing good. Thank you for replying me, I appreciate your time. I thought I could get the opportunity to share the following with you. I ran/solved a time dependent ALE model in comsol and got postprocessing data, deformed geometry, etc. I am interested in this deformed geometry if I could use this as a geometry of another model. I will take the opportunity to make this more clear. 1. I would like to extract / export (or any other process/advice) the deformed geometry from the output of the ALE model at the end of the solution time. 2. I will make another model with this geometry. In this case the deformed geometry is the initial geometry of the new model. 3. Is this possible ? How ? Any advice will be highly appreciated. Have fun. Aziz

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 29, 2010, 2:00 a.m. EST
Hi

Yes you can at any time save the models and then export/import your mesh, look at the "file export as mesh" or "file import as mesh" options
And run an indexed search for "import mesh" on your doc

To rerun a model on imported mesh you must first get it "analysed" in the sens you (COMSOL) must create the boundaries onto which you apply your physics.

Therefore COMSOl has 3 geometrical entities, this is often overlooked:
1)- raw geometry (the one you create, import) <=>
2)- analysed geometry (simplified by COMSOL, redundant volumes, surfaces, lines points are removed, items are split and reordered, elements are inexed in a given way, line directions are defined, surface normals as well, etc. <=>
3)- meshed Lines/Surfaces/Volumes of the analysed geometry with indexes to idetify which node belongs to which surface/line=boundary, and which element belongs to which Volume/Surface=Sub-Domain to apply the correct physics to these Nodes/elements

The bidirectionality link is not obvious and in fact not always possible without some human intervention

You see this also in the logic of the icons on top of the window:
One (1) for raw geometry,
Four (4) for analysed geometry (i.e Points, lines=Edges, surfaces=Boundaries, volumes=Sub-domains as defined for 3D, nameing "left-shift" for 2D respectively 1D)
One (1) for meshed geometry

Hope this helps
Good luck
Ivar
Hi Yes you can at any time save the models and then export/import your mesh, look at the "file export as mesh" or "file import as mesh" options And run an indexed search for "import mesh" on your doc To rerun a model on imported mesh you must first get it "analysed" in the sens you (COMSOL) must create the boundaries onto which you apply your physics. Therefore COMSOl has 3 geometrical entities, this is often overlooked: 1)- raw geometry (the one you create, import) 2)- analysed geometry (simplified by COMSOL, redundant volumes, surfaces, lines points are removed, items are split and reordered, elements are inexed in a given way, line directions are defined, surface normals as well, etc. 3)- meshed Lines/Surfaces/Volumes of the analysed geometry with indexes to idetify which node belongs to which surface/line=boundary, and which element belongs to which Volume/Surface=Sub-Domain to apply the correct physics to these Nodes/elements The bidirectionality link is not obvious and in fact not always possible without some human intervention You see this also in the logic of the icons on top of the window: One (1) for raw geometry, Four (4) for analysed geometry (i.e Points, lines=Edges, surfaces=Boundaries, volumes=Sub-domains as defined for 3D, nameing "left-shift" for 2D respectively 1D) One (1) for meshed geometry Hope this helps Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 11, 2010, 6:22 p.m. EST
Hi Ivar,

I am really interested to work on your reply posted on January 26, 2010.

I made two simple models to understand the scenario. First model was a stepped channel ( 10cm width x 50 cm long and 20cm x 100 cm). Water flowing into the channel and exit, solving for 0:0.1:2 time. Second model had channel shape 40 cm x 80 cm instead of 20 x100, time 2:0.1:4, all others are same. I took these two models on the matlab window one after another. I wrote proper matlab codes to feed the initial condition of the second model taken from the output solution of the first model .The results were validated, worked good.

I was encouraged to make a counter check with another set of models, in this case it was ALE. I used a similar process with ALE models but not making different geometry. In ALE at any different time steps the geometry will be different. For the first model time was 0:0.005:1 and 1:0.005:2 or 0:0.005:1 for the second model. It did not work.

A separate technique that I thought should work: From the first model output new geometry was created from the mesh, ale frame, it was deformed geometry at the end of solution time and different from the raw geometry. My understanding was - these would solve the mesh coordinates and associated values issues. Redefined the domain, subdomain and the boundaries, used the previous technique of feeding initial values to the deformed model. But this also did not work, I wondered, why ?

Using Solver Manager:

In the solver manager I used one model of each to create fem0 and fem1. In this case channel worked good but ALE didn't. ALE worked in different solver.

Any advice will be appreciated. Have fun.

Aziz
Hi Ivar, I am really interested to work on your reply posted on January 26, 2010. I made two simple models to understand the scenario. First model was a stepped channel ( 10cm width x 50 cm long and 20cm x 100 cm). Water flowing into the channel and exit, solving for 0:0.1:2 time. Second model had channel shape 40 cm x 80 cm instead of 20 x100, time 2:0.1:4, all others are same. I took these two models on the matlab window one after another. I wrote proper matlab codes to feed the initial condition of the second model taken from the output solution of the first model .The results were validated, worked good. I was encouraged to make a counter check with another set of models, in this case it was ALE. I used a similar process with ALE models but not making different geometry. In ALE at any different time steps the geometry will be different. For the first model time was 0:0.005:1 and 1:0.005:2 or 0:0.005:1 for the second model. It did not work. A separate technique that I thought should work: From the first model output new geometry was created from the mesh, ale frame, it was deformed geometry at the end of solution time and different from the raw geometry. My understanding was - these would solve the mesh coordinates and associated values issues. Redefined the domain, subdomain and the boundaries, used the previous technique of feeding initial values to the deformed model. But this also did not work, I wondered, why ? Using Solver Manager: In the solver manager I used one model of each to create fem0 and fem1. In this case channel worked good but ALE didn't. ALE worked in different solver. Any advice will be appreciated. Have fun. Aziz

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 16, 2010, 7:52 a.m. EST
Hey Aziz,

I have a similar problem of using the stored solution as the initial condition.......
I have a membrane, i structurally deformed by a dc voltage...
Now, i want to use this deformed position , in a furter step.... i.e i wnt to calculate eigen freq at this deformed postion.... plz help... how to proceed????

I'll be highly obliged..
Waiting.................
Hey Aziz, I have a similar problem of using the stored solution as the initial condition....... I have a membrane, i structurally deformed by a dc voltage... Now, i want to use this deformed position , in a furter step.... i.e i wnt to calculate eigen freq at this deformed postion.... plz help... how to proceed???? I'll be highly obliged.. Waiting.................

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 17, 2010, 12:27 p.m. EST
To use solution data as initial condition, both the geometry are required to be exactly same. In dynamic and ALE model the geometry shapes are not same, shape changes with time. However the deformed shape can be created using solution mesh.

Thanks - Aziz
To use solution data as initial condition, both the geometry are required to be exactly same. In dynamic and ALE model the geometry shapes are not same, shape changes with time. However the deformed shape can be created using solution mesh. Thanks - Aziz

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 22, 2010, 9:02 a.m. EST
sir

Thanku for ur time.... but still i'm in doubt.
I tried my best to follow you but i couldn't get any fruitful results. May u plz detail out ur last answer or may b (if u have) send me a model explaining what u said. i am a user of comsol3.5a.

waiting.

plz reply fast.
sir Thanku for ur time.... but still i'm in doubt. I tried my best to follow you but i couldn't get any fruitful results. May u plz detail out ur last answer or may b (if u have) send me a model explaining what u said. i am a user of comsol3.5a. waiting. plz reply fast.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 22, 2010, 9:37 a.m. EST
Tell me about your model to make specific comments and what are you trying to do.

Thanks

Aziz
Tell me about your model to make specific comments and what are you trying to do. Thanks Aziz

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 22, 2010, 3:06 p.m. EST
Hi

check the forum, for 3.5a there are several discussion on restarting/continuing an analysis with the solver sequencer

--
Good luck
Ivar
Hi check the forum, for 3.5a there are several discussion on restarting/continuing an analysis with the solver sequencer -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 23, 2010, 8:56 a.m. EST
sir,

here i have attached a .mph file of my model.... Clearly some structural deformation is obtained after application of 15V voltage.... Now i want to calculate eigen freq of this membrane at this deformed position (not the initial position).......
how to proceed?

Regards
Archana
sir, here i have attached a .mph file of my model.... Clearly some structural deformation is obtained after application of 15V voltage.... Now i want to calculate eigen freq of this membrane at this deformed position (not the initial position)....... how to proceed? Regards Archana


Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 23, 2010, 10:30 a.m. EST
Hi

First of all your mesh seem to me far to coarse to obtain good results, but as a start it's probably OK. check that you ahve a few elelments in the thikness between your electrodes. Also t start with, do it in 2D with a beam its easier to debug the physics

Now in 3.5a from my understanding you must go via matlab to save your static case and then do a an eigenfrequency analysis linearisation from the stressed saved starting point.

in v4 it's by performing a double segregated solving , stationary followed by an eigenfrequency restarted from the stationary case

--
Good luck
Ivar
Hi First of all your mesh seem to me far to coarse to obtain good results, but as a start it's probably OK. check that you ahve a few elelments in the thikness between your electrodes. Also t start with, do it in 2D with a beam its easier to debug the physics Now in 3.5a from my understanding you must go via matlab to save your static case and then do a an eigenfrequency analysis linearisation from the stressed saved starting point. in v4 it's by performing a double segregated solving , stationary followed by an eigenfrequency restarted from the stationary case -- Good luck Ivar

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.