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.

Conditional nodes

Please login with a confirmed email address before reporting spam

Hello, Under Geometry it is possible to execute nodes conditionally, depending on the value of a parameter for example. Is it possible elsewhere somehow? For example, I have a problem where I calculate the points of an interpolated function by an external code and write it to different files, for different configurations of the model. Within the comsol model, these different configurations are selected by a parameter. I would like to import the interpolated functions from these different files corresponding to the different configurations, based on the value of this parameter. Now I would do it importing all the interpolated data into different functions f1, f2, f3, etc, then sum them as f(x) = (param==1)f1(x)+param(==2)f2(x)+... but there may be a more elegant solution

Conditional nodes could also be useful elsewhere (within physics, etc) Thank you Daniel


1 Reply Last Post 2021年12月29日 GMT-5 06:29

Please login with a confirmed email address before reporting spam

Posted: 3 years ago 2021年12月29日 GMT-5 06:29

Even if the above approach can work as a workaround, it is problematic in the following case: I am using my comsol model in 2 stages: 1 - run one simulation making some preliminary simulations, and export some data for the external software. 2 - After the external code has generated the interpolated function files, I run another simulation of the model, using these interpolated functions

The problem is, that initially, when I start from a clean environment, the interpolated functions are not yet calculated, these files do not exist. However, the comsol model already contains these interpolated functions, and even if these are not used actually in the stage1 simulation (because they are multiplied by a (parameter==1) factor which evaluates to zero), comsol still complains (of course) about these missing files. So I need to generate a dummy file first by hand, and than later overwrite it.

It is possible to conditionally disable some nodes, or make it more seamless somehow? It's ok as long as I am using it myself, but starts to get cumbersome when I send the model for some colleague to work on.

Even if the above approach can work as a workaround, it is problematic in the following case: I am using my comsol model in 2 stages: 1 - run one simulation making some preliminary simulations, and export some data for the external software. 2 - After the external code has generated the interpolated function files, I run another simulation of the model, using these interpolated functions The problem is, that initially, when I start from a clean environment, the interpolated functions are not yet calculated, these files do not exist. However, the comsol model already contains these interpolated functions, and even if these are not used actually in the stage1 simulation (because they are multiplied by a (parameter==1) factor which evaluates to zero), comsol still complains (of course) about these missing files. So I need to generate a dummy file first by hand, and than later overwrite it. It is possible to conditionally disable some nodes, or make it more seamless somehow? It's ok as long as I am using it myself, but starts to get cumbersome when I send the model for some colleague to work on.

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.