Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

define vector as input parameter

Please login with a confirmed email address before reporting spam

Hi,

How can I define a vector as input parameter in Comsol by matlab? Specifically, suppose a vector has 100 items, then every item will be used to define material properties at different regions. After first calculation, the detailed value of the vector will be changed in the matlab, then a new calculation will be started based on the redefined vector parameter.

Thank you very much.

3 Replies Last Post 1 feb 2015, 17:50 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 19 dic 2014, 17:08 GMT-5
Your intent is not quite clear. If you want to have a material property defined as a function of material coordinates, then define a MATLAB function that receives the coordinates and returns the scalar property for those coordinates. You should then be able to link to the function in the Global Definitions node.

Is there a reason you cannot define the material property function directly in COMSOL instead of MATLAB? Then you could implicitly use the spatial coordinates with an analytical function, which might simplify things (COMSOL has substantial capability built in). This would especially work well if the property varies with some other COMSOL variable, hence leveraging the multiphysics features of COMSOL.

If this does not answer your question, please provide more information, or provide example files.

--
Steven Conrad, MD PhD
LSU Health
Your intent is not quite clear. If you want to have a material property defined as a function of material coordinates, then define a MATLAB function that receives the coordinates and returns the scalar property for those coordinates. You should then be able to link to the function in the Global Definitions node. Is there a reason you cannot define the material property function directly in COMSOL instead of MATLAB? Then you could implicitly use the spatial coordinates with an analytical function, which might simplify things (COMSOL has substantial capability built in). This would especially work well if the property varies with some other COMSOL variable, hence leveraging the multiphysics features of COMSOL. If this does not answer your question, please provide more information, or provide example files. -- Steven Conrad, MD PhD LSU Health

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 27 gen 2015, 19:37 GMT-5
Hi,

Dr. Steven Conrad, thank you very much for your help and sorry for the late reply because of other duties.
We are trying to simulate a conductor and current density on the cross-section needs to be distributed like attached figure 'finial'. At the beginning of simulation, we set a uniform conductivity at the cross-section and get current distribution like attached figure 'initial'. Then we compare the current density with the Jc (which is a value shown in figure 'finial'). According to the comparison, we revise the conductivity and calculate again. So we would get the current distribution like figure 'finial' after iteration. All in all, our aim is to adjust conductivity so that the current density could be distributed like figure 'finial'.
Thank you again.

Best regards,
Jing Wang
Hi, Dr. Steven Conrad, thank you very much for your help and sorry for the late reply because of other duties. We are trying to simulate a conductor and current density on the cross-section needs to be distributed like attached figure 'finial'. At the beginning of simulation, we set a uniform conductivity at the cross-section and get current distribution like attached figure 'initial'. Then we compare the current density with the Jc (which is a value shown in figure 'finial'). According to the comparison, we revise the conductivity and calculate again. So we would get the current distribution like figure 'finial' after iteration. All in all, our aim is to adjust conductivity so that the current density could be distributed like figure 'finial'. Thank you again. Best regards, Jing Wang


Please login with a confirmed email address before reporting spam

Posted: 9 years ago 1 feb 2015, 17:50 GMT-5
Jing,

If the conductivity could be described as a parameterized equation, then it would be a candidate for the Optimization Module. At first glance, that may not be possible, at least easily.

The approach I would consider is to add a Coefficient Form PDE physics to your model and define the conductivity as its dependent variable, allowing you to solve for it on the mesh. You would then create a PDE that would describe conductivity in such a way as to represent the difference between your solution electric field and your desired field, which should converge the conductivity to the desired value.

I have not yet tried this approach, but these are my initial thoughts.

--
Steven Conrad, MD PhD
LSU Health
Jing, If the conductivity could be described as a parameterized equation, then it would be a candidate for the Optimization Module. At first glance, that may not be possible, at least easily. The approach I would consider is to add a Coefficient Form PDE physics to your model and define the conductivity as its dependent variable, allowing you to solve for it on the mesh. You would then create a PDE that would describe conductivity in such a way as to represent the difference between your solution electric field and your desired field, which should converge the conductivity to the desired value. I have not yet tried this approach, but these are my initial thoughts. -- Steven Conrad, MD PhD LSU Health

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.