Re: Cannot use mesh element

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Yvan Fournier

Re: Cannot use mesh element

Post by Yvan Fournier »

Hello,

Do you have "error*" or "listing" files in the execution directory ? They should contain more details on the cause of the crash
(you only posted the EnSight case index file, not the mesh or data, so there is very little information, except that the code went at least that far).

Best regards,

  Yvan
Christophe Rehmet

Re: Cannot use mesh element

Post by Christophe Rehmet »

Hello Yvan and thank you for your answer ,

In fact I managed to find my mistake. It came from the boundary conditions at one of my four injections. However I have another small problem to change the existing code. I try to modifying the code in uslrc.f90 in arc electric module. I defined a cut plane in my geometry and I'd like to use it to measure the current. So I changed the following lines by trying the code given below. I could'nt find the error. Would you have any solution? Thank you.

   do ifac = 1, nfac
      if(        cdgfac(2,ifac).lt.  5d-5                        &
            .and. cdgfac(2,ifac) .gt. -5d-5                       &
           .and. surfac(1,ifac) .lt. 1d-8                        &
           .and. surfac(1,ifac) .gt. -1d-8                       &
           .and. surfac(3,ifac) .lt. 1d-8                        &
           .and. surfac(3,ifac) .gt. -1d-8 )  then
        iel = ifacel(1,ifac)
        elcou = elcou + propce(iel,ipcdc2) * surfac(2,ifac)
      endif
    enddo

Modified by

call getfac('Plan_courant_3', nlelt, lstelt)
     do ilelt = 1, nlelt
    ifac = lstelt(ilelt)
     do ifac = 1, nfac
     iel  = ifacel(1,ifac)
     elcou = elcou + propce(iel,ipcdc2) * surfac(2,ifac)
     enddo
    enddo
Yvan Fournier

Re: Cannot use mesh element

Post by Yvan Fournier »

Hello,

You seem to have an extra a loop on ifac :

Code: Select all

call getfac('Plan_courant_3', nlelt, lstelt)
do ilelt = 1, nlelt
  ifac = lstelt(ilelt)
  do ifac = 1, nfac
    iel  = ifacel(1,ifac) 
    elcou = elcou + propce(iel,ipcdc2) * surfac(2,ifac)
  enddo
enddo
Should be replaced by :

Code: Select all

call getfac('Plan_courant_3', nlelt, lstelt)
do ilelt = 1, nlelt
  ifac = lstelt(ilelt)
  iel  = ifacel(1,ifac) 
  elcou = elcou + propce(iel,ipcdc2) * surfac(2,ifac)
enddo
Best regards,

  Yvan
Christophe Rehmet

Re: Cannot use mesh element

Post by Christophe Rehmet »

Hello Yvan thank you for your answer but in the sub- routine uslerc.f90 when I introduce (defining and using) lstelt, calculation cannot run. So I try another approach without using lstelt

   call getfac('Plan_courant_3', nfac, lndfac)
   do ifac = 1, nfac
     iel = ifacel(1,ifac)
    elcou = elcou + propce(iel,ipcdc2) * surfac(2,ifac)
    enddo

With this solution I can measure a current but it blocks on the calculation of POT_VEC1.
Yvan Fournier

Re: Cannot use mesh element

Post by Yvan Fournier »

Hello,
You should use another variable than nfac (for example nlfac), otherwise, calling getfac will change the global nfac value, which probably explains why the calculation blocks.
Also, for correctness, you should replace:
  iel = ifacel(1,ifac)
with:
  iel = ifacel(1, lndfac(ifac))
and:
  surfac(2,ifac)
with:
  surfac(2, lndfac(ifac))
Best regards,

  Yvan
Christophe Rehmet

Re: Cannot use mesh element

Post by Christophe Rehmet »

Hello Yvan.

I find another solution less problematic than defining a plan. So I used the following code lines to find my plan to -120° relative to the benchmark:

 do ifac = 1, nfac
     if( - surfac(1,ifac)*1.d0/2.d0  - surfac(2,ifac)*(sqrt(3.d0)/2.d0) .lt. 1d-8                &
  . and. - surfac(1,ifac)*1.d0/2.d0 - surfac(2,ifac)*(sqrt(3.d0)/2.d0) .gt. -1d-8 .and.  &
    cdgfac(1,ifac)*(sqrt(3.d0)/2.d0) - cdgfac(2,ifac)*1.d0/2.d0   .lt. 5d-5  .and.           &
    cdgfac(1,ifac)*(sqrt(3.d0)/2.d0) - cdgfac(2,ifac)*1.d0/2.d0 .gt. -5d-5 .and.            &
            surfac(3,ifac) .lt. 1.d-8                                                                                     &
           .and. surfac(3,ifac) .gt. -1.d-8 )  then   iel = ifacel(1,ifac)
     elcou = elcou + propce(iel,ipcdc1) * surfac(1,ifac) &
        +propce(iel,ipcdc2) * surfac(2,ifac)
Post Reply