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

Block coupling three equations using foam extend 4.1

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ELwardi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2019, 12:29
Question Block coupling three equations using foam extend 4.1
  #1
Member
 
Elwardi Fadeli
Join Date: Dec 2016
Location: Boumerdes, Algeria
Posts: 41
Rep Power: 10
ELwardi is on a distinguished road
Hi all,

I'm using (trying to use ) foam-extend's coupledFvMatrix (https://github.com/Unofficial-Extend...vBlockMatrix.H)

to couple three equations. The coupling terms consist of "laplacians" and Time derivatives .

This thread explains how I'm approaching this and what the current results are. I know I'm doing something (Or more) wrong since these results are not sane enough .

First, construct a volVectorField to hold solved (scalar) Fields:
Code:
volVector3Field pSwSg
(
    IOobject
    (   
        "pSwSg",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),  
    mesh,
    dimensionedVector3("zero", dimless, vector3::zero)
);
Later in the code, define each fvScalarMatrix; for example:


Code:
// "Main" pressure equation

fvScalarMatrix pEqn
(

     fvm::ddt(M, p) + fvm::laplacian(-D, p) + fvc::div(somePhi)

);


// Coupled term between pEqn and some other SwEqn
fvScalarMatrix SwInp
(   
    - fvm::ddt(M1, Sw) // and maybe fvm::laplacian(D1, Sw)
);
The actual coupling is carried out when creating the block matrix:
Code:
// Instantiate the coubled matrix

fvBlockMatrix<vector3> resEqn(pSwSg);



// Add equations
resEqn.insertEquation(0, pEqn);
resEqn.insertEquation(1, SwEqn);
resEqn.insertEquation(2, SgEqn);


// Insert coupling terms
// Sw term in pEqn:
 resEqn.insertEquationCoupling(0, 1, SwInp);
// Note that SwInp is a fvScalarMatrix

 // Add more couplings ...
After this, we solve the blockMatrix and retrieve solutions.


The problem is, inserting the following code:
Code:
Info<< "Lower Coupling:" <<
    << resEqn.coupleLower() << nl
    << "Upper Coupling:" << 
    << resEqn.coupleUpper() << nl
    << "Component Coupled:" << 
    << resEqn.componentCoupled() << nl
    << "Coupled Diagonal:" << nl
    << resEqn.diag() << endl;
somewhere before solving the equation, and testing it on a minimal case (1D 5cells mesh), results in the following output:


Code:
Lower Coupling:
3
(
unallocated
1
unallocated
1
unallocated
0
)

Upper Coupling:
3
(
unallocated
1
unallocated
1
unallocated
0
)

Component Coupled:
1



Coupled Diagonal:
square
5
(
(-865.137 -7.42132e-07 -7.42132e-07 21.9694 7.42132e-06 0 -129771 -0.00011132 -0.000103899) 

(-14549.7 -1.51723e-13 -1.51723e-13 368.569 1.51723e-12 0 -2.18245e+06 -2.27584e-11 -2.12412e-11) 

(-302060 -4.08706e-29 -4.08706e-29 7645.23 4.08706e-28 0 -4.5309e+07 -6.13059e-27 -5.72188e-27) 

(-1.3066e+07 -8.3987e-74 -8.3987e-74 330590 8.3987e-73 0 -1.95991e+09 -1.2598e-71 -1.17582e-71) 

(-1.27778e+07 -3.88293e-254 -3.88293e-254 323294 3.88293e-253 0 -1.91666e+09 -5.8244e-252 -5.4361e-252)
)



GMRES:  Solving for pSwSg, Initial residual = (0.006936 0.000167427 0.992364), Final residual = (2.11584e-12 7.29283e-15 1.42317e-14), No Iterations 1

Huh, no upper/lower coupling .


Any help or orientation to some reference materials is greatly appreciated.
Best regards,
Kummi likes this.
ELwardi is offline   Reply With Quote

Old   March 18, 2019, 22:20
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Are you looking at the right place? Look at the matrix: there is diag, upper and lower; then there is out-of-core coefficient like processor boundaries.

From your output, you MUST get block clefs for upper and lower; otherwise GMT’s would not be called. I think you are looking at the wrong place.

I also have doubts about your cross-mciupling matrix, but that’s another thing...
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   March 19, 2019, 11:35
Default
  #3
Member
 
Elwardi Fadeli
Join Date: Dec 2016
Location: Boumerdes, Algeria
Posts: 41
Rep Power: 10
ELwardi is on a distinguished road
Mr @hjasak, thank you for your reply.


As you pointed out, the coupled matrix seems to be OK unless I'm making a vague, invalid assumption somewhere (detailed log attached).


I need to be 100% sure of something though; Does

Code:
fvBlockMatrix::insertEquationCoupling(id1, id2, 2In1)
insert the matrix 2In1 as coupling term of variable of equation 2 in equation1 ?

(following the same convention of insertBlockCoupling used in pUCoupledFoam) Or is it the other way around.
Attached Files
File Type: txt log.txt (2.8 KB, 16 views)
ELwardi is offline   Reply With Quote

Reply

Tags
block matrix, block-coupling, foam ext 4.0, foam extend


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
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
[Commercial meshers] Using starToFoam clo OpenFOAM Meshing & Mesh Conversion 33 September 26, 2012 05:04
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 00:54.