# lapalce discretization for couple boundary condition

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 31, 2022, 01:45 lapalce discretization for couple boundary condition #1 New Member   Mostafa Join Date: Oct 2021 Posts: 20 Rep Power: 3 Hello foamers , I'm currently studying source code of coupledFvPatchField so i will use it in my future research extension for Discretizing the Laplace operator , we need gradientInternalCoeffs and gradientBoundaryCoeffs so we have gamma*surface area*( gradientBoundaryCoeffs + gradientInternalCoeffs*internal field ) My question is how the those coefficients are evaluated for couple boundary condition so that we get the following results as stated in source code template tmp > coupledFvPatchField::gradientInternalCoeffs( ) const { return -pTraits:ne*this->patch().deltaCoeffs(); } template tmp > coupledFvPatchField::gradientBoundaryCoeffs( ) const { return -this->gradientInternalCoeffs(); }

 November 2, 2022, 05:10 #2 Senior Member   Domenico Lahaye Join Date: Dec 2013 Posts: 541 Blog Entries: 1 Rep Power: 15 Could you pls. elaborate on your post and place links to the code that you are referring to? Thx. Last edited by dlahaye; November 2, 2022 at 05:11. Reason: Added.

 November 2, 2022, 15:45 #3 New Member   Mostafa Join Date: Oct 2021 Posts: 20 Rep Power: 3 Hello Domenico , in boundary conditions files in /src/finiteVolume/fields/fvPatchFields , we have three cases for boundary conditions basic --> (fixedValue-zeroGradient-fixedGradient-couple- etc) derived --> (any derived boundary condition according to used model) constrained ---> ( symmery - processors Bcs , region couple (patch to patch BC) ) in any one of them , boundary faces contributions to diagonal coefficient and source of ldu Matrix is presented through 5 functions The ones related to divergence (convection term) discretization are valueInternalCoeffs() valueBoundaryCoeffs() so discretizing the divergence term we get gamma*face area*( valueBoundaryCoeffs + valueInternalCoeffs*adjacent cell center value ) The ones related to laplace (diffusuion term ) discretization are gradientInternalCoeffs() gradientBoundaryCoeffs() and discretizing the laplace term we get gamma*face area*( gradientBoundaryCoeffs + gradientInternalCoeffs*adjacent cell center value ) My problem is in couple boundary condition src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C I want to understant how the following coefficients are obtained template tmp > coupledFvPatchField::gradientInternalCoeffs( ) const { return -pTraits:ne*this->patch().deltaCoeffs(); } template tmp > coupledFvPatchField::gradientBoundaryCoeffs( ) const { return -this->gradientInternalCoeffs(); } what i understand is that gamma*face area*(phiN-phiO)/deltaX take the form gamma*face area*(gradientBoundaryCoeffs + gradientInternalCoeffs*phiO) so gradientBoundaryCoeffs = phiN*1/deltaX gradientInternalCoeffs = -1/deltaX but the answer indicated that gradientBoundaryCoeffs = 1/deltaX gradientInternalCoeffs = -1/deltaX

 November 3, 2022, 06:59 #4 Senior Member   Domenico Lahaye Join Date: Dec 2013 Posts: 541 Blog Entries: 1 Rep Power: 15 I am confused by your explanation for the following two reasons. 1/ valueInternalCoeffs() and valueBoundaryCoeffs() are related to Dirichlet bc (fixed values). gradientInternalCoeffs() and gradientBoundaryCoeffs() are related to Neumann bc (fixed gradient). 2/ boundary conditions are imposed on differential equations, not on individual differential operators (Laplacian or gradient). Does this help?

 November 3, 2022, 10:44 #5 New Member   Mostafa Join Date: Oct 2021 Posts: 20 Rep Power: 3 first of all valueInternalCoeffs() , valueBoundaryCoeffs() , gradientInternalCoeffs() and gradientBoundaryCoeffs() are related to discretization of laplace and divergence operator not Drichelete and neumann Open fixedValue BC , you will see the four functions define ; two of them are called when discretizing the laplace operator and the other two when discretizing the divergence operator look at these lines of codes in gaussLaplacianScheme::fvmLaplacianUncorrected class forAll(vf.boundaryField(), patchi) { const fvPatchField& pvf = vf.boundaryField()[patchi]; const fvsPatchScalarField& pGamma = gammaMagSf.boundaryField()[patchi]; const fvsPatchScalarField& pDeltaCoeffs = deltaCoeffs.boundaryField()[patchi]; if (pvf.coupled()) { fvm.internalCoeffs()[patchi] = pGamma*pvf.gradientInternalCoeffs(pDeltaCoeffs); fvm.boundaryCoeffs()[patchi] = -pGamma*pvf.gradientBoundaryCoeffs(pDeltaCoeffs); } else { fvm.internalCoeffs()[patchi] = pGamma*pvf.gradientInternalCoeffs(); fvm.boundaryCoeffs()[patchi] = -pGamma*pvf.gradientBoundaryCoeffs(); } } gradientInternalCoeffs , gradientBoundaryCoeffs are called to account for boundary face contribution to diagonal and source coefficient of ldu Matrix 2) regarding your second not indeed differential equations are set of operators which will be spatially and temporally discretized so that are applied to boundary cells while discretization

November 3, 2022, 12:53
#6
Senior Member

Domenico Lahaye
Join Date: Dec 2013
Posts: 541
Blog Entries: 1
Rep Power: 15
Dear Mostafa,

1/ My bad. Thank you for pointing our my mistake. Appreciated. I will redo my homework.

2/ Returning to your original question.

Quote:
Is it possibly that phiN is taken into account on the neighbouring patch? (merely speculating here)

Greetings.

 Tags boundaries condition, interface bc, openfoam