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.

Can i easily define a boundary condition for every node in a mesh, rather than having the same boundary condition across every point in the mesh?

Please login with a confirmed email address before reporting spam

I would like to solve Laplace's equation in a domain, which I will call A. The domain contains another domain I will call B. Given a set of coordinate, (x,y,z) on the boundary between A and B I can calculate the the boundary value. This requires a sum carried out in a python script and cannot be directly defined as a function within comsol.

If I export the position of each node and caculate the boundary condition at each node can I then return the information to comsol to set the boundary value at each node?


2 Replies Last Post 11.07.2023, 13:43 GMT-4
Robert Koslover Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 1 year ago 11.07.2023, 11:19 GMT-4
Updated: 1 year ago 11.07.2023, 11:26 GMT-4
  1. Usually, from the physics perspective, one seeks to specify a continuous geometry with sufficient accuracy to represent your physical problem, and then to build the discrete mesh with sufficient detail to represent that continuous geometry with adequate fidelity. In my own work, I've never had to be concerned with setting boundary conditions point by point, at the individual node level. You can specify boundary conditions (e.g., a potential) as functions of coordinates, without paying detailed attention to the mesh (assuming it is fine enough). Would that not be sufficient in your case? Are you be willing to explain more about the physics problem you are trying to solve? 2. In regard to importing (x,y,z) information for your unusual boundary condition from an external file, consider setting up an interpolation function.
-------------------
Scientific Applications & Research Associates (SARA) Inc.
www.comsol.com/partners-consultants/certified-consultants/sara
1. Usually, from the physics perspective, one seeks to specify a continuous *geometry* with sufficient accuracy to represent your physical problem, and then to build the discrete mesh with sufficient detail to represent that continuous geometry with adequate fidelity. In my own work, I've never had to be concerned with setting boundary conditions point by point, at the individual node level. You can specify boundary conditions (e.g., a potential) as functions of coordinates, without paying detailed attention to the mesh (assuming it is fine enough). Would that not be sufficient in your case? Are you be willing to explain more about the physics problem you are trying to solve? 2. In regard to importing (x,y,z) information for your unusual boundary condition from an external file, consider setting up an *interpolation* function.

Please login with a confirmed email address before reporting spam

Posted: 1 year ago 11.07.2023, 13:43 GMT-4

Thanks for your response.

The boundary conditions cannot be fitted nicely to a function, as they are found by integrating over an inhomogeneous charge distribution, which is in turn found using data exported from a different comsol simulation, and cannot be fitted nicely. It is relatively easy to calculate this value at a fixed point using a python script. Assuming any function i define as the boundary condition would calculate that function at a fixed set of nodes, it would introduce less error to just calculate these values using my python script.

I'll look into the interpolation function to see if that works.

Thanks for your response. The boundary conditions cannot be fitted nicely to a function, as they are found by integrating over an inhomogeneous charge distribution, which is in turn found using data exported from a different comsol simulation, and cannot be fitted nicely. It is relatively easy to calculate this value at a fixed point using a python script. Assuming any function i define as the boundary condition would calculate that function at a fixed set of nodes, it would introduce less error to just calculate these values using my python script. I'll look into the interpolation function to see if that works.

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.