Dear all,
I want to integrate some equation on a simulation volume in Matlab using mphint2.
The equation contains variables from datasets of 2 distinct models (the geometries of both are the same).
I tried a few different ways, but I did not manage to do it without changing to one model. Maybe you have some ideas, how I could get at least one of the ways running.
My first attempt was to create a Matlab function, which I also define in the second model, that returns the variable values of the first model at a certain point (using mphinterp).
The problem I experienced here was that the Matlab session that was opened by Comsol to evaluate this function was not able to connect to a Comsol server though I opened a separate one and adjusted the ports to match (I used addpath to include the mli folder, then mphstart and import com.comsol.model.* and import com.comsol.model.util.*). While trying to do that I also recognized that I could not easily disconnect and connect repeatedly a single server with Matlab without restarting the server (the first connection is fine).
So, does anybody have an idea how to fix that?
The second attempt was to find the coordinates of the geometry nodes of the second model (using mpheval) and to use them to find the values for the variable of the first model (using mphinterp) on that nodes and to save the values in a file. The Matlab function in the second model should then just open the file and return this values during the integration. Unfortunately the integration is not performed on the coordinates of the nodes - or better - the number of points, where the integration wants to evaluate the expression, does not coincide with the number of nodes.
For that: Does someone have an idea, how to find out at which points the mphint2 evaluates the variables?
At the end, if anybody has a simpler idea on how I could use the data of the different models to create an integral over an equation containing variables of both sets, I would also be happy to get a hint.
Thank you already in advance.
Best,
Hannes
I want to integrate some equation on a simulation volume in Matlab using mphint2.
The equation contains variables from datasets of 2 distinct models (the geometries of both are the same).
I tried a few different ways, but I did not manage to do it without changing to one model. Maybe you have some ideas, how I could get at least one of the ways running.
My first attempt was to create a Matlab function, which I also define in the second model, that returns the variable values of the first model at a certain point (using mphinterp).
The problem I experienced here was that the Matlab session that was opened by Comsol to evaluate this function was not able to connect to a Comsol server though I opened a separate one and adjusted the ports to match (I used addpath to include the mli folder, then mphstart and import com.comsol.model.* and import com.comsol.model.util.*). While trying to do that I also recognized that I could not easily disconnect and connect repeatedly a single server with Matlab without restarting the server (the first connection is fine).
So, does anybody have an idea how to fix that?
The second attempt was to find the coordinates of the geometry nodes of the second model (using mpheval) and to use them to find the values for the variable of the first model (using mphinterp) on that nodes and to save the values in a file. The Matlab function in the second model should then just open the file and return this values during the integration. Unfortunately the integration is not performed on the coordinates of the nodes - or better - the number of points, where the integration wants to evaluate the expression, does not coincide with the number of nodes.
For that: Does someone have an idea, how to find out at which points the mphint2 evaluates the variables?
At the end, if anybody has a simpler idea on how I could use the data of the different models to create an integral over an equation containing variables of both sets, I would also be happy to get a hint.
Thank you already in advance.
Best,
Hannes