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

Do-loop in CFX Perl language

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 15, 2011, 08:37
Default Do-loop in CFX Perl language
  #1
New Member
 
Enrico Anderlini
Join Date: Oct 2011
Location: Southampton
Posts: 4
Rep Power: 14
fated-oracle is on a distinguished road
Hi!

I have to finish a project for my university, which simulates the fall of a rigid body onto a calm free surface. I did the simulation with a deforming mesh and now I'm supposed to do it with a fixed mesh, moving flow approach (the fluids are water, incompressible and air compressible).

In order to do this I would need the flow velocity to be dependent on the force on the body at each time step (it is a transient simulation). The force on the body can be obtained with a monitor as force_y()@Body. The problem is I need to update the velocity at each time step. I have read this can be done with a junction box routine and a code written in Fortran. The problem is I need to run the simulation on different platforms (windows and linux) and this would require different languages for the specification of the location of the fortran files and different compilers. Besides, as I am new to this approach it would require quite a lot of time as well. I was wondering if there was a way to write this code all in Perl and within the CFX file so as to avoid these problems.

The code would look something like this (in fortran-style):
do i=1:tot number of time steps
Fi=force_y()@Body !I would need to call this et everytime step, where !i is the interested time step
Vi+1=Vi+(g-Fi/M)Dt !where Vi is the old velocity, M is the mass of
!the body Dt is the time step
yvel=Vi+1 !This is the function to be used in CFX Pre for the vertical velocity of the fluid.
end do

As you can see this is rather complicated as it would require a user input call at the beginning of each time step.
Thank you in advance!
fated-oracle is offline   Reply With Quote

Old   November 15, 2011, 09:48
Default
  #2
Senior Member
 
Join Date: Apr 2009
Posts: 531
Rep Power: 21
stumpy is on a distinguished road
Perl code is only evaluated once, at the start of the solver run, so you can't use that approach. You can make the velocity a function of the force using CEL. The problem is that you don't want the force value to get updated each coefficient loop; instead you want it to hold the value from the previous timestep. You can achieve that by using an Additional Variable that is only updated once per timestep. This is a hidden CCL only feature. Search this forum for "Update Loop = TRANS_LOOP" for more info.
stumpy is offline   Reply With Quote

Old   November 15, 2011, 19:25
Default
  #3
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
Also note this approach means that you have to model an accelerating frame of reference. Whether these acceleration terms are important for you or not is for you to determine.
ghorrocks 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
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45
heat generation in CFX Ema CFX 4 August 7, 2009 05:39
Electronics Enclosure Analysis with CFX Simulation Engineer CFX 1 April 22, 2009 11:08
CFX 10's solutions differ from CFX 5.7's Atit Koonsrisuk CFX 4 July 26, 2006 11:59
FSI using CFX and ANSYS Bi Chang CFX 2 May 10, 2005 04:47


All times are GMT -4. The time now is 20:57.