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/)
-   -   Modeling delta function as source (https://www.cfd-online.com/Forums/openfoam-programming-development/106512-modeling-delta-function-source.html)

nandiganavishal August 30, 2012 18:02

Modeling delta function as source
 
Hi Foamers,

I would like to know if it is possible to include a delta function as
a source term in OpenFOAM. For instance, I would like to implement,

div(a*gradient(phi)) = -a_0*(c+(d*delta(x-x_c)))

where x_c is the position corresponding to the nodal point where delta
function is singular and the position changes at every time step.

Please let me know if we can implement this in OpenFOAM.

Thanks

Regards
Vishal

jimteb February 27, 2015 05:55

Hi Vishal,

I was wondering if you found an answer to this?

thanks

hajott February 27, 2015 12:42

I assume, that you mean the dirac distribution by delta(x-x0).
You can approximate delta by a field that has the value 1/V in the grid cell containing x0 and 0 elsewhere, resulting in:
integral(f(x)delta(x-x0))dV=f(x0).

For a more accurate solution you may need to implement a jump boundary condition and split your mesh on each "side" of x0.

ssss February 28, 2015 08:37

You can create a volScalarField filled with 0s. Then loop over the cells and check which one of them satisfy the delta condition, so that you can change their values to 1


All times are GMT -4. The time now is 21:49.