CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Darcy as coded source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2021, 03:59
Default Darcy as coded source
  #1
Member
 
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 5
Pyrokrates is on a distinguished road
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.
Pyrokrates is offline   Reply With Quote

Old   May 22, 2021, 04:16
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Darcy-Forchheim should also be there in porous sources.
Can't you just use them, or in a modified form?
Probably better than writing from scratch.
olesen is offline   Reply With Quote

Old   May 25, 2021, 02:54
Post
  #3
Member
 
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 5
Pyrokrates is on a distinguished road
Hey,
thanks for your answer. I know that Darcy-Forchheimer is already implemented. The problem is, that I am not deep enough inside all the code to understand the whole structure. I mean the place, where fvOptions calls DarcyForchheimer.C and how it is calculated there (I`m also not familiar with all OF defined functions, classes, templates for variables , ...). If I write my own code it`s easier to define my input for local permeability.


To change the equations in DarcyForchheimer.C I need to know the whole part from fvOptions.C to DarcyForhcheimer.C so I can change the LIBS to my local coded data. That is another problem too.





Thanks in advance.
Pyrokrates is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 05:08.