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/)
-   -   Setting normal gradient as BC (https://www.cfd-online.com/Forums/openfoam-programming-development/217212-setting-normal-gradient-bc.html)

Dozer_94 May 3, 2019 09:27

Setting normal gradient as BC
 
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,

fumiya May 7, 2019 08:14

Hi,

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

Hope this helps,
Fumiya

Dozer_94 May 7, 2019 11:22

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,

fumiya May 8, 2019 09:54

Hi Dozer_94,

The following thread will be of help:
https://www.cfd-online.com/Forums/op...iteration.html

Fumiya

Dozer_94 May 21, 2019 10:33

Thank you Fumiya, this was exactly what I was searching for. Seems like something I could have figured out myself, though.


All times are GMT -4. The time now is 00:01.