Scaling arrays

Hi
For my model I have to produce an array of equidistant features, where each element is scaled (say linearly) with its position. I do not see such an option, except of manually doing it (but I might have hundreds of features).
Any idea on how to manage that?

Thanks

7 Replies Last Post Apr 26, 2017, 11:53 AM EDT
Jeff Hiller COMSOL Employee
Posted: 9 months ago Jan 11, 2017, 8:38 AM EST
Hello Yuri,
You could achieve such a geometry either with MATLAB (assuming you have LiveLink for MATLAB) or with a method in an application (assuming you use COMSOL on a Windows computer so you have the Application Builder).
Best regards,
Jeff
Hello Yuri, You could achieve such a geometry either with MATLAB (assuming you have LiveLink for MATLAB) or with a method in an application (assuming you use COMSOL on a Windows computer so you have the Application Builder). Best regards, Jeff

Posted: 9 months ago Jan 11, 2017, 10:00 AM EST
Jeff, thanks, Can I, once built it in app builder bring it back to COMSOL
Jeff, thanks, Can I, once built it in app builder bring it back to COMSOL

Jeff Hiller COMSOL Employee
Posted: 9 months ago Jan 11, 2017, 10:48 AM EST
Yes, an app can be used to create an "incomplete" mph file, e.g. one that contains just a geometry. You can then open that mph file in the GUI and continue from there.
Jeff
Yes, an app can be used to create an "incomplete" mph file, e.g. one that contains just a geometry. You can then open that mph file in the GUI and continue from there. Jeff

Jeff Hiller COMSOL Employee
Posted: 9 months ago Jan 11, 2017, 3:55 PM EST
The topic of generating a geometry with the Application Builder seems to pop up more and more often in the Discussion Forum, so I am attaching a simple example.
The app consists essentially in just one method. That method is triggered by one button. The method is written to create 7 equally spaced blocks of increasing sizes.
There is a Save menu that lets you save the mph file under a new name.
You can then open that mph file in a fresh GUI and add physics, mesh, etc. Alternatively, you can use "Insert Sequence" in an existing model file to import the 7 blocks. See PS below.

Using this approach, you can quickly generate geometries that would be tedious to put together in the GUI. You can also use this approach to generate randomized geometries - something that cannot be done in the GUI.

I hope this helps.
Best,
Jeff

PS: Yet another alternative is to, in the app, export the geometry as a .mphbin file instead of saving it in a .mph file. You then Import the .mphbin file into a new mph file. This has the benefit of not populating your new mph file's Geometry branch with lots of nodes you don't need.
The topic of generating a geometry with the Application Builder seems to pop up more and more often in the Discussion Forum, so I am attaching a simple example. The app consists essentially in just one method. That method is triggered by one button. The method is written to create 7 equally spaced blocks of increasing sizes. There is a Save menu that lets you save the mph file under a new name. You can then open that mph file in a fresh GUI and add physics, mesh, etc. Alternatively, you can use "Insert Sequence" in an existing model file to import the 7 blocks. See PS below. Using this approach, you can quickly generate geometries that would be tedious to put together in the GUI. You can also use this approach to generate randomized geometries - something that cannot be done in the GUI. I hope this helps. Best, Jeff PS: Yet another alternative is to, in the app, export the geometry as a .mphbin file instead of saving it in a .mph file. You then Import the .mphbin file into a new mph file. This has the benefit of not populating your new mph file's Geometry branch with lots of nodes you don't need.


Posted: 7 months ago Mar 31, 2017, 10:02 AM EDT
Hi Jeff,
But if we have never used JAVA scripts before? How could we use the application builder as mentioned ?
Thanks
Hi Jeff, But if we have never used JAVA scripts before? How could we use the application builder as mentioned ? Thanks

Jeff Hiller COMSOL Employee
Posted: 7 months ago Mar 31, 2017, 11:03 AM EDT
I'll speak from personal experience: I learned a bit of Java way back in grad school and had forgotten most of it by the time COMSOL came up with apps. What I've found is that the Application Builder includes several tools that make it easier to develop methods if you do not have prior experience with Java (or limited experience like myself): "Record code", "Language Elements", "Model Expressions", as well as code completion and a built-in debugger.

There have been a few webinars that discuss some of these capabilities. You can find archived webinars on the App Builder here:
www.comsol.com/events/webinars/archive?eventtype%5B%5D=event_webinar&startTime=8&endTime=20&eventtopic%5B%5D=application-builder&view=cards&events_sort=date

Best,
Jeff
I'll speak from personal experience: I learned a bit of Java way back in grad school and had forgotten most of it by the time COMSOL came up with apps. What I've found is that the Application Builder includes several tools that make it easier to develop methods if you do not have prior experience with Java (or limited experience like myself): "Record code", "Language Elements", "Model Expressions", as well as code completion and a built-in debugger. There have been a few webinars that discuss some of these capabilities. You can find archived webinars on the App Builder here: https://www.comsol.com/events/webinars/archive?eventtype%5B%5D=event_webinar&startTime=8&endTime=20&eventtopic%5B%5D=application-builder&view=cards&events_sort=date Best, Jeff

Posted: 6 months ago Apr 26, 2017, 11:53 AM EDT
Okay thank you ! I hope that i could understand it because i need it to build my geometry !
Kind regards Jeff
Okay thank you ! I hope that i could understand it because i need it to build my geometry ! Kind regards Jeff

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.