|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Join Date: Jun 2017
Posts: 3
Rep Power: 10 ![]() |
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 09:19. |
|
|
|
|
|
|
|
|
#2 |
|
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,001
Rep Power: 146 ![]() ![]() ![]() ![]() |
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. |
|
|
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Jun 2017
Posts: 3
Rep Power: 10 ![]() |
Thanks for your help so far, I will have look.
|
|
|
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Jun 2017
Posts: 3
Rep Power: 10 ![]() |
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. |
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
| [Other] Can't Shake Erros: patch type 'patch' not constraint type 'empty' | BrendaEM | OpenFOAM Meshing & Mesh Conversion | 12 | April 3, 2022 19:32 |
| [snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
| decomposePar -allRegions | stru | OpenFOAM Pre-Processing | 2 | August 25, 2015 04:58 |
| foam-extend_3.1 decompose and pyfoam warning | shipman | OpenFOAM | 3 | July 24, 2014 09:14 |