Conversation
44956eb to
b190d6c
Compare
Thomas-Ulrich
left a comment
There was a problem hiding this comment.
LGTM (as far as I can understand). See minor comments nevertheless.
|
|
||
| MeshSize{ PointsOf{Surface{:};} } = res; | ||
|
|
||
| //Physical Curve(1) = { 1, 8, 9, 11, 12, 6, 7, 4 }; // exterior |
There was a problem hiding this comment.
remove commented lines?
|
|
||
|
|
||
| function VolumeTagging:mu(x, y, tag) | ||
| local _tag = math.floor(tag) |
There was a problem hiding this comment.
why do you need to use math.floor?
In any case, if you want to avoid floor(3.99999999) = 3
you may want to try:
local _tag = math.floor(tag + 0.5)
There was a problem hiding this comment.
This is something I inherited from an old PR. Here: #39
We will not have this issue since it's always long int. I will remove the floor. Thanks!
src/mesh/MeshData.h
Outdated
| NumberingConvention convention_; | ||
| }; | ||
|
|
||
| class VolumeData : public MeshData { |
There was a problem hiding this comment.
calling it VolumeTagData would avoid confusion, as VolumeData are generally stored as ElementalData
There was a problem hiding this comment.
I like this. Was also iffy about the name. Thanks! Reminds me of this.
|
I am able to compile and run, thanks for implementing this feature! Maybe one thing to consider is to add an example to show users how to use the feature: and then another bp3_voltag.toml that refers to the new bp3_voltag.lua |
|
also one quick question when I use this: I am getting a lot nil results from the lua (though I should only get 1/2 as defined in the mesh ) for example: 2 --- Is Tandem calling this function for fault elements where tag is not defined ? Could this cause some ill defined scenarios on the lua end ? |
|
@baroryan thank you for taking a look!
|
|
Thanks Piyush! You were right about 2, my bad : ) |
Thomas-Ulrich
left a comment
There was a problem hiding this comment.
LGTM now. See also new comments.
| - **mesh_file**: Mesh file. | ||
| - **lib**: Lua file containing material & frictional paramters. | ||
| - **scenario**: Name of the specific scenario defined in the Lua library. | ||
| - **Lua material functions**: When volume tagging is used, `mu`, `lam`, and `rho` Lua functions also receive the volume tag as the last argument. |
There was a problem hiding this comment.
What about:
Note that the mu, lam, and rho Lua functions receive the volume tag as the last function argument. If region IDs are not set in the mesh, a value of -1 is assumed.
|
|
||
| function VolumeTagging:mu(x, y, tag) | ||
| local _tag = math.floor(tag) | ||
| local _tag = tag |
There was a problem hiding this comment.
in the end you don't need _tag its seems, you could use directly tag?
8b8df34 to
021c95c
Compare
Closes Issue: N/A
Summary:
This PR introduces volume tagging support, allowing material properties to be assigned regionally based on integer tags defined in the mesh (physical groups in Gmsh). The element tags are parsed, preserved during MPI parallel mesh partitioning, and exposed directly to Lua configuration scripts, enabling region-aware material property functions for Elasticity and Poisson operators.
Description: Changes
Mesh & Geometry: Captured element tags during mesh parsing in GlobalSimplexMeshBuilder (addElement). Introduced VolumeData (inheriting from MeshData) to handle the storage and MPI redistribution (via AllToAllV) of these tags across partitions. Extended Curvilinear to store and provide access to these tags via getVolumeTag(elNo).
Lua Scripting Integration: Extended LuaLib with getMemberFunctionTagged and functional_t_region to allow Lua material functions to accept an additional tag argument alongside spatial coordinates.
Form & Operators: Updated DGCurvilinearCommon::make_volume_functional to evaluate material functions by passing both the quadrature coordinates and the element's volume tag. ElasticityScenario, PoissonScenario, and SeasScenario were updated to use functional_t_region for material properties (mu, lam, rho, K). These can all be unified under a single functional_t once facet tagging comes in.
CI/Tests: Updated GitHub Actions to fetch test data from the volume-tagging-test branch of tandem_test_data. Refactored existing Python parallel consistency tests to be reusable and added a new volume tagging consistency test.
Tests
Unit tests:
Integration tests:
Additional Info
If a mesh is loaded that does not provide volume tags (or an older builder is used), the system safely defaults to assigning a tag of -1 to all elements and prints a warning to std::cerr.
tldr:
Volume tags from the mesh are now passed to Lua scripts. You can define region-specific materials in your TOML/Lua config like this: