CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] groovyBC accessing to scalarIOList (https://www.cfd-online.com/Forums/openfoam-community-contributions/170146-groovybc-accessing-scalariolist.html)

Tobi April 25, 2016 08:58

groovyBC accessing to scalarIOList
 
Hey all & Bernhard,

just a simple question. Is there the possibility to access scalarIOList within groovyBC? The problem on that I focus at the moment is, that I created a Gaussian-Temperature Boundary-Condition (LASER) using groovyBC and now I want to reduce the used power by a coefficient. The coefficient is calculated in my solver and needs to be available in the boundary. The only work-around that solved my problem till now is to create a new volScalarField that includes the value of the coefficient. This works but finally its not a good solution. The other way would be to calculate the coefficient within the BC but therefore I need some other fields.

Any suggestion is welcomed.

gschaider April 25, 2016 16:08

Quote:

Originally Posted by Tobi (Post 596597)
Hey all & Bernhard,

just a simple question. Is there the possibility to access scalarIOList within groovyBC? The problem on that I focus at the moment is, that I created a Gaussian-Temperature Boundary-Condition (LASER) using groovyBC and now I want to reduce the used power by a coefficient. The coefficient is calculated in my solver and needs to be available in the boundary. The only work-around that solved my problem till now is to create a new volScalarField that includes the value of the coefficient. This works but finally its not a good solution. The other way would be to calculate the coefficient within the BC but therefore I need some other fields.

Any suggestion is welcomed.

Accesing stuff that is not registered with the mesh (in other words: a child-class of registeredIOObject) is almost impossible if the two implementations (BC and solver) don't share code.

What is not totally clear to me: is the coefficient one scalar for the whole simulation or one scalar value per patch face? And it is calculated in the code of your solver?

If it is just one value it should be possible to use the global-variables in swak4Foam (usually through the calculateGlobalVariables-function plugin). It should be even possible to inject such global variables from the solver. But the API of the GlobalVariablesRepository is not designed for this and of course it binds the code of your solver to swak4Foam

Tobi April 25, 2016 17:05

Quote:

Originally Posted by gschaider (Post 596650)
Accesing stuff that is not registered with the mesh (in other words: a child-class of registeredIOObject) is almost impossible if the two implementations (BC and solver) don't share code.

What is not totally clear to me: is the coefficient one scalar for the whole simulation or one scalar value per patch face? And it is calculated in the code of your solver?

If it is just one value it should be possible to use the global-variables in swak4Foam (usually through the calculateGlobalVariables-function plugin). It should be even possible to inject such global variables from the solver. But the API of the GlobalVariablesRepository is not designed for this and of course it binds the code of your solver to swak4Foam

Hi Bernhard,

the missing information (or not clear information):

  • the scalar is only one value
  • it is calculated in the solver
At the moment I am using a volScalarField that is working nice but I do not know how the speed is influenced using very big meshes. In the groovyBC I just check out the max value (finally each value in the volScalarField is identically):
Code:



type groovy;
{
  .
  .
  variables
  (
        "myScalar=max(powerCoeff)";
  );
}

I was only interested if you already had some work-around. Maybe I will check it out with swak4Foam. If it is binded, does not matter.

gschaider May 2, 2016 14:25

Sorry. But there is currently no easy fix for your problem. One reason is that there is no general mechanism like the objectRegistry for scalar data

Quote:

Originally Posted by Tobi (Post 596655)
Hi Bernhard,

the missing information (or not clear information):

  • the scalar is only one value
  • it is calculated in the solver
At the moment I am using a volScalarField that is working nice but I do not know how the speed is influenced using very big meshes. In the groovyBC I just check out the max value (finally each value in the volScalarField is identically):
Code:



type groovy;
{
  .
  .
  variables
  (
        "myScalar=max(powerCoeff)";
  );
}

I was only interested if you already had some work-around. Maybe I will check it out with swak4Foam. If it is binded, does not matter.



All times are GMT -4. The time now is 08:19.