
[Sponsors] 
March 22, 2011, 14:51 
Conjugate Mass Foam Solver with reaction?

#1 
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 
Hello Foamers,
I managed to combine one of my solvers that solves for time dependent passive scalar transport in a turbulent flow field for at particular species with mass transport in a solid similar to conjugateHeatFoam. This works without a hitch, but when I try to attached a simple first order reaction based on a stationary species in the solid phase it gives some errors on runtime. At first, i defined the separate species as its own field, not part of the coupledFvScalarMatrix. This gave an error: > FOAM FATAL ERROR: incompatible fields for operation [C] + [Cmetal] I am sure it is from the source term (fvm::Sp(0.01*Csolid,Cmetal)) where i tried to couple a non coupleFvScalarMatrix field into the mix. I then decided to try and make a third region (identical to the solid region) that is overlayed on the solid region into a different mesh. Code:
// Add solidside equation CEqns.set ( 1, new fvScalarMatrix ( fvm::ddt(Csolid)  fvm::laplacian(Dsolid, Csolid) + fvm::Sp(0.01*Csolid,Cmetal) ) ); //solve the metal oxidation reaction only in the solid CEqns.set ( 2, new fvScalarMatrix ( fvm::ddt(Cmetal) + fvm::Sp(0.01*Csolid,Cmetal) ) ); > FOAM FATAL ERROR: incompatible fields for operation [C] + [C] I'm assuming that the error was because I was trying to solve a system in which one variable was defined on one mesh....and another defined on a separate mesh. how does one overcome this issue? Dan p.s. I am using 1.6ext 

March 22, 2011, 15:14 

#2 
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 18 
I'm pretty sure all the fields need to be on the same mesh, if they're not then you'll have to find a way of mapping the terms from one mesh to another. I would say try implementing your source term using an explicit source term first to see if that works, or even just a scalar value to see if it runs.


March 22, 2011, 17:40 

#3  
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 
Quote:
Code:
// Add solidside equation CEqns.set ( 1, new fvScalarMatrix ( fvm::ddt(Csolid)  fvm::laplacian(Dsolid, Csolid) + k*Csolid*Cmetal ) ); //add the solidside equation for another scalar in the solid CEqns.set ( 2, new fvScalarMatrix ( fvm::ddt(Cmetal) + k*Csolid*Cmetal ) ); CEqns.solve(); Dan 

March 23, 2011, 04:16 

#4 
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 17 
Hi!
If you want to use fvm::Sp() in the building of your matrix, you ought to inverse Csolid and Cmetal within the fonction Sp(). Indeed the second argument is the variable of the matrix: Code:
fvm::Sp(0.01*Cmetal,Csolid) Bests, Cyp 

March 23, 2011, 09:09 

#5  
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 
Quote:
Code:
> FOAM FATAL ERROR: incompatible fields for operation [C] + [C] From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&) in file /home/dcombest/OpenFOAM/OpenFOAM1.6ext/src/finiteVolume/lnInclude/fvMatrix.C at line 1207. FOAM aborting Code:
// Add solidside equation CEqns.set ( 1, new fvScalarMatrix ( fvm::ddt(Csolid)  fvm::laplacian(Dsolid, Csolid) + fvm::Sp(k*Cmetal,Csolid)//k*Csolid*Cmetal ) ); //add the solidside equation for another scalar in the solid CEqns.set ( 2, new fvScalarMatrix ( fvm::ddt(Cmetal) + fvm::Sp(k*Cmetal,Csolid)//k*Csolid*Cmetal ) ); CEqns.solve(); Code:
// Add solidside equation CEqns.set ( 1, new fvScalarMatrix ( fvm::ddt(Csolid)  fvm::laplacian(Dsolid, Csolid) + k*Csolid*Cmetal ) ); //add the solidside equation for another scalar in the solid CEqns.set ( 2, new fvScalarMatrix ( fvm::ddt(Cmetal) + k*Csolid*Cmetal ) ); CEqns.solve(); Dan 

March 23, 2011, 09:18 

#6 
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 17 
Hi!
Look at your second equation : if you want to construct a matrix for the variable Cmetal, the second argument of your source term fvm::Sp() must be Cmetal : Code:
fvm::Sp(k*Csolid,Cmetal) I think it should work now. 

March 23, 2011, 10:44 
Excellent!

#7 
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 
That did the trick! I'm still unclear as to why the fvm::Sp() is better than just an explicit k*C*C in the equation. Is this a situation where k*C*C is collected in the b of Ax=b and fvm::Sp() collects the term into A of Ax = b? Is there an advantage? Thanks again for the help.
Dan 

March 23, 2011, 10:51 

#8  
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 
I actually found the answer on the message boards here (http://www.cfdonline.com/Forums/ope...fvmspb.html) which states:
Quote:


March 23, 2011, 10:53 

#9  
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 17 
Quote:


Tags 
block matrix, conjugate, mass source term 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
channelFoam for a 3D pipe  AlmostSurelyRob  OpenFOAM  3  June 24, 2011 13:06 
[Gmsh] Import problem  ARC  OpenFOAM Meshing & Mesh Conversion  0  February 27, 2010 10:56 
gmsh2ToFoam  sarajags_89  OpenFOAM  0  November 24, 2009 22:50 
Conjugate Gradient Solver.  Froed  Main CFD Forum  0  July 29, 2005 06:29 
Conjugate gradient solver for pressure.  R.F.  Main CFD Forum  0  November 12, 2004 11:49 