CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Sinusoidal boundary condition

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2020, 11:55
Default Sinusoidal boundary condition
  #1
Member
 
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9
ErenC is on a distinguished road
Hello everyone!
I am trying to give sinusoidal BC(Temperature) to a wall, I tried to use groovyBC but somehow it doesnt work. Wall is the left wall, so I tried to use pos().y/L inside sin function. Here is the BC that doesnt work.

Code:
               type            groovyBC;
               value uniform 0;
               valueExpression "(311.3+A*sin(pos().y*pi/L))";
               variables 2 ("A=5;" "L=6.69e-2;");
If someone can point my error that would be great!
Eren.
ErenC is offline   Reply With Quote

Old   November 19, 2020, 17:58
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by ErenC View Post
Hello everyone!
I am trying to give sinusoidal BC(Temperature) to a wall, I tried to use groovyBC but somehow it doesnt work. Wall is the left wall, so I tried to use pos().y/L inside sin function. Here is the BC that doesnt work.

Code:
               type            groovyBC;
               value uniform 0;
               valueExpression "(311.3+A*sin(pos().y*pi/L))";
               variables 2 ("A=5;" "L=6.69e-2;");
If someone can point my error that would be great!
Eren.

Rule of thumb: put at least as much work into the formulation of the question as you expect the other person to look at it. "Somehow it doesn't work" makes it a guessing game not a question for help and people usually go to this message board for the riddles



The expression looks syntactically OK. Whether the constants fit your case is something I can't know.


One thing that could cause a crash is "value uniform 0" as this value is used during initialization (before groovyBC had a chance to kick in) and depending on the the solver might lead to a crash during calculation of pressure or density. Make it "value uniform 331.3"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   November 20, 2020, 04:16
Default
  #3
Member
 
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 9
ErenC is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Rule of thumb: put at least as much work into the formulation of the question as you expect the other person to look at it. "Somehow it doesn't work" makes it a guessing game not a question for help and people usually go to this message board for the riddles



The expression looks syntactically OK. Whether the constants fit your case is something I can't know.


One thing that could cause a crash is "value uniform 0" as this value is used during initialization (before groovyBC had a chance to kick in) and depending on the the solver might lead to a crash during calculation of pressure or density. Make it "value uniform 331.3"
First of all, thank you very much for your answer.
You are right, I should defined the "what" is the problem. The problem is, it does not crash, it just stays with the initial value. And according to your explanation, it is perfectly normal. I was just looking at the "initial" values to be sure it works since simulation takes too much time. I didnt knew that groovyBC takes action after initialization.

Thank you very much for your time,
Have a nice day.
Eren.
ErenC is offline   Reply With Quote

Old   November 21, 2020, 15:17
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by ErenC View Post
First of all, thank you very much for your answer.
You are right, I should defined the "what" is the problem. The problem is, it does not crash, it just stays with the initial value. And according to your explanation, it is perfectly normal. I was just looking at the "initial" values to be sure it works since simulation takes too much time. I didnt knew that groovyBC takes action after initialization.

Thank you very much for your time,
Have a nice day.
Eren.

The reason is that during the construction of the boundary condition it is not sure that fields mentioned in the expressions are already constructed. Which would lead to a crash and users wouldn't be able to use perfectly reasonable expressions. With this groovyBC is usally evaluated the first time the variable is being solved for. Which usually is early enough. But there is an optional parameter evaluateDuringConstruction for groovyBC that forces an evaluation
ErenC likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   September 12, 2023, 22:39
Default You can try modifying the code as follows
  #5
New Member
 
divinegabriel
Join Date: Sep 2023
Posts: 1
Rep Power: 0
divinegabriel is on a distinguished road
Your issue may be related to how you define variables in the code. You can try modifying the code as follows:

ini
groovyBC
{
type groovyBC;
variableName T;
value uniform 0;
valueExpression "(311.3+A*sin(pos().y*pi/L))";
variables "A=5" "L=6.69e-2";
}
In this code, variableName is the name of the temperature variable in your model. Additionally, you should check other parameters in your model to ensure that they are set correctly and are consistent with the boundary condition you want to apply.
divinegabriel is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 17:38
Centrifugal fan-reverse flow in outlet lesds to a mass in flow field xiexing CFX 3 March 29, 2017 10:00
Radiation interface hinca CFX 15 January 26, 2014 17:11
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00


All times are GMT -4. The time now is 20:04.