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.
Load materials from library with Java API
Posted 18 mars 2013, 14:45 UTC−4 API, Simulation Apps, Materials Version 4.2 2 Replies
Please login with a confirmed email address before reporting spam
Hello COMSOL aficianados,
We are working with the Java API for COMSOL here. Let's say you want to load the material copper into your model. It seems, according to the manual, that the only way to get all the material properties is to define them all yourself using e.g.:
myModel.material().create("mat1");
myModel.material("mat1").name("Material name");
myModel.material("mat1").set("roughness",0.1);
myModel.material("mat1").set("shininess",200);
myModel.material("mat1").propertyGroup("def").set("density","8700[kg/m^3]");
etc. ad nauseum for every single material property.
My question - is there a way to just do, using the API, what I would do in the GUI, which is to load the pre-defined material from the COMSOL materials library? Something like:
myModel.material().loadFromLibrary("copper")
and that would automatically just load up everything into the model?
Link to COMSOL 4.2 Java API manual:
nf.nci.org.au/facilities/software/COMSOL/4.2/doc/pdf/mph/COMSOLJavaAPIReferenceGuide.pdf
We are working with the Java API for COMSOL here. Let's say you want to load the material copper into your model. It seems, according to the manual, that the only way to get all the material properties is to define them all yourself using e.g.:
myModel.material().create("mat1");
myModel.material("mat1").name("Material name");
myModel.material("mat1").set("roughness",0.1);
myModel.material("mat1").set("shininess",200);
myModel.material("mat1").propertyGroup("def").set("density","8700[kg/m^3]");
etc. ad nauseum for every single material property.
My question - is there a way to just do, using the API, what I would do in the GUI, which is to load the pre-defined material from the COMSOL materials library? Something like:
myModel.material().loadFromLibrary("copper")
and that would automatically just load up everything into the model?
Link to COMSOL 4.2 Java API manual:
nf.nci.org.au/facilities/software/COMSOL/4.2/doc/pdf/mph/COMSOLJavaAPIReferenceGuide.pdf
2 Replies Last Post 25 mars 2013, 11:50 UTC−4