|
[Sponsors] |
May 21, 2021, 03:59 |
Darcy as coded source
|
#1 |
Member
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 5 |
Hey,
I would like to define my Darcy-parameter D local inside my porous media. Therefor I try to write a vectorCodedSource to change the "fvOptions(U)" sink term in my Ueqn.H from porousSimpleFoam solver. If if apply my code with constant D and nu hard coded, my velocity increases and I get wrong results. How can I applay change fvOptions(U) instead of U at the whole field (U changes not only in my filter cellZone). The next problem is that I dont know how to load nu out of transportProperties instead of hard coding it. Different lookup and other code snippets didnīt work. My fvOptions look like follows: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2006 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // PorousMediaSource { type vectorCodedSource; name PMSource; active true; vectorCodedSourceCoeffs { fields (U); selectionMode cellZone; cellZone filter; codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ double D_ = 0.000001; const double nu_ = 1.532e-05; const vectorField& U_ = mesh().lookupObject<volVectorField>("U"); const vectorField& C = mesh_.C(); vectorField& USource = eqn.source(); forAll(C, i) { USource[i] -= U_[i] * D_ * nu_; if (i < 1) { Pout << U_[i] << USource[0] << endl; } } Pout << "***codeAddSup***" << endl; #}; codeConstrain #{ Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { // Dummy entry } } Thanks in advance Chris Last edited by Pyrokrates; May 25, 2021 at 05:16. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Thermophysical Properties | wsmith02 | OpenFOAM | 4 | June 1, 2023 14:30 |
[OpenFOAM.com] swak4foam compiling issues on a cluster | saj216 | OpenFOAM Installation | 5 | January 17, 2023 16:05 |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 01:22 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 12:41 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 10:57 |