Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to write grid #80

Closed
sreekar2858 opened this issue Jun 20, 2023 · 14 comments · Fixed by #84
Closed

Unable to write grid #80

sreekar2858 opened this issue Jun 20, 2023 · 14 comments · Fixed by #84
Assignees
Labels
bug Something isn't working

Comments

@sreekar2858
Copy link

sreekar2858 commented Jun 20, 2023

Description

I have an cube OpenFOAM mesh and tried to deform top and side faces by x1.05 to test if idwarp works.
But I am getting an error at the end of the run. I am attaching the case directory with .py file for reference.
OF_idwarp.zip

Steps to reproduce issue

  1. I am using idwarp from dafoam-latest running on docker. https://dafoam.github.io/mydoc_get_started_download_docker.html

Current behavior

Python is throwing error that

 Finished Mesh Initialization.
Traceback (most recent call last):
  File "solid_warp.py", line 44, in <module>
    mesh.writeGrid()
  File "/home/dafoamuser/dafoam/packages/miniconda3/lib/python3.8/site-packages/idwarp/UnstructuredMesh.py", line 505, in writeGrid
    self._writeOpenFOAMVolumePoints(self.getCommonGrid())
AttributeError: 'USMesh' object has no attribute '_writeOpenFOAMVolumePoints'

Expected behavior

It should've changed the polyMesh in OpenFOAM directory

Code versions

  • Operating System: Ubuntu 20.04.5 LTS (Focal Fossa)
  • Python: 3.8.10
  • OpenMPI: v3.1.6
  • CGNS: 4.1.2
  • PETSc: 3.14.6
  • Compiler: Python
  • This repository: --
@sseraj
Copy link
Collaborator

sseraj commented Jun 20, 2023

It looks like the function _writeOpenFOAMVolumePoints was moved to pyofm, but the call was not updated in USMesh. The fix should be to just replace this call, is that right @friedenhe?

@sseraj sseraj added the bug Something isn't working label Jun 20, 2023
@friedenhe
Copy link
Collaborator

@sseraj, that is right. The _writeOpenFOAMVolumePoints function is deprecated in IDWarp. @sreekar2858, to test IDWarp, please deform the mesh and run the primal solver for one step. It will save the flow solution and the deformed mesh to a folder called "1". You can then use Paraview to load the "1" step and visualize the mesh change.

@sreekar2858
Copy link
Author

Thank you for the prompt response.
I can't change the call within docker to pyofm, can I?
If yes, can you please direct me how?

@friedenhe
Copy link
Collaborator

No, you can't. There is no easy way to directly output the volume mesh without calling the primal solver.

@sreekar2858
Copy link
Author

No, you can't. There is no easy way to directly output the volume mesh without calling the primal solver.

Do you suggest any other way of morphing mesh that has good results as IDWarp?
I would like to deform the solid mesh based on a list of points. At some locations the elements are collapsing, so, it would be great if you recommend an alternative short-term.

@friedenhe
Copy link
Collaborator

@sreekar2858, to test IDWarp, please deform the mesh and run the primal solver for one step. It will save the flow solution and the deformed mesh to a folder called "1". You can then use Paraview to load the "1" step and visualize the mesh change.

@sreekar2858
Copy link
Author

Sorry, I don't understand what you mean by deform the mesh. I am using dafoam's docker container but the case I shared is for plain OpenFOAM with no optimization.
Can you please elaborate on how I can deform the mesh?

My goal is not to optimize the geometry but rather deform it at specific surfaces with corresponding known nodal/ FFD location.

@sreekar2858
Copy link
Author

Thank you for the reference
I tried using deformMesh on the same geometry I ran optimization on to make it simple. I got the shapez values from out file and modified the json file retaining all other information. I also changed the task to "deformMesh". I can see the mesh change but it is not the same and it is overlapping as in the picture.
image
Also you can notice that the deformed mesh is overlapping
image

I am also attaching the runscript for reference
runScript_v2.zip

Thank you
Sreekar

@sreekar2858
Copy link
Author

sreekar2858 commented Jun 30, 2023

@sseraj Also can I ask if there is any docker image with IDWarp besides DAFoam?

@sseraj
Copy link
Collaborator

sseraj commented Jun 30, 2023

The MDO Lab docker images also include IDWarp, but the deprecated function call will still be in that image. We will try to update the code soon.

@bernardopacini
Copy link
Collaborator

Thanks for bringing this up. It is on my todo list and I will address it soon.

@sreekar2858
Copy link
Author

sreekar2858 commented Jul 10, 2023

Check this: https://github.com/DAFoam/tutorials/blob/4d9761f90492b84cace353e516dc2950dc56adbe/Prowim_Wing_Propeller/runScript_v2.py#L298

@friedenhe
I am unable to get desired result from "deformMesh". Can you please check the above response if I did anything incorrect?

@friedenhe
Copy link
Collaborator

Your run script looks OK, I suspect the issue is in the design variable json file. I suggest you load a json file that has only one shape variable that is non-zero, and then gradually add more non-zero design variables for debugging.

mtowara added a commit to mtowara/idwarp that referenced this issue Aug 11, 2023
moved to pyOFM, fixes mdolab#80
@mtowara mtowara mentioned this issue Aug 11, 2023
13 tasks
sseraj added a commit that referenced this issue Aug 19, 2023
* fix writeVolumeMeshPoints

moved to pyOFM, fixes #80

* black formatting

---------

Co-authored-by: sseraj <sseraj@umich.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants