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

Fortran random number generator

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2017, 13:50
Default Fortran random number generator
  #1
New Member
 
Join Date: Jun 2017
Posts: 3
Rep Power: 8
Jogginghose is on a distinguished road
Good evening,

I am new to CFD and I am working on a fibrous filter simulation. I use CEL expressions to create cylinders with a randomzied orientation. In order to get that randomization I thought about a Fortran subroutine which can create random numbers ([0,1)).

Since I am not really good at coding, I have looked for already existing codes and found some Fortran codes for random number generators (e.g. Mersenne-Twister). I created new enviromental variables for windows, used the Intel compiler and got two files (a .dll and .O). And now I have two questions:

1. I always start CFX with the workbench but where do I need to put the files?
I put the files in the folder ANSYS creates for my project but I guess that is wrong because I get the error message:

| Message:
|
| Unable to load symbol <file name> from ..\winnt-amd64\<file name>.dll:
| The specified procedure could not be found.

2. Or do I need an extra Fortran code that is compatible with CFX?

I hope somebody can help me with this problem and thanks in advance.

Last edited by Jogginghose; July 10, 2017 at 08:19.
Jogginghose is offline   Reply With Quote

Old   July 9, 2017, 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
Doesn't your fortran compiler have a random number generator built in? All the compilers I have seen have one. Then you don't need an external library.

Have a look in the CFX documentation for examples of linking fortran to CFX.
ghorrocks is offline   Reply With Quote

Old   July 10, 2017, 07:03
Default
  #3
New Member
 
Join Date: Jun 2017
Posts: 3
Rep Power: 8
Jogginghose is on a distinguished road
Thanks for your help so far, I will have look.
Jogginghose is offline   Reply With Quote

Old   July 24, 2017, 12:49
Default
  #4
New Member
 
Join Date: Jun 2017
Posts: 3
Rep Power: 8
Jogginghose is on a distinguished road
Hey,

my random number generator is working quite well now; I used the intrinsic subroutine RANDOM_NUMBER of Fortran. But I still have one problem:

When I use the User Function I get an array of random numbers between (0,1), but I need just one number (or an array with the same number everywhere). I tried several things, the furthest I got was one random number and every other number was my function argument (e.g Function 1(0.25)).

I would appreciate some tips from somebody who has more experience than me in Fortran.

Thanks in advance.

PS: I attached my fortran source code and pictures for the two cases above. I used the velocity to test my subroutine.
Attached Images
File Type: jpg one_random_velocity_point.jpg (77.5 KB, 21 views)
File Type: jpg random_velocity.jpg (143.7 KB, 21 views)
Attached Files
File Type: zip win_15.zip (900 Bytes, 11 views)
Jogginghose 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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
[Other] Can't Shake Erros: patch type 'patch' not constraint type 'empty' BrendaEM OpenFOAM Meshing & Mesh Conversion 12 April 3, 2022 18:32
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 03:21
decomposePar -allRegions stru OpenFOAM Pre-Processing 2 August 25, 2015 03:58
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 08:14


All times are GMT -4. The time now is 00:07.