|
[Sponsors] |
October 20, 2014, 20:51 |
Negative source term issues fvScalarMatrix
|
#1 |
Member
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 12 |
Hello all,
I would like to know how to solve the following equation when m_o < 0 ## CODE BELOW## dimensionedScalar D_dt(transportProperties.lookup("D_dt")); fvScalarMatrix m_o_diffuseEqn ( D_dt*fvm::laplacian(m_o_diffuse) == fvm::Sp(1,m_o_diffuse) - m_o ); m_o_diffuseEqn.solve(); ## CODE ABOVE## where m_o is known (volScalarField) and m_o_diffuse will be determined. D_dt is simply a constant with units of m^2 I should say this solves just fine when m_o > 0. The code still compiles and solves when m_o < 0 the problem is that m_o_diffuse is identical to m_o i.e. nothing happened. I've tried fvm::SuSp and many combinations of the source term handling features but OF doesnt seem to recognize anything: error: no matching function for call to ‘SuSp(int, Foam::volScalarField&)’ I wouldnt be posting this if I haven't already tried applying information ive read in other posts. I simply cannot figure this one out! Thanks, James |
|
October 21, 2014, 18:55 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
You've got sign problem.
First, your equation should look like this fvScalarMatrix m_o_diffuseEqn ( - D_dt*fvm::laplacian(m_o_diffuse) == m_o - fvm::Sp(1,m_o_diffuse) ); m_o_diffuseEqn.solve(); That's the same, but Sp and SuSp expect a positive diagonal (and yours was negative). I would also consider solving for the variable of opposite sign, to make sure it remains positive. This definitely gets me to a known territory (elliptic relaxation). I think the negative variable should also work, but the meaning of source and sink terms etc. then becomes a bit weird. Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
October 21, 2014, 20:55 |
|
#3 |
Member
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 12 |
Excellent! I will try this configuration. Also, another problem is that m_o can be both positive and negative. The implementation is not yet clear to me if the field has both mixed positive and negative values.
Perhaps a superposition of the negative portion on the RHS and the positive values either on the LHS or in an SuSp(1,m_o_positive) on the RHS of the equation you've provided? This is of course, where the summation of the split field results in the original field. Thank you, James |
|
October 21, 2014, 20:58 |
|
#4 |
Member
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 12 |
Amendment to last post:
The superposition of the two requires zeros in certain location s such that the sum of the two fields forms the original field. I would use either +eps on the LHS instead of 0 And - eps for the other. Would this work to eliminate divide by zero errors? |
|
Tags |
diffusion equation, fvscalarmatrix, open foam, openfoam2.3, source term |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 10:17 |
How does fluent handles the momentum source term? | QBeast | FLUENT | 0 | April 22, 2013 15:12 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 18:18 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |