Go Back   Physics Help Forum > Physics Forums > Physics Software

Physics Software Physics Software Forum - Physics software for computers and calculators

Reply
 
LinkBack Thread Tools Display Modes
Old Oct 24th 2018, 02:15 AM   #1
Junior Member
 
Join Date: Jul 2018
Posts: 4
Post analytical expression to numerical grid points

Hello everybody
does anyone knows how can I map an analytical expression for B to a discrete grid in numeral simulation?
Like the results of numerical MHD simulation which produce discrete data for B.
mehdi6 is offline   Reply With Quote
Old Oct 24th 2018, 03:00 AM   #2
Senior Member
 
Woody's Avatar
 
Join Date: Jun 2016
Location: England
Posts: 640
The only way I can think of is the brute force method.
You basically calculate the analytical expression for every point in the grid.

Sometimes,
if the analytical expression describes a "well behaved" phenomenon,
shortcuts can be achieved by approximations and interpolating.

There may be more elegant solutions for certain particular problems,
but in general I can't think of any other way.
__________________
~\o/~
Woody is offline   Reply With Quote
Old Oct 24th 2018, 03:52 AM   #3
Senior Member
 
Join Date: Oct 2017
Location: Glasgow
Posts: 249
Originally Posted by mehdi6 View Post
Hello everybody
does anyone knows how can I map an analytical expression for B to a discrete grid in numeral simulation?
Like the results of numerical MHD simulation which produce discrete data for B.
I don't what B is, but you could perhaps just loop over your discrete space and sample the analytical function?

Psuedocode (C# style):


Code:

B = new List<double>();

foreach (var xValue in xValues)
{
  var value = myAnalyticalFunction(xValue);
  B.Append(value);
}

Print(B)
In the above pseudocode, "xValues" is a list of x-axis values. If your function is multi-variate, you can loop over points.
benit13 is offline   Reply With Quote
Reply

  Physics Help Forum > Physics Forums > Physics Software

Tags
analytical, expression, grid, numerical, points


« Simulator | - »

Thread Tools
Display Modes


Similar Physics Forum Discussions
Thread Thread Starter Forum Replies Last Post
Analytical relation for the length of the wake behind a cylinder in an external flow Vijay9 General Physics 0 Jul 16th 2017 06:18 AM
GM counter numerical pranimaboity2050 Nuclear and Particle Physics 0 Nov 17th 2014 11:23 AM
Physics lab, Analytical balance, question kl.twilleger General Physics 2 Apr 15th 2013 09:35 AM
Analytical balance source needed... Squint General Physics 0 Apr 15th 2013 08:12 AM
equality of fouriers expression shamreen Theoretical Physics 3 Jun 2nd 2010 01:14 AM


Facebook Twitter Google+ RSS Feed