From: Ataollah M. <am...@ti...> - 2013-05-15 18:23:58
|
Dear all, I want to replace my dirichlet BCs implementation using penalty method with the DrichletBoundary class implementation. My problem is that I want different inhomogenous dirichlet BCs on different boundary_ids, but as far as I can see none of derived classes from FunctionBase supports functions that get an boundary_id (or something similar?). I would appreciate if anyone can comment and/or suggest a workaround. Best, Ata |
From: Roy S. <roy...@ic...> - 2013-05-15 18:33:07
|
On Wed, 15 May 2013, Ataollah Mesgarnejad wrote: > I want to replace my dirichlet BCs implementation using penalty > method with the DrichletBoundary class implementation. > > My problem is that I want different inhomogenous dirichlet BCs on > different boundary_ids, but as far as I can see none of derived > classes from FunctionBase supports functions that get an boundary_id > (or something similar?). > > I would appreciate if anyone can comment and/or suggest a workaround. Add a distinct DirichletBoundary for each boundary_id. --- Roy |
From: Ataollah M. <am...@ti...> - 2013-05-15 22:30:44
|
Roy, Unless I'm missing something, I don't think that would solve the problem. Maybe I'm not explaining my problem clear enough: I have parameters in my_equation_system.parameters like "boundary_type_01" with a value like "ramp" and "noundary_amp_01" with a value like 10.0 that is my way to implement a ramp dirichlet bc 10*time on boundary_id=1. And there are bunch of different types. So if I want a WrappedFunction to construct a DirichletBoundary I need both the boundary_id and parameters. Best, Ata On May 15, 2013, at 1:33 PM, Roy Stogner <roy...@ic...> wrote: > > On Wed, 15 May 2013, Ataollah Mesgarnejad wrote: > >> I want to replace my dirichlet BCs implementation using penalty >> method with the DrichletBoundary class implementation. >> >> My problem is that I want different inhomogenous dirichlet BCs on >> different boundary_ids, but as far as I can see none of derived >> classes from FunctionBase supports functions that get an boundary_id >> (or something similar?). >> >> I would appreciate if anyone can comment and/or suggest a workaround. > > Add a distinct DirichletBoundary for each boundary_id. > --- > Roy |
From: Roy S. <roy...@ic...> - 2013-05-15 22:44:16
|
On Wed, 15 May 2013, Ataollah Mesgarnejad wrote: > Unless I'm missing something, I don't think that would solve the problem. > > Maybe I'm not explaining my problem clear enough: I have parameters in my_equation_system.parameters like "boundary_type_01" with a value like "ramp" and "noundary_amp_01" with a value like 10.0 that is my way to implement a ramp dirichlet bc 10*time on boundary_id=1. And there are bunch of different types. So if I want a WrappedFunction to construct a DirichletBoundary I need both the boundary_id and parameters. You don't need the boundary_id because you already know the boundary id - if you initialize DirichletBoundary bdy_a with the set {1} of boundary ids, and you initialized DirichletBoundary bdy_b with the set {2} of boundary ids, then whenever the function attached to bdy_a gets called you know it was called for a point on boundary_id 1 and whenever the function attached to bdy_b gets called you know it was called for a point on boundary_id 2. You use two different function objects. Your function would still need the parameters; for that you either need to use ugly global variables or you need to create your own FunctionBase subclass which stores an EquationSystems reference. I'd recommend the latter. WrappedFunction is mostly about backwards compatibility and easier prototyping of simple applications, not a recommended class for complex designs. --- Roy |
From: Ataollah M. <am...@ti...> - 2013-05-15 23:05:03
|
On May 15, 2013, at 5:44 PM, Roy Stogner <roy...@ic...> wrote: > > On Wed, 15 May 2013, Ataollah Mesgarnejad wrote: > >> Unless I'm missing something, I don't think that would solve the problem. >> >> Maybe I'm not explaining my problem clear enough: I have parameters in my_equation_system.parameters like "boundary_type_01" with a value like "ramp" and "noundary_amp_01" with a value like 10.0 that is my way to implement a ramp dirichlet bc 10*time on boundary_id=1. And there are bunch of different types. So if I want a WrappedFunction to construct a DirichletBoundary I need both the boundary_id and parameters. > > You don't need the boundary_id because you already know the boundary > id - if you initialize DirichletBoundary bdy_a with the set {1} of > boundary ids, and you initialized DirichletBoundary bdy_b with the set > {2} of boundary ids, then whenever the function attached to bdy_a gets > called you know it was called for a point on boundary_id 1 and whenever the > function attached to bdy_b gets called you know it was called for a > point on boundary_id 2. You use two different function objects. > I understand. > Your function would still need the parameters; for that you either > need to use ugly global variables or you need to create your own > FunctionBase subclass which stores an EquationSystems reference. I'd > recommend the latter. WrappedFunction is mostly about backwards > compatibility and easier prototyping of simple applications, not a > recommended class for complex designs. That's exactly is what I was wondering. As always many thanks for the help, Ata > --- > Roy |
From: Roy S. <roy...@ic...> - 2013-05-15 23:13:40
|
On Wed, 15 May 2013, Ataollah Mesgarnejad wrote: > That's exactly is what I was wondering. > > As always many thanks for the help, You're welcome! Glad I finally started to make sense. One of these days I need to just get in the habit of writing actual thorough documentation rather than expecting everyone to read my mind or pick my brain. --- Roy |