Usage of "field_get_coefaf_s" subroutine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
saintlyknighted
Posts: 16
Joined: Sun Aug 06, 2023 3:40 am

Usage of "field_get_coefaf_s" subroutine

Post by saintlyknighted »

Hi everyone, I'm currently going through some source code someone else has written and I came across this:

Code: Select all

! Boundary condition pointers for gradients and advection
      call field_get_coefa_s(ivarfl(ivar), coefap)
      call field_get_coefb_s(ivarfl(ivar), coefbp)

! Boundary condition pointers for diffusion
      call field_get_coefaf_s(ivarfl(ivar), cofafp)
      call field_get_coefbf_s(ivarfl(ivar), cofbfp)
I wanted to know what these subroutines do, but the documentation mentions "Return pointer to the coefa/coefb/coefaf/coefbf array of a given scalar field.", and I have no idea what these arrays are. What I can glean from the rest of the code is that they are coefficients related to boundary fluxes, but I do not know what they are or how they are calculated.

Would appreciate if anyone knows more about this. Thank you!
Yvan Fournier
Posts: 4168
Joined: Mon Feb 20, 2012 3:25 pm

Re: Usage of "field_get_coefaf_s" subroutine

Post by Yvan Fournier »

Hello,

These arrays are "preprocessed" boundary condition codes (that are subject to a redesign in a future version), built from the icodcl/rcodcl arrays described in the user documentation. They match the a/b/af/bf coefficients described in the theoretical documentation's section on boundary conditions, and are usually not set directly, bu through utility functions.

These arrays should only be accesses in very advanced user-defined functions. In older versions, they could be used in postprocessing operations to ensure gradient computations used the correct boundary conditions, but this is no longer needed, as higher level functions handle this.

Without seeing the rest of your code, I can not be sure if you can find a simpler alternative here.

Best regards,

Yvan
saintlyknighted
Posts: 16
Joined: Sun Aug 06, 2023 3:40 am

Re: Usage of "field_get_coefaf_s" subroutine

Post by saintlyknighted »

Hi Yvan, the theoretical documentation explains enough for me I believe. Thanks for mentioning that, I had forgotten that the user and theory guides existed and could be referenced.
Post Reply