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

The problem about add body force(physical external forcing)using CFX

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2020, 11:29
Default The problem about add body force(physical external forcing)using CFX
  #1
New Member
 
jinzhihui
Join Date: Oct 2017
Posts: 12
Rep Power: 9
Jinzhihui is on a distinguished road
Hi
I'm trying to add a body force to momentum source through CFX.
I have a constant body force f(fx fy 0) which Located in a specific area(such as x1<x<x2,y1<y<y2). I want to add them to the momentum equation.I have added only one direction body force(X or Y,but not all)to Subdomain Source form with User CEL function and Routine in CFX successfully.
PHP Code:
#include "cfx5ext.h"
dllexport(user_source)
      
SUBROUTINE USER_SOURCE (
     & 
NLOC,NRET,NARG,RET,ARGS,CRESLT,CZ,DZ,IZ,LZ,RZ)

      
INTEGER NLOCNRETNARG
      CHARACTER
*(4CRESLT
      REAL    RET
(1:NLOC,1:NRET), ARGS(1:NLOC,1:NARG)

      
INTEGER IZ(*)
      
CHARACTER CZ(*)*(1)
      
DOUBLE PRECISION DZ(*)
      
LOGICAL LZ(*)
      
REAL RZ(*)

      
CALL USER_SOURCE_SUB (NLOC,RET(1,1),ARGS(1,1),ARGS(1,2))
C
      CRESLT 
'GOOD'
      
END

      SUBROUTINE USER_SOURCE_SUB 
(NLOC,SOURCE,X,Y)

      DO 
ILOC=1,NLOC
         SOURCE
(ILOC) = 0.0
         
IF (X(ILOC).GE.1.5  .AND. X(ILOC).LE.2.5  .AND.
     &    
Y(ILOC).GE.1.5 .AND. Y(ILOC).LE.2.5THEN
            SOURCE
(ILOC) =  1000000.0
         END 
IF
C---------------------
      
END DO
C
      END 
Now I need to add Fx and Fy simultaneously ,The NRET of CEL Routine is always 1 in CFX according to User CEL Function and Routines in the CFX Modeling Guide.So I tried to use two CEL Function from two different Routine,and define of the Functions as below:

(1)this work done successfully,these Functions from the same Routine.




(2)this work can't run




Unfortunately,I got error message.Notice that the Function 1 and 2 from two Routines,because i need two kinds of return Values.





1.If there are any mistakes in what I have finished(add one dirction body force)?

2.What is the reason for this mistake?

3.How to add different direction momentum source at same time?

Appreciate your response....
Jinzhihui is offline   Reply With Quote

Old   January 16, 2020, 11:38
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,869
Rep Power: 33
Opaque will become famous soon enough
You have shown the UserFortran code, but not the context on how it is used.

Please show how it is accessed in the setup, i.e.

MOMENTUM SOURCE:
Option = Cartesian Components
X Component =
Y Component =
Z Component =
END
Opaque is offline   Reply With Quote

Old   January 17, 2020, 02:31
Default
  #3
New Member
 
jinzhihui
Join Date: Oct 2017
Posts: 12
Rep Power: 9
Jinzhihui is on a distinguished road
Quote:
Originally Posted by Opaque View Post
You have shown the UserFortran code, but not the context on how it is used.

Please show how it is accessed in the setup, i.e.

MOMENTUM SOURCE:
Option = Cartesian Components
X Component =
Y Component =
Z Component =
END
Thinks for your reply.
this UserFortran code is used to define one User Routine whose Option is User CEL Function, in CFX Pre.The Function which has three Arguments and onlu one return variavle is defined as below,for this routine structure of User CEL Functions only have one renturn variable :




So do you have some suggestions....
Jinzhihui is offline   Reply With Quote

Old   January 17, 2020, 04:35
Default
  #4
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,910
Rep Power: 28
Gert-Jan will become famous soon enough
Are you convinced that function 2 is working properly? Did you for example try running only function 2? Or using functions 2 twice, for x and y component?
Gert-Jan is offline   Reply With Quote

Old   January 17, 2020, 05:16
Default
  #5
New Member
 
jinzhihui
Join Date: Oct 2017
Posts: 12
Rep Power: 9
Jinzhihui is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
Are you convinced that function 2 is working properly? Did you for example try running only function 2? Or using functions 2 twice, for x and y component?
Yes,I have already run only function 2 for X ,for X and Y component both,It's OK.

I guess the reason for error is the two User Function for X and Y component come from two different User Routines, and CFX need to call two different User CEL Function Routines(Both of these two Routines can run independently,and the Structure of Routines same as the first Fig) .This means CFX call the Function using the same Routine(only one) for x and y component, It can run.
Jinzhihui is offline   Reply With Quote

Old   January 17, 2020, 06:14
Default
  #6
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,910
Rep Power: 28
Gert-Jan will become famous soon enough
I would like know what ANSYS says........
Gert-Jan is offline   Reply With Quote

Old   January 19, 2020, 23:45
Default
  #7
New Member
 
jinzhihui
Join Date: Oct 2017
Posts: 12
Rep Power: 9
Jinzhihui is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
I would like know what ANSYS says........
ANSYS prompt this error message


I don't get what you mean....
Jinzhihui is offline   Reply With Quote

Old   January 20, 2020, 04:16
Default
  #8
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,910
Rep Power: 28
Gert-Jan will become famous soon enough
I mean the ANSYS support help desk
Gert-Jan is offline   Reply With Quote

Reply

Tags
body force, cel function, cfx, momentum sources


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
CGNS Compiling Diego Main CFD Forum 17 December 21, 2014 02:40
modeling a floating body in cfx neda2014 CFX 9 October 14, 2014 05:53
CFX parallel hp MPI problem fluidmechanics CFX 5 June 19, 2013 20:05
CFX pressure in Simulations problem nasdak CFX 1 April 14, 2010 14:22
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07


All times are GMT -4. The time now is 22:48.