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.

Change value of expression seperately for different domains

Please login with a confirmed email address before reporting spam

Hi all!

I am quite new in Comsol 4.1 and have the following question:

I created a variable xGe with the geometric scope "Entire model" since I want to use it in every domain.
Now I'd like to give this variable a different expression depending on the domain (let's say be a constant in domain1 and a function in domain2).
Where can I set the value of the variable separately for different domains?

Thanks for the help in advance!
Tanja

4 Replies Last Post 2011年3月25日 GMT-4 18:14

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月25日 GMT-4 10:57
Hi,

I think You can define different variables (under Model. Definitions) for each subdomain,
say "Variables 1", "Variables 2" ...., add different expressions you want.

Then for each variables, set the "Geometric entity level" from "Entire model" to "Domain", add the domain you want to the corresponding variables.
Hope it helps.

XLi
Hi, I think You can define different variables (under Model. Definitions) for each subdomain, say "Variables 1", "Variables 2" ...., add different expressions you want. Then for each variables, set the "Geometric entity level" from "Entire model" to "Domain", add the domain you want to the corresponding variables. Hope it helps. XLi

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月25日 GMT-4 11:06
Hi XLi!

Thanks for the answer. I know that, but that's not exactly what I want. I'd like to have just one variable which has a different value in the different domains, since I want to script models in Matlab independently of how many domains are in the model.

Tanja
Hi XLi! Thanks for the answer. I know that, but that's not exactly what I want. I'd like to have just one variable which has a different value in the different domains, since I want to script models in Matlab independently of how many domains are in the model. Tanja

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月25日 GMT-4 12:16
Hi,

Instead, use a Variables node for each domain with a manual selection including a single domain only and define a single variable with the same name in each but with a different value for its description. Then you have a single variable with different values in different domains. Not really sure that it fits your application but this works well in the COMSOL Multiphysics environment.

Best regards,
Magnus Ringh, COMSOL
Hi, Instead, use a Variables node for each domain with a manual selection including a single domain only and define a single variable with the same name in each but with a different value for its description. Then you have a single variable with different values in different domains. Not really sure that it fits your application but this works well in the COMSOL Multiphysics environment. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月25日 GMT-4 18:14
Hi Magnus!

Thanks for your help, that's exactly what I wanted. :)
There is now another issue.. If I update the variable in Comsol and then load the model in Matlab I have to load the model a few times until it contains the updated values. What could be the reason for that?

Best wishes,
Tanja
Hi Magnus! Thanks for your help, that's exactly what I wanted. :) There is now another issue.. If I update the variable in Comsol and then load the model in Matlab I have to load the model a few times until it contains the updated values. What could be the reason for that? Best wishes, Tanja

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.