fds icon indicating copy to clipboard operation
fds copied to clipboard

Non-matching diffusive mass flux across mesh boundaries with refinement.

Open marcosvanella opened this issue 5 years ago • 8 comments

I'm looking at mass fluxes across interpolated mesh boundaries. I'm having difficulties getting matching diffusive mass fluxes across mesh boundaries with refinement. Add this piece of code in line 267 of divg.f90 to write out computed fluxes in one interpolated boundary face (4 faces fine side) as seen from the two meshes of the attached case.

   N=1; RHO_D_DZDN=0._EB
   DO K=0,KBAR
      DO J=0,JBAR
         DO I=0,IBAR
            IF(NM==1 .AND. I==8 .AND. (J==3 .OR. J==4) .AND. (K==3 .OR. K==4)) THEN ! <- With Refinement
            !IF(NM==1 .AND. I==4 .AND. J==2 .AND. K==2) THEN ! <- No Refinement
               WRITE(LU_ERR,*) 'NM,N,I,J,K=',NM,N,I,J,K,' : RHO_D_DZDX=',RHO_D_DZDX(I,J,K,N)
               RHO_D_DZDN=RHO_D_DZDN+RHO_D_DZDX(I,J,K,N)
            ELSEIF(NM==2 .AND. I==0 .AND. J==2 .AND. K==2) THEN
               WRITE(LU_ERR,*) 'NM,N,I,J,K=',NM,N,I,J,K,' : RHO_D_DZDX=',RHO_D_DZDX(I,J,K,N)
               WRITE(LU_ERR,*) ' '; WRITE(LU_ERR,*) ' '
            ENDIF
         ENDDO
      ENDDO
   ENDDO
   IF(NM==1) THEN ! <- With Refinement
      WRITE(LU_ERR,*) ' '
      WRITE(LU_ERR,*) 'Fine  NM,N=',NM,N,'                             : Average RHO_D_DZDX=',1._EB/4._EB*RHO_D_DZDN ! Area average.
   ENDIF

When commenting the lines with tag "With Refinement", uncommenting the "No refinement" line and using the 4x4x4 left mesh specified in the input file I get matching fluxes for the boundary face. I'm not seeing that for the case with refinement.

two_mesh.fds.txt

marcosvanella avatar Dec 10 '20 18:12 marcosvanella

Thanks, I'll take a look

rmcdermo avatar Dec 10 '20 18:12 rmcdermo

@marcosvanella You've uncovered some dirty laundry. This has never been right. The good news is that we have dealt with something similar before and fixed it. If you look at the FDS Tech Guide, Special Topic: Vertical Mesh Coarsening in Atmospheric Flows, we do a special interpolation of the density to make sure the heat flux matches at a mesh interface. I think we would have to apply the same idea to RHO and ZZ in all directions if we have a mesh interface.

rmcdermo avatar Dec 10 '20 22:12 rmcdermo

@marcosvanella try the latest code (PR #9054) with your case and this one.

diffuse_3d.fds.txt

This case uses a MASS_FILE. The total HELIUM is pretty tight. I think the discrepancy is related to advection.

rmcdermo avatar Dec 14 '20 23:12 rmcdermo

Yes, fluxes match now in the original case. I run diffuse_3d for 50 sec and the error picks up compared to the 10 sec run, but it is still < 10^-4 of the original mass. Also, velocity values increase in the refinement boundary. Let me know if you want to close this or keep it open to deal here with heat fluxes.

marcosvanella avatar Dec 15 '20 16:12 marcosvanella

Thanks. Let's keep it open to deal with heat fluxes.

At 50 s, does the mass actually start to leave the domain? I'll create a sealed case for verfication.

rmcdermo avatar Dec 15 '20 16:12 rmcdermo

There's no difference in final mass using open or solid external boundaries.

marcosvanella avatar Dec 15 '20 16:12 marcosvanella

@rmcdermo Does this still need to be open for heat flux that we should tag for 7?

drjfloyd avatar Apr 13 '23 16:04 drjfloyd

Yes, I have not fixed the heat fluxes yet.

rmcdermo avatar Apr 13 '23 19:04 rmcdermo