CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM

Rigorous Second Derivative Zero - Boundary Condition

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

LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2021, 03:52
Default Rigorous Second Derivative Zero - Boundary Condition
New Member
Join Date: May 2016
Posts: 10
Rep Power: 6
samwong is on a distinguished road
Hi All,

I want to set the following condition for T for my problem.
i.e. some Flux due to Temperature and Pressure to be equal.

\frac{dT}{dx} + \frac{dP}{dx} = 0

I have tried to do this by calling lookupPatchField, then using Tp.snGrad().
Then I read Eugene's post for setting

\frac{d^2 T}{dx^2} = 0

by calling lookupObject then using fvc::grad.

I think the difference between fvc::grad and snGrad() is that,
fvc::grad use both internalField and patchField,
but snGrad() only use the patchField (boundary face and its cell's cell-center).
I wonder if using fvc::grad is better(more rigorous) then snGrad().

Eugene's post:
Second Derivative Zero - Boundary Condition

His code:
void extrapolatedGradientFvPatchScalarField::updateCoeffs()
    if (updated())
    word field = this->dimensionedInternalField().name();
    vectorField nf = patch().nf();
    volVectorField gradField 
        = fvc::grad(db().lookupObject<volScalarField>(field));

        = (nf & gradField.boundaryField()[patch().index()]
Here is my code
void equalGradientFvPatchScalarField::updateCoeffs()
    if (updated())
    const fvPatchField<scalar>& Pp =                                                                                 
           patch().lookupPatchField<volScalarField, scalar>(PName_);   
    gradient() =  - Pp.snGrad();
samwong is offline   Reply With Quote


boundaries condition, openfoam, user defined boundary

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Fatal overflow in linear solver. iamnotfajar CFX 9 October 28, 2020 04:47
Constant mass flow rate boundary condition sahm OpenFOAM 0 June 20, 2018 22:45
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 01:44
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 02:53
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 06:49

All times are GMT -4. The time now is 12:38.