How Do You Calculate Surface Integrals in Fortran 90?

Supermann11
Messages
5
Reaction score
0
I am dumfounded on how one would perform surface integrals in Fortran 90 over a platelet, or a rectangular box. I can do single and double integrals but I have no idea on how to do surface integrals

Thanks in advance!
 
Physics news on Phys.org
Well, we are just as dumbfounded as you.

Fortran only provides a means to evaluate your formulas after you are done doing the calculus and algebra necessary to obtain a result.

Now, if you could provide some specifics, say a particular problem you would like to solve, that would be a good start.
 
Basically I am to find the magnetic field of a volume (with constant magnitisation) in or outside the said volume. The integral involved is:

∫∫(r-r').M(r').(|r-r'|^-3) dS'

Where r' is the variable which must be integrated. M(r') is the magnetisation.

So far I presume we can split the platlet into little 'cells' and r is the position of the cell. So r-r' is the contribution of a 'cell' to the magnetic field.
 
Last edited:
To evaluate integrals of this type, usually the region, surface, or volume is discretized in some fashion. Sometimes, the problem can be transformed using one of the integral theorems of Green or Stokes. Unless you can find canned (already written) Fortran programs designed to analyze these types of problems, you've got a pretty significant software development project waiting, much more so if you are only interested in solving one problem.

In short, there is no intrinsic function or subroutine in Fortran where you write a couple of statements and a big hairy surface integral is reduced to a single number. You've got to write your own program or find a program someone else has already written.
 
Thank you for your response. Do you have any pointers on how I would approach this problem? I get the fact that I need to discritize the surface and see how an elemetal cell contributes to the magnetic field, then add up all these elements but how would I go about that? I'm really struggling on how I could code this!
 
I'm not an E & M guy. I know a little finite element method, a little boundary element method, but mostly for stress analysis applications. If you are trying to develop a program from scratch to analyze a magnetic problem, plan to spend weeks, if not months, writing and testing code, especially since you don't appear to have much experience in developing this type of software. If you need a solution in a quicker time-frame, search out applications which can analyze such problems.

It's also not clear if this is a class assignment or something you are doing for work. There are several books which discuss how to develop finite element programs. You can search for these using Google or Amazon.
 
  • Like
Likes 1 person
Cheers, it is for a class assignment. I doubt it'll be months as it's suppose to be completed in around 15 hours, Thanks for your help :)
 
If this is a homework assignment, you shouldn't be posting in this forum anyway.

Try posting in one of the HW forums, say Advanced Physics or Calculus. You might get some useful discussion on your particular problem.
 
Fortran 90 and surface integrals

Homework Statement


I am struggling on coding a solution to a surface integral on Fortran 90.

Basically I am to find the magnetic field of a volume (with constant magnitisation) in or outside the said volume. The integral involved is:

∫∫(r-r').M(r').(|r-r'|^-3) dS'

The surface is a platelet, like a box.

Where r' is the variable which must be integrated. M(r') is the magnetisation.

Homework Equations



∫∫(r-r').M(r').(|r-r'|^-3) dS'

The Attempt at a Solution


So far I presume we can split the platlet into little 'cells' and r is the position of the cell. So r-r' is the contribution of a 'cell' to the magnetic field.
 
Last edited:
  • #10
As a programmer and a physicist, I would start with a drawing. Fairly elaborate.
Perhaps work out a few examples for the simplest possible cases.
Surf to see what worked out solutions (not programs, just the physics side) are available -- nice test material later on, too!
See what kind of stuff is needed to solve subproblems, draw (and erase, draw again) a flowchart of these subroutines, etc.
15 hours isn't much on the clock, but for an assignment like this it's not all that bad (if only because you can always point out later that others worked on the more general routines for years and years...).
 
Back
Top