mdolab / idwarp

IDWarp is a mesh warping package for the MACH framework.
Other
17 stars 29 forks source link

Unable to deform using "specifiedSurfaces" #85

Open sreekar2858 opened 1 year ago

sreekar2858 commented 1 year ago

Description

Hello I am using OpenFOAM case to morph a face using IDWarp. The geometry is a cuboid as the following picture. The specifiedSurfaces are marked in red. image

I defined the python script as follows:

import os
from mpi4py import MPI
from idwarp import USMesh
from pyofm import *
import numpy as np

options = {
  'gridFile':os.getcwd(),
  'fileType':'OpenFOAM',
  'specifiedSurfaces':["inner_walls"],
  'symmetrySurfaces':[],
  'symmetryPlanes':[],
  'aExp': 3.0,
  'bExp': 5.0,
  'LdefFact':1.0,
  'alpha':0.25,
  'errTol':0.000001,
  'evalMode':'fast',
  'useRotations':True,
  # 'zeroCornerRotations':True,
  'cornerAngle':30.0,
  'bucketSize':8,
}

# Create the mesh object
mesh = USMesh(options=options, comm=MPI.COMM_WORLD)

# Extract all coordinates
coords0 = mesh.getSurfaceCoordinates()

# Modify the coordinates as required
newCoords = coords0.copy()

for i in range(0,coords0.shape[0]):
    newCoords[i, 2] += 0.005

print(newCoords.shape)

# Reset the newly computed surface coordinates
mesh.setSurfaceCoordinates(newCoords)

mesh.getCommonGrid()

# Actually run the mesh warping
mesh.warpMesh()

# Write the new grid file.
mesh.writeGrid()

When I tried to check what "getSurfaceCoordinates" returns, I noticed it output 6272 points but the specifiedSurfaces should have 355 points and the entire geometry has 3190 points. I don't understand where the other points are from. I exported the output from getSurfaceCoordinates() into a txt file and plotted in paraview which is perfectly coinciding with the existing mesh. So, it is returning all the points in the mesh with some additional points.

I would like to just morph the coordinates of a surface and want the entire mesh to conform to that change.

Steps to reproduce issue

  1. IDWarp 2.6.1 with fix from #84. This is optional as I would like to understand what the function getSurfaceCoordinates() returns and in what order.
  2. Here is the test case I am working on Test_Geom_01_solid.zip

Current behavior

The function is returning all the mesh points in the geometry with some redundant points.

Expected behavior

It should only return the points from specifiedSurfaces input in options.

Code versions

sreekar2858 commented 1 year ago

To add to this I tried to just move 1 node to check how it works. The mesh is not warping at all, the deformed node just pierced into neighboring cells just as here: https://github.com/mdolab/idwarp/issues/80#issuecomment-1614412960

Thank you for the help -Sree