Writing a blockMeshDict file with variables
Hi there,
I'm trying to write a blockmesh file using variables for the vertices and the number of cells but I'm not quite sure how to do this. At the moment, I'm trying this: Code:
convertToMeters 1; Thanks in advance for any advice |
Hi,
Code:
$ cd $FOAM_TUTORIALS |
@alexeym - Thanks a lot. That's what I was looking for
|
Ok one more question on this.. Because the calculation I am making is going to be for the number of cells, I need to convert it to an integer. I'm having trouble finding an example of how to do this.
Any ideas? Thanks again! |
Well, if you take a look into src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H, there is a note:
Code:
Note |
Hi Alexey, thanks again for getting back to me so quickly. Ok so as I'm understanding it, the use of calc would be:
Code:
x 20.0; |
Just
Code:
std::floor($xn) Code:
test #calc "std::floor($halfAngle/4)"; Code:
... codeStream object compilation output ... |
Hi Alexey,
I should've written back quicker... I messed around with it a bit and found my way to that syntax and have it working now. thanks a lot again for your help! Ariel |
Hello,
I was trying to implement something similar, but i have problems with negative variables. It seems i can decleare them but as soon i use them in the calc expression the blockMesh gives me an error. So in Code:
x1 -30; If x1 is declared as negative and dx =10 , everything is ok. if x1 is declared as negative and dx as ´ #calc "$x1";´ i get an error. Does anybody knows the reason and a work around? Note that the real operation that i would like to do is something like Code:
nx #calc "std::floor( ($x2-$x1)*$n )"; Thank you in advance. |
Hi,
You need to have a space between the variables and the operator for it to recognize it as subtraction. Instead of: $x2-$x1 So it should be: $x2 - $x1 Not sure if this is documented, but this was what I found out when I was playing around with this feature. Hope this helps. Cheers, Antimony |
Correct,
This worked. Thank you |
Using Regular C++ syntax to write Blockmesh file
hello everyone,
if i wanted to use regular C++ or objective C syntax to organize my code could I do that? for example Code:
i want to get practice writing in C++11 so that I can more easily ready the source code. I am working on a pretty complex blockmesh right now and would like to use oop in my code to try to help organize the shapes. Has anyone done this? Would I use #codestream for this. I am working my way through the manual. But found the codestream section a bit confusing... |
Figured out how to do this. #include. The of manual says it all
Sent from my SM-G930V using CFD Online Forum mobile app |
Error while using calc
Hi everyone!
I'm having lots of trouble with this functionality...Can someone help me please? I started with a very basic expression: xA 30; xU 20; acaso #calc "xA + xU"; and it gives the following error: Creating block mesh from "/home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/system/blockMeshDict" Using #calcEntry at line 33 in file "/home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/system/blockMeshDict" Using #codeStream with "/home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_a9cfc2467f9de95ca529e46e98786f31497c cff1.so" Creating new library in "dynamicCode/_a9cfc2467f9de95ca529e46e98786f31497ccff1/platforms/linux64GccDPInt32Opt/lib/libcodeStream_a9cfc2467f9de95ca529e46e98786f31497c cff1.so" Invoking "wmake -s libso /home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/dynamicCode/_a9cfc2467f9de95ca529e46e98786f31497ccff1" wmake libso /home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/dynamicCode/_a9cfc2467f9de95ca529e46e98786f31497ccff1 /opt/openfoam6/wmake/wmake: riga 410: make: command not found /opt/openfoam6/wmake/wmake: riga 413: make: command not found wmake error: file 'Make/linux64GccDPInt32Opt/sourceFiles' could not be created in /home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/dynamicCode/_a9cfc2467f9de95ca529e46e98786f31497ccff1 --> FOAM FATAL IO ERROR: Failed wmake "dynamicCode/_a9cfc2467f9de95ca529e46e98786f31497ccff1/platforms/linux64GccDPInt32Opt/lib/libcodeStream_a9cfc2467f9de95ca529e46e98786f31497c cff1.so" file: /home/laj/OpenFOAM/laj-6/run/interFoam/expo/expoBCTest/system/blockMeshDict from line 17 to line 32. From function static void (* Foam::functionEntries::codeStream::getFunction(con st Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&) in file db/dictionary/functionEntries/codeStream/codeStream.C at line 218. FOAM exiting Any clue? Thank you very much! |
Quote:
you need a dollar sign before all your variables when you call them, so: Code:
xA 30; |
I tried but...
Hello!
I tried but it gave me the same error...Anyother ideas? |
Make sure 2 add spaces aroundathematical characters such as -+×÷/.
|
Creating a parametric array of geometries
Hi everyone,
I am relatively new to OpenFOAM. I want to create an array of rectangular grooves in my geometry that are defined by some parameters (width, height, and spacing). From what I learned in this thread, I am able to use a while loop to create the required vertices for the grooves. However, I am having some issues when intend to create the blocks using hex inside a while loop. Below is my code; Code:
convertToMeters 0.001; Code:
error: invalid initialization of reference of type ‘Foam::IOstream&’ from expression of type ‘Foam::label {aka int}’ |
All times are GMT -4. The time now is 07:07. |