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.

Undefined variable in while using comosol with matlab-ERROR

Please login with a confirmed email address before reporting spam

I am getting the following error when I run Comsol with MATLAB. I am unable to correct the error. Can someone give any insight to correct the error. I can see that the variable is found to be undefined when, a new domain is created by MATLAB in the comsol model.

Messages: The following feature has encountered a problem:

Undefined variable.
- Variable: material.epsilonr22
- Geometry: geom1
- Domain: 35

Failed to evaluate variable.
- Variable: comp1.es.epsilonryy
- Defined as: material.epsilonr22

Failed to evaluate variable.
- Variable: comp1.es.chiyy
- Defined as: ((-1)+comp1.es.epsilonryy)

Failed to evaluate variable.
- Variable: comp1.es.Py
- Defined as: (epsilon0_const*((comp1.es.Ey*comp1.es.chiyy)+(comp1.es.Ex*comp1.es.chiyx)))

Failed to evaluate variable.
- Variable: comp1.es.Dy
- Defined as: (comp1.es.Py+((epsilon0_const*comp1.es.Iyy)*comp1.es.Ey))

Failed to evaluate expression.
- Expression: d((-(comp1.es.Dx*test(comp1.Vx)+comp1.es.Dy*test(comp1.Vy))*comp1.es.d)*(dvol),{test@2})
- Feature: Stationary Solver 1 (sol1/s1)

2 Replies Last Post Feb 19, 2019, 12:21 a.m. EST
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Feb 18, 2019, 8:25 a.m. EST

This could be a problem with the materials you have defined for your model.

Try to save your model as an MPH-file (using mphsave) and load the model into Comsol Desktop. The error messages are usually more clear in that environment.

-------------------
Lars Gregersen
Comsol Denmark
This could be a problem with the materials you have defined for your model. Try to save your model as an MPH-file (using mphsave) and load the model into Comsol Desktop. The error messages are usually more clear in that environment.

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Feb 19, 2019, 12:21 a.m. EST

Thank you Lars! I have sorted the issue by keeping a count on the domains. Actually, my simulation runs in loop and in every loop there are possibility that a new domain will be created. So, as soon as a new domain is added, I add the required properties to the material. This solved the issue.

Thank you Lars! I have sorted the issue by keeping a count on the domains. Actually, my simulation runs in loop and in every loop there are possibility that a new domain will be created. So, as soon as a new domain is added, I add the required properties to the material. This solved the issue.

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.