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

how to implement the unit gradient vector in openfoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2022, 01:21
Default how to implement the unit gradient vector in openfoam
  #1
New Member
 
Yang Xueliang
Join Date: Nov 2021
Posts: 28
Rep Power: 4
Youngxl is on a distinguished road
Dear all,
Recently, I have implemented an equation involving the unit gradient vector, which has the following form, I don't know how to implement it, because it involves the case that the denominator is 0. Is there any good way to solve this problem?

Assumed that p is a volScalarField like pressure and I want to calculate the equation n=\frac{grad p}{mag(grad p)}.

Thans for reading my post.
Best wishes,
Young
Youngxl is offline   Reply With Quote

Old   February 18, 2023, 16:06
Default
  #2
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
Did you solve the problem, i am facing the same situation
gyr is offline   Reply With Quote

Old   February 24, 2023, 08:48
Default
  #3
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi,

Around line 122 of interfaceProperties.C, a unit gradient vector of alpha1_ field (scalar value of Volume Of Fluid) is calculated. This might help you.

https://www.openfoam.com/documentati...8C_source.html

Code:
     // Cell gradient of alpha
     const volVectorField gradAlpha(fvc::grad(alpha1_, "nHat"));
  
     // Interpolated face-gradient of alpha
     surfaceVectorField gradAlphaf(fvc::interpolate(gradAlpha));
  
     // Face unit interface normal
     surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_));
Value of deltaN_ is decided in interfaceProperties constructor.

Code:
     deltaN_
     (
         "deltaN",
         1e-8/cbrt(average(alpha1.mesh().V()))
     ),
snak is offline   Reply With Quote

Reply

Tags
gradient, openfoam, unit normal


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
Getting Started with OpenFOAM wyldckat OpenFOAM 25 August 14, 2022 13:55
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 2 November 4, 2019 08:51
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 06:15
UNIGE February 13th-17th - 2107. OpenFOAM advaced training days joegi.geo OpenFOAM Announcements from Other Sources 0 October 1, 2016 19:20
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36


All times are GMT -4. The time now is 15:02.