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.

Initial values

Please login with a confirmed email address before reporting spam


Hi,

How do I save the solution for a coarse mesh to use for initial conditions for a finer mesh?
--
JDP

4 Replies Last Post 2011年9月7日 GMT-4 08:26
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 2011年4月22日 GMT-4 17:30
Hi

interesting question,
I'm not sure you can, as you need to re-interpolate the results from the coarse to the new mesh.

Via Matlab it's certainly possible, with some tweaking (so far I'm not using Matlab with v4, haven't found the need , yet ;).

Often I interpret manually my preliminary results to apply them as initial conditions with simple functional relations (1st order equations or simple slopes)

--
Good luck
Ivar
Hi interesting question, I'm not sure you can, as you need to re-interpolate the results from the coarse to the new mesh. Via Matlab it's certainly possible, with some tweaking (so far I'm not using Matlab with v4, haven't found the need , yet ;). Often I interpret manually my preliminary results to apply them as initial conditions with simple functional relations (1st order equations or simple slopes) -- Good luck Ivar

Jim Freels mechanical side of nuclear engineering, multiphysics analysis, COMSOL specialist

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年4月23日 GMT-4 23:36
This is quite easily done with the new model builder in v4+ of COMSOL. There may be simpler and better ways to do it than what I do, but I like my method because I can understand what I have. One of the beautiful features of finite-element methods, is that mapping coarse solutions onto finer mesh solutions is straight forward because each point in space is interpolated (by definition) within the nodes of the finite element ! I am stating this procedure from memory, so please excuse me if I make a mistake !

1. after the coarse mesh solution is obtained, I save the model file

2. then I right click on the "solver" block of the model builder and choose "copy"

3. a copy node is then created just down the tree from the right-click point

4. right click on the copy node, and rename it to something you can recognize; for example, "coarse-mesh converged solution"

5. create a 2nd finer mesh, by first right-clicking on mesh, create mesh-2. I typically rename most every node in the model builder tree to something I can recognize.

6. in the solver portion, under the solver step, set the mesh to the new mesh

7. in the dependent variables section, specify the initial conditions (two places, also variables not solved for) as coming from the solution, and then below that pick your newly saved copy called "coarse-mesh converged solution:.

8. after setting everything else like you want, right click on the solver, and pick "compute"

Like I said earlier, there may be an easier way (for example, using the "continue" feature), but I like this because I can understand what I am doing this way. The current solved solution is typically called "solution 1", so I am copying "solution 1" to a separate place. Then if I mess up, or my next solution attempt fails, I have not lost the good converged solution from the coarse mesh. You can also verify the interpolated coarse-to-fine mesh initial condition by plotting the initial conditions in the results portion of the tree to be sure it is what you want.
This is quite easily done with the new model builder in v4+ of COMSOL. There may be simpler and better ways to do it than what I do, but I like my method because I can understand what I have. One of the beautiful features of finite-element methods, is that mapping coarse solutions onto finer mesh solutions is straight forward because each point in space is interpolated (by definition) within the nodes of the finite element ! I am stating this procedure from memory, so please excuse me if I make a mistake ! 1. after the coarse mesh solution is obtained, I save the model file 2. then I right click on the "solver" block of the model builder and choose "copy" 3. a copy node is then created just down the tree from the right-click point 4. right click on the copy node, and rename it to something you can recognize; for example, "coarse-mesh converged solution" 5. create a 2nd finer mesh, by first right-clicking on mesh, create mesh-2. I typically rename most every node in the model builder tree to something I can recognize. 6. in the solver portion, under the solver step, set the mesh to the new mesh 7. in the dependent variables section, specify the initial conditions (two places, also variables not solved for) as coming from the solution, and then below that pick your newly saved copy called "coarse-mesh converged solution:. 8. after setting everything else like you want, right click on the solver, and pick "compute" Like I said earlier, there may be an easier way (for example, using the "continue" feature), but I like this because I can understand what I am doing this way. The current solved solution is typically called "solution 1", so I am copying "solution 1" to a separate place. Then if I mess up, or my next solution attempt fails, I have not lost the good converged solution from the coarse mesh. You can also verify the interpolated coarse-to-fine mesh initial condition by plotting the initial conditions in the results portion of the tree to be sure it is what you want.

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 2011年4月24日 GMT-4 02:44
Hi James

THanks for an interesting and useful procedure, I'll certainly use that one ;)

--
Good luck
Ivar
Hi James THanks for an interesting and useful procedure, I'll certainly use that one ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年9月7日 GMT-4 08:26
Hi James,

this helped me, too. Thank you.

Stefan
Hi James, this helped me, too. Thank you. Stefan

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.