Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

combination solution at different positions in the same point or line graph

Please login with a confirmed email address before reporting spam

Suppose I have a solution written generally as u(x,t). I need to compute u(0,t)-u(1,t) and plot this quantity as a function of t. I've found even for this trivial application in point graph or line graph under a 1D plot, I have difficulty. I need to pick the x=0 point or edge to obtain u(0,t) and pick the x=1 point or edge to obtain u(1,t) but there's no way of putting u(0,t) and u(1,t) together in the same point graph or line graph!


3 Replies Last Post May 4, 2024, 7:24 a.m. EDT
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 7 months ago Apr 16, 2024, 1:37 p.m. EDT
Updated: 7 months ago Apr 16, 2024, 1:36 p.m. EDT

I'm guessing that you may find Comsol's "spatial at" operator to be helpful. The explanation in the Help system may seem a bit overwhelming at first, but be patient. As an example in 3D space, to evaluate your expression expr, at an example (x,y,z) location = (1,0,-1), this would become: comp1.at3(1,0,-1,expr) . Anyway, here's the details, in all their glory, from the Help system: ..... SPATIAL AT The operator evaluates an expression expr in a specific point in space. Typically, use ati without extra arguments when evaluating inside a mesh and add extra arguments when evaluating outside the mesh or even outside the geometry. • The scope.ati(<coordinate expressions>, expr) operator evaluates the expression expr in the geometry with the given scope (typically comp1 for Component 1 or a similar scope for another Component branch) on an i-dimensional entity in the point given by the coordinate expressions (at0 for a 0-dimensional entity, at1 for a 1-dimensional entity, at2 for a 2-dimensional entity, and at3 for a 3-dimensional entity). For example, comp1.at1(0,y,dom) evaluates dom in the two-dimensional geometry on an edge in the point (0, y). To use a certain ati operator variant, there must be a meshed geometric entity of the right dimension at the coordinates where it is evaluated; for example, at0 only works if the source geometry has a vertex in the point where you want to evaluate the expression. The number of arguments for the scope.ati operator is equal to the space dimension in the source component (the coordinate expressions) plus one (the expression to evaluate). • For two- and three-dimensional models, the evaluation on the domain level (that is, at2 for two-dimensional models and at3 for three-dimensional models) can take an extra argument 'evaltype'. The supported 'evaltype' values are 'mi' and 'minc'. Contrary to regular ati evaluations, these evaluation types do not require any domain meshes and can be evaluated in any given point. However, if there are two adjacent domains for which something is defined differently, the operator requires that the boundary between the domains is meshed. The 'mi' (mesh-independent evaluation) value checks that you have meshed all such required boundaries (even for variables that have nothing to do with the actual argument of the operator), whereas the 'minc' (mesh-independent no-check evaluation) value do not, and it might therefore give inaccurate results if not used correctly. • To all operators you can add a suffix (“_frameId”) that specifies the frame in which the coordinate expressions are used — for example, at1_spatial(x,y, expr). Without a suffix, the evaluation is performed in the material frame.

-------------------
Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
I'm guessing that you may find Comsol's "spatial at" operator to be helpful. The explanation in the Help system may seem a bit overwhelming at first, but be patient. As an example in 3D space, to evaluate your expression expr, at an example (x,y,z) location = (1,0,-1), this would become: comp1.at3(1,0,-1,expr) . Anyway, here's the details, in all their glory, from the Help system: ..... SPATIAL AT The operator evaluates an expression expr in a specific point in space. Typically, use ati without extra arguments when evaluating inside a mesh and add extra arguments when evaluating outside the mesh or even outside the geometry. • The scope.ati(, expr) operator evaluates the expression expr in the geometry with the given scope (typically comp1 for Component 1 or a similar scope for another Component branch) on an i-dimensional entity in the point given by the coordinate expressions (at0 for a 0-dimensional entity, at1 for a 1-dimensional entity, at2 for a 2-dimensional entity, and at3 for a 3-dimensional entity). For example, comp1.at1(0,y,dom) evaluates dom in the two-dimensional geometry on an edge in the point (0, y). To use a certain ati operator variant, there must be a meshed geometric entity of the right dimension at the coordinates where it is evaluated; for example, at0 only works if the source geometry has a vertex in the point where you want to evaluate the expression. The number of arguments for the scope.ati operator is equal to the space dimension in the source component (the coordinate expressions) plus one (the expression to evaluate). • For two- and three-dimensional models, the evaluation on the domain level (that is, at2 for two-dimensional models and at3 for three-dimensional models) can take an extra argument 'evaltype'. The supported 'evaltype' values are 'mi' and 'minc'. Contrary to regular ati evaluations, these evaluation types do not require any domain meshes and can be evaluated in any given point. However, if there are two adjacent domains for which something is defined differently, the operator requires that the boundary between the domains is meshed. The 'mi' (mesh-independent evaluation) value checks that you have meshed all such required boundaries (even for variables that have nothing to do with the actual argument of the operator), whereas the 'minc' (mesh-independent no-check evaluation) value do not, and it might therefore give inaccurate results if not used correctly. • To all operators you can add a suffix (“_frameId”) that specifies the frame in which the coordinate expressions are used — for example, at1_spatial(x,y, expr). Without a suffix, the evaluation is performed in the material frame.

Please login with a confirmed email address before reporting spam

Posted: 7 months ago Apr 27, 2024, 4:35 a.m. EDT

Dr Koslover thank you very much

Dr Koslover thank you very much

Please login with a confirmed email address before reporting spam

Posted: 7 months ago May 4, 2024, 7:24 a.m. EDT

However, how to capture an expression in the spatial frame on a moving boundary? e.g. to capture the speed (or another quantity) of the (spatially) right most point on a rolling circle rolling to the right.

However, how to capture an expression in the spatial frame on a moving boundary? e.g. to capture the speed (or another quantity) of the (spatially) right most point on a rolling circle rolling to the right.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.