Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Dirac Delta function

Soogeun_Kim
Beginner
2,483 Views
How is the Dirac Delta Function expressed in visual fortran?
0 Kudos
4 Replies
Arjen_Markus
Honored Contributor II
2,483 Views
Can you provide a bit more context? The Dirac Delta function is mathematically speaking
a bit of an odd object, even though there is a sound theory for it and its kin.For a programming
language that deals with finite (and finite-precision) numbers and characters, such a function
can not be expressed directly. That is not to say that the concept and the associated operations
are impossible to express, but you willhave to provide some information on what you want todo.

Regards,

Arjen
0 Kudos
Soogeun_Kim
Beginner
2,483 Views
Thank you for your prompt reply.

I'm solving the 2D Helmholtz problem on a Cartesian plane. u''(x,y)+q*u(x,y)=f(x,y)

Above governing equation, f(x,y) is external or internal source and Dirac Delta Function.

I want to compare analytical solution with numerical solution.

I have analytical solution.

To obtain numerical solution, Dirac Delta Funtion code is needed.

I know the function can not be expressed directly.

So, in detail, my question is how is the approximated expression of Dirac Delta Function.


Thank you in advance

Soogeun Kim
0 Kudos
Arjen_Markus
Honored Contributor II
2,483 Views
You should use a step function with the smallest support possible. How you do that depends
on thenumerical method you are using, but if you use finite differences, it would be a source
term in a single node of the grid. For finite volumes, similarly, but then thephysical meaning
is easier to explain: you integrate the function over the single volume, so in fact you spread
it out over that volume, as that is the smallest entity.

Regards,

Arjen
0 Kudos
anthonyrichards
New Contributor III
2,483 Views
The Dirac Delta function only really has meaning when integrated over a region containing the point at which the delta function does not vanish. Dirac's calls it an 'improper function'.

In which case the delta-function provides a factor of unity to apply to whatever value its accompanying (multiplying) function(s) has/have at that, and only at that, point. If the region considered omits the point at which the delta function does not vanish, then the delta-function provides a factor of zero.

So I guess you need to define a function that takes as its arguments lower and an upper bounds defining the 1-D range you are considering and a 1-D co-ordinate for the point at which the delta-function does not vanish.
The function should then return zero or unity according to whether the point is within the range specified.
Clearly if it returns a value of zero, there will then be no need to compute the value of the functions it multiplies at the point considered. This can be generalised to 2-D and more-D versions.
The simplest implementation would appear to be

FUNCTION DIRAC(X,XMIN,XMAX)
! Assumes XMIN<=XMAX...
DIRAC=0.0D+00
if(X.LT.XMIN.OR.X.GT.XMAX) DIRAC=1.0D+00
RETURN
END
0 Kudos
Reply