## Why a NURBS surface always automatically rotates after being generated

Moderator: GiD Team

KHTseng
Posts: 5
Joined: Wed Jun 05, 2019 4:24 pm

### Why a NURBS surface always automatically rotates after being generated

Dear All,

I have a question about generating a NURBS surface:
That the generated NURBS surface (by points) always be rotated automatically.
For example: 1) A set of xyz data was imported for representing the topography.
2) Then I used geometry->create->NURBS surface->by points to select all the dots for generating a NURBS surface.
(I tried to do this is because I have to generated meshes for the controlled-source EM problem which considers topography. And I want to use the NURBS surface to save the memory from millions dots to one surface)
3) press ESC to create the NURBS surface.

Then the result is shown as above figure.
I have no idea why this problem happen because I made another one successfully in several months ago. However, I couldn't remember the flow what I tried.

-------
By the way, may I know if there is any way to add some points and lines in the NURBS meshes for assigning sizes during generating the unstructured meshes?
I hope to generate finer meshes near some points (as the observation sites) and two lines (as the transmitter power line). My idea is:
1) creating the ground as a NURBS surface (from topography dots),
3) mesh->unstructured->assign sizes on [points/line/surface] (for stations, transmitters and ground) to generate meshes as following style

I will be very grateful for any suggestions.
Have a nice day

K. H. Tseng
escolano
Posts: 1624
Joined: Thu Sep 18, 2014 3:31 pm

### Re: Why a NURBS surface always automatically rotates after being generated

The "create NURBS surface by points" tools as first step calculate x'y'z' local axes, and do a projection in z' axis, and a bounding box in x'y' axes.

To calculate these local axes is considering your points as a cloud of concentrated masses and calculate its main inertia axis.
The x'y' could become not parallel to global xy as you expected (it your particular case were the points are inside a xy projected rectangle)
Nowadays you cannot control how to select these x'y'z' local axes (e.g. to use the XYZ global axes like you wanted, maybe we can add this feature for next versions)

If do you want, you can try to trim the surface created, cutting it with the surfaces extruded from the rectangular lines you want.

Consider also the option of create from a cloud of nodes a grid of surfaces/elements (or a raster Arc/Info ASCII file), respectively with
-Geometry->Create->Geometry from mesh->Nodes to grid surfaces
-Files->Export->Nodes to raster

About assign mesh sizes to geometrical entities, you can only assign it to the boundary lines and/or points of the surface. There are not 'inner points or lines' on the surface.
what you can try is a meshing preference that automatically refine the mesh based on the 'curved inner parts' of the surface (really based on the 'chordal error' or distance between the mesh and the surface shape)
Utilities->Preferences... Meshing->Chordal error
try setting a relative and/or absolute 'chordal error', and maybe other of the possible setting.

About the points to place your 'transmitters', you can try to force some points to be on the final mesh (to have a node with its coordinates).
Mesh->Mesh criteria->Force points to->Surface mesh
A final meshing step will force to have these points on the surface mesh (moving some node or inserting some new node)
but I thing that you cannot assign mesh sizes to these points to have control on the surface mesh size.
KHTseng
Posts: 5
Joined: Wed Jun 05, 2019 4:24 pm

### Re: Why a NURBS surface always automatically rotates after being generated

Dear escolano,

Thank you very much for your explanation.
a)
The second figure which I attached in my first post was also created by GiD in couple of months ago (with a correct fitting between NURBS surface and dot data cloud), then I wander why the NURBS surface became different in this time.

As your mentioned explanation about the x'y'z' projection, seems the new z' is created by some interpolation method (?). Then I wander how the z' is calculated where out of the surface cloud (whether that is close to the nearest point or some mean value from the local points). However, that may become an acceptable error for my result which I do not have to worry about, probably.

[Consider also the option of create from a cloud of nodes a grid of surfaces/elements (or a raster Arc/Info ASCII file), respectively with
-Geometry->Create->Geometry from mesh->Nodes to grid surfaces
-Files->Export->Nodes to raster]
Unfortunately, I am using the GiD with version 13, that the above mentioned instruction doesn't work (there is no "Nodes to grid surface" under the "Geometry from mesh").

b)
Then for the created NURBS surface, may I know if there is any setting for the resolution of NURBS surface? That I create one surface from million of dots but the details look not so clean as the dot cloud. Which some of the specific topography characteristics that I want to present are at the center of this surface.

c)
For the explanation about assigning mesh sizes near lines and points on a surface, I found some stuffs of my past work with GiD:
Screen Shot 2019-06-06 at 4.24.08 PM.png (38.43 KiB) Viewed 4483 times
Screen Shot 2019-06-06 at 4.24.18 PM.png (16.31 KiB) Viewed 4483 times
Screen Shot 2019-06-06 at 4.26.07 PM.png (14.7 KiB) Viewed 4483 times

I can easily figure out how did I make the points for assigning mesh sizes. By simply using the routine of splitting surface then did the way as the one which mentioned in the tutorial.
But sadly to say, I couldn't remember how did I make the line in a surface with GiD...
That seems I created two lines by several points and combined the lines with the NURBS surface as an inner boundary (now I couldn't understand why an inner boundary could exist without any connection with other boundaries, but obviously it worked with some way before...). May I know if you have any idea for the similar process?

Wish you have a nice day.
K. H. Tseng
escolano
Posts: 1624
Joined: Thu Sep 18, 2014 3:31 pm

### Re: Why a NURBS surface always automatically rotates after being generated

a) z coordinate is extrapolated as you pointed, with a kind of weighted average of a cloud of closed points

b) There is not possible to have user control on the resolution the NURBS surface created, it is automatic, in any case it is only an approximation, does not fit the original points.

c) I don't know how have you created in the past the entities of the model of your pictures.
Maybe they were created from a triangulation, that wast tried to be converted in geometry using the tools like
Geometry->Create->Surf mesh (this create surf-meshes, that are GiD pseudo-surfaces with shape defined by a underlying triangulation)
or
Geometry->Create->Geometry from mesh->NURBS patches
both cases try to divide the triangles in parts, and create its points, lines and surfaces.

About creating curves on an existent surface, you can divide it in u or v parametric direction
Geometry->Edit->Divide->Surfaces
or create the curve by intersection with other auxiliary surface (e.g. some extra plane)
Geometry->Edit->Intersection->Surfaces
or
Geometry->Edit->Intersection->Surface 2 points
(this ask for 2 points on the surface, and create do do the intersection a 'virtual plane' with the points and a normal averaging the normal of the surface on the points)
KHTseng
Posts: 5
Joined: Wed Jun 05, 2019 4:24 pm

### Re: Why a NURBS surface always automatically rotates after being generated

Dear escolano,

Thank you very much for the detailed explanation about how the GiD create NURBS surface.
Now I have a clearer view.

About the interesting question that how did I make that mesh which can solve all of my questions...
Well, I tried to use a smaller dot cloud, from a square shape to a rectangular shape. Surprisedly, the NURBS surface fit the shape of cloud now. I couldn't explain the reason but it just works. (Thus, the NURBS problem is solved.)
Now I am trying to follow your suggestions to combine the line with the NURB surface.
The closest result was madden by "Geometry->intersection->surface-line"
That I got the following result:

The all the dots are chosen to make a NURBS surface, and two lines (blue) are made by parts of that dots.
The purple lines are, what I think, the projected lines on the NURBS surface. The follow figure shows the mesh result which assigned the blue lines:

That we can see the result is not completely correct. I think that only part of the blue lines successfully projected to the NURBS surface.

Is there anyway to draw a short line on the NURBS surface by two points? (The "Geometry->intersection->surface-2 points" will split the surface instead of make a short line on the surface).
Or, is there any trick for adjusting the result to make the blue lines fully project to the NURBS surface? (that the purple lines should have fully same shape as blue lines)

Best regards,
K.H. Tseng
escolano
Posts: 1624
Joined: Thu Sep 18, 2014 3:31 pm

### Re: Why a NURBS surface always automatically rotates after being generated

The pink lines is a way of represent the surface in 'normal render'.
The surface is represented drawing its lines 'a little' contracted to 'a center'

Usually the surface lines are only the ones of its outer boundary or inner boundary of holes.

By intersection or collapsing it is possible that finally the surface include the intersection line in its boundary definition. It is like a special hole or gap, with zero depth. The same curves are repeated twice for the surface boundary definition, once in a direction and another time in the opposite direction.

It is not possible to add this 'kind of holes' manually.
In fact when selecting entities, the second time that an entity is specified in become unselected. (the selection is a list of integer ids without repetition)

The surface mesh will match the line mesh of its boundary curves, but not other curves (also if in 3D space the curve is 'on the surface')
KHTseng
Posts: 5
Joined: Wed Jun 05, 2019 4:24 pm

### Re: Why a NURBS surface always automatically rotates after being generated

Thank you very much for the explanation about the NURBS surface, escolano.
Consider the limitation of NURBs surface, I decided to move to the way for making the surfaces by lines and dots.
With giving up the resolution of topography, the geometry can still represent some rough characteristics.

It seems the geometry issue has been solved. But I am still, unfortunately, facing another problem about the GiD crash during generating the meshes.

Here are some informations of my geometry design:
i. a center area which the surfaces are created by several dots with 50(size) grids (contains 12 dots [Rx] and 29 lines [Tx])
ii. an intermediate area which the surfaces are created by several dots with 200(size) grids
iii. an outer boundary area which surfaces are created by the edge lines of intermediate area and two dots at 200,000(size) away.
iv. a volume(z+) which created by i+ii+iii (as the above figures)
v. a volume(z-) which create by i+ii+ a boundary surface at 10,000,000.

I am trying to generate unstructured tetrahedral meshes for my model with the follow characteristics:
a) the edges, elements which near Rx and Tx are smaller (size of edge: <50~200)
b) the edges, elements which near the boundaries are larger (size of edge: >20,000)
c) as the z(+) increase, the meshes should be larger
d) the mesh size extremely increases at volume (z-) direction (just needs few elements)

For approach my target, I tried several procedures by following the tutorial (I tried many rounds for with and without the follow steps):
1. Mesh > unstructured > assign sizes on points > select 12 Rx dots [ to reach target “a“]
2. Mesh > unstructured > assign sizes on lines > select 29 Tx dots [ to reach target “a“]
for 1 & 2, the assigned size has been tried from less than 50 to 200 [between size of “i“ &“ii“]
3. Mesh > unstructured > assign sizes on surfaces > select surface i & ii [with size 200]
4. Mesh > boundary layer > 3D > assign > chose volume iv. > chose surface i+ii+iii or the outer boundaries
5. generate mesh > mesh size : 1,000-50,000

In another mesh generator program “Tetgen“, I can define the super ellipse for increasing the size of elements from the center to the outer boundary, and specifically define the local ellipses for several locations.

What I tried to do in GiD is making a similar model.

However, GiD always crash in few seconds after I starting generating the mesh (as the size in 5. is larger, GiD crash as quicker).
What I guess is the program got some problem during calculating the change of element sizes from 200 to 200,000. There is no error information in GiD so I couldn't figure out what is the real reason.

Could I keep discussing the questions in this talk instead of moving to the “mesh“ plate?

Wish you have a good day.

K. H. Tseng

Here is a error report from MAC OS which I got in one of tens crash events:
Process: gid.exe [1255]
Path: /Applications/GiD-14.0.1.app/Contents/MacOS/gid.exe
Identifier: gid.exe
Version: GiD-14.0.1 (GiD-14.0.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1247]
Responsible: gid.exe [1255]
User ID: 501

Date/Time: 2019-06-17 18:30:53.015 +0900
OS Version: Mac OS X 10.14.5 (18F132)
Report Version: 12
Anonymous UUID: 9708DE9B-9A2E-2FD5-C468-C3C4D464C9E3

Time Awake Since Boot: 2400 seconds

System Integrity Protection: enabled

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
objc[1255]: Invalid or prematurely-freed autorelease pool 0x7f8b2f005058. Set a breakpoint on objc_autoreleasePoolInvalid to debug. Proceeding anyway because the app is old (SDK version 10.9.0). Memory errors are likely.
[1255] stack overflow

0 libsystem_kernel.dylib 0x00007fff7e2582c6 __pthread_kill + 10
2 libsystem_c.dylib 0x00007fff7e1c2745 __abort + 144
3 libsystem_c.dylib 0x00007fff7e1c2ff3 __stack_chk_fail + 205
4 gid.exe 0x000000010138c287 RemoveRepeatedEdges(Edge3D*, int&) + 2887
5 ??? 0x0000290400002904 0 + 45097156618500

0 libsystem_kernel.dylib 0x00007fff7e25961a __select + 10
1 libtcl8.6.dylib 0x0000000103837238 NotifierThreadProc + 506

0 libsystem_kernel.dylib 0x00007fff7e25222a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff7e25276c mach_msg + 60
2 com.apple.CoreFoundation 0x00007fff52159e6d __CFRunLoopServiceMachPort + 327
3 com.apple.CoreFoundation 0x00007fff521593da __CFRunLoopRun + 1619
4 com.apple.CoreFoundation 0x00007fff52158b35 CFRunLoopRunSpecific + 459
5 com.apple.AppKit 0x00007fff4f7d96a6 _NSEventThread + 175

rax: 0x0000000000000000 rbx: 0x00000001046de5c0 rcx: 0x00007ffeeeb777c8 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007ffeeeb77800 rsp: 0x00007ffeeeb777c8
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000206
r12: 0x0000000000000307 r13: 0x0000000000000000 r14: 0x0000000000000006 r15: 0x000000000000002d
rip: 0x00007fff7e2582c6 rfl: 0x0000000000000206 cr2: 0x00007fffb47fe188

Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133

Binary Images:
0x100f9a000 - 0x102ac4ff7 +gid.exe (0) <9BF0E263-35DB-302C-B004-B0820B8AE449> /Applications/GiD-14.0.1.app/Contents/MacOS/gid.exe
0x10326d000 - 0x103280ff7 +libobjarray_64.dylib (0) <39AD9605-4AA9-328C-8E05-A7E05576A87A> /Applications/GiD-14.0.1.app/Contents/MacOS/scripts/objarray/libobjarray_64.dylib
........( other similar description, omitted by TSENG)

External Modification Summary:
Calls made by other processes targeting this process:
Calls made by all processes on this machine:

VM Region Summary:
ReadOnly portion of Libraries: Total=442.3M resident=0K(0%) swapped_out_or_unallocated=442.3M(100%)
Writable regions: Total=367.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=367.3M(100%)

VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 768K 5
Activity Tracing 256K 1
CG backing stores 15.0M 6
CG image 744K 33
CG raster data 1536K 33
CoreGraphics 8K 1
CoreImage 20K 5
CoreUI image data 572K 13
CoreUI image file 404K 2
Dispatch continuations 16.0M 1
Kernel Alloc Once 8K 1
MALLOC 317.6M 134
MALLOC guard page 32K 7
Memory Tag 242 12K 1
STACK GUARD 56.0M 10
Stack 12.1M 10
VM_ALLOCATE 228K 23
__DATA 32.6M 308
__FONT_DATA 4K 1
__GLSLBUILTINS 5176K 1
__TEXT 215.0M 300
__UNICODE 564K 1
mapped file 78.4M 35
shared memory 2728K 10
=========== ======= =======
TOTAL 982.8M 986

Model: Macmini6,2, BootROM 278.0.0.0.0, 4 processors, Intel Core i7, 2.6 GHz, 16 GB, SMC 2.8f0
Graphics: kHW_IntelHD4000Item, Intel HD Graphics 4000, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x10E), Broadcom BCM43xx 1.0 (7.21.190.33 AirPortDriverBrcm4360-1325.2)
Bluetooth: Version 6.0.12f1, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
...(hardware information, omitted by TSENG)
escolano
Posts: 1624
Joined: Thu Sep 18, 2014 3:31 pm

### Re: Why a NURBS surface always automatically rotates after being generated

Attach a zip with your GiD model to do some meshing tests.
KHTseng
Posts: 5
Joined: Wed Jun 05, 2019 4:24 pm

### Re: Why a NURBS surface always automatically rotates after being generated

escolano wrote:Attach a zip with your GiD model to do some meshing tests.

Dear escolano,

I am sorry for causing your confusion by my complicate description.
That will be much clear with data and files.

I attached two gid files: the file “1volm“ is the one I showed and described. It always crashed whenever I tried to generate the meshes. (It will immediately crash if I set the mesh size to 20000; or crash in 5-10 sec if I set the mesh size to 5000).

In another file “3volm“, I divided the volumes into inner, intermediate and outer regions. This time I can generate the meshes if I set the no assigned meshes size to 5000. But it will still crash if I set it larger. The generated meshes will be equally distributed but I want to make the outer regions as I showed the one from Tetgen.

Both of the files have mesh assignment informations in the unstructured setting.

By the way, may I know whether the GiD has a view option for checking the mesh shapes inside (like slice view)? I know there is a clip view option but that won‘t show the mesh structure at the cutting plane.

Wish you have a good day.

K. H. Tseng
Attachments
3volm_beforemesh.gid.zip
1volm_beforemesh.gid.zip
The file which I described in past content
escolano
Posts: 1624
Joined: Thu Sep 18, 2014 3:31 pm

### Re: Why a NURBS surface always automatically rotates after being generated

The main problem of this model is the bad shape of some surfaces (like the surface 3246 of the 3volm_beforemesh.gid),
there are self-intersections of intersections with neighbor surfaces that prevent the creation of the volume mesh.

I attach some pictures of the problematic shape, and some mesh of these surfaces.
Surface 3246:
surface_bad_shape.png (35.85 KiB) Viewed 4280 times

Surface mesh:
surface_bad_shape-mesh.png (46.04 KiB) Viewed 4280 times

Detail of surface mesh:
surface_bad_shape-mesh-2.png (33.37 KiB) Viewed 4280 times

About do slices to see the interior shape of a volume mesh, there are different tools:
1- use Mesh->Mesh quality, to see a frequency graphs of different quality criteria.
2- can delete part of the mesh in preprocess to see interior elements (before save the model to be restored after delete part)
3- Go to postprocess and then could do cuts (and set off or transparent then volume mesh and rotate the view to see the cutted elements)