using System; using GP = Science.Physics.GeneralPhysics; namespace ScienceTest.PhysicsTest.GeneralPhysicsTest { /// /// MaxwellEquationTest /// public class MaxwellEquationTest { private string result; public string Result { get{return result;} } public MaxwellEquationTest() { } public void Compute() { GP.MaxwellEquation eq = new GP.MaxwellEquation(); GP.Vector.Field fe = new GP.Vector.Field(efield); GP.ElectricField E = new GP.ElectricField(); E.VectorField = fe; eq.E = E; GP.Vector.Field fb = new GP.Vector.Field(bfield); GP.MagneticField B = new GP.MagneticField(); B.VectorField = fb; eq.B = B; GP.Vector.Field j = new GP.Vector.Field(current); eq.CurrentDensity = j; GP.Scalar.Field rho = new GP.Scalar.Field(charge); eq.ChargeDensity = rho; GP.Time t = new GP.Time(); t.s = 1.0; eq.AtTime = t; GP.Position r = new GP.Position(); r.X = 12.0; r.Y = 2.0; r.Z = 3.0; eq.AtPosition = r; eq.CheckGaussLaw(); eq.CheckGaussLawInMagnetism(); eq.CheckFaradayLaw(); eq.CheckAmpereLaw(); result += eq.Result + "\r\n"; } private GP.Scalar charge(GP.Position x, GP.Time t) { GP.Scalar s = new GP.Scalar(); return s; } private GP.Vector current(GP.Position x, GP.Time t) { GP.Vector v = new GP.Vector(); return v; } private GP.Vector efield(GP.Position x, GP.Time t) { GP.Vector res = new GP.Vector(); double c = 1.0/Math.Sqrt(GP.Constant.PermittivityOfFreeSpace *GP.Constant.PermeabilityOfFreeSpace); double k = 0.000001; res.X = 0.0; res.Y = 100.0*Math.Cos(k*x.X - c*k*t.s); res.Z = 0.0; return res; } private GP.Vector bfield(GP.Position x, GP.Time t) { GP.Vector res = new GP.Vector(); double c = 1.0/Math.Sqrt(GP.Constant.PermittivityOfFreeSpace *GP.Constant.PermeabilityOfFreeSpace); double k = 0.000001; res.X = 0.0; res.Y = 0.0; res.Z = 100.0/c*Math.Cos(k*x.X - c*k*t.s); return res; } } } /* Good in Gauss Law! Good in Gauss Law In Magnetism! Good in Faraday Law! Good in Ampere Law! */