CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   codedBoundary Condition (https://www.cfd-online.com/Forums/openfoam-solving/246800-codedboundary-condition.html)

rishik686 December 24, 2022 12:36

codedBoundary Condition
 
1 Attachment(s)
Hi everyone,
I am trying to implement a time-varying velocity inlet boundary condition.

by using codedFixedValue type.

But, i am getting the follwing error while compiling,

error: return-statement with a value, in function returning ‘void’ [-fpermissive]

I have attached my U file also,

Please help me out to overcome this error.

Swirl December 26, 2022 12:29

I think your error lies in using the "return" statement, since the function is aparently defined as a void (which doesn't have a return value). The C++ source guide gives an example of how to use this type of BC:

https://cpp.openfoam.org/v10/classFo...atchField.html

I think, in your case it could look something like:
Code:

const scalar t = this->db().time().value();
operator==(<description of U-vector here>);


rishik686 December 30, 2022 04:07

Quote:

Originally Posted by Swirl (Post 841801)
I think your error lies in using the "return" statement, since the function is aparently defined as a void (which doesn't have a return value). The C++ source guide gives an example of how to use this type of BC:

https://cpp.openfoam.org/v10/classFo...atchField.html

I think, in your case it could look something like:
Code:

const scalar t = this->db().time().value();
operator==(<description of U-vector here>);


thanks swirl,
i corrected it,need to rewritr the code with operator.
thanks for your help


All times are GMT -4. The time now is 15:56.