Pages

Tuesday, March 2, 2010

Creating a Model with a Moving Wall in ANSYS CFX

Ever see those cool CFD animations of a model with a moving boundary? Ever wondered how much of a headache those are to set-up? Well it turns out it is not bad at all. I have run through a generic example below to show you how quickly you can do it in CFX.



Problem Description:
In this problem we are going to be modeling a moving wall on a tank. The assumption that the wall motion is know will be made and supplied to the CFX in a comma separated value (csv) format. The model will be general so that you can apply the method to similar problems.

Set-up:
The geometry was generated with two bodies combined in one part. The one domain, hereafter called the port, is the domain where the mesh is going to be deformed because of the moving wall. The other domain is the tank to which the fluid is being ejected. The mesh in this region will not be deformed.

So we move along to opening the mesh file in CFX and we begin by changing it over to a transient run. The next step would be to opening the Default Domain and in the panel change the Mesh Deformation option to Regions of Motion Specified. The next step is to create a sub-domain for the port region under the Default Domain. In the sub-domain panel, select the port region for the location and move over to the Mesh Motion tab.

We are going to use a specified mesh motion using ccl. In the current case the motion is in the z-direction so I specify a name of the cel expression MeshMotion which we will define next. A key point we are going to use is that we want to compress the mesh in the entire domain evenly to maintain the best quality mesh we can.

Defining a temporal functions from csv file
Since we are assuming we know the movement of the wall, we are going to read it in using a csv file. We first must make sure that it has the proper header. The header of the csv file should follow:

[Name]
SpecifiedMotion
[Spatial Fields]
X

[Data]
X [m], displacement []


Now the data should be a function of time. But we import it as a spatial variable. We will change it over when we define our cel expressions. To bring this file into CFX, we choose Tools -> Initialize Profile Data from the pull-down menu. After selecting the data file we notice the function is consistent with our header.

The next step is to change the spatial function into a temporal one. We will do this by creating an expression called MeshDeformation. We will then define this as SpecifiedMotion.displacement(t * 1[m] / 1 [s] ) * StrokeDistance. Note we will define StrokeDistance later.

Interpolation Functions and Other Expressions
First we will generate a function that will be used to make sure we compress the entire sub-domain evenly. We do this by generating a user-function we will call InterpolationLocation. We put unit of [m] in the Argument Units and [] for the Resulting Units. For the one-dimensional function we will supply the data pairs 0, 0 and 4, 1. We do this because the port mesh at 0 [m] will not be deformed and the port mesh at 4 [m] will deform the full amount we will specify (my port is 4 [m] long).

Next we must create our MeshMotion expression. For this we define it at MeshDeformation*InterpolationLocation(z-Total Mesh Displacement Z). Note the InterpolationLocation is the function we just defined and Total Mesh Displacement Z is the predefined expression that outputs the total mesh displacement in the z-direction relative to the initial mesh. We defined the MeshDeformation expression earlier.

The final expression we need to define is the StrokeDistance. We simply define this through a cel expression to be -4 [m]. The negative sign indicates that displacement will be in the –Z direction.

That is all there is to it. That wasn’t so bad was it? Now there are just the smaller things to add into the model such as transient result files and initial conditions. These are straightforward as in your other models. Hope you found it useful. Obviously more complexity can be built into the model, but this shows the basics of the moving mesh portion.
_____________________________________________________

Per requests, I have included some images to help you follow along.  The first image is shows how to set-up the CSV file.  Note you can do this in a text editor like notepad, or you can use Excel to develop the data and save the data as a CSV file.  Either way the ASCII data should look like:

How the CSV file should be spaced.

The next step after we generate our CSV file is to import this into CFX.  This is done by selecting from the pull-down menu Tools -> Initialize Profile Data.  Point to the location of your CSV and select OK.  If you now look under User Functions in the tree, you will see SpecifiedMotion.  Double-click this and the image below would appear.
Function from CSV File
Now that we have this we can generate our CEL expressions.  These expressions are given above and shown in the image below.
CEL for the above Example
The file piece of the puzzle is to add the InterpolationLocation user-function.  The final syntax of this user-function is shown below.  Note that the 4 is length of the chamber we wish to compress.
Using a CFX user function for interpolation
 I hope you found the original demo interesting and new images helpful in generating these types of models.  Cheers!!!

22 comments:

  1. Hi, I would like to ask for some helps. Possible? I am doing flutter simulation of a wing (AGARD 445.6) with ANSYS Workbench and CFX. However, my result was wrong. I think the problem is with my setting. If possible, I hope you can give me instruction on what are the correct settings. Honestly, I have a lot more to ask.

    Freddie

    ReplyDelete
    Replies
    1. Hi Freddie,
      I am also doing the flutter simulation with ANSYS Workbench and CFX. Could you please help me if you have any guide for it. Please reply me as soon possible.

      Delete
  2. Freddie-

    Flutter simulations in Mechanical and CFX can be done, but it takes some time to debug all the parts. I’ll make a note and try and put a flutter problem on blog, but it would take some time for me to figure out how to present it clearly within the confines of the blog. Unfortunately may not be of much use to you in debugging your current problem.

    I have a couple of recommendations. First, try contacting your technical support. They will be able to help you work through determining the correct settings. If you are an existing SimuTech ANSYS Customer, please let me know and we can surely support your request via our technical support channel. Second you may be able to find other resources at www.cfd-online.com/Forums/cfx.

    Longer term I would recommend some FSI training. Modeling FSI presents many challenges, and training provides valuable background information required in generating an accurate model. SimuTech offers FSI training classes and there is currently an online training scheduled for April 26-29 (see http://www.simutechgroup.com/ansys-training.html for a complete listing of training). This online class is broken down into four 2-hour sessions. We also offer training at our offices which are spread across North America. SimuTech also provides consulting services. We could work with you in developing a working model which you could then adapt to meet your future needs.

    Good luck. FSI problems are always challenging, but keep working through it because it feels great when you finally see good results. And thanks for reading our blog.

    Nick

    ReplyDelete
  3. Hi Nick,

    Would you mind posting more details of this project? Specifically, I'm looking for the CVS file and CEL expressions used. Your explanation is a good start, but I am having difficulty following it. Alternatively, some screen shots along the way would suffice. I am trying to create a simulation with a much more complex boundary motion but ANSYS' documentation on the subject is lacking, so this is a good place for me to start.

    Thanks,
    Colin

    ReplyDelete
  4. Colin-

    I have included some additional instructions. I hope you find these interesting. If you are still having trouble and SimuTech provides your CFX support, please do not hesitate to contact us.

    Good luck.

    Nick

    ReplyDelete
  5. Hi there,

    I am doing something very similary as this mesh deformation set-up except that i am deforming a 3D boundary. This requires the x y and z spatial variables but the displacement componenet is different for each timestep. How do i implement the tiime sense this in CEL expressions or in the excell files?

    Thanks
    Majed

    ReplyDelete
  6. Hi there,

    I am trying to setup a transient simulation with complex geometry change I am able so far only to capture with separately prepared meshes that I link consecutively in workbench at every time step. The only way to simulate an expansion for a compressible fluid with these separate meshes is by using a subdomain with a total negative mass flow value calculated from the volume differences that I derive from the CAD data upfront together with volumeAve(Density), otherwise I get only constant pressure. It works very good with expansion but now that I am moving over to simulate a compression phase, I need to consider continuity in the mass inflow in the subdomain, which requires to add accurate values for the inflowing masses at each node. Any hints how to set that up? I wonder if with mesh deformation the interpolator automatically captures the continuous mass prerequisite between mesh deformation steps, which would be a big incentive to try to work out my problem with your CSV file approach?

    Thanks

    ReplyDelete
  7. Majed & Johannes-

    These are complex problems that you describe and with only your descriptions it is hard to determine the best modeling approach. If you are an existing SimuTech ANSYS Customer, please let me know and we can surely support your request via our technical support channel. Through this support we can do more detailed discussions that are required to determine the best approach to modeling your problem. However I will put my initial comments on your questions below for each of you.

    Majed-
    What I think you are doing is trying to move a surface that is not aligned to an axis at varying speeds at each node. If this is the case, it could be done with CEL similar to what I described, but it would be very tedious. Also, the applicability of this approach would depend on the amount of deformation in each direction. There are other approaches that may be more practical such as the 6 DOF solver or the immersed body technique (both available in R12.1). Another option would be calling Fortran to do the moving mesh, but this may be more complex that you need. Without knowledge of exactly the problem you are trying to model and the quantities you are interested in, it is difficult to say what approach you should take. Investigate these approaches and select the best approach for your problem.

    Johannes-
    I think this type of mesh deformation would work well for your problem. The quantities from the initial grid are mapped onto the deformed grid and then iterations are done to make sure that the mass, momentum, energy are conserved at the new time step. However I would recommend that you speak with someone and explain all the physics you are trying to model to ensure that this moving wall technique described here is the best approach.

    Guys-
    Good luck. It sounds like these are complex problems you are trying to tackle. I am sorry I did not reply sooner to your questions, but I hope you found my comments useful. Let me know how your simulations turn out and thanks for reading our blog.

    Nick

    ReplyDelete
  8. Hi Nick,

    I greatly appreciate your reply. The deformation is complex, specifically the simulation is of a heart valve leaflet deforming in time and in space. The 3d motion of the leaflet has been solved using FEA in (LSDyna). So i am basically trying to do a transient, prescrived wall boundry deformation on the leaflet wall that has a very complex motion and no equation exist to define its deformation, hence why many different data displacement files exist. I have started with FORTRAN but still working on it, at the moment i am having issues with it. I do have an ansys costumer support account, and I recently seeked their support 4 times (over the past few days), but non with helpful results yet. Since you seem to be more aware with this issue how is it possible to get your assistance through the ansys support channel?


    I also noticed the when running a simulaiton the boundary profile data is read only at the start of a run. Is it possible to enforce the initial boundary profile data to be read every time step? I have implemented a FORTRAN junction box that creates a file based on the time step but how can it be read by cfx every timestep.
    Your help will be really appreciated,
    Thanks

    Majed

    ReplyDelete
  9. Majed,

    It sounds like you are in the middle of a complex analysis. I think it will be too involved aid you in developing this model here. I can try to help you on this via email. Please provide your email with your full contact information and I will try getting back to you. Or you can contact your regional SimuTech office here: http://www.simutechgroup.com/simutech-support/contact-support.html

    Nick

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Hi
    I am working on ' moving projectiles inside a shock tube at supersonic speeds and trying to capture shock waves, using CFX. ANSYS CFX is giving me hard time to solve this problem. Is this a moving mesh or deforming mesh problem. How can I move the projectiles (Fluid domain / Immersed solid) Should I use the projectile as sub domain or an immersed solid.
    The projectile is inside the tube and it moves through the tube and has to reach the atmosphere. Can this problem be solvable in CFX. I will appreciate any help on this

    ReplyDelete
  12. hello everybody, I am doing flutter analysis of Agard 445.6 wing but the problem is that the mode shape that I am getting are diffrent from expreimental values,How can I match to experimental values. I am using Ansys Workbench 13.
    waiting for reply

    ReplyDelete
  13. Hi, chanced upon your blog and found it to be really useful.

    I am currently simulating sand particles in a fluid and then subject the total fluid to impact loading (such as an explosion). I will need to model a few sand particles individually to see their movement and behavior in the fluid and pressure acted on them upon the pressure loaded.

    I keep getting folded mesh messages and the particles doesn't seem to response well individually (1 should travel at a different velocity than the other).

    Not too sure will you be able to help on this?

    ReplyDelete
  14. I have a doubt! The mesh displacement is solved using a Displacemnt diffusion equation. But there are some options more below, more near small volumes ...small region near boundary..value....can somebody tell what is the correct option to be used to get the deformed mesh generated nicely, like seen in the animation above ?

    ReplyDelete
  15. Hi, i got the following error message from CFX-solver when running,

    "C:\Program Files\ANSYS Inc\v130\CFX\bin\perllib\cfx5solve.pl" -batch
    -ccl runInput.ccl -fullname "Fluid Flow CFX_002"

    Setting up CFX Solver run ...


    +--------------------------------------------------------------------+
    | |
    | Starting ANSYS Solver |
    | |
    +--------------------------------------------------------------------+


    +--------------------------------------------------------------------+
    | An error has occurred in cfx5solve: |
    | |
    | ANSYS Solver terminated unexpectedly with return code 3840



    +--------------------------------------------------------------------+

    Please tell me what is the problem..

    I am doing FSI using ansys workbench.

    ReplyDelete
  16. Hi,
    I am doing a flow analysis of directional control valve where the spool(circular rod) moves linearly inside a cylindrical block. I need to analyse the flow as the spool moves. I have to model the fluid domain and the spool as a moving domain. I have ideas on using remeshing techniques with ICEM CFX where the mesh deformation is large and getting an error. what should i do?

    ReplyDelete
  17. Hi there!

    your example was very useful in trying to solve moving mesh problem with CFX.
    But could you put some more images of your case, please?
    it is still not quite clear for me, whether the whole sub-domain moves or just the wall? Which settings do you use for setting interface with body, where mesh doesn't deform?
    Could you post screen shots of mesh motion exactly for the boundary (part) that moves, please?
    It would be very-very helpful.
    Thanks in advance

    ReplyDelete
  18. Hi,Thanks for your helps,but I have a problem.From"Total Mesh Displacement Z is the predefined expression",can I ask you how to define the 'Total Mesh Displacement Z'? Thanks.

    ReplyDelete
  19. can you provude a complete tutorial to create this wave tank? Please send it to fabricio.leite58@uol.com.br

    ReplyDelete
  20. Thanks a lot for sharing us about this update. Hope you will not get tired on making posts as informative as this. local studio city moving company

    ReplyDelete
  21. Great and I have a nifty proposal: Whole House Renovation house remodeling services

    ReplyDelete