CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Extract Mesh/Geometry

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By singer1812
  • 1 Post By Lance

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2013, 10:23
Question Extract Mesh/Geometry
  #1
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 13
Bill Tuer is on a distinguished road
Hi,

I want to extract a deformed geometry (or mesh) from the latest result file in a transient simulation. The extracted file will be used to perform a remeshing - or multiple remeshings until the end of the simulation. So I think it will be the best to do the extraction by a batch file (maybe which is executing a replay script - see below) and the the remeshing by a replay script (ICEM - also executed from the batch file).

In the help files I found (topic "Remeshing with Automatic Geometry Extraction"):

"Note that some mesh-to-geometry conversion tools are unable to extract the latest mesh coordinates from the most recent CFX-Solver Results file. If this is the case, then introduce a call to CFX-Pre (within the External Command) that executes a session file that simply loads the latest CFX-Solver Results file and writes a new CFX-Solver Input file. That CFX-Solver Input file will contain the required, latest mesh coordinates."

So thats exactly what I want to do now - but how? I know that it is possible to record a session file into CFX-Pre, with the commands to load a specific file and then to write the CFX-Solver Input file - but the point is just a specific file - I want to load the latest result file automaticaly (e.g. by a variable or a by an argument for ...). I'm looking for an solution for days, now (and so my favourite word from the help text is "simply")...
Bill Tuer is offline   Reply With Quote

Old   June 4, 2013, 11:22
Default
  #2
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21
singer1812 is on a distinguished road
The external command is the name of script file. The script file should contain the commands below (case file name will be what ICEM will open to update the geom and remesh, which you will put in a separate ICEM script file):


>load filename=res, mode=def, recoverSession=no, replaceFlow=yes, overwrite=yes
> update
>writeCaseFile filename=cfxmesh.def, operation=write solver file
> update
> update
singer1812 is offline   Reply With Quote

Old   June 4, 2013, 11:43
Default
  #3
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21
singer1812 is on a distinguished road
Sorry:
Accidently hit the post button before I was done with post and editing it.

Your External Command will be somthing like this (last time i used remesh scripting was for V12, so you will need to update it and the path):

/CFX/ANSYS_12.0.1/v120/icemcfd/linux64_amd/bin/icemcfd -batch -script ../icem_remesh.rpl

The icem_remesh.rpl file will have the following:

# adapt path names
#set cfxinstallation /CFX/ANSYS_12.0.1/v120/CFX
YOU ADD YOUR PATH HERE
#set iceminstallation /CFX/ANSYS_12.0.1/v120/icemcfd
YOU ADD YOUR PATH HERE
set env(CFX_DATA_DIR) $env(ICEM_ACN)/icemcfd/output-interfaces
set env(CFX_UNITS_DIR) $env(ICEM_ACN)/icemcfd/output-interfaces

# need to run res file through Pre it seems... this is to get latest mesh instead of initial mesh
ic_run_application_exec . $cfxinstallation/bin cfx5pre {-batch ../res2def.pre}

ic_empty_tetin
#ic_run_application_exec . $iceminstallation/linux64_amd/icemcfd/output-interfaces cfx2df {-s0 cfxmesh.def ./tmpdomain.uns}
ic_run_application_exec . $env(ICEM_ACN)/icemcfd/output-interfaces cfx2df {-s0 cfxmesh.def ./tmpdomain.uns}
ic_uns_load ./tmpdomain.uns 3 0 {}

# Scale to original size... no need as original is in m
# Build mesh topology and change to geom
ic_unload_tetin
ic_uns_build_mesh_topo All -angle 175
ic_geo_import_mesh {} 1 1 1
ic_geo_set_modified 1
ic_csystem_display all 0
ic_csystem_set_current global
ic_boco_nastran_csystem reset
ic_save_tetin geom_frommesh1.tin


YOU ADD YOUR MESH BUILDING HERE

# Now save it out to be re-used
ic_boco_save ./nastran.fbc
ic_boco_save_atr ./nastran.atr
ic_uns_check_duplicate_numbers
ic_uns_renumber_elements all 1 1
ic_save_unstruct tetra_mesh.uns 1 {} {} {}
ic_exec $env(ICEM_ACN)/icemcfd/output-interfaces/cfx5 -dom ./tetra_mesh.uns -b ./nastran.fbc -db -internal_faces ./cfx5.msh
# and convert to gtm if necessary
ic_run_application_exec . $cfxinstallation/bin cfx5gtmconv {-icem cfx5.msh cfx5.gtm -o }

# Delete unnecessary files
cmd_rm tetra_mesh.uns tgrid_temp1.uns tgrid_mesh.uns tmpdomain.uns geom_frommesh1.tin temp_tetra.tin tgrid_cmd.log nastran.fbc nastran.fbc_old nastran.atr cfxmesh.def prism_input.uns prism.uns cfx5,msh


The above script calls res2def.pre, which uses cfxpre to update the geom to lastest deformation that ICEM can use. res2def.pre has the stuff in it below:

COMMAND FILE:
CFX Pre Version = 12.0
END

>load filename=res, \
mode=def, recoverSession=no, replaceFlow=yes, overwrite=yes
> update

>writeCaseFile filename=cfxmesh.def, \
operation=write solver file
> update

> update


Note. The above icem script creates a gtm file. You might not want that. Change to what you want it to.
mvoss and aero_head like this.
singer1812 is offline   Reply With Quote

Old   June 4, 2013, 12:00
Default
  #4
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 13
Bill Tuer is on a distinguished road
Wow, thank you very much for this detailed help!
I will try to adapt it and to give a feedback very soon...
Bill Tuer is offline   Reply With Quote

Old   June 6, 2013, 06:58
Default
  #5
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 13
Bill Tuer is on a distinguished road
So, I adapt the code for my ANSYS 14.0 Version and for generating cfx5 files. But it seems that I still have the problem to get the deformed mesh out of the latest result file.

I realized that a res file is generated during the solution process with the name res, now (I misunderstood this all the time). This file is written in a directory with a .dir at the end, e.g. CFX_001.dir.

I tested my batch file and the ICEM replay file - the call to CFX-Pre seems to work - but no file is written (I specified the absolute pathes in the script files to know where the outputed files should be located).

Is it possible that I have a problems with environmental variables? Or with relativ/absolute pathes? Where can I found information about path and file variables which are set by ANSYS automatically?

And last but not least: How can I fix my problem to get the mesh out of the res file (by script)?
Bill Tuer is offline   Reply With Quote

Old   May 11, 2015, 17:42
Default
  #6
Member
 
Kegan Leckness
Join Date: Mar 2015
Posts: 38
Rep Power: 11
KeganLeckness is on a distinguished road
Hi Bill,

I'm having a similar issue with getting the meshed geometry out of my res file. How did you fix your problem?

Thanks,
Kegan
KeganLeckness is offline   Reply With Quote

Old   May 12, 2015, 07:21
Default
  #7
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 13
Bill Tuer is on a distinguished road
Hi Kegan,

sorry for the late response.
It is just the COMMAND FILE: already shown above, in my case with changes to:

>load filename=./res, mode=def, recoverSession=no, replaceFlow=yes, overwrite=yes
> update

>writeCaseFile filename=.\cfxmesh.def, operation=write def file
> update
> update

I got it working and then I give it up. It was too complicated to find the right interrupt conditions and to get a stable remeshing algorithm...

Good luck,
Bill
Bill Tuer is offline   Reply With Quote

Old   May 13, 2015, 00:37
Default
  #8
Member
 
Kegan Leckness
Join Date: Mar 2015
Posts: 38
Rep Power: 11
KeganLeckness is on a distinguished road
Bill,

You were quite fast! Thank you!

My only confusion is this, and then I'm done:

The remeshing script (ICEM CFD script) calls to the command file. Where is this command file stored, such that it has access to the geometry from the ongoing simulation? The .dir directory, itself?

Thank you so much,
Kegan
KeganLeckness is offline   Reply With Quote

Old   May 13, 2015, 03:48
Default
  #9
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by KeganLeckness View Post
The remeshing script (ICEM CFD script) calls to the command file. Where is this command file stored, such that it has access to the geometry from the ongoing simulation? The .dir directory, itself?
Im not Bill but I had the same issue a couple of months ago. The command file res2def.pre should be in the working directory, not the _001.dir directory.
Example: if your run is located in c:\cfd\my_run_001.dir the command file should be in c:\cfd

...or just change the line
ic_run_application_exec . $env(CFX5ROOT)/bin cfx5pre {-batch ../res2def.pre}
to allow res2def.pre to be anywhere you want.
KeganLeckness likes this.
Lance is offline   Reply With Quote

Old   May 8, 2018, 00:07
Default CFX remesh without ICEM
  #10
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 13
S_teph_2000 is on a distinguished road
Hello,
Is there a way to do this without ICEM? I used Ansys Mesh for my geometry...
S_teph_2000 is offline   Reply With Quote

Old   May 8, 2018, 02:43
Default
  #11
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by S_teph_2000 View Post
Hello,
Is there a way to do this without ICEM? I used Ansys Mesh for my geometry...
I use use ICEM for remeshing but if Ansys Meshing can be scripted I guess you can also perform dynamical remeshing with it in cfx. See the section on user defined remeshing in the cfx reference guide.
Lance is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Extract one face of a sHM-mesh emjay OpenFOAM Meshing & Mesh Conversion 1 January 5, 2012 07:03
how to extract the components of radial and tangential velocities renyun0511 OpenFOAM Running, Solving & CFD 0 April 8, 2011 08:15
extract information from sample during simulation for use duongquaphim OpenFOAM Programming & Development 0 January 10, 2011 14:51
Extract data we want from Techplot to a data file vetnav Main CFD Forum 0 July 28, 2010 21:17
How can we extract the impact angle from a trackin shehab FLUENT 1 October 17, 2007 11:34


All times are GMT -4. The time now is 18:00.