|
[Sponsors] |
May 27, 2024, 19:10 |
Using arithmetic operators in dictionaries
|
#1 |
New Member
Abdullah Saifee
Join Date: Feb 2021
Posts: 13
Rep Power: 5 |
I'm using OpenFOAM 10. Following is a portion of a p boundary condition for a particular patch in the domain. I'm trying to achieve a sinusoidal pressure evolution, meaning the flow will be changing direction over the period. Is the following correct for a 3 second period? The reason I'm asking is because in the results, if I look at some p file, the frequency shows to be 2.
Code:
{ type uniformTotalPressure; p0 { type sine; frequency 2.0*pi/3.0; amplitude -50.0; //scale -1; level 0; } } Code:
{ type uniformTotalPressure; rho rho; psi none; gamma 1; p0 { type sine; amplitude { type constant; value -50; } frequency 2; start 0; level { type constant; value 0; } } value uniform -12.4322; } |
|
May 28, 2024, 04:33 |
|
#2 |
Senior Member
Join Date: Dec 2021
Posts: 251
Rep Power: 5 |
Hey!
Not sure about formulas directly written in place of a number, although you could use eval to compute your frequency or any variable beforehand. So for instance, you would write before the boundary subdictionary: Code:
freq #eval {2*pi/3}; { type uniformTotalPressure; p0 { type sine; frequency $freq; amplitude -50.0; //scale -1; level 0; } } And of course, you can use variables inside variables (dont forget the $ sign when calling other variables). Hope it helps! There is probably a way to do this inside the boundary condition but I am not sure how (maybe codedStream?). |
|
May 28, 2024, 06:04 |
|
#3 |
New Member
Abdullah Saifee
Join Date: Feb 2021
Posts: 13
Rep Power: 5 |
Thanks for the response.
Where should I put this eval function? Not in the p file? |
|
May 28, 2024, 06:17 |
|
#4 | |||
New Member
Abdullah Saifee
Join Date: Feb 2021
Posts: 13
Rep Power: 5 |
Quote:
Quote:
Quote:
So is there a way to use some different approach? |
||||
May 28, 2024, 06:24 |
|
#5 |
Senior Member
Join Date: Dec 2021
Posts: 251
Rep Power: 5 |
Hey!
Okay that's weird. I noticed that you use OpenFOAM 10 while I use OpenFOAM v2312, maybe the eval feature is not available for the Foundation version. The calc function seems to need to compile stuff, since there is a dynamicCode folder and a wmake command sent. To make sure the error is not related to access privileges, you could try to run a test case locally on your computer if you can. |
|
Tags |
boundary condition, openfoam 10, pressure b.c, sine |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Arithmetic Average of Monitor Point as Workbench Output Parameter | jaxk | CFX | 4 | September 25, 2023 09:18 |
Accessing dictionaries from constant folder in multi region solver | F42 | OpenFOAM Programming & Development | 5 | January 19, 2022 06:56 |
What are dictionaries in Openfoam ? | granzer | OpenFOAM | 3 | November 25, 2020 01:47 |
What are the units used in the thermophysicalProperties and fvOptions dictionaries? | ophr | OpenFOAM Pre-Processing | 2 | June 16, 2019 02:29 |
How to decide which dictionaries need to be created? | darthcoder | OpenFOAM Running, Solving & CFD | 2 | April 4, 2015 11:27 |