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.

Evaluating Volume in Livelink

Please login with a confirmed email address before reporting spam

The below post is related to an archived discussion


I came with the same question about evaluating the volume of my geometry in Livelink,

One can evaluate the volume right after running the model (not before) using

model.result.numerical.create('meas1', 'MeasureVolume'); model.result.numerical('meas1').selection.all; %or other selection depending on your problem model.result.numerical('meas1').setResult; current_volume = model.result.numerical("meas1").getReal

Otherwise, if one wants to evaluate to evaluate the volume before running the model, consider for instance that you want to create a geometry with a desired volume within a loop (see for instance https://www.comsol.com/blogs/how-to-create-a-randomized-geometry-using-model-methods/), the previous method is not practical. I have done this via the mesh node.

current_volume = mphmeshstats(model,'mesh1').volume

If one have several meshes then, one has to sum up them all.

Is there other solution, perhaps at the geometry node?


2 Replies Last Post Dec 13, 2023, 12:06 p.m. EST
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 11 months ago Dec 13, 2023, 10:41 a.m. EST

You can measure the volume of a domain WHILE you run the model by integrating 1 in that domain of interest in a nonlocal coupling. This can be done directly in COMSOL. I guess there is an option to do it over the Livelink, but I am not using that.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
You can measure the volume of a domain WHILE you run the model by integrating 1 in that domain of interest in a nonlocal coupling. This can be done directly in COMSOL. I guess there is an option to do it over the Livelink, but I am not using that. Cheers Edgar

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 11 months ago Dec 13, 2023, 12:06 p.m. EST
Updated: 11 months ago Dec 13, 2023, 11:52 a.m. EST

You also don't need to solve or (resolve) any physics. You can "get initial values" (or "update solution") instead to compute (or recompute) a quantity that is not impacted by the solution of the physics.

Jeff

-------------------
Jeff Hiller
You also don't need to solve or (resolve) any physics. You can "get initial values" (or "update solution") instead to compute (or recompute) a quantity that is not impacted by the solution of the physics. 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.