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

To know how to assign diffusion in different directions for interMinxingFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2024, 21:58
Default To know how to assign diffusion in different directions for interMinxingFoam
  #1
New Member
 
Charitha Rangana Dissanayaka
Join Date: Mar 2022
Posts: 6
Rep Power: 4
Charitha_Dissanayaka is on a distinguished road
Dear All,

I need your help to solve the following matter.
I used interMixingFoam to simulate landslide in OpenFOAM-4.x. But I have observed some strange result between the phases of alpha2 and alpha3 (landslide material) during the post processing. Hence I want to modify the interMixingFoam to assign diffusion coefficients in x,y, and z directions separately.


solver name has changed to interMixingFoam -> myInterMixingFoam

Then modified the createFields.H in like below.

//Modification made to defined the tensor term of the diffusion
dimensionedTensor Dcx23(mixture.lookup("Dcx23"));
dimensionedTensor Dcy23(mixture.lookup("Dcy23"));
dimensionedTensor Dcz23(mixture.lookup("Dcz23"));

At last I assigned the following terms to the alphaEqns.H



template<in-vector xDir, class tensor>
template<in-vector yDir, class tensor>
template<in-vector zDir, class tensor>

const tensor xDir = (1 0 0);
const tensor yDir = (0 1 0);
const tensor zDir = (0 0 1);

// Create the diffusion coefficients for alpha2<->alpha3
volTensorField Dcx23(Dx23*max(alpha3,scalar(0))*pos(alpha2));
volTensorField Dcx32(Dx23*max(alpha2,scalar(0))*pos(alpha3));
volTensorField Dcy23(Dy23*max(alpha3,scalar(0))*pos(alpha2));
volTensorField Dcy32(Dy23*max(alpha2,scalar(0))*pos(alpha3));
volTensorField Dcz23(Dz23*max(alpha3,scalar(0))*pos(alpha2));
volTensorField Dcz32(Dz23*max(alpha2,scalar(0))*pos(alpha3));

// add diffusive flux for alpha3->alpha2
alphaPhi2 -= fvc::interpolate(Dcx32)*mesh.magSf()*fvc::snGrad(( alpha1) & xDir); // x direction
alphaPhi2 -= fvc::interpolate(Dcy32)*mesh.magSf()*fvc::snGrad(( alpha1) & yDir); // y direction
alphaPhi2 -= fvc::interpolate(Dcz32)*mesh.magSf()*fvc::snGrad(( alpha1) & zDir); // z direction

// Solve for alpha2
// assigning of direction for the fvm would be either '& direction::x' or '& xDir'
fvScalarMatrix alpha2Eqn
(
fvm::ddt(alpha2)
+ fvc::div(alphaPhi2)
- fvm::laplacian((Dcx23 + Dcx32, alpha2) & xDir)
- fvm::laplacian((Dcy23 + Dcy32, alpha2) & yDir)
- fvm::laplacian((Dcv23 + Dcv32, alpha2) & zDir)
);
alpha2Eqn.solve();


But I unable to compile the code due to an error.
For your reference I attached the alphaEqns.H and createFields.H files to this link.
Your kind help is I highly appreciated.
Attached Files
File Type: h createFields.H (2.4 KB, 0 views)
File Type: h alphaEqns.H (7.1 KB, 0 views)
Charitha_Dissanayaka is offline   Reply With Quote

Reply

Tags
openfoam


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
is it possible to define different mass diffusion coefficients in different zones? Weiqiang Liu Main CFD Forum 0 June 3, 2019 21:24
how to obtain mass diffusion coefficient with UDF? Weiqiang Liu FLUENT 0 May 28, 2019 13:32
Problem simulating the temperature rise in a composite material (chtMultiRegionFoam) Adam_K OpenFOAM Running, Solving & CFD 2 March 27, 2019 07:51
Harmonic average of Diffusion Tensors in Finite Volume Method Yurie_Breschnef Main CFD Forum 4 September 6, 2018 05:51
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20


All times are GMT -4. The time now is 09:42.