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.

Custom External Material Interfaces

Please login with a confirmed email address before reporting spam

I currently have a C function that allows me to compute nonlinear magnetoleastic (aka magnetostrictive) behavior. The call to this function looks something like:

[strain11, strain22, ...., strain23, B1,B2,B3 ] = material(stress11, stress22, ...stress 23, H1,H2,H3)

So the material calculates the nonlinear strain and flux density based on input stress and magnetic field. I am looking to use this model with an External Material, but I've been having problems setting it up. The key challenge I have is in setting up an External Material with terms from both mechanical and magnetic properties. The current Interface Types seem limited to exclusively solid mechanics or magnetic systems, so how can I couple them?

Should I setup two materials, one that returns the magnetic properties, and another that returns the mechanical? I'm assuming I could then pass the required arguments as parameters in the Material Contents section.

Or else, I saw on a recent Comsol video that a company had created its own Interface Type (www.comsol.com/video/modeling-nonlinear-materials-comsol-multiphysics). Is there any information available on how to create your own interface?

The main information I need is the syntax for main function in my dll, and how to pass both magnetic and mechanical variables to it.

Thanks

3 Replies Last Post 20.10.2016, 08:56 GMT-4
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 19.10.2016, 05:14 GMT-4
Hi,

There is currently no way in which you can create your own interface to the external materials. In the case you are referring to, we have provided a tailored interface to a company developing third party material modes.

You could create two external materials, one for the structural part, and one for the magnetic part. It is possible to pass any variables, also from other physics interfaces as arguments.

The effect is that you will get a decoupling of the problem, which is more or less the same as if you use a segregated solver (which you may be interested in doing anyway). If you are using a fully coupled solver, however, the Jacobian (stiffness matrix) will be missing the cross coupling terms, and this will hurt the convergence of the nonlinear solver.

Regards,
Henrik
Hi, There is currently no way in which you can create your own interface to the external materials. In the case you are referring to, we have provided a tailored interface to a company developing third party material modes. You could create two external materials, one for the structural part, and one for the magnetic part. It is possible to pass any variables, also from other physics interfaces as arguments. The effect is that you will get a decoupling of the problem, which is more or less the same as if you use a segregated solver (which you may be interested in doing anyway). If you are using a fully coupled solver, however, the Jacobian (stiffness matrix) will be missing the cross coupling terms, and this will hurt the convergence of the nonlinear solver. Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 19.10.2016, 10:28 GMT-4
Thanks Henrik,

To follow up and make sure I'm doing this properly, should I be passing the extra variables using the 'Material model parameters' list in the 'Material Contents' section?

As a final question, in my C script, I load an external data set that is used to interpolate some values. It is a double array with ~1e6 values. Is there anyway to create a variable within Comsol that is initially empty that I can then fill with this data, or a pointer to the data? That way I would only need to load the data once.

Thanks
Thanks Henrik, To follow up and make sure I'm doing this properly, should I be passing the extra variables using the 'Material model parameters' list in the 'Material Contents' section? As a final question, in my C script, I load an external data set that is used to interpolate some values. It is a double array with ~1e6 values. Is there anyway to create a variable within Comsol that is initially empty that I can then fill with this data, or a pointer to the data? That way I would only need to load the data once. Thanks

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 20.10.2016, 08:56 GMT-4

To follow up and make sure I'm doing this properly, should I be passing the extra variables using the 'Material model parameters' list in the 'Material Contents' section?


Yes


As a final question, in my C script, I load an external data set that is used to interpolate some values. It is a double array with ~1e6 values. Is there anyway to create a variable within Comsol that is initially empty that I can then fill with this data, or a pointer to the data? That way I would only need to load the data once.


Currently, I do not think that there is a way of dong this, other than making the C function itself contain the interpolation table. I have now filed a suggestion for such an extension.

Regards,
Henrik


[QUOTE] To follow up and make sure I'm doing this properly, should I be passing the extra variables using the 'Material model parameters' list in the 'Material Contents' section? [/QUOTE] Yes [QUOTE] As a final question, in my C script, I load an external data set that is used to interpolate some values. It is a double array with ~1e6 values. Is there anyway to create a variable within Comsol that is initially empty that I can then fill with this data, or a pointer to the data? That way I would only need to load the data once. [/QUOTE] Currently, I do not think that there is a way of dong this, other than making the C function itself contain the interpolation table. I have now filed a suggestion for such an extension. Regards, Henrik