Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
14 nov 2019, 06:39 GMT-5
Hi Lin
You can retrieve numerical values from Comsol to Matlab in a number of ways.
mphinterp gives you values at arbitrary coordinates.
mpheval gives you values at node points.
mphgetu gives you the raw solution vector. You use the information returned from mphxmeshinfo to identify which field variables are stored where in this vector.
Comsol has support for returning sensitivities that may be useful when doing optimisation. See the chapter on "Sensitivity Analysis" in the Reference Manual for more information.
-------------------
Lars Gregersen
Comsol Denmark
Hi Lin
You can retrieve numerical values from Comsol to Matlab in a number of ways.
mphinterp gives you values at arbitrary coordinates.
mpheval gives you values at node points.
mphgetu gives you the raw solution vector. You use the information returned from mphxmeshinfo to identify which field variables are stored where in this vector.
Comsol has support for returning sensitivities that may be useful when doing optimisation. See the chapter on "Sensitivity Analysis" in the Reference Manual for more information.
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
14 nov 2019, 07:00 GMT-5
I think he or she's asking about how to transfer the variable the other way around.
-------------------
ZHANG, Pu
School of Physics,
Huazhong University of Science and Technology
I think he or she's asking about how to transfer the variable the other way around.
Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
15 nov 2019, 04:49 GMT-5
Hi Pu
You could be right ;-)
You can "transfer" a field variable back to a Comsol model by
- Saving the data as a file and set up an interpolation function.
- Use the COMSOL API to set a solution vector in the Comsol model. There is no easy to use function for this. See the section "Solution Creation" in the Programming Reference Manual for more info
-------------------
Lars Gregersen
Comsol Denmark
Hi Pu
You could be right ;-)
You can "transfer" a field variable back to a Comsol model by
1. Saving the data as a file and set up an interpolation function.
2. Use the COMSOL API to set a solution vector in the Comsol model. There is no easy to use function for this. See the section "Solution Creation" in the Programming Reference Manual for more info
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
15 nov 2019, 07:40 GMT-5
Good to know.
It sounds there's no very direct way to do the variable assignment via Matlab Livelink.
-------------------
ZHANG, Pu
School of Physics,
Huazhong University of Science and Technology
Good to know.
It sounds there's no very direct way to do the variable assignment via Matlab Livelink.
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
19 nov 2019, 10:01 GMT-5
Hi Pu
You could be right ;-)
You can "transfer" a field variable back to a Comsol model by
- Saving the data as a file and set up an interpolation function.
- Use the COMSOL API to set a solution vector in the Comsol model. There is no easy to use function for this. See the section "Solution Creation" in the Programming Reference Manual for more info
Thanks for your reply! The second methods you suggested actually works and I am grateful for your help!!
But I encounter another problem now , I want to caculate the integration of the shape functions( and other function as well) on each node. At first, I try to set up a PDE fields and extract the residual Vector from it, but I find out that I need to solve the PDE fields first then I can get the residual Vector. Is there any other way to acquire the integration of the shape functions on every node?
>Hi Pu
>
>You could be right ;-)
>
>You can "transfer" a field variable back to a Comsol model by
>
>1. Saving the data as a file and set up an interpolation function.
>2. Use the COMSOL API to set a solution vector in the Comsol model. There is no easy to use function for this. See the section "Solution Creation" in the Programming Reference Manual for more info
Thanks for your reply! The second methods you suggested actually works and I am grateful for your help!!
But I encounter another problem now , I want to caculate the integration of the shape functions( and other function as well) on each node. At first, I try to set up a PDE fields and extract the residual Vector from it, but I find out that I need to solve the PDE fields first then I can get the residual Vector. Is there any other way to acquire the integration of the shape functions on every node?