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

Key frame remeshing

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2015, 05:15
Default Key frame remeshing
  #1
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Hi,
I have an application where the flow is entirely determined by wall motion, similar to an IC engine. First I run a dry-run solving only for the mesh motion, and remesh when the quality becomes too poor. I get a series of meshes that are then read in CFX when I compute the flow. I use the configuration/remeshing tab for this, with an external command that locates the correct mesh and replace the current mesh (as described in 33.2.2.1. User Defined Remeshing cfx_pre.pdf). My monitor for domain volume show the expected result (continuous smooth curve), but my monitor points for velocity inside the domain drop to zero for the time step after the mesh is replaced (time step 90 in figure). It is like the solution is not interpolated from time step 89 to 90.

Relevant CEL:
SIMULATION CONTROL:
&replace CONFIGURATION CONTROL:
CONFIGURATION: Configuration 1
Flow Name = Flow Analysis 1
ACTIVATION CONTROL:
CONTROL CONDITION: Activation Condition 1
Option = Start of Simulation
END
END
REMESH: Remesh 1
Activation Condition List = Interrupt Condition 1
External Command = ../read_mesh.sh
Location = FLUID1
Option = User Defined
Replacement Mesh File = cfxmesh.cfx5
END
END
END
END

Interrupt Condition 1 is true when time step = 89, i.e. one time step before my velocity drops. Do I need another configuration that starts when Configuration 1 end? I tried that by adding another configuration which had the setting ‘Initial values = Configuration 1 results’, but I could not get it to run. Im not even sure why I would need that.

Any ideas on why the velocity drops to zero and how I should proceed?


Lance is offline   Reply With Quote

Old   August 27, 2015, 08:09
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,703
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You will probably need to talk to the CFX developers for this one.
ghorrocks is offline   Reply With Quote

Old   August 27, 2015, 09:14
Default
  #3
Far
Super Moderator
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,553
Blog Entries: 6
Rep Power: 54
Far has a spectacular aura aboutFar has a spectacular aura about
Send a message via Skype™ to Far
This behavior seems normal to me (Glenn please correct me, if I am wrong) since due to change in setup residuals first goes up and then come to required level in next few iterations.
Far is offline   Reply With Quote

Old   August 27, 2015, 11:57
Default
  #4
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
FAR: He is posting flow conditions not resisduals. Those should be continous if the solver is behaving correctly.

One thing I think about: Are you prescribing fixed wall motion or is it a function of the flow? In past releases of CFX (prior to the 6DOF implementation), I put in my own motion equations and had to do remeshes during solution. In my intial attempts, I got behavior like you are showing. It occured becuase I wasnt conserving momentum of my moving solid across the remesh. If you are moving your wall based on flow interaction (and not using the 6-DOF but your own built in F=ma CELs) then you need to account for the momentum across the remesh.
singer1812 is offline   Reply With Quote

Old   August 28, 2015, 04:22
Default
  #5
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Yes, I am showing velocity and not residuals. The wall motion is known beforehand and prescribed using specified mesh displacement when doing the dry-run to obtain the meshes. Then when computing the flow I use a Fortran routine to obtain intermediate meshes for every time step. That only works when the mesh topology is the same, so I trigger a key frame remesh to stop the solver and (hopefully) interpolate the flow onto the new mesh topology. I though that the momentum would carry over the mesh reload step, but maybe it doesnt? That would explain the loss in velocity.
Lance is offline   Reply With Quote

Old   September 1, 2015, 07:15
Default
  #6
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Update: I got it to work. The problem was that I triggered the remesh one time step too early and that the solution was interpolated onto a mesh that didnt have any mesh motion. I had to recode my Fortran code a bit, but now it seems to work as intended.
-Maxim- likes this.
Lance is offline   Reply With Quote

Old   November 14, 2018, 10:12
Default
  #7
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Hi Lance,

i am simulating a moving mesh case and have to use Remeshing when the mesh gets distorted too much. I want to do Remeshing with Keyframe meshes as you did in your case. For that purpose I have created the meshes at different instants and want to import them at particular time during the CFX run (using Interruption Control and Configuration). But in the Configuration tab of CFX i don't know what is the external command? CFX guide says "The External Command is typically a shell script or batch file". Can you please tell me how to write this External Command? Can you please attach some example.

remesh.jpg

Replacement file is mesh file (.msh file, i export the meshes in fluent format in ICEM) which will be read in the CFX during the simulation, isn't it?

If the mesh is generated in millimeters, then do i need to scale the mesh during the export as it will be automatically read by the solver during the run? Normally if mesh is made in millimeters then i select Units to "mm" during the import in CFX, but in this case meshes have to be imported automatically
cfd seeker is offline   Reply With Quote

Old   November 14, 2018, 10:38
Default
  #8
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by cfd seeker View Post
CFX guide says "The External Command is typically a shell script or batch file". Can you please tell me how to write this External Command? Can you please attach some example.
My shell scripts identifies the current time step, and then overwrite ./cfxmesh.cfx5 with an already existing mesh.

For me, this looks something like
at timestep 10, copy ../meshfolder/cfxmesh.cfx5.10 to ./cfxmesh.cfx5
at timestep 20, copy ../meshfolder/cfxmesh.cfx5.20 to ./cfxmesh.cfx5
at timestep 30, copy ../meshfolder/cfxmesh.cfx5.30 to ./cfxmesh.cfx5

Quote:
Originally Posted by cfd seeker View Post
Replacement file is mesh file (.msh file, i export the meshes in fluent format in ICEM) which will be read in the CFX during the simulation, isn't it?
Correct
Quote:
Originally Posted by cfd seeker View Post
If the mesh is generated in millimeters, then do i need to scale the mesh during the export as it will be automatically read by the solver during the run? Normally if mesh is made in millimeters then i select Units to "mm" during the import in CFX, but in this case meshes have to be imported automatically
It should work. If CFX complains about bounding box tolerance then try to scale the mesh using the "mesh reload options" check box below Replacement file.
Lance is offline   Reply With Quote

Old   November 14, 2018, 12:41
Default
  #9
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Quote:
Originally Posted by Lance View Post
My shell scripts identifies the current time step, and then overwrite ./cfxmesh.cfx5 with an already existing mesh.

For me, this looks something like
at timestep 10, copy ../meshfolder/cfxmesh.cfx5.10 to ./cfxmesh.cfx5
at timestep 20, copy ../meshfolder/cfxmesh.cfx5.20 to ./cfxmesh.cfx5
at timestep 30, copy ../meshfolder/cfxmesh.cfx5.30 to ./cfxmesh.cfx5
thanks Lance for the reply, that was really helpful.

For each new instant you used a separate shell script to replace old mesh with new mesh?

If your script is not confidential can you share it? I have never used it, so don't know about its syntax. BTW i am working on Windows PC, so still shell script will be required?

Where did you get the information regarding the shell script to replace the old mesh with new mesh because in CFX guide not much is available, isn't it?
cfd seeker is offline   Reply With Quote

Old   November 15, 2018, 01:33
Default
  #10
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by cfd seeker View Post
For each new instant you used a separate shell script to replace old mesh with new mesh?
One shell script for everything. See below.

Quote:
Originally Posted by cfd seeker View Post
If your script is not confidential can you share it? I have never used it, so don't know about its syntax. BTW i am working on Windows PC, so still shell script will be required?
I use Linux, so you will have to modify this to Windows

Code:
#!/bin/bash

#get current directory
currdir=`pwd`

#get monitor data
cfx5mondata -dir $currdir >file.atstep

#get ATSTEP from monitor data file
string=$(sed -n '$p' file.atstep)
arrIN=(${string//,/ })
ATSTEP=${arrIN[0]}

#file to copy
#copy ../meshes/cfxmesh.cfx5.ATSTEP to ./cfxmesh.cfx5
cfxname="../meshes/cfxmesh.cfx5."$ATSTEP
cp $cfxname "$currdir/cfxmesh.cfx5"
Quote:
Originally Posted by cfd seeker View Post
Where did you get the information regarding the shell script to replace the old mesh with new mesh because in CFX guide not much is available, isn't it?
The manuals are quite helpful, and a bit of trial and error with simplified models when developing everything.
Lance is offline   Reply With Quote

Old   November 15, 2018, 02:55
Default
  #11
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Quote:
#!/bin/bash

#get current directory
currdir=`pwd`

#get monitor data
cfx5mondata -dir $currdir >file.atstep

#get ATSTEP from monitor data file
string=$(sed -n '$p' file.atstep)
arrIN=(${string//,/ })
ATSTEP=${arrIN[0]}

#file to copy
#copy ../meshes/cfxmesh.cfx5.ATSTEP to ./cfxmesh.cfx5
cfxname="../meshes/cfxmesh.cfx5."$ATSTEP
cp $cfxname "$currdir/cfxmesh.cfx5"
thanks again for your reply. From the code what is understood is that .cfx5 is the extension for mesh file which can be read in CFX but what kind of extension .cfx5.ATSTEP is? I know that atstep in CFX is accumulated time step.
cfd seeker is offline   Reply With Quote

Old   November 15, 2018, 02:57
Default
  #12
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by cfd seeker View Post
...what kind of extension .cfx5.ATSTEP is? I know that atstep in CFX is accumulated time step.
It is just my naming convention when storing meshes.
cfx5mesh.cfx5.10 is the mesh for time step 10
cfx5mesh.cfx5.20 is the mesh for time step 20
and so on...
when ATSTEP = 10, cfx5.$ATSTEP will resolve to cfx5.10 in my script.
Lance is offline   Reply With Quote

Old   November 15, 2018, 03:01
Default
  #13
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Quote:
Originally Posted by Lance View Post
It is just my naming convention when storing meshes.
cfx5mesh.cfx5.10 is the mesh for time step 10
cfx5mesh.cfx5.20 is the mesh for time step 20
and so on...
when ATSTEP = 10, cfx5.$ATSTEP will resolve to cfx5.10 in my script.
thanks for the quick reply. I didn't know that the mesh file can be named by adding something after the extension type.
cfd seeker is offline   Reply With Quote

Old   November 15, 2018, 03:46
Default
  #14
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
For Windows i have to write a batch file which will perform the required tasks. Do you have idea where i can find information regarding batch files in CFX guides?
cfd seeker is offline   Reply With Quote

Old   November 15, 2018, 04:11
Default
  #15
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by cfd seeker View Post
For Windows i have to write a batch file which will perform the required tasks. Do you have idea where i can find information regarding batch files in CFX guides?
I doubt you will find much info in the CFX manuals. But since this is not really CFX-specific a simple web search on 'windows batch file' will probably help you.
Lance is offline   Reply With Quote

Old   November 16, 2018, 03:13
Default
  #16
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Instread of using 'User defined' option for Remeshing i choose to go with ICEM CFD replay but for each instant i created new geometry myself and for each instant i recorded a reply file. But during the solution when the first remeshing starts, it did remeshing but the the solution stops with an error "ANSYS CFX Solver input file does not exist".

I checked the "30_remesh.out" (first remeshing starts at 30th timestep) and it conatins this error:

"Batch run of "C:\Users\u1dp_hy\Desktop\e-Level\Pump\Pump_New_Remesh_008.dir\meshUpdate.pre" failed due to the following errors:
-- WARNING -- This results file contains multiple meshes. The latest mesh will be loaded, which will be the deformed mesh for a case that includes Mesh Deformation. If the original undeformed mesh is required, you should load the case file (.cfx) or the CFX-Solver input file (.def) instead.

-- ERROR -- The mesh cannot be reloaded as the file '30_newmesh_01.mesh' does not exist. But actually '30_newmesh_01.mesh' do get created in the folder along with '30_newmesh_01.mesh.log'. Is this 'mesh.log' file creating some problem?

Did you also face such problem? Do you have any idea what this is about and how it can be fixed?

Attching the .out file of Remesh.

30_remesh.txt

Last edited by cfd seeker; November 16, 2018 at 09:38.
cfd seeker is offline   Reply With Quote

Old   November 16, 2018, 08:13
Default
  #17
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
The warning is probably nothing to care about. The error on the other hand...
Are you sure about the spelling? Should it be 30_newmesh_01.mesh or 30_newmesh_01.msh ?
Lance is offline   Reply With Quote

Old   November 16, 2018, 09:34
Default
  #18
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Quote:
Originally Posted by Lance View Post
The warning is probably nothing to care about. The error on the other hand...
Are you sure about the spelling? Should it be 30_newmesh_01.mesh or 30_newmesh_01.msh ?
I didn't understand your spelling point. This is the error what I am getting. Remeshing failed and CFX wrote "30_remesh.out" in the directory (attached as a .txt file in the previous post) and i read the error from this "30_remesh.out" file.
cfd seeker is offline   Reply With Quote

Old   November 16, 2018, 09:44
Default
  #19
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by cfd seeker View Post
I didn't understand your spelling point. This is the error what I am getting. Remeshing failed and CFX wrote "30_remesh.out" in the directory (attached as a .txt file in the previous post) and i read the error from this "30_remesh.out" file.
What did you name the replacement file in CFX? 30_newmesh_01.mesh or 30_newmesh_01.msh?
You seem to produce a file with extension .mesh (for some reason) but if CFX expects a .msh file it will never work.
Lance is offline   Reply With Quote

Old   November 16, 2018, 09:57
Default
  #20
Senior Member
 
Join Date: Mar 2011
Location: Germany
Posts: 552
Rep Power: 20
cfd seeker is on a distinguished road
Quote:
Originally Posted by Lance View Post
What did you name the replacement file in CFX? 30_newmesh_01.mesh or 30_newmesh_01.msh?
You seem to produce a file with extension .mesh (for some reason) but if CFX expects a .msh file it will never work.
I am using "ICEM CFD Replay" option, not the "User defined" as used by you. With "ICEM CFD Replay" i have to specify .tin and .rpl file.

Remeshing.jpg

For each instant where simulation will stop, i have created a separate .tin and separate .rpl file.
cfd seeker 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
Remeshing issue due to solid contact Jrmy FLUENT 4 October 18, 2018 16:34
Convert DFT of pressure in rotating frame to stationary frame CFD-123 FLUENT 0 February 12, 2015 17:51
ICEM CFD Replay Remeshing EvaS CFX 1 December 19, 2012 19:30
Rotating Reference Frame Pressure Gradient clac FLUENT 0 August 22, 2012 18:20
Question about N-S eqs. in body fixed noninertial reference frame doctorWho Main CFD Forum 0 July 12, 2011 18:07


All times are GMT -4. The time now is 01:43.