CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

lapalce discretization for couple boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 31, 2022, 00:45
Default lapalce discretization for couple boundary condition
  #1
New Member
 
Mostafa
Join Date: Oct 2021
Posts: 22
Rep Power: 4
mostafa kareem is on a distinguished road
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<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs( ) const
{
return -pTraits<Type>:ne*this->patch().deltaCoeffs();
}


template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs( ) const
{
return -this->gradientInternalCoeffs();
}
mostafa kareem is offline   Reply With Quote

Old   November 2, 2022, 04:10
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 723
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
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 04:11. Reason: Added.
dlahaye is offline   Reply With Quote

Old   November 2, 2022, 14:45
Default
  #3
New Member
 
Mostafa
Join Date: Oct 2021
Posts: 22
Rep Power: 4
mostafa kareem is on a distinguished road
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<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs( ) const
{
return -pTraits<Type>:ne*this->patch().deltaCoeffs();
}


template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::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
mostafa kareem is offline   Reply With Quote

Old   November 3, 2022, 05:59
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 723
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
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?
dlahaye is offline   Reply With Quote

Old   November 3, 2022, 09:44
Default
  #5
New Member
 
Mostafa
Join Date: Oct 2021
Posts: 22
Rep Power: 4
mostafa kareem is on a distinguished road
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<Type, GType>::fvmLaplacianUncorrected class


forAll(vf.boundaryField(), patchi)
{
const fvPatchField<Type>& 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
mostafa kareem is offline   Reply With Quote

Old   November 3, 2022, 11:53
Default
  #6
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 723
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
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:
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
Is it possibly that phiN is taken into account on the neighbouring patch? (merely speculating here)

Greetings.
dlahaye is offline   Reply With Quote

Reply

Tags
boundaries condition, interface bc, openfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 17:38
Centrifugal fan-reverse flow in outlet lesds to a mass in flow field xiexing CFX 3 March 29, 2017 10:00
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
inlet velocity boundary condition murali CFX 5 August 3, 2012 08:56


All times are GMT -4. The time now is 19:31.