diff --git a/.gitignore b/.gitignore index d3bef7e5d50894bd601521e706a4e7414b1ff189..d94e2cc67ce1466c4ba93ced6809598942d9c2fa 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ # ignore system matrices *A_*.txt +# ignore line_integrals +*line_integral* + # ignore .ip helper file (X11) *.ip diff --git a/examples/channel_flow_force/input.yml b/examples/channel_flow_force/input.yml index b703c78a3ddb14124aa656d96e9cfe02f720daf7..a1c6d664ab5e1a3b59e4ff780250e1675d79b8a0 100644 --- a/examples/channel_flow_force/input.yml +++ b/examples/channel_flow_force/input.yml @@ -141,6 +141,12 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: False diff --git a/examples/channel_flow_pressure/input.yml b/examples/channel_flow_pressure/input.yml index 3727c2676491b711996e344ad43a343f2dfe3cb2..fb21454113de1087156274559e042e81e431a928 100644 --- a/examples/channel_flow_pressure/input.yml +++ b/examples/channel_flow_pressure/input.yml @@ -141,6 +141,12 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: False diff --git a/examples/knudsen_pump/input.yml b/examples/knudsen_pump/input.yml index 7c0243a0c3b5fafe9b3ccb09b5f0b9b5d73c07b1..bc7b143e9cd5a638e5e723bd94ee76192af31660 100644 --- a/examples/knudsen_pump/input.yml +++ b/examples/knudsen_pump/input.yml @@ -170,10 +170,22 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: False massflow: [] + line_integrals: + - name: "avg(abs(ux(x=0,y)))" + expr: abs(ux)/1.5 + start: [0, -2.0] + end: [0, -0.5] + res: 10000 # Parameter Study # ============== diff --git a/examples/knudsen_pump/study/input.yml b/examples/knudsen_pump/study/input.yml index 99f31fe7a9ca22bc9101ca85c858206d676ecd67..cb5fe60df3d959296bc5e3572f445418b536a5be 100644 --- a/examples/knudsen_pump/study/input.yml +++ b/examples/knudsen_pump/study/input.yml @@ -174,10 +174,22 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: False massflow: [] + line_integrals: + - name: "avg(abs(ux(x=0,y)))" + expr: abs(ux)/1.5 + start: [0, -2.0] + end: [0, -0.5] + res: 10000 # Parameter Study # ============== diff --git a/examples/lid_driven_cavity/input.yml b/examples/lid_driven_cavity/input.yml index a26931e5967ea83f83a6ca02176859818a4df80d..9f7d5601592c6b5b4ad280b5e4712673c2253d83 100644 --- a/examples/lid_driven_cavity/input.yml +++ b/examples/lid_driven_cavity/input.yml @@ -127,10 +127,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/lid_two_regions/input.yml b/examples/lid_two_regions/input.yml index f6d35b7ac9c0684ed0b200f622575fc0f45b8e43..eb099fef8a11d52362f423c7a000e5160eb135b0 100644 --- a/examples/lid_two_regions/input.yml +++ b/examples/lid_two_regions/input.yml @@ -129,10 +129,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: True massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input.yml b/examples/thermal_edge_flow/input.yml index 8664dc270020da75579d721c07c98202d84b8467..9a9252171b294196697ccaf72b3e1705ed226bf9 100644 --- a/examples/thermal_edge_flow/input.yml +++ b/examples/thermal_edge_flow/input.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input1.yml b/examples/thermal_edge_flow/input1.yml index 04092a11ff7b30b3faa272792f213030a33c0a7b..7f6381b83111735b1b3cd3c989432b297758ab04 100644 --- a/examples/thermal_edge_flow/input1.yml +++ b/examples/thermal_edge_flow/input1.yml @@ -147,10 +147,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input10.yml b/examples/thermal_edge_flow/input10.yml index cc78c893e6a42bc295f509c7d5472b1908bd3420..885cd4a90ba39053043ea791ade78ff2b58dc31f 100644 --- a/examples/thermal_edge_flow/input10.yml +++ b/examples/thermal_edge_flow/input10.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input11.yml b/examples/thermal_edge_flow/input11.yml index 91544d3581b270d66a77ebf3413bdc0854493572..269ed1d83a3091d935a389979256f526ae9ca0a9 100644 --- a/examples/thermal_edge_flow/input11.yml +++ b/examples/thermal_edge_flow/input11.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input12.yml b/examples/thermal_edge_flow/input12.yml index 80a20fb8c605d2bc409051585742a070ba21c650..7abb531fc394acdfe0be131d386b01ed91d16bb0 100644 --- a/examples/thermal_edge_flow/input12.yml +++ b/examples/thermal_edge_flow/input12.yml @@ -133,10 +133,27 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: + - name: "avg(abs(uy(x,y=0.5)))" + expr: abs(uy)/8 + start: [0, 0.5] + end: [8, 0.5] + res: 10000 + - name: "avg(abs(uy(x,y=4.5)))" + expr: abs(uy)/8 + start: [0, 4.5] + end: [8, 4.5] + res: 10000 # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input2.yml b/examples/thermal_edge_flow/input2.yml index 919506ffb9c86b8fbc313bf964907bd646010107..1ad44c9389b8755ce5864efe7505eed331be9662 100644 --- a/examples/thermal_edge_flow/input2.yml +++ b/examples/thermal_edge_flow/input2.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input3.yml b/examples/thermal_edge_flow/input3.yml index a8b316ed4e0765712deaa6a3075ca98c9690a11a..6b6990411caf18b06adf53801238f0150af626fe 100644 --- a/examples/thermal_edge_flow/input3.yml +++ b/examples/thermal_edge_flow/input3.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input4.yml b/examples/thermal_edge_flow/input4.yml index 434c710c249fb286f76f911da7551858ba8ecac9..86c748ba54f47c4492c550def402947ba095c52e 100644 --- a/examples/thermal_edge_flow/input4.yml +++ b/examples/thermal_edge_flow/input4.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input5.yml b/examples/thermal_edge_flow/input5.yml index a24ec389d49206a217f7bd6390ec48c1748ca78a..0df65c51c3f8cec6c6ad9b2bf11026d54a0c1fc6 100644 --- a/examples/thermal_edge_flow/input5.yml +++ b/examples/thermal_edge_flow/input5.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input6.yml b/examples/thermal_edge_flow/input6.yml index 674f775340b22b276a5d82eb172abfcdf8bc5b2c..72ae02197878a57228f7b91648585be5a1f15c93 100644 --- a/examples/thermal_edge_flow/input6.yml +++ b/examples/thermal_edge_flow/input6.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input7.yml b/examples/thermal_edge_flow/input7.yml index 56904f68daa3d5ba00b59b2e556a8fd6fa2b3c27..c6c7d54a3ed38c54849f6136238780ebb5488fec 100644 --- a/examples/thermal_edge_flow/input7.yml +++ b/examples/thermal_edge_flow/input7.yml @@ -131,10 +131,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input8.yml b/examples/thermal_edge_flow/input8.yml index 1828bddf42c9a1607685fc8738b5db2b5ce6edcb..07c47cf32cd96f91b0ad1a39f550503f4ee40f86 100644 --- a/examples/thermal_edge_flow/input8.yml +++ b/examples/thermal_edge_flow/input8.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/examples/thermal_edge_flow/input9.yml b/examples/thermal_edge_flow/input9.yml index d6e97c29718c3209102855982c0d8084c521dfb1..ead1c66ee303ffe104a32744f4cb43d8b6fe1803 100644 --- a/examples/thermal_edge_flow/input9.yml +++ b/examples/thermal_edge_flow/input9.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/fenicsR13/input.py b/fenicsR13/input.py index 81e5f18ab6bb79dbea28e169256fe152b9373bcd..efb3a9b791f1fd77b9dc010c5474c8a515386c1b 100644 --- a/fenicsR13/input.py +++ b/fenicsR13/input.py @@ -156,11 +156,27 @@ class Input: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds + # - line_integrals: List of line integral dicts: + # - name: Name for output + # - expr: Expression to evaluate + # - start: Start point + # - end: End point + # - res: Sampling resolution of line postprocessing: write_pdfs: True write_vecs: True massflow: [] - + line_integrals: + - name: "avg(abs(uy(x,y=0.5)))" + expr: abs(uy)/8 + start: [0, 0.5] + end: [8, 0.5] + res: 10000 + - name: "avg(abs(uy(x,y=4.5)))" + expr: abs(uy)/8 + start: [0, 4.5] + end: [8, 4.5] + res: 10000 # Parameter Study # ============== @@ -298,6 +314,44 @@ class Input: "required": True, "schema": {"type": "integer"} }, + "line_integrals": { + "type": "list", + "required": True, + "schema": { + "type": "dict", + "schema": { + "name": { + "type": "string", + "required": True, + }, + "expr": { + "anyof": [ + {"type": "string"}, {"type": "float"} + ], + "required": True, + }, + "start": { + "type": "list", + "required": True, + "schema": {"anyof": [ + {"type": "string"}, {"type": "float"} + ]} + }, + "end": { + "type": "list", + "required": True, + "schema": {"anyof": [ + {"type": "string"}, {"type": "float"} + ]} + }, + "res": { + "type": "integer", + "required": True, + "min": 1 + }, + }, + }, + }, } }, "parameter_study": { diff --git a/fenicsR13/solver.py b/fenicsR13/solver.py index fdeb9c4c7cd218db4eed78ab09ca568d6e5bc6ea..75a7b2e766c16ea1ea1fe76b35f06096b8cb4173 100644 --- a/fenicsR13/solver.py +++ b/fenicsR13/solver.py @@ -71,6 +71,9 @@ class Solver: self.time = time self.mode = params["mode"] + self.comm = df.MPI.comm_world + self.rank = df.MPI.rank(self.comm) + # CIP self.use_cip = self.params["stabilization"]["cip"]["enable"] self.delta_theta = self.params["stabilization"]["cip"]["delta_theta"] @@ -88,6 +91,7 @@ class Solver: self.write_pdfs = self.params["postprocessing"]["write_pdfs"] self.write_vecs = self.params["postprocessing"]["write_vecs"] self.massflow = self.params["postprocessing"]["massflow"] + self.line_integrals = self.params["postprocessing"]["line_integrals"] # Create region field expressions self.regs = copy.deepcopy(self.params["regs"]) @@ -167,6 +171,42 @@ class Solver: } self.errors = {} + def __createSolMacroScaExpr(self, cpp_string): + """ + Return a DOLFIN scalar expression with predefined macros after solve. + + These macros include: + + ============================ =========== =============================== + Name Macro CPP Replacement + ============================ =========== =============================== + ``theta`` ``theta`` ``sol["theta"]`` + ``sx`` ``sx`` ``sol["s"].split()[0]`` + ``sy`` ``sy`` ``sol["s"].split()[1]`` + ``p`` ``p`` ``sol["p"]`` + ``ux`` ``ux`` ``sol["u"].split()[0]`` + ``uy`` ``uy`` ``sol["u"].split()[1]`` + ``sigmaxx`` ``sigmaxx`` ``sol["sigma"].split()[0]`` + ``sigmaxy`` ``sigmaxy`` ``sol["sigma"].split()[1]`` + ``sigmayx`` ``sigmayx`` ``sol["sigma"].split()[1]`` + ``sigmayy`` ``sigmayy`` ``sol["sigma"].split()[2]`` + ============================ =========== =============================== + """ + return df.Expression( + str(cpp_string), + degree=2, + theta = self.sol["theta"], + sx = self.sol["s"].split()[0], + sy = self.sol["s"].split()[1], + p = self.sol["p"], + ux = self.sol["u"].split()[0], + uy = self.sol["u"].split()[1], + sigmaxx = self.sol["sigma"].split()[0], + sigmaxy = self.sol["sigma"].split()[1], + sigmayx = self.sol["sigma"].split()[1], + sigmayy = self.sol["sigma"].split()[2] + ) + def __createMacroScaExpr(self, cpp_string): """ Return a DOLFIN scalar expression with predefined macros. @@ -870,6 +910,7 @@ class Solver: secs = end_t - start_t self.write_content_to_file("assemble", secs) print("Finish assemble: {}".format(str(secs))) + sys.stdout.flush() print("Start solve") sys.stdout.flush() @@ -899,6 +940,7 @@ class Solver: secs = end_t - start_t self.write_content_to_file("solve", secs) print("Finished solve: {}".format(str(secs))) + sys.stdout.flush() if self.mode == "heat": (self.sol["theta"], self.sol["s"]) = sol.split() @@ -939,6 +981,86 @@ class Solver: print("avg vel:", avgvel) self.write_content_to_file("avgvel", avgvel) + def __line_integral_average(u, A, B, n): + """ + Integrate u over segment [A, B] partitioned into n elements + """ + assert u.value_rank() == 0 + assert len(A) == len(B) > 1 and np.linalg.norm(A-B) > 0 + assert n > 0 + + # Mesh line for integration + mesh_points = [A + t*(B-A) for t in np.linspace(0, 1, n+1)] + tdim, gdim = 1, len(A) + + # Create line mesh + mesh = df.Mesh(df.MPI.comm_world) + if self.rank == 0: + editor = df.MeshEditor() + editor.open(mesh, "interval", tdim, gdim) + editor.init_vertices(n+1) + editor.init_cells(n) + for vi, v in enumerate(mesh_points): + editor.add_vertex(vi, v) + for ci in range(n): + editor.add_cell(ci, np.array([ci, ci+1], dtype='uintp')) + editor.close() + df.MeshPartitioning.build_distributed_mesh(mesh) + print(mesh) + sys.stdout.flush() + + # Setup function space + elm = u.function_space().ufl_element() + family = elm.family() + degree = elm.degree() + V = df.FunctionSpace(mesh, family, degree) + v = df.Function(V) + + # Interpolate to line mesh + # df.interpolate does not work in parallel from different meshes + # -> https://fenicsproject.org/docs/dolfin/1.6.0/python/ + # programmers-reference/cpp/function/LagrangeInterpolator.html + # Use LagrangeInterpolator, which works in parallel + # -> https://fenicsproject.org/qa/7758/ + # function-interpolation-in-parallel/?show=12144#c12144 + df.LagrangeInterpolator.interpolate(v, u) + + custom_dx = df.Measure("dx", domain=mesh) + + return df.assemble(v * custom_dx) + + print("Start line_integrals") + start_t = time_module.time() + sys.stdout.flush() + for li in self.line_integrals: + name = li["name"] + + # Interpolate in "best" Lagrange space + maxdeg = max([ + self.params["elements"]["theta"]["degree"], + self.params["elements"]["s"]["degree"], + self.params["elements"]["p"]["degree"], + self.params["elements"]["u"]["degree"], + self.params["elements"]["sigma"]["degree"] + ]) + expr = df.interpolate( + self.__createSolMacroScaExpr(li["expr"]), + df.FunctionSpace(self.mesh, "Lagrange", maxdeg) + ) + start = np.array(li["start"]) + end = np.array(li["end"]) + res = li["res"] + result = __line_integral_average( + expr, start, end, res + ) + self.write_content_to_file( + "line_integral_{}".format(name), result + ) + end_t = time_module.time() + secs = end_t - start_t + print("Finish line_integrals: {}".format(str(secs))) + sys.stdout.flush() + def __load_exact_solution(self): """ Load exact solution from the location given in ``input.yml``. diff --git a/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml b/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml index 6855e36c00d90c52c914d77ed07bdd65067fad04..268ed83c910899936d0150b6bfd77b6f76e9d877 100644 --- a/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml +++ b/tests/heat/inputs/heat_01_coeffs_p1p1_gls.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml b/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml index 0494a72d0d3e2c51c78fa31f3a4ff65492debf45..64f023bd8de04b3e65a202b30be0254a428036b3 100644 --- a/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p1p1_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml b/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml index 157f9e683d74621e746320582f69edb7ec38518e..e88a3babe6787b363be16155fd0118c7eb95659d 100644 --- a/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p1p2_nostab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml b/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml index f2187e1446736c205494061ac12ad4e101ed0973..80b1df8143fd772e3620f622b74bae2f92d4b39c 100644 --- a/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml +++ b/tests/heat/inputs/heat_01_coeffs_p2p2_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml b/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml index 13aaf21119635c7661328f5d3a665f4ca5a0106b..7acfe1d022162e30271a14fd1d5df543b9017604 100644 --- a/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml +++ b/tests/heat/inputs/heat_10_coeffs_p2p2_stab.yml @@ -135,10 +135,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml index 8026b0289b43f81dec5bb4a0ae2e0803dd46b74d..bccad8408affe5d1a2aeec59a36203cb2c482bf9 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_gls.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml index 31deaf639de532e1b86731727fe6b231a5eb7c62..000e1a25d71a543ed0eb25b8cb4aa69cba950055 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p1p1p1p1_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml index 6da34550a008f24035510bcd3da714beafb38b3c..42d4585482d6727361b301d046b64a248e080d5f 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p1p2p1p1p2_nostab.yml @@ -133,10 +133,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_gls.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_gls.yml index aaf5feceb65279795ed3766b99c740db68538457..77b3d5dd66ec1ab8f1f3ea2102fda82c4d9656ae 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_gls.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_gls.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml index 5f30460f54a7f3e4d3670112f21b478a88b26c03..545ce6bc1e8cb12e84965150e103d04c1bbc475f 100644 --- a/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_nosources_norot_inflow_p2p2p2p2p2_stab.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_gls.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_gls.yml index 795307a0925ae2580b69ab97246ed717756f926f..8eb4ec79ddbcab287acc1fbe4da5c3205a276e4a 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_gls.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_gls.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml index fd7474a8abfa11f78b197e94193b94880a9cce4f..0f26bedb00e4ac7133d5ca4be0bf341db268ca34 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p1p1p1p1p1_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_gls.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_gls.yml index da87e381338de7253e1e72acd4a14971111b718f..025b7793e521d01168413c732b888e8d33c272c9 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_gls.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_gls.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml index e58ac1bc3a092b24a18ffebaef3d2fe1b529a076..9b62ee2cc6745885928189dc1deaf58b96353bdd 100644 --- a/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml +++ b/tests/r13/inputs/r13_1_coeffs_sources_rot_noinflow_p2p2p2p2p2_stab.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml index 91b9200aeeeeff2cdad536d2de194c47238c65e9..f00aebe69a5bcf136a308c26ffd6d9ceacacfa4b 100644 --- a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml +++ b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_gls.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml index 6c5c4b9bd9e80eae3213fc715f3f421ec8e56fae..ca6c0d9d019522171d93517e93065e2711b80c87 100644 --- a/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_nosource_rot_p1p1p1_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml index 50a1ff6d6206ad5760d07831dd27080a6913760a..bb260395a62000032eecd2d89785efde95887198 100644 --- a/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_source_norot_p1p1p1_stab.yml @@ -135,10 +135,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml index 82faaf36812fdf37fc62562f2556b78f13905a88..2cbbd235f27c22ebbb91f3dbe0a330afb0eb0480 100644 --- a/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p1p1p1_stab.yml @@ -134,10 +134,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml b/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml index 866dbc5994e9e3f341505f3f48ab2981a3b325c1..e5bac6dfbf20c79c9a1f8dced4df130207651da6 100644 --- a/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p1p2p3_nostab.yml @@ -132,10 +132,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml b/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml index 9b1310470dcb5c50ea646d97b80b0555b8e3d0fd..371f1cb1f99ab3efa8ca3a02ab1444698eb0ed49 100644 --- a/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml +++ b/tests/stress/inputs/stress_01_source_rot_p2p2p2_stab.yml @@ -133,10 +133,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ============== diff --git a/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml b/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml index acdbd677b69702c47abbef6e0d572c6b841c1fdc..2f3f8f320e2459d6175252984a4b3e3459b8acd6 100644 --- a/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml +++ b/tests/stress/inputs/stress_10_source_rot_p1p1p1_stab.yml @@ -135,10 +135,17 @@ convergence_study: # - write_pdfs: Write all solution fields as PDF plot # - write_vecs: Write all solution fields as vectors # - massflow: List of BC IDs to compute massflow J=int_bc dot(u,n) ds +# - line_integrals: List of line integral dicts: +# - name: Name for output +# - expr: Expression to evaluate +# - start: Start point +# - end: End point +# - res: Sampling resolution of line postprocessing: write_pdfs: False write_vecs: False massflow: [] + line_integrals: [] # Parameter Study # ==============