Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
2017年9月11日 GMT-4 07:41
Hi Min
This is not how Matlab works.
You use mpheval to extract values from a Comsol model and you can continue to work on the data in Matlab.
There is no way that Comsol can know if you change a value in Matlab. If you wish a Comsol model to be affected you must send the new values to Comsol using one or more commands.
There is currently no feature that will send the output from mpheval to a Comsol. If you really need to change values in a model on the mesh level then you have to use the Comsol API (look for setU in the programming reference manual).
You will probably find it easier using an interpolation function instead.
--
Lars Gregersen
Comsol Denmark
Hi Min
This is not how Matlab works.
You use mpheval to extract values from a Comsol model and you can continue to work on the data in Matlab.
There is no way that Comsol can know if you change a value in Matlab. If you wish a Comsol model to be affected you must send the new values to Comsol using one or more commands.
There is currently no feature that will send the output from mpheval to a Comsol. If you really need to change values in a model on the mesh level then you have to use the Comsol API (look for setU in the programming reference manual).
You will probably find it easier using an interpolation function instead.
--
Lars Gregersen
Comsol Denmark
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
2017年9月12日 GMT-4 09:49
Thanks for you reply Lars.
I'm simulating with parametric sweep.
In my model, each parameter result is based on previous step of parameter.
(Voltage parameter sweep,
V1 result came from V0
V2 result came from V1
....
Vn result came from Vn-1
It is because of changed variables.(material parameter)
However, once simulation got finished in Livelink, I couldn't make my variables be affected from prvious step result. It represents result all of the parameter step without having no chance to edit my variables.
That's why I've trying with mpheval.
In Parametric sweep how can I modify my variables depending on at specific step result?and get next step result with previous result?
Thanks for you reply Lars.
I'm simulating with parametric sweep.
In my model, each parameter result is based on previous step of parameter.
(Voltage parameter sweep,
V1 result came from V0
V2 result came from V1
....
Vn result came from Vn-1
It is because of changed variables.(material parameter)
However, once simulation got finished in Livelink, I couldn't make my variables be affected from prvious step result. It represents result all of the parameter step without having no chance to edit my variables.
That's why I've trying with mpheval.
In Parametric sweep how can I modify my variables depending on at specific step result?and get next step result with previous result?
Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
2017年9月13日 GMT-4 04:50
Updated:
7 years ago
2017年9月13日 GMT-4 04:50
You have two choices:
1 -
You can extract the values from one simulation using mphgetu and put it back in again using setU as described earlier. This requires that the geometry and mesh doesn't change and that you set up the solver such that it uses the current value (instead of using the initial value settings).
2 -
Define two physics in your model (I'm assuming that you only have one now?). Solve the first physics. Use the result of this simulation as initial value for the second physics and so on.
But I still don't think that all of this is necessary. If you wish to change material parameters you can just make the material parameters depend on the parameter value.
I would recommend that you send your model to support where somene can have a look.
-------------------
Lars Gregersen
Comsol Denmark
You have two choices:
1 -
You can extract the values from one simulation using mphgetu and put it back in again using setU as described earlier. This requires that the geometry and mesh doesn't change and that you set up the solver such that it uses the current value (instead of using the initial value settings).
2 -
Define two physics in your model (I'm assuming that you only have one now?). Solve the first physics. Use the result of this simulation as initial value for the second physics and so on.
But I still don't think that all of this is necessary. If you wish to change material parameters you can just make the material parameters depend on the parameter value.
I would recommend that you send your model to support where somene can have a look.