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.
Save as java file
Posted Dec 13, 2010, 8:20 a.m. EST API, Simulation Apps Version 4.1 10 Replies
Please login with a confirmed email address before reporting spam
On Comsol 4.1:
I'm trying to use java editing to build a dynamic model with subsequent changes in the geometry based on results of previous simulations. I would like to start from a model I already built and simulated with the GUI, but when I export the model into Java I get the whole history of my actions, like deleting/modifying stuff, so the code is full of useless parts. Is there any way of cleaning up the code automatically? Something like "save the model as it is" discarding all the history?
Many thanks,
Giuseppe Schiavone
Please login with a confirmed email address before reporting spam
have you tried int eh v4.1, "file reset model" ?
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
didn't really see the menu item.. It works fine! Thanks a lot!
G. Schiavone
Please login with a confirmed email address before reporting spam
Hi G. Schiavone,
Can you please tell from where I can get some java examples.
I want to creat a random distribution of my geometry feature (rectange) within a certain area(bigger rectangle). I make the rectangle in COMSOL GUI and then save model as .java file ... open it in Java editor and now I want to put random function and loops so that I can get randomly placed rectangles within a certain area (bigger rectangle)
In other words you can say that I want to make randomly placed rectangles within a bigger rectangle....
Thanks in advance
Please login with a confirmed email address before reporting spam
If you want Java code examples google is your friend. If you want COMSOL Java code samples.... just open any model and export it as Java and you'll have the code which you can read>understand>edit as you like.
Hope this was helpful..
G. Schiavone
Please login with a confirmed email address before reporting spam
If you want COMSOL Java code samples.... just open any model and export it as Java and you'll have the code which you can read>understand>edit as you like.
Thanks a lot. Yes I need COMSOL JAVA code samples. However, I do not find any model that used loops. So is it possible to script loops in COMSOL JAVA scripting?
Thanks again
Please login with a confirmed email address before reporting spam
I used a while loop to redraw the geometry according to some values computed in the solution. So the cycle was: draw, compute, extract values -> modify geometry accordingly and all over again..
Not sure how Java works for what you want to do, but I don't think it'll take too much fiddling about to implement a simple loop cycle.
Keep experimenting!
G.Schiavone
Please login with a confirmed email address before reporting spam
Thanks
Alex
Please login with a confirmed email address before reporting spam
After doing above all. Run Comsol server, you should find it some where in start menu. After the server is running, click the play button to run the program in Eclipse.
I hope this helps ..... questions are welcome
Please login with a confirmed email address before reporting spam
I have tried it with the feeder clamp model and I only see messages been displayed in the Comsol server window saying that a client has connected/disconnected, but nothing more happens... I am using Comsol version 4.2.
Do you know what is the expected result of executing a Java model externally from Eclipse? Thank you very much for your help.
Please login with a confirmed email address before reporting spam
Does COMSOL allow you to restore a previous version of a model like this, given that all the information is contained in the java file?
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.
Suggested Content
- BLOG Best Practice for Working with Model M-Files
- KNOWLEDGE BASE Trusting server certificates in COMSOL Multiphysics
- BLOG How to Use Model Methods to Accelerate Your COMSOL® Workflow
- FORUM Save Solution in a Java File for copying result plots
- BLOG Automate Your Modeling Tasks with the COMSOL API for use with Java®