First time here? Checkout the FAQ!
x
0 votes
by (120 points)
retagged by

Hello everyone,

I wanted to ask if there is a way to assign a specific tag number (which is, by default, 1) to a block?

For example, I generate a block (mesh.Block), on which I then define different regions (e.g. a sphere, box, cylinder, ...), which in turn I can assign a tag number to. What I am looking for is something like:

geom = mesh.Block(size=(x, y, z), resolution=1., tag=0)

To my knowledge, this is possible only for connecting linear elements of the underlying geometry (for boundary conditions) and for regions of the block but not the block itself.

Cheers in advance,

Joshua

2 Answers

0 votes
by (19.1k points)

Does this function provide what you are looking for?

https://opencarp.org/documentation/carputils-documentation#master/classcarputils_1_1mesh_1_1block_1_1Block.html%23a51c587a5cc73bc84a78ffed1b3b5b773

If yes, then it could indeed make sense to add this extra option to the constructor as you suggested.

0 votes
by (610 points)
I think that Block does not support a variable default tag. Instead any elements which are not tagged explicitely will be tagged as 1.

A possible solution is to setup the tag for the complete mesh. For instance if you have a Block mesh you can assign BoxRegion over the whole domain. For that you can addapt the following code:

    (x, y, z) = (10, 10, 10)
    default_tag = 0
    geom     = mesh.Block(size=(x, y, z), resolution=1.)
    initial  = mesh.BoxRegion(lowerleft=(-x/2,-y/2.,-z/2.), upperright=(x/2,y/2,z/2), tag=default_tag)
    geom.add_region(initial)

Just make sure to add all your region before adding the initial region, otherwise the initial region will take precedence (so it will be the only region in the mesh).
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...