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

Rigorous Second Derivative Zero - Boundary Condition

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2021, 04:52
Default Rigorous Second Derivative Zero - Boundary Condition
  #1
New Member
 
Join Date: May 2016
Posts: 11
Rep Power: 9
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:
Code:
void extrapolatedGradientFvPatchScalarField::updateCoeffs()
{
    if (updated())
    {
        return;
    }
    
    word field = this->dimensionedInternalField().name();
    
    vectorField nf = patch().nf();
    
    volVectorField gradField 
        = fvc::grad(db().lookupObject<volScalarField>(field));

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

Reply

Tags
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 05:47
Constant mass flow rate boundary condition sahm OpenFOAM 0 June 20, 2018 23:45
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 02:44
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 03:53
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 07:49


All times are GMT -4. The time now is 09:05.