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

codedSource and semiImplicitSource Mix?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2022, 12:53
Default codedSource and semiImplicitSource Mix?
  #1
New Member
 
Lukas Kutej
Join Date: Jan 2016
Location: Darmstadt
Posts: 20
Rep Power: 10
delsolman is on a distinguished road
Hello guys...I would like to have Su Sp source applied on a part of field under if condition.

- semiImplicitSorce:
here I can define Su and Sp source sadly only for whole field

Code:
sourceTerm
{
    type            scalarSemiImplicitSource;
    enabled         true;

    scalarSemiImplicitSourceCoeffs
    {
        selectionMode   all;
        volumeMode      absolute;
        injectionRateSuSp
        {
            k           (1e30 1e30);
        }
    }
}
I don't want to define "cellZone" because it should be mesh independent.

- codedSource:
here I can do a "if" loop over the partial domain, but I don't know how to define Su and Sp

Code:
sourceTerm
{
    type            scalarCodedSource;
    name            sourceTerm;

    scalarCodedSourceCoeffs
    {
        selectionMode   all;
        volumeMode      absolute;
        fields          (k);

        codeInclude
        #{
        #};

        codeCorrect
        #{
        #};

        codeAddSup
        #{
            // Cell center coordinates
            const volVectorField& C = mesh_.C();
            const volScalarField& ySwitch = mesh_.thisDb().lookupObject<volScalarField>("ySwitch");
            scalarField& kSource = eqn.source();

                // Apply the source
                forAll (C, i)
                {
                    if (ySwitch[i] > 0.9999)
                    {
                        // cell volume specific source
                        kSource[i] += 1e30;
                    }
                };

        #};

        codeConstrain
        #{
        #};
    }
}
So is there some option please how can I define Su, Sp in codedSource or how can I do a "if" loop inside of semiImplicitSource?
delsolman 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
Customized semiImplicitSource Ricky-11 OpenFOAM Programming & Development 1 November 25, 2016 12:04


All times are GMT -4. The time now is 18:14.