Directly Setting Dirichlet BCs Using Something Other than the Solution Variable
Posted: 18 Jul 2020, 20:50
Good morning!
I am attempting to rewrite a module I had written to make it more user-friendly for my community. I had originally written the model with a very complex SIF file and all sorts of MATC code. I'm in the process of rewriting the solver so that it is both less cumbersome and conforms to current Elmer programing standards. In addition, I'm trying to take a lot of the MATC code and put it directly into the solver.
An issue I am running into is how to set Dirichlet bcs in the solver. The standard method I've been able to find is to use
from the DefaultUtils module. However, this just takes
where Varname is whatever name I assign to field variable in the Solver section of the SIF. In my particular case, Varname is a rather cumbersome BC to use because it is not directly measurable quantity. Rather, it is algebraically related to some other physical quantities that are much easier to measure for real systems and are more intuitive to talk about.
A straight forward way to implement this would be to write a UserFunction and call it in the SIF:
where the UserFunction does the algebra to relate MeasurableQuantity to the BC for Varname. However, I find this somewhat inelegant, and would prefer to have the ability to have the user write in the SIF
and then have the solver seamlessly convert MeasurableQuantity in the Solver module and set the bcs. Is there a utility function call that I could use in the Solver module that would enable this functionality? Would I need to loop over the BC elements and set each element? That is, essentially do what DefaultDirchletBCs() but insert some code that algebraically alters the input in the Boundary section of the SIF?
Note, I still want the Solver module to output the solution in terms of Varname, but I want to prescribe the Dirichlet BCs in terms of MeasurableQuantity.
I am attempting to rewrite a module I had written to make it more user-friendly for my community. I had originally written the model with a very complex SIF file and all sorts of MATC code. I'm in the process of rewriting the solver so that it is both less cumbersome and conforms to current Elmer programing standards. In addition, I'm trying to take a lot of the MATC code and put it directly into the solver.
An issue I am running into is how to set Dirichlet bcs in the solver. The standard method I've been able to find is to use
Code: Select all
CALL DefaultDirchletBCs()
Code: Select all
Boundary 1
Varname = Real
End
A straight forward way to implement this would be to write a UserFunction and call it in the SIF:
Code: Select all
Constant
MeasurableQuantity= Real
End
Boundary 1
Varname = Real; Procedure "UserFunction" "UserFunction"
End
Code: Select all
Solver 1
....
Use MeasurableQuantity = Logical
...
End
Boundary 1
MeasurableQuantity = Real
End
Note, I still want the Solver module to output the solution in terms of Varname, but I want to prescribe the Dirichlet BCs in terms of MeasurableQuantity.