|
[Sponsors] |
How to distribute particles randomly at initial time |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 28, 2018, 10:40 |
How to distribute particles randomly at initial time
|
#1 |
New Member
Shi Xiaolei
Join Date: Feb 2018
Posts: 1
Rep Power: 0 |
Dear All,
I would like to simulate a channel turbulent flow with particles by using DPMFoam, there should be constant 20000 particles in the field for each time step. My question is how to inject those 20000 particles into the field randomly at initial time, if I specify manualInjection in "kinematicCloudProperties" and use a "kinematicCloudPositions" file to specify the location of each particle, it would be troublesome. Is there any better solution? Please let me know is you are aware of this.. Thank you! |
|
May 25, 2020, 04:23 |
|
#2 |
Member
Simon
Join Date: Sep 2019
Location: Germany
Posts: 51
Rep Power: 6 |
Hi,
I know that the answer is a little bit late and maybe you already found other help. What I would try to do is to programm a small code that can create you the random positions in a X/Y/Z-Space. You can write them out of your programm as a .txt-File. That means you can use any programming language that you want (not necessarily C++). Have you already exeriances with programming? Simon |
|
May 25, 2020, 07:10 |
|
#3 |
Member
Simon
Join Date: Sep 2019
Location: Germany
Posts: 51
Rep Power: 6 |
Hello again,
i was writing a python-program for generating the random numbers and saving them in a file. I put it in this post. If you want you can just copy it, paste it in your python-editor and edit the parameters. Maybe there are better way to have the same result. So let me know if you found one. Code:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 25 10:52:19 2020 @author: simon """ # ============================================================================= # Program to generate random positions in a 3D box. # Replace the positions in your kinematicCloudPositions-file with the points # out of the file produced by this python script. # ============================================================================= #import scipy.interpolate as si import numpy as np #Number of positions and size of cubic space where they can be noOfPositions = 2000 xMin = -0.0025 xMax = 0.0025 yMin = -0.0025 yMax = 0.0025 zMin = -0.0025 zMax = 0.0025 # round the float numbers to a number of digits xRound = 6 yRound = 6 zRound = 6 # create a new file and open it. # Write also the Path from program-folder to saving-folder file = open('Files/positions.txt', 'w') file.write('( \n') # create random numbers for X/Y/Z for i in range(noOfPositions): xRand = np.round( np.random.uniform(xMin, xMax) ,xRound) yRand = np.round( np.random.uniform(yMin, yMax) ,yRound) zRand = np.round( np.random.uniform(zMin, zMax) ,zRound) # Write the random numbers in the file file.write('('+ str(xRand) +' '+ str(yRand) +' '+ str(zRand) +') \n') file.write(') \n') file.close() Thank you Simon Last edited by SimonStar; May 25, 2020 at 08:42. |
|
May 28, 2020, 06:08 |
|
#4 |
Member
Simon
Join Date: Sep 2019
Location: Germany
Posts: 51
Rep Power: 6 |
Sorry to answer myself always
can someone help me how to inject particles instead at a single timepoint in a specified timeframe? Maybe just upload the kinematicCloudProperties or what else I have to know for this. This would be very nice from you. Thank you Simon |
|
June 1, 2021, 15:30 |
Latin Hypercube design
|
#5 | |
Member
Sourav Mandal
Join Date: Jul 2019
Posts: 55
Rep Power: 6 |
Quote:
Last edited by sourav90; June 8, 2021 at 08:48. Reason: More specific |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 06:28 |
pressure in incompressible solvers e.g. simpleFoam | chrizzl | OpenFOAM Running, Solving & CFD | 13 | March 28, 2017 06:49 |
Extrusion with OpenFoam problem No. Iterations 0 | Lord Kelvin | OpenFOAM Running, Solving & CFD | 8 | March 28, 2016 12:08 |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
Simulation seems to converge but crashes suddenly | xxxx | OpenFOAM | 16 | September 12, 2014 09:07 |