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.

Packed bed geometry from .xyz file

Please login with a confirmed email address before reporting spam

Dear all,

I'm a Chemical Engineer PhD student and I'm trying to perform CFD simulations in comsol throughout a previous calculated Monte Carlo geometry represented by an .xyz file. This geometry file contais a matrix whit 3D coordinates of the centre of different spheres with the same diameter. This file represent a sort of packed bed (cake deposition) created by the adsorption of colloidal macromolecules during filtration processes. I would to import this file, generate geometry and perform micro-CFD simulations around that "spheres packed bed".

Can someone say me if in comsol is possible to generate geometry from .xyz file?

Thanks in advance, Francesco


4 Replies Last Post 2019年7月9日 GMT-4 08:53
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2019年7月8日 GMT-4 08:20
Updated: 5 years ago 2019年7月8日 GMT-4 08:20

Hello Francesco,

You can create geometry programmatically via MATLAB programming (if your license includes the optional LiveLink for MATLAB product) or by using model methods. See this thread where various resources are pointed out: https://www.comsol.com/forum/thread/123442/creating-geometry-with-an-algorithm .

Best regards,

Jeff

-------------------
Jeff Hiller
Hello Francesco, You can create geometry programmatically via MATLAB programming (if your license includes the optional LiveLink for MATLAB product) or by using model methods. See this thread where various resources are pointed out: https://www.comsol.com/forum/thread/123442/creating-geometry-with-an-algorithm . Best regards, Jeff

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2019年7月8日 GMT-4 09:12
Updated: 5 years ago 2019年7月8日 GMT-4 11:04

Hello Francesco,

I just noticed that you indicate you are using version 5.2. Since model methods were introduced at version 5.3, that is not an option for you. However, you could still create your geometry using JAVA programming (much like you would in model methods) using the Application Builder to create an app that uses a method to create the geometry. It's less direct than a model method but it will work. This recorded webinar uses that approach: https://www.comsol.com/video/automating-preprocessing-and-postprocessing-with-application-builder-features .

Yet another option, again using JAVA as the programming language, consists in using the COMSOL API.

Best regards,

Jeff

-------------------
Jeff Hiller
Hello Francesco, I just noticed that you indicate you are using version 5.2. Since model methods were introduced at version 5.3, that is not an option for you. However, you could still create your geometry using JAVA programming (much like you would in model methods) using the Application Builder to create an app that uses a method to create the geometry. It's less direct than a model method but it will work. This recorded webinar uses that approach: https://www.comsol.com/video/automating-preprocessing-and-postprocessing-with-application-builder-features . Yet another option, again using JAVA as the programming language, consists in using the COMSOL API. Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2019年7月9日 GMT-4 07:58
Updated: 5 years ago 2019年7月9日 GMT-4 07:57

Dear Jeff,

thanks very much for your advice. I'm a Matlab user so maybe the best way is to use Matlab. On the other ways maybe is not simple for me because I'm not very confidently with Java programming.

I'll try with matlab and for any questions I'll aks you. Do you have any other sujjestions about Matlab, like specific tutorial?

Best regards, Francesco

Dear Jeff, thanks very much for your advice. I'm a Matlab user so maybe the best way is to use Matlab. On the other ways maybe is not simple for me because I'm not very confidently with Java programming. I'll try with matlab and for any questions I'll aks you. Do you have any other sujjestions about Matlab, like specific tutorial? Best regards, Francesco

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2019年7月9日 GMT-4 08:53
Updated: 5 years ago 2019年7月9日 GMT-4 11:08

A convenient way to learn the syntax, if you have not worked with LiveLink for MATLAB before, is to build a model in the GUI and save it as a .m file. That .m file will contain lines of MATLAB code needed to create the same model you put together in the GUI. In your case it seems like all you need to do in MATLAB is get information stored in a file and then do a for loop around the creation of a sphere, with the rest of your modeling being done in the GUI.

Also, I'd recommend going through the manual entitled Introduction to LiveLink for MATLAB. You can find it within the software, under File > Help >Documentation. It includes a tutorial with step-by-step instructions.

A few videos on using LiveLink for MATLAB (from shorter to longer): https://www.comsol.com/video/livelink-matlab-demonstration https://www.comsol.com/video/18-minute-intro-to-livelink-for-matlab https://www.comsol.com/video/intro-to-scripting-using-livelink-for-matlab

If you should need further assistance, please contact our support team through email (support@comsol.com) or by phone by calling your local rep (You can find their info here: www.comsol.com/contact) .

Best regards,

Jeff

-------------------
Jeff Hiller
A convenient way to learn the syntax, if you have not worked with LiveLink for MATLAB before, is to build a model in the GUI and save it as a .m file. That .m file will contain lines of MATLAB code needed to create the same model you put together in the GUI. In your case it seems like all you need to do in MATLAB is get information stored in a file and then do a for loop around the creation of a sphere, with the rest of your modeling being done in the GUI. Also, I'd recommend going through the manual entitled Introduction to LiveLink for MATLAB. You can find it within the software, under File > Help >Documentation. It includes a tutorial with step-by-step instructions. A few videos on using LiveLink for MATLAB (from shorter to longer): https://www.comsol.com/video/livelink-matlab-demonstration https://www.comsol.com/video/18-minute-intro-to-livelink-for-matlab https://www.comsol.com/video/intro-to-scripting-using-livelink-for-matlab If you should need further assistance, please contact our support team through email (support@comsol.com) or by phone by calling your local rep (You can find their info here: www.comsol.com/contact) . Best regards, Jeff

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.