Main Content

generateMaxwellStressTensor

Compute Maxwell stress tensor at nodal locations

Since R2024a

Description

example

results = generateMaxwellStressTensor(R) generates the Maxwell stress tensor values at the mesh nodes and stores it in the MaxwellStressTensor property of the results object. Here, results is an ElectrostaticResults or MagnetostaticResults object.

Examples

collapse all

Add the Maxwell stress tensor to the electrostatic solution stored in an ElectrostaticResults object.

Create an femodel object for electrostatic analysis. Include a geometry of a frame.

model = femodel(AnalysisType="electrostatic", ...
                    Geometry="Frame.stl");

Plot the geometry of the frame with edge labels.

pdegplot(model,EdgeLabels="on");

Specify the vacuum permittivity in the SI system of units.

model.VacuumPermittivity = 8.8541878128e-12;

Specify the relative permittivity of the material.

model.MaterialProperties = ...
        materialProperties(RelativePermittivity=1.00059);

Specify the electrostatic potential at the inner boundary.

model.EdgeBC([1 2 4 6]) = edgeBC(Voltage=1000);

Specify the electrostatic potential at the outer boundary.

model.EdgeBC([3 5 7 8]) = edgeBC(Voltage=0);

Generate the mesh. This assignment updates the mesh stored in the Geometry property of the model.

model = generateMesh(model);

Solve the model.

R = solve(model)
R = 
  ElectrostaticResults with properties:

      ElectricPotential: [1272x1 double]
          ElectricField: [1x1 FEStruct]
    ElectricFluxDensity: [1x1 FEStruct]
                   Mesh: [1x1 FEMesh]

Generate the Maxwell stress tensor.

R = generateMaxwellStressTensor(R)
R = 
  ElectrostaticResults with properties:

      ElectricPotential: [1272x1 double]
          ElectricField: [1x1 FEStruct]
    ElectricFluxDensity: [1x1 FEStruct]
                   Mesh: [1x1 FEMesh]
    MaxwellStressTensor: [2x2x1272 double]

Add the Maxwell stress tensor to the magnetostatic solution stored in a MagnetostaticResults object.

Create an femodel object for magnetostatic analysis. Include a geometry representing a plate with a hole.

model = femodel(AnalysisType="magnetostatic", ...
                    Geometry="PlateHoleSolid.stl");

Plot the geometry of the plate with face labels.

pdegplot(model,FaceLabels="on",FaceAlpha=0.3);

Specify the vacuum permeability in the SI system of units.

model.VacuumPermeability = 1.2566370614e-6;

Specify the relative permeability of the material.

model.MaterialProperties = ...
        materialProperties(RelativePermeability=5000);

Apply the magnetic potential boundary conditions on the side faces and the face bordering the hole.

model.FaceBC(3:6) = faceBC(MagneticPotential=[0;0;0]);
model.FaceBC(7) = faceBC(MagneticPotential=[0;0;0.01]);

Specify the current density for the entire geometry.

model.CellLoad = cellLoad(CurrentDensity=[0;0;0.5]);

Generate the mesh. This assignment updates the mesh stored in the Geometry property of the model.

model = generateMesh(model);

Solve the model.

R = solve(model)
R = 
  MagnetostaticResults with properties:

      MagneticPotential: [1x1 FEStruct]
          MagneticField: [1x1 FEStruct]
    MagneticFluxDensity: [1x1 FEStruct]
                   Mesh: [1x1 FEMesh]

Generate the Maxwell stress tensor.

R = generateMaxwellStressTensor(R)
R = 
  MagnetostaticResults with properties:

      MagneticPotential: [1x1 FEStruct]
          MagneticField: [1x1 FEStruct]
    MagneticFluxDensity: [1x1 FEStruct]
                   Mesh: [1x1 FEMesh]
    MaxwellStressTensor: [3x3x834 double]

Input Arguments

collapse all

Electrostatic or magnetostatic solution, specified as an ElectrostaticResults or MagnetostaticResults object. Create R using the solve function.

Version History

Introduced in R2024a