effortts calculation (F=PxS)

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

effectively Yvan I did what James said. I modified the subroutine USPROJ.F90 as follows :

Code: Select all

if (ineedf.eq.1) then
  do ii = 1, ndim
    xfor(ii) = 0.d0
  enddo

  call getfbr('204', nlelt, lstelt)
  !==========

  do ilelt = 1, nlelt

    ifac = lstelt(ilelt)

    do ii = 1, ndim

      xfor(ii) = xfor(ii) + ra(iforbr + (ifac-1)*ndim + ii-1)
    enddo
  enddo
Then After the convergence I see nothing in the post processing menu??

Where I need retrieve the result of this calculation??

Thank's for all
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: effortts calculation (F=PxS)

Post by JamesMcNaughton »

Yeah like Yvan says you have what you need to calculate the moment so you just need to print your result to a file, if it's just a number then you can put it in the listing, for example:

Code: Select all

write(nfecra,*)xfor(1),xfor(2),xfor(3)
Or could put this in a specific file, look at the "profile" example in usproj if you're not familiar with doing this in fortran.
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

THank's James,

I modified the usproj subroutine as you explain but I didn't have anything concerning the forces in the "listing"?

Code: Select all

if (ineedf.eq.1) then

  do ii = 1, ndim
    xfor(ii) = 0.d0
  enddo

  call getfbr('Face_201', nlelt, lstelt)
  !==========

  do ilelt = 1, nlelt

    ifac = lstelt(ilelt)

    do ii = 1, ndim

      xfor(ii) = xfor(ii) + ra(iforbr + (ifac-1)*ndim + ii-1)
write(nfecra,*)xfor(1),xfor(2),xfor(3)
	
    enddo

  enddo

  if (irangp.ge.0) then
    call parrsm(ndim,xfor)
  endif

endif
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: effortts calculation (F=PxS)

Post by JamesMcNaughton »

Without knowing more about the set-up it's just a guess to the problem.. it's possible you are running in parallel and Face_201 is not on process 0 (the process that writes to the listing) and so you will never enter the loop.

In your example xfor is the sum of forces, the parrsm sums across all processes, so you need to place after that call, for example:

Code: Select all

if (ineedf.eq.1) then

  do ii = 1, ndim
    xfor(ii) = 0.d0
  enddo

  call getfbr('Face_201', nlelt, lstelt)
  !==========

  do ilelt = 1, nlelt

    ifac = lstelt(ilelt)

    do ii = 1, ndim

      xfor(ii) = xfor(ii) + ra(iforbr + (ifac-1)*ndim + ii-1)
   
    enddo

  enddo

  if (irangp.ge.0) then
    call parrsm(ndim,xfor)
  endif
  if (irangp.le.0) then
    write(nfecra,*)xfor(1),xfor(2),xfor(3)
  endif

endif
Try that and if you still have nothing I recommend posting your full usproj and listing which will help determine problems.

Also note this is calculating the global sum in the x,y,z directions, not the moment. The moment requires cross product with the distance vector.

James
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

Hi James,

I copied / pasted what you gave me and I had nothing on the "listing" concerning forces!

Below attached the file "listing" and "usproj"!
Attachments
usproj.txt
(15.74 KiB) Downloaded 211 times
listing-1.txt
(80.04 KiB) Downloaded 229 times
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: effortts calculation (F=PxS)

Post by JamesMcNaughton »

It is in the listing you provide, line 811 is the first instance.
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

Thank's a lot James :)

The is three value ( -7359.1764031134608 2.21572025732103550E-002 337.84818969745351)

So Fx = -7359.1764031134608,
Fy = 2.21572025732103550E-002
Fz = 337.84818969745351

That's right I guess?
JamesMcNaughton
Posts: 72
Joined: Mon Mar 19, 2012 1:21 pm

Re: effortts calculation (F=PxS)

Post by JamesMcNaughton »

Yes, for the first time-step.
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

Hi James,

Thanks a lot, really you helped me a lot :o

without your help I wouldn't have solved this problem of forces,
Thanks
stage75

Re: effortts calculation (F=PxS)

Post by stage75 »

Hi,
is there a relation that allows us to calculate the moment in subroutine instead of the hand calculation

Thanks
Post Reply