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

Extract Mesh/Geometry

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By singer1812
  • 1 Post By Lance

Reply
 
LinkBack Thread Tools Display Modes
Old   June 4, 2013, 09:23
Question Extract Mesh/Geometry
  #1
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 4
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, 10:22
Default
  #2
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 494
Rep Power: 10
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, 10:43
Default
  #3
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 494
Rep Power: 10
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 likes this.
singer1812 is offline   Reply With Quote

Old   June 4, 2013, 11:00
Default
  #4
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 4
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, 05:58
Default
  #5
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 4
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, 16:42
Default
  #6
New Member
 
Kegan Leckness
Join Date: Mar 2015
Posts: 18
Rep Power: 2
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, 06:21
Default
  #7
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 4
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 12, 2015, 23:37
Default
  #8
New Member
 
Kegan Leckness
Join Date: Mar 2015
Posts: 18
Rep Power: 2
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, 02:48
Default
  #9
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 522
Rep Power: 11
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

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract one face of a sHM-mesh emjay OpenFOAM Native Meshers: snappyHexMesh and Others 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 07: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 20:17
How can we extract the impact angle from a trackin shehab FLUENT 1 October 17, 2007 10:34


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