CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Conditional solving of transport equations (https://www.cfd-online.com/Forums/openfoam-programming-development/203094-conditional-solving-transport-equations.html)

upuli June 18, 2018 06:02

Conditional solving of transport equations
 
Hi


I have seen some posts on conditional solving of transport equation.Many posts mentioned the use of interfoam solver. But I am not clear how this can be done. I have the following transport equation
Code:

fvScalarMatrix TsEqn
    (
      fvm::ddt(Ts)
 
    + fvm::div(phibed,Ts)

          - fvc::laplacian(DTs,Ts)
    );

TsEqn.solve();


I want to solve only in a region where solid is present(in the same mesh). I have another volume scalar field solid which has the value of 1 within the solid region and which has the value of 0 when there are no solids. I used icoFoam solver to develop the equation. How can I solve the above TsEqn within the solid region(solid=1).




Thanking You


Upuli

hyFoam June 18, 2018 16:33

Hi Upuli,


Isn't the solution identical to the one in this post:
https://www.cfd-online.com/Forums/op...ity-value.html


i.e., removing elements from the fvMatrix based on the value taken by the scalarField that is marking fluid and solid regions.



Thanks,


Vince

upuli June 18, 2018 23:06

Hi



Thank you verymuch. It is same as the thread you mentioned. I will try it. But I am also curious on how this is done in InterFoam solver. There is a thread on that https://www.cfd-online.com/Forums/op...-equation.html. But it is not clear to me.

upuli July 10, 2018 02:06

Hi



My solids field is moving along x direction at a constant velocity. I used the below code to solve the TsEqn within the solid field and it doesnot seem to be move when the solid field move in the x direction.


Code:

DynamicList<label> removedCellsFromMatrix;
DynamicList<scalar> valuesToImpose;


forAll(solid, celli)
    {
        if(solid[celli] < 1)
        {
            removedCellsFromMatrix.append(celli);
        }
}

forAll(removedCellsFromMatrix, i)
    {
        valuesToImposemass.append(300.0);
}


fvScalarMatrix TsEqn
    (
      fvm::ddt(Ts)
 
    + fvm::div(phibed,Ts)

          - fvc::laplacian(DTs,Ts)
    );

TsEqn.solve();
TsEqn.setValues(removedCellsFromMatrix, valuesToImpose);

pre.cjk { font-family: "Nimbus Mono L", monospace; }p { margin-bottom: 0.1in; line-height: 120%; }a:link { }


All times are GMT -4. The time now is 06:07.