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

Fortran user: not able to figure out how not two points overlap in space

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 8, 2015, 09:57
Smile Fortran user: not able to figure out how not two points overlap in space
  #1
New Member
 
sARTHAK
Join Date: Dec 2015
Posts: 5
Rep Power: 10
Sarthak876 is on a distinguished road
Hi,
My goal is to Generate some random points in space which I have done. But I am not able to figure out how not two points overlap in space(mainly not two points should be in vicinity of other till raidus =1). How to do it !!!
Sarthak876 is offline   Reply With Quote

Old   December 8, 2015, 16:42
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
What are the points for? Monitor points? particle seed points? Something else?
ghorrocks is offline   Reply With Quote

Old   December 9, 2015, 04:30
Default
  #3
New Member
 
sARTHAK
Join Date: Dec 2015
Posts: 5
Rep Power: 10
Sarthak876 is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
What are the points for? Monitor points? particle seed points? Something else?
The points basically represent particles with raidus 1 unit.
Sarthak876 is offline   Reply With Quote

Old   December 9, 2015, 05:40
Default
  #4
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
Are they seed points for a particle tracking model?
ghorrocks is offline   Reply With Quote

Old   December 10, 2015, 05:10
Default
  #5
New Member
 
sARTHAK
Join Date: Dec 2015
Posts: 5
Rep Power: 10
Sarthak876 is on a distinguished road
I dont know what is Particle tracking model. I am trying to generate model in which I generate Random particle in confined space and then by some potential they interact,potential is only position dependent there should be a finite distance between every particles and that is 1 unit in any direction.

I dont know how to generate coordinates of Particles such that no two particles are in vicinity of each other. Please help
Sarthak876 is offline   Reply With Quote

Old   December 10, 2015, 06:36
Default
  #6
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
Some explanation of what you are doing would help.

Are you generating these points in the solver, post processor, a solid modelling package or the mesher?

How do the points interact? Do they interact with a fluid? If so then how?
ghorrocks is offline   Reply With Quote

Old   December 10, 2015, 10:09
Default
  #7
New Member
 
sARTHAK
Join Date: Dec 2015
Posts: 5
Rep Power: 10
Sarthak876 is on a distinguished road
They are interacting via Lenard-Jones potential,with each Iteration there position is changed but with is the confined Volume !! Suppose it as like a gas molecules in box but here they interact with L-J potential.
Sarthak876 is offline   Reply With Quote

Old   December 10, 2015, 15:56
Default
  #8
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
The L-J potential is an atomic scale effect. CFX cannot model atomic scale effects. It sounds like you are using the wrong software.
ghorrocks is offline   Reply With Quote

Old   December 11, 2015, 07:35
Default
  #9
New Member
 
sARTHAK
Join Date: Dec 2015
Posts: 5
Rep Power: 10
Sarthak876 is on a distinguished road
I am writting CODE in fortran and then plot my points in gnuplot !!

And I think I know the solution now what you do is generate 1000 or whatever no of particles you want to generate and then calculate distance btw each pair and if it is less than your raidus of paricle or atom replace one of the particles one of the coordinate and it may happen now where you have putted your particle it is in vicinity of any other particle so again do the above thing untill tou find a place where there is no particle in its vicinity.

here's my code for it


!================================================= ===============================================!
!========================ELIMINATING OVER LAPPING OF POINTS======================================!
!================================================= ===============================================!
subroutine Eliminate_overlap(n,x,y,z,sizee)
implicit none
integer::n
real::x(n),y(n),z(n),sizee
integer::i,j
real::xr,yr,zr,dis
integer::m


do i=1,n-1
do j=i+1,n
xr=(x(i)-x(j)) !Distance of ith particle from all particles in X direction
yr=(y(i)-y(j)) !Distance of ith particle from all particles in Y direction
zr=(z(i)-z(j)) !Distance of ith particle from all particles in Z direction

dis=( ((xr)*(xr))+((yr)*(yr))+((zr)*(zr)) )**(0.5)

if ((dis)>1) then
else
if ((dis)<=1) then
call replace(i,j,x,y,z,n,sizee)

end if
end if
end do
end do

return
end subroutine

subroutine replace(i,j,x,y,z,n,sizee)
implicit none
integer::n
real::x(n),y(n),z(n),sizee
integer::i,j
REAL :: r
CALL init_random_seed()
CALL RANDOM_NUMBER(r)
x(i)=(r*sizee)
call Eliminate_overlap(n,x,y,z,sizee)
return
end subroutine
!================================================= ===============================================!

Thanks for you help bro/sis, if there is any problem in this algorithm please tell me.
Sarthak876 is offline   Reply With Quote

Old   December 11, 2015, 16:46
Default
  #10
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
If you are not using CFX then why are you posting on the CFX forum?
ghorrocks 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
User fortran error when running CFX-10 in parallel CFDworker CFX 3 September 22, 2015 08:59
User Fortran - stack overflow problem D.ko CFX 2 November 12, 2013 05:56
User monitor points raw file aerost CFX 1 November 19, 2012 16:47
Can use PVM in User Fortran LIU Yu CFX 0 November 29, 2008 22:10
CFX11.0 cannot find dll in User Fortran brunoc CFX 0 April 4, 2007 10:42


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