|November 15, 2011, 09:37||
Do-loop in CFX Perl language
Join Date: Oct 2011
Posts: 4Rep Power: 6
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.
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!
|November 15, 2011, 10:48||
Join Date: Apr 2009
Posts: 530Rep Power: 13
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.
|November 15, 2011, 20:25||
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 12,395Rep Power: 96
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.
|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|