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.

Using the grad-free optimization and the with operator.

Please login with a confirmed email address before reporting spam

Hello,

I am currently using the Grad-free operator to try to solve an inversion problem. The problem consists of taking measurements of a magnetic field at the surface. We are making synthetic models in comsol, then using the grad-free optimization to try to solve. I find that the objective function doesn't like the with operator so with an objective function like this:

(real(mod1.intop21(with(2,mf.Hy)))-1.60154e-4)^2

Where this function is trying to minimize the high frequency (defined in our parameter sweep) real part of the magnetic field with the value that was taken from the specific model with a certain Chargeability and conductivity. We have an objective function at each point for the low, high, real, imag parts. So 4 in total for each point.



Warning: Problem encountered during results while solving.
The solution specification is nonscalar or out of range.
- Geometry: 1
- Point: 34
Failed to evaluate expression.
- Expression: with(2,mod1.mf.Hy)
Failed to evaluate expression.
- Expression: with(2,mod1.mf.Hy)
Failed to evaluate expression.
- Expression: mod1.intop21(with(2,mod1.mf.Hy))
Failed to evaluate expression.
- Expression: imag(mod1.intop21(with(2,mod1.mf.Hy)))
Failed to evaluate variable.
- Variable: opt.obj84
- Defined as: ((2.5741099999999998e-012+imag(mod1.intop21(with(2,mod1.mf.Hy))))^2)
Failed to evaluate variable.
- Variable: all obj sum
- Defined as: (opt.obj84+(opt.obj83+(((opt.obj80+(((opt.obj77+(opt.obj76+((opt.obj74+(opt.obj73+(opt.obj72+((opt.obj70+((opt.obj68+(opt.obj67+(opt.obj66+((opt.obj64+(((((((opt.obj57+(((opt.obj54+(opt.obj53+((((opt.obj49+((opt.obj47+((opt.obj45+(opt.obj44+((opt.obj42+(opt.obj41+(opt.obj40+(opt.obj39+((opt.obj37+(((opt.obj34+(opt.obj33+(opt.obj32+(opt.obj31+((opt.obj29+(opt.obj28+(((opt.obj25+(opt.obj24+(((((opt.obj19+(((((opt.obj14+(opt.obj13+(opt.obj12+((opt.obj10+((((opt.obj6+(((opt.obj3+(opt.obj1+opt.obj2))+opt.obj4)+opt.obj5))+opt.obj7)+opt.obj8)+opt.obj9))+opt.obj11))))+opt.obj15)+opt.obj16)+opt.obj17)+opt.obj18))+opt.obj20)+opt.obj21)+opt.obj22)+opt.obj23)))+opt.obj26)+opt.obj27)))+opt.obj30)))))+opt.obj35)+opt.obj36))+opt.obj38)))))+opt.obj43)))+opt.obj46))+opt.obj48))+opt.obj50)+opt.obj51)+opt.obj52)))+opt.obj55)+opt.obj56))+opt.obj58)+opt.obj59)+opt.obj60)+opt.obj61)+opt.obj62)+opt.obj63))+opt.obj65))))+opt.obj69))+opt.obj71))))+opt.obj75)))+opt.obj78)+opt.obj79))+opt.obj81)+opt.obj82)))
Failed to evaluate expression.
- Expression: real(all obj sum)
Failed to evaluate expression.
- Expression: real(all obj sum)

Is there something wrong with my syntax here? Am I going to have to define this is a different way?

1 Reply Last Post Dec 10, 2013, 1:09 a.m. EST
COMSOL Moderator

Hello Josh Leland

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 10, 2013, 1:09 a.m. EST
The with operator can access any solution during results evaluation,not solving.
The with operator can access any solution during results evaluation,not solving.

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.