Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 5773

How can I import position-dependent variables into Comsol matlab code using livelink?

$
0
0

I am using Comsol with Matlab livelink. Please, find my attached Matlab code and mph file. Directly in Comsol matlab code, I computed phi0 which gives the initial values of variable phi on each of the nodes (line 134-156). I used the mesh discretization of 40 by 80 which gives a total nodes of 41*81. And the code runs completely.

Now, using the same discretization, I computed phi0 with another code (line 8-42), which I assigned to phi3 (line 46 and 47). I inputed phi3 as phi0 in Comsol (line 157). I have the coordinates of each nodes and their corresponding phi3. I used num2str in line 157 to assigned phi3 as phi0 which includes the x and y coordinates of each node and their corresponding phi0 (line 46) but the code gave error. I also used line 47 which contains only phi3, without x and y coordinates. But the code also gave error. It also gave error when I exported phi0 from Comsol and I tried to plug the exported phi0 back into Comsol. Error message: Error in multiphysics compilation. Syntax error in expression. Please, help me. How can I use calculated phi0 ( position-dependent variable) obtained from external source on each of the nodes of a Comsol model directly from the Matlab code generated from the model? I have the x and y coordinates of each of the nodes and the corresponding phi0.


Viewing all articles
Browse latest Browse all 5773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>