CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Euler solver in BCs (https://www.cfd-online.com/Forums/openfoam/121894-euler-solver-bcs.html)

Hiroshiman August 7, 2013 08:35

Euler solver in BCs
 
Hi,
I'm trying to implement a boundary conditions that links pressure to outflow using a differential equation (Windkessel) and therefore need to solve it. A simple 1st order backward Euler solver should be enough and, fortunately, one is available in OF.

I've never added a new BC but I tried a take an existing one, use the outflow on the selected patch to calculate the pressure and export it.

I was wondering : what it the best existing BC to start from ? Has anyone an example a the use of a solver in a BC function ?


Best regards,

Florian

cfdonline2mohsen August 8, 2013 13:19

Dear Hiroshiman

The following pdf by Håkan Nilsson in Chalmers University is so helpful.

How to implement a new boundary conditions:
http://www.tfd.chalmers.se/~hani/kur...yCondition.pdf

Also, take a look at his homepage for more tutorials:

http://www.tfd.chalmers.se/~hani/index.html
http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2009/

Hiroshiman August 8, 2013 13:37

Hi Kia,
thank you for the links. Actually I've already read the Chalmers guide for the programmation of BCs.
Currently I'm using the codedFixedValue BC with a code that calculates p from phi on the outlet.
I still have a few problems : how can I access the mean value of the pressure on the patch ? I'm able to do it for phi but not for p (surfaceField vs volume Field).

Code:

const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");
const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi);

I must solve something like :
d(p-phi*R)/dt=f(p,phi) to impose p on the outlet, is it possible to use the ddt solver of openfoam ? I coded an Euler solver but I'd like to use a maximum of integrated functions...


Regards,

Florian

Andreas2014 April 19, 2016 05:58

Hi,

Hiroshiman, did you manage to get it to work?
Here is how you can access pressure.
Code:


const scalarField& press =
                patch().lookupPatchField<volScalarField, scalar>("pressure");

Did you have to solve the ode at every internal iteration in a timestep?

I am using resistance boundary conditions, where the pressure outlet is simply the product of a resistance value and the flowrate at the outlet.

I have coded it with codedFixedValue but am not getting the same results as those I find in Fluent.

Any pointers would be appreciated,

Kind regards,
Andreas

Neb June 5, 2020 06:43

HI, It's been a long time, but has anyone solved this problem? I should be doing the exact same thing.

Thanks!


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