2
$\begingroup$

I consider for a calculation a sphere embedded within a matrix. To plot the results and especially the behavior around the spherical inclusion I want to "cut" through the matrix. That seems to work with "ZoomElements", but in combination with "Domains" to cut only through the inclusion I receive errors.

Below is a minimal sample code:

<< AceFEM`;
SMTInputData[];

A = ImplicitRegion[(1. (x))^2 + (1. (y))^2 + (1. (z))^2 > 
    0.1, {{x, -1, 1}, {y, -1, 1}, {z, -1, 1}}];

mesh = ToElementMesh[A, "RegionHoles" -> None, 
   "RegionMarker" -> {{{0., 0., 0.}, 2, 0.0001}, {{0.8, 0.8, 0.8}, 1, 
      0.001}}, MaxCellMeasure -> .1, "MeshOrder" -> 1];

SMTAddDomain[{"Matrix", "MySED3O1DFLEO1DHooke", {}}, {"Inclusion", 
   "MySED3O1DFLEO1DHooke", {}}];
SMTAddMesh[mesh, {{"O1", 1} -> "Matrix", {"O1", 2} -> "Inclusion"}];
SMTAnalysis["Tie" -> True];

That is working fine:

SMTShowMesh["Mesh" -> True, "BoundaryConditions" -> True, 
 Axes -> True, 
 "ZoomElements" -> ("X" <= 0.55 && ("X" <= 0 || "Y" >= 0) &), 
 AxesLabel -> {"X_1", "X_2", "X_3"}]

enter image description here

That gives errors:

SMTShowMesh["Domains" -> "Inclusion", "Mesh" -> True, 
 "BoundaryConditions" -> True, Axes -> True, 
 "ZoomElements" -> ("X" <= 0.55 && ("X" <= 0 || "Y" >= 0) &), 
 AxesLabel -> {"X_1", "X_2", "X_3"}]

enter image description here

Do you have any suggestions or solutions for this problem?

Best,

Max

$\endgroup$
3
$\begingroup$

Options "Domains" and "ZoomElements" are mutually exclusive. Argument of "ZoomElements" is an "element selector" that can be used to select domains as well. (e.g. element_selector={node_selector, domain_selector} form)

In your case

SMTShowMesh["Mesh" -> True, "BoundaryConditions" -> True, Axes -> True, "ZoomElements" -> {("X" <= 0.55 && ("X" <= 0 || "Y" >= 0) &), "Inclusion"}, AxesLabel -> {"X_1", "X_2", "X_3"}]

$\endgroup$
1
  • $\begingroup$ That is an elegant solution. Thank you very much Mr. Korelc. $\endgroup$
    – Max
    Aug 5 at 8:52
3
$\begingroup$

One option is to do some walkaraound.

First you can identify the nodes in your inclusion and get their coordinates:

incluNodes = SMTElementData[SMTFindElements["Inclusion"], "Nodes"];
ninNodes = Dimensions[incluNodes];
xincluNodes = 
  Table[SMTNodeData[incluNodes[[i]], "X"], {i, ninNodes[[1]]}];

Then you can select the nodes you are interested in:

showINodes = {};
Do[Do[
  If[xincluNodes[[i, j, 1]] <= 0.55,
   If[xincluNodes[[i, j, 1]] <= 0 || xincluNodes[[i, j, 2]] >= 0,
    AppendTo[showINodes, i]];
   Break[]]
  , {j, 4}]
 , {i, ninNodes[[1]]}]

And finally you can plot some cross section of your inclusion:

SMTShowMesh["Domains" -> "Inclusion", "ZoomNodes" -> DeleteDuplicates[Flatten[incluNodes[[showINodes]]]]]

enter image description here

$\endgroup$
2
  • $\begingroup$ that is a very good a workaround. Thank you for that. Does the error message occurs for you too, when you are using the "ZoomElements"command? $\endgroup$
    – Max
    May 19 at 9:22
  • $\begingroup$ Yes, it occurrs. $\endgroup$ May 21 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.