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

Setting normal gradient as BC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By fumiya

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2019, 10:27
Default Setting normal gradient as BC
  #1
New Member
 
Join Date: Dec 2016
Posts: 24
Rep Power: 9
Dozer_94 is on a distinguished road
Hi all,

I am editing icoFoam for a specific calculation in which I want to set the normal gradient of a patch as a boundary condition.

So normally scalar field 'c' would be solved using the BCs for the values of 'c', but now I would like OF to use normal gradient 'dc/dn' as BC.

I know that 'c.boundaryField()[patch].snGrad()' would return the values of the normal gradient, but I'd like it vice versa.

Anyone know if this is possible at all?

Thanks in advance,
Dozer_94 is offline   Reply With Quote

Old   May 7, 2019, 09:14
Default
  #2
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19
fumiya is on a distinguished road
Hi,

You can use the fixedGradient boundary condition to set a patch normal gradient to a user-specified value.

Hope this helps,
Fumiya
__________________
[Personal]
fumiya is offline   Reply With Quote

Old   May 7, 2019, 12:22
Default
  #3
New Member
 
Join Date: Dec 2016
Posts: 24
Rep Power: 9
Dozer_94 is on a distinguished road
Hi Fumiya,

Thanks for your reply. I was aware that this was the way to go for the initial conditions. However, I would like OF to do this for me as a BC that changes each timestep.

To give a bit more information: I am using an external solver that calculates dc/dn from other quantities. The goal is to set this calculated dc/dn as BC for the next timestep. Therefore, I need a way (be it a provided member function or a more elaborate method) to incorporate this in the solver itself.

Thanks,
Dozer_94 is offline   Reply With Quote

Old   May 8, 2019, 10:54
Default
  #4
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 19
fumiya is on a distinguished road
Hi Dozer_94,

The following thread will be of help:
Updating Boundary Conditions Each Iteration

Fumiya
Gerry Kan likes this.
__________________
[Personal]
fumiya is offline   Reply With Quote

Old   May 21, 2019, 11:33
Default
  #5
New Member
 
Join Date: Dec 2016
Posts: 24
Rep Power: 9
Dozer_94 is on a distinguished road
Thank you Fumiya, this was exactly what I was searching for. Seems like something I could have figured out myself, though.
Dozer_94 is offline   Reply With Quote

Old   August 1, 2024, 13:19
Default Doubt regarding fixed gradient boundary condition.
  #6
New Member
 
ghanashyam k c
Join Date: May 2022
Posts: 8
Rep Power: 4
gsam is on a distinguished road
If I apply a fixed gradient condition on a patch under atmospheric conditions, will the gradient change over time as the liquid passes through this boundary? For example, if I use `zero gradient` as the boundary condition for the velocity ( U ), and the fluid passes through, would recalculating the gradient later necessarily result in a zero gradient again?
gsam is offline   Reply With Quote

Old   August 2, 2024, 08:11
Default
  #7
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14
Tobermory will become famous soon enough
I think you are misunderstanding the nature of the fixed gradient boundary condition ... it literally fixes the gradient. So yes, the gradient will be maintained as the flow passes through (the patch value will of course change).
Tobermory is offline   Reply With Quote

Old   August 5, 2024, 10:36
Default
  #8
New Member
 
ghanashyam k c
Join Date: May 2022
Posts: 8
Rep Power: 4
gsam is on a distinguished road
Thank you for the reply. Apparently, i am dealing with an Electrohydrodynamic solver. The problem is when I apply zero gradients at one of the boundaries as a voltage condition, my electric field changes, which is not supposed to since the electric field is -grad(Voltage). Since I am applying a zero gradient, it should maintain the Ey constant, which is a normal component of the electric field. I am unable to find what is the real issue occurring here.
gsam is offline   Reply With Quote

Reply

Tags
solver, volscalarfield


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
[swak4Foam] Boundary Conditions with GroovyBC, Normal Gradient treima OpenFOAM Community Contributions 32 November 17, 2017 04:44
How to extract the normal pressure gradient from the momentum equation mtgoncalves OpenFOAM Programming & Development 4 September 29, 2017 11:50
Surface normal velocity BC with zero gradient tangential, cylinder c_dowd OpenFOAM Running, Solving & CFD 0 May 25, 2013 08:22
[swak4Foam] Boundary Conditions with GroovyBC, Normal Gradient treima OpenFOAM Community Contributions 2 January 26, 2013 03:37
normal temperature gradient on a boundary Sandrine FLUENT 0 June 10, 2009 13:29


All times are GMT -4. The time now is 06:22.