Extract Mesh/Geometry
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")... |
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 |
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. |
Wow, thank you very much for this detailed help!
I will try to adapt it and to give a feedback very soon... |
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)? |
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 |
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,
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 |
Quote:
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. |
CFX remesh without ICEM
Hello,
Is there a way to do this without ICEM? I used Ansys Mesh for my geometry... |
Quote:
|
All times are GMT -4. The time now is 18:26. |