CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   New BC with differential equation (https://www.cfd-online.com/Forums/openfoam-programming-development/228271-new-bc-differential-equation.html)

crubio.abujas July 13, 2020 15:24

Quote:

Originally Posted by RGS (Post 777628)
Hello, I was finally able to run a simulation with the code that you sent me, and I got the following error:

Code:

--> FOAM FATAL ERROR:
Attempt to cast type patch to type lduInterface

    From function To& Foam::refCast(From&) [with To = const Foam::lduInterface; From = const Foam::fvPatch]
    in file /home/ubuntu/OpenFOAM/OpenFOAM-7/src/OpenFOAM/lnInclude/typeInfo.H at line 114.

 FOAM aborting

Do you know what might be the cause of the error?

Hi Rohit,

I think lduInterface is an abstract class defined as "An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches". They are defined for interface as regionCoupled. It seems that you are defining as a patch a region that is defined in the mesh as a interface, and therefore the error. You mentioned that you are willing to build a multi-region solver, right?

If you can share the case I can try help you further to locate where the error is happening.

Good luck anyway!

RGS July 15, 2020 07:48

Quote:

Originally Posted by crubio.abujas (Post 777668)
Hi Rohit,

I think lduInterface is an abstract class defined as "An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches". They are defined for interface as regionCoupled. It seems that you are defining as a patch a region that is defined in the mesh as a interface, and therefore the error. You mentioned that you are willing to build a multi-region solver, right?

If you can share the case I can try help you further to locate where the error is happening.

Good luck anyway!


Thank you for offering to go through my case files. I will send them to you over email.

RGS July 24, 2020 05:22

Quote:

Originally Posted by crubio.abujas (Post 777668)
Hi Rohit,

I think lduInterface is an abstract class defined as "An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches". They are defined for interface as regionCoupled. It seems that you are defining as a patch a region that is defined in the mesh as a interface, and therefore the error. You mentioned that you are willing to build a multi-region solver, right?

If you can share the case I can try help you further to locate where the error is happening.

Good luck anyway!


Hello Carlos,

Everything is working now, thank you! I had not defined some periodic boundary conditions properly, which was the reason for the error. The boundary condition itself compiled without any errors.

RGS July 24, 2020 05:48

Quote:

Originally Posted by crubio.abujas (Post 777069)
Ok, now I'm getting you. Sorry, I totally missed the point. In such a case what you want is to change u in the boundaries, so the field validate your condition. Right?

I've been thinking about it and I think you need further information. Let me explain: In this case you need to work with a boundary condition in u (tortuosity field) which is the one related to the condition. You can set a gradient into this field, but your condition does not totally define the expected value, only part of its information. What you're asking to \bf{\nabla{}u} is that, when subtracted to \bf{e} the resultant vector is perpendicular to \bf{n}. But there are infinite number of vectors that can fulfill that request!


https://i.ibb.co/QFh601x/condition-visualized.png

You can add a corrector term to other expression to ensure that this condition is satisfied, but you need further definition on this gradient.

Also you need to take into account that the relevant information to OpenFoam is the value of the gradient projected on the line connecting the face center and the cell center. This is the factor that will affect the rest of your field.
If you figure out a way to define it, then it can be implemented.


Quote:

Originally Posted by crubio.abujas (Post 777102)
Thinking about it, the condition \nabla{}u\cdot{}n = e\cdot{}n can be applied if the normal is pointing to the cell center. If you're working with simple meshes there's a good chance that this is the case. If you have a big incidence of non-orthogonality then this approach could lead to some numerical errors, but maybe these error can be assumed. You can try this approach as a first approximation and see is it fits your results.

I've been recently working through the book "The Finite Volume Method in Computational Fluid Dynamics", there is a chapter which tell you how OpenFoam deals with the non-orthogonality and some strategies to reduce the errorr. The book is openly available, so feel free to take a look on it!

I think it is only necessary to find \nabla \textbf{u} . \textbf{n} and not \nabla \textbf{u} itself. In other words, I think we need to define the normal gradient to the face, or flux for a von Neumann boundary condition, as mentioned in section 8.3.2 of the book that you recommended (Thank you for the recommendation. I think I should go through the whole book when I have time). I hope I understood this correctly.

Would it be possible to specify a custom von Neumann boundary condition with something like a von Neumann equivalent to codedFixedValue?


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