diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index 6529ca68009e95ac52f1bbed9aaa2172733a5a92..2d6535275ad99936d9e8f71e284c6944e4f3635b 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -217,7 +217,9 @@ class StructuredField : public Field text_format = false; options["TextFormat"] = new FieldOptionBool(text_format, "True for ASCII input " "files, false for binary files\n" - "(4 bite signed integers for n, double precision floating points for v, D and O)", + "(4 bite signed integers for n, " + "double precision floating points " + "for v, D and O)", &update_needed); data = 0; } @@ -1000,8 +1002,14 @@ class PostViewField : public Field view_index = 0; options["IView"] = new FieldOptionInt(view_index, "Post-processing view index", &update_needed); - crop_negative_values=true; - options["CropNegativeValues"] = new FieldOptionBool(crop_negative_values,"return LC_MAX instead of a negative value (this option is needed for backward compatibility with the BackgroundMesh option",&update_needed); + crop_negative_values = true; + options["CropNegativeValues"] = new FieldOptionBool(crop_negative_values, + "return LC_MAX instead of a " + "negative value (this option " + "is needed for backward " + "compatibility with the " + "BackgroundMesh option", + &update_needed); } ~PostViewField() { diff --git a/demos/fields.geo b/demos/fields.geo index e9eed3cd65584cf0e8cd67d4458f62d3561446ce..f588c5256237cefe2d32fd66d9384269f118b9c5 100644 --- a/demos/fields.geo +++ b/demos/fields.geo @@ -3,21 +3,24 @@ Point(1) = {0.0,0.0,0,lc}; Point(2) = {1,0.0,0,lc}; Point(3) = {1,1,0,lc}; Point(4) = {0,1,0,lc}; +Point(5) = {0.2,.5,0,lc}; Line(1) = {3,2}; Line(2) = {2,1}; Line(3) = {1,4}; Line(4) = {4,3}; -Point(55) = {0.2,.5,0,lc}; Line Loop(5) = {1,2,3,4}; Plane Surface(6) = {5}; -// Attractors field on points 1 and 55, and on line 1 +// Attractor field on points 5 and on line 1. This field returns the +// distance to point 5 and to (100 equidistant points on) line 1. Field[1] = Attractor; +Field[1].NodesList = {5}; Field[1].NNodesByEdge = 100; -Field[1].NodesList = {1,55}; Field[1].EdgesList = {1}; -// Threshold field defined on the attractors +// Threshold field using the return value of the attractor field 1 in +// order to define a simple change in element size around the +// attractors (i.e., around point 5 and line 1) // // LcMax - /------------------ // / @@ -28,18 +31,38 @@ Field[1].EdgesList = {1}; // Attractor DistMin DistMax Field[2] = Threshold; Field[2].IField = 1; -Field[2].LcMin = lc/20; +Field[2].LcMin = lc / 30; Field[2].LcMax = lc; Field[2].DistMin = 0.15; Field[2].DistMax = 0.5; -//Field[2].Sigmoid = 1; -// Function field +// MathEval field with a function depending on the model coordinates Field[3] = MathEval; Field[3].F = "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101"; -// Use minimum of threshold and function field as background field -Field[4] = Min; -Field[4].FieldsList = {2, 3}; +// Attractor around point 1 +Field[4] = Attractor; +Field[4].NodesList = {1}; -Background Field = 4; +// MathEval field with a function depending on the return value of the +// attractr field 4, i.e., depending on the distance to point 1 (here +// using a cubic law, with minumum element size = lc / 100) +Field[5] = MathEval; +Field[5].F = Sprintf("F4^3 + %g", lc / 100); + +// Box field to impose a step change in element sizes inside a box +Field[6] = Box; +Field[6].VIn = lc / 15; +Field[6].VOut = lc; +Field[6].XMin = 0.3; +Field[6].XMax = 0.6; +Field[6].YMin = 0.3; +Field[6].YMax = 0.6; + +// Use minimum of all the fields as the background field +Field[7] = Min; +Field[7].FieldsList = {2, 3, 5, 6}; +Background Field = 7; + +// Don't extend the elements sizes from the boundary inside the domain +Mesh.CharacteristicLengthExtendFromBoundary = 0; diff --git a/doc/texinfo/opt_fields.texi b/doc/texinfo/opt_fields.texi index f0fb4211c68804f987b959ecad8540304f11a94b..df0680f675b959b202e772268d416092503d3dca 100644 --- a/doc/texinfo/opt_fields.texi +++ b/doc/texinfo/opt_fields.texi @@ -6,7 +6,7 @@ @ftable @code @item Attractor Compute the distance from the nearest node in a list. It can also be used to compute distance from curves, in this case each curve is replaced by NNodesByEdge equidistant nodes and the distance from those nodes is computed. @* -The ANN library is used to find the nearest node : http://www.cs.umd.edu/~mount/ANN/ @* +The ANN library is used to find the nearest node: http://www.cs.umd.edu/~mount/ANN/ @* Options:@* @table @code @item EdgesList @@ -146,7 +146,7 @@ default value: @code{@{@}} @end table @item MaxEigenHessian -Compute the maximum eigen value of the Hessian matrix of Field[IField]. Gradients are evaluated by finite differences, eigenvalues are computed using the GSL library.@* +Compute the maximum eigen value of the Hessian matrix of Field[IField]. Gradients are evaluated by finite differences, eigenvalues are computed using the GSL library.F = max ( eigenvalues ( grad ( grad ( Field[IField] ) ) ) ) @* Options:@* @table @code @item Delta @@ -217,6 +217,28 @@ type: integer@* default value: @code{0} @end table +@item Restrict +Restrict the application of a field to a given list of geometrical curves, surfaces or volumes. @* +Options:@* +@table @code +@item EdgesList +Curve indices@* +type: list@* +default value: @code{@{@}} +@item FacesList +Surface indices@* +type: list@* +default value: @code{@{@}} +@item IField +Field index@* +type: integer@* +default value: @code{1} +@item RegionsList +Volume indices@* +type: list@* +default value: @code{@{@}} +@end table + @item Structured Linearly interpolate between data provided on a 3D rectangular structured grid. The format of the input file is : @* Ox Oy Oz @*