Condition over duplicate nodes using CustomLIB

Moderator: GiD Team

Post Reply
fcdiass
Posts: 16
Joined: Fri Nov 08, 2019 8:04 pm

Condition over duplicate nodes using CustomLIB

Post by fcdiass »

Hello, I have the same problem reported years ago on this topic: https://www.gidhome.com/forum/viewtopic.php?f=9&t=2877.

The difference is that I am using the new problem type, based on the CustomLIB library.

I need to define a boundary condition (fixed displacement in x and y directions) for a group of lines. In this way, I created a group with the lines that I want to apply this fixed displacement:
Screenshot 2022-02-02 142713.png
Screenshot 2022-02-02 142713.png (24.95 KiB) Viewed 4970 times
Also, I need to create discontinuities. I duplicate the nodes in the following lines:
Screenshot 2022-02-02 143744.png
Screenshot 2022-02-02 143744.png (1.44 KiB) Viewed 4970 times
When I generate the mesh, everything is apparently correct. The following image shows the mesh, highlighting the duplicated nodes.
Screenshot 2022-02-02 141634.png
Screenshot 2022-02-02 141634.png (10.2 KiB) Viewed 4970 times
The problem appears when I need to obtain the nodes in the group "Fixed_xy".

Command:

Code: Select all

GiD_EntitiesGroups get "Fixed_xy" nodes
Output:

Code: Select all

1 2 4 10 11 12 13 16
Although nodes 3, 5, 14, and 15 belong to the "Fixed_xy" group, the output of the GiD_EntitiesGroups function does not contain them.

Can someone help me to deal with this problem?
fcdiass
Posts: 16
Joined: Fri Nov 08, 2019 8:04 pm

Re: Condition over duplicate nodes using CustomLIB

Post by fcdiass »

Additional information:

I am using the GiD version 14.0.6.

The example used in the previous post:
DuplicatedNodesCustomLIB.gid.zip
(4.41 KiB) Downloaded 186 times
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Condition over duplicate nodes using CustomLIB

Post by escolano »

Duplicate is a rare meshing feature, and it seems that some duplicated nodes are not assigned to the groups.
This is really a bug, it must inherit the group from the geometric entity.

We will study to fix it, but the fix will be available only for next GiD 15.0.x official and 15.1.xd developer (It won't be new 14.x versions)

Until a fix is available you must do some trick, like automatically detect by proximity duplicated nodes and assign to the wanted groups, etc.
fcdiass
Posts: 16
Joined: Fri Nov 08, 2019 8:04 pm

Re: Condition over duplicate nodes using CustomLIB

Post by fcdiass »

The team do not fix this bug in version 14 is unfortunate. I noticed you use – at least in the official versions of GiD – semantic versioning (https://semver.org/). I think this situation demands an increment in the PATCH version (14.0.x) and not an increment in the MINOR version (14.x), as you suggested. As a user and a developer, I kindly ask you to reconsider your decision.

Duplicate is a rare mesh feature, but what is the point in offering it if you can't apply a condition to duplicate nodes?

About the trick you suggest:
I thought of verifying all nodes in a group with duplicated nodes. Doing this, I would need to compare the coordinates of each node in a group with the rest of the mesh nodes. If two nodes have the same coordinates, I should add the duplicated node in the group.
This solution is simple and easy to implement. The problem is: When working with medium/large models, it would come into a computational efficiency issue. For example, if the model has 500 000 nodes and the condition group has 10 000 nodes, I will need to verify 5 000 000 000 times (500 000 x 10 000).

Questions:
- Is there any way to verify and add the nodes in all the group conditions more efficiently? Can you help me with examples? (I can't help to say that, in my opinion, the most efficient way to do it is to add the duplicated node when GiD duplicates it. And the only one who can make this is the CIMNE team, releasing a PATCH version for GiD 14).
- As you said, I could "automatically detect by proximity duplicated nodes." How am I supposed to do it? Has GiD a built-in function that detects close nodes? For example, I give the node number, and GiD returns the nearest nodes inside a spheric region with radius r.
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Condition over duplicate nodes using CustomLIB

Post by escolano »

Our current policy of versions is that release an new main official version 14, 15,... each two years. (we are close to GiD 16.0, GiD 14.0 is about four years old)
And we maintain two lines, e.g. for current main version=15
- 15.1.xd developers, with the news of the next two yeas and officials
- 15.0.x with fix, with fixed bugs (minor changes ,and never new features)
The fix of bugs is not ported to older main versions like 14.0.7 that you suggested, or other versions 13.0.x, 12.0.x, ... and so one
(we are a small team to maintain all previous official versions, and for all platforms: Windows x63, x32, Linux, macOs)

The related bug is now fixed for next GiD 15.0.4 official and 15.1.5d developer versions, and the duplicated nodes will inherit also the group (not the conditions that doesn't had this bug)

About the possibilities, you can simply wait and upgrade to GiD 15, and/or for GiD 14 you can do some tricky fix in our problemtype to automatically assign (e.g. in the event of mesh generation) the duplicated nodes to the missing groups.

Off course finding by brute force will be O(N^2) and computationally unaffordable for not so big models
Sorry, we don't provide to scripting any finding near entities method or spatial search data structure (oct-tree, kd-tree, etc.)

You can do more specific implementations, for example
-duplicated nodes (probably) have exactly the same coordinates, you can a simple Tcl array with the "x,y,z" coordinates of each node as string key. This will be a O(N) finding method.
-or the conditions are inherit for duplicated nodes, then can define and apply and auxiliary condition, and assign to the groups to the entities with this condition, without any search.
fcdiass
Posts: 16
Joined: Fri Nov 08, 2019 8:04 pm

fcdiass

Post by fcdiass »

Thank you so much for your explanation.

I was trying to implement some tricks for the 14 version of GiD.
No matter what choice I make, I will have to identify duplicate nodes after each new mesh generation. So I tried to use the built-in function GiD_Event_AfterMeshGeneration with no success.

Even a simple definition as

Code: Select all

proc GiD_Event_AfterMeshGeneration { fail } {
    W "Test!"
}
was not capable of running correctly. After generating the model mesh (Mesh -> Generate mesh... [Ctrl-g]) no message is displayed. It seems that GiD is not calling the GiD_Event_AfterMeshGeneration function.

I also tested the GiD_Event_BeforeMeshErrors, GiD_Event_BeforeMeshProgress, GiD_Event_MeshProgress, GiD_Event_AfterMeshProgress and GiD_Event_AfterChangeMesh. I could only do what I meant with the GiD_Event_AfterChangeMesh. But I noticed that GiD_Event_AfterChangeMesh is called twice when I generate the mesh. The first time, the function receives as parameters num_nodes=0 and num_elem=0. Only the second time, the function correctly receives the number of nodes and elements in the mesh.

Questions:
- Which functions (those mentioned above) are actually being called by GiD 14?
- In what situations GiD_Event_AfterChangeMesh function is called? Why sometimes it receives as parameters num_nodes=0 and num_elem=0? I need to understand if I need to do some treatment when the function GiD_Event_AfterChangeMesh receives parameters equal to zero.
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Condition over duplicate nodes using CustomLIB

Post by escolano »

The event names that you are trying like GiD_Event_AfterMeshGeneration exists in current GiD 15 versions
In GiD 14.0.6 the old event was named AfterMeshGeneration (it is already raised in GiD 15 for back compatibility)

proc AfterMeshGeneration { fail } {
W "hello"
}

See the menu: Help->Customization manual to know the valid commands of your exact GiD version
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Condition over duplicate nodes using CustomLIB

Post by escolano »

Exceptionally we have released a new GiD 14.0.7 official version with this fix, but only for Windows platforms.
It is available in our webpage: https://www.gidhome.com/download/official-versions
fcdiass
Posts: 16
Joined: Fri Nov 08, 2019 8:04 pm

Re: Condition over duplicate nodes using CustomLIB

Post by fcdiass »

Thank you so much for your help!
Post Reply