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.

Error Using MATLAB to Simulate a Line Scan of a Multiturn Differential Coil Above a Conducting Plate

Joey Marano Materials State Awareness

Please login with a confirmed email address before reporting spam

Hello all,

I am using COMSOL Multiphysics 6.1 with MATLAB. I am attempting to simulate a multiturn split differential coil above a conducting plate. It is supposed to calculate the eddy currents and magnetic fields produced when an aluminum conductor is placed under a multi-turn coil carrying a sinusoidal current. I exported the COMSOL file to MATLAB and attempted to write some code that would simulate a line scan that iteratively moves a notch laterially. When running the code, it produces the following error:

———

Java exception occurred:

Exception:

com.comsol.util.exceptions.FlException: The following feature has encountered a problem

Messages:

The following feature has encountered a problem:
  • Feature: Stationary Solver 5.1 (sol1/s5)

    Failed to find a solution.

    In Coil Left (Notch):

    Divergence of the linear iterations.

    Returned solution is not converged.

    Not all parameter steps returned.

Stack trace:

at com.comsol.solver.SolverOperation.execute(SourceFile:360)

at com.comsol.solver.SolverOperation.addError(SourceFile:558)

at com.comsol.solver.SolverOperation.execute(SourceFile:372)

at com.comsol.model.method.SolverSequenceMethod.doRun(SourceFile:2317)

at com.comsol.model.method.SolverSequenceMethod.doRunAll(SourceFile:3046)

at com.comsol.model.dbmodel.SolverSequenceDb.runAll(SourceFile:305)

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.comsol.bridge.command.c.a(SourceFile:161)

at com.comsol.bridge.command.c.run(SourceFile:103)

at com.comsol.bridge.command.l.c(SourceFile:213)

at com.comsol.bridge.command.l.a(SourceFile:203)

at com.comsol.bridge.command.l$1.run(SourceFile:94)

at com.comsol.util.thread.SuspendableTasks$1.run(SourceFile:111)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

———

I am fairly new to useing COMSOL so this may not be a particularly interesting question to answer but if you've run into this or something simular, any help is appreciated. I am not sure why COMSOL would be able to solve the model but the MATLAB code produced by COMSOL would not be able to.

Please let me know if any additional information is required.

Thank you!


1 Reply Last Post 13 avr. 2023, 07:22 UTC−4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago 13 avr. 2023, 07:22 UTC−4

Without seeing your model it is difficult to give you useful feedback.

I suggest you make a model in the Comsol GUI that gets as close as possible to what you want to simulate. Use parameters anywhere for stuff you want to change while simulating in Matlab. Save the model as an MPH-file.

When simulating the model in Matlab then simply load the MPH-file into Matlab and update any parameters you wish to change before starting the solvers.

If you export your model as an M-file and just update the model in various placed there is a large probability that the numbering of domain, faces, edges and points have changes and hence you easily end up with an invalid model - unless you also update the numbers for any selections that are used in the model.

-------------------
Lars Gregersen
Comsol Denmark
Without seeing your model it is difficult to give you useful feedback. I suggest you make a model in the Comsol GUI that gets as close as possible to what you want to simulate. Use parameters anywhere for stuff you want to change while simulating in Matlab. Save the model as an MPH-file. When simulating the model in Matlab then simply load the MPH-file into Matlab and update any parameters you wish to change before starting the solvers. If you export your model as an M-file and just update the model in various placed there is a large probability that the numbering of domain, faces, edges and points have changes and hence you easily end up with an invalid model - unless you also update the numbers for any selections that are used in the model.

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.