Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Beginner COMSOL problem

  1. Feb 20, 2010 #1

    I'm new to COMSOL and am in the stage where I know what I want done, but I just can't get the software to do it.

    Suppose I model out a metal spring, and fix one end of it in place. I want to pull on the other end, and then plot some value relevant to the deformation of the spring. Right now, I can input one value as a constraint in the boundary settings, and that works fine. I get my deformation value, but it's slow and tedious to plug in one value at a time, and wait for the solution.

    What I want to do is have COMSOL do this for a range of values, and then plot the resulting values. I know it's possible to put in an expression containing variables in the constraint box, but I can't get it to work.

    I hope this is an easy question to answer, thanks for helping a newbie out.
  2. jcsd
  3. Feb 22, 2010 #2
  4. Feb 22, 2010 #3
    Since I only used Comsol for EM simulations I don't know the module you use but, maybe you could also define the parameter you want to change within the solver itself. In Solver Parameters, you can define one parameter (which in my case is usually the free space wavelength) and use Parametric Solver. This solves the problem for each value.
    Parameter name: Lambda
    Values: 1540e-9:1e-9:1560e-9
    then I write Lambda to the dialog box for the free space wl.

    Well, also you can export the whole problem as an .m file, and open it up with Comsol with Matlab, from there on, your whole computation will be a block of Comsol code within any kind of Matlab code.

    I use this often, since I need to reinitialize my geometry and mesh due to the parameter. For example, if I take radius of a circle in my geometry as a parameter, the preceding trick will fail, since a change in radius will present a new problem and geometry.

    I mean you could define a variable for an initial condition value, like

    for radius=10e-6:1e-6:20e-6
    Comsol code in which "radius" is used as one of the parameters

    this would for every time create a new FEM problem (geometry, boundary conditions, mesh etc.) solve it, and save it if you code it down.

    If you can, stay away from the latter technique, since working with the simulation as a .m code has a steep learning curve (not that it is hard though, because it is dependent on trial and error.)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook