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

[swak4Foam] dynamic no-flux BC for electrokinetics, can groovyBC do this?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2017, 20:03
Question dynamic no-flux BC for electrokinetics, can groovyBC do this?
  #1
New Member
 
Omar E. Godinez
Join Date: May 2016
Posts: 8
Rep Power: 10
OmarEGB is on a distinguished road
Hi,
I have a solver for a Poisson-Nernst-Planck system, that is, the Poisson equation gives me an electric field -\nabla \phi and that electric field pushes the ions according the the Nernst-Planck equation, together with diffusion . The ion flux would be something like this

J=-D(\nabla c + z_i c \nabla \phi )

now, as a boundary condition, I need this flux to be zero in one of my boundaries. Obviously, making the condition \nabla c = 0 isn't enough in this case, since \nabla \phi has a constant value (that comes from the boundary conditions to the Poisson equation), and additionally, the simulation starts from a non-uniform c field, so making that zero isn't an option either. I would need to specify a condition for the gradient in the form

\nabla c = -z c \nabla \phi

where the c in the right hand side would be the previous concentration value at the boundary (from the previous timestep) and \nabla \phi is known (since this happens to be a boundary condition for the Poisson equation).

I was looking at my options and apparently It looks like could use groovyBC, or otherwise I would need to write a library specifically for that boundary condition.
I have no experience whatsoever with swak4foam or writing custom boundary conditions so I would like to take the easiest path.
Could anyone enlighten me on whether this can be done with groovyBC? is there any other alternative?
OmarEGB is offline   Reply With Quote

Old   February 8, 2018, 12:03
Default
  #2
New Member
 
Chris
Join Date: Jun 2016
Posts: 2
Rep Power: 0
Snapy is on a distinguished road
Hi OmarEGB,

did you manage to add that type of boundary condition? I would like to add a similar BC.

I would appreciate any hint
Snapy is offline   Reply With Quote

Old   February 8, 2018, 22:22
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Snapy View Post
Hi OmarEGB,

did you manage to add that type of boundary condition? I would like to add a similar BC.

I would appreciate any hint
Code:
snGrad(phi)
gives you the gradient in the normal direction of the patch
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 9, 2018, 06:00
Default
  #4
New Member
 
Chris
Join Date: Jun 2016
Posts: 2
Rep Power: 0
Snapy is on a distinguished road
Thanks for the fast response and hint

So I could use snGrad() in refCast to set the BC for a specific patch:

Am I correct?

Quote:
fixedGradientFVPatchScalarField& c =
refCast<fixedGradientFvPatchScalarField>
(c.boundaryFieldRef()["patchID"]);
c.gradient() = phi.boundaryField()["patchID"].snGrad();
Snapy is offline   Reply With Quote

Reply

Tags
custom boundary condition, groovybc, no flux, pnp, swak4foam


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
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 09:44
Local mesh refinement definition in a DEFORMING dynamic mesh zone using Dynamic Mesh Emanuele88 FLUENT 0 February 9, 2016 12:39
[swak4Foam] and accessing flux on remote patches for setting B.C's mayank.dce2k7 OpenFOAM Community Contributions 19 August 21, 2013 20:01
groovyBC nonuniform Wall heat flux Shoonya Main CFD Forum 0 August 11, 2010 14:03
monitoring dynamic heat flux through a surface abdnakhi FLUENT 0 August 15, 2005 10:57


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