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

Implementation a new solver in foam-extend

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 14, 2020, 11:38
Default Implementation a new solver in foam-extend
  #1
New Member
 
Yujuan Luo
Join Date: Jul 2019
Posts: 21
Rep Power: 7
Yujuan is on a distinguished road
Hi all,


Now I want to implement a new solver in foam-extend-4.1. In the solver, two equations for θ1 and θ2 have to be solved. The transient term, convection term and source term are similar to expressions in other solvers, but the diffusion terms look little bit different:
In the equation for θ1, the diffusion term is a*div(D1gradθ1+D2gradθ2).

In the equation for θ2, the diffusion term is b*div(D1gradθ1+D2gradθ2).


Now I implement these terms like follows:
(1) Define a fvBlockMatrix thetaEqn.

(2) Define fvScalarMatrix theta1Eqn and theta2Eqn for θ1 and θ2. For θ1, a*div(D1gradθ1) is expressed like: a*fvm::laplacian(D1,θ1), where a is a volScalarField. For θ2, it is similar.
(3) thetaEqn.insertEquation(0, theta1Eqn); thetaEqn.insertEquation(1, theta2Eqn).

(4) thetaEqn.insertEquationCoupling(0,1,a*fvm::laplaci an(D2,θ2)); thetaEqn.insertEquationCoupling(1,0,b*fvm::laplaci an(D1,θ1)).
(5) thetaEqn.solve();




However, the simulation just crashed after some time. Do you have any suggestions on how to implementing this diffusion term? Thanks a lot!


Best regards,
Yujuan
Yujuan is offline   Reply With Quote

Old   May 18, 2020, 13:04
Default
  #2
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Hey Yujuan,
Depending on how your solver is structured (iterative solver), you can also directly embed the diffusion term linked to the "other scalar" explicitely. A combination of fvc::div and fvc::grad as you suggested should work while using fvm::laplancian for the scalar for which you are currently solving the equation. You should be able to iterate over both equations until convergence is reached for both scalars. However, I do not know how this will affect the overall stability of the solver. If you still havn't found a solution, it could be worth trying.
Good luck!
RP
raumpolizei is offline   Reply With Quote

Old   May 19, 2020, 10:24
Default
  #3
New Member
 
Yujuan Luo
Join Date: Jul 2019
Posts: 21
Rep Power: 7
Yujuan is on a distinguished road
Quote:
Originally Posted by raumpolizei View Post
Hey Yujuan,
Depending on how your solver is structured (iterative solver), you can also directly embed the diffusion term linked to the "other scalar" explicitely. A combination of fvc::div and fvc::grad as you suggested should work while using fvm::laplancian for the scalar for which you are currently solving the equation. You should be able to iterate over both equations until convergence is reached for both scalars. However, I do not know how this will affect the overall stability of the solver. If you still havn't found a solution, it could be worth trying.
Good luck!
RP
Hi, raumpolizei


Thanks a lot for your suggestions. I'll have a try to use fvc::div(fvc::grad).
Yujuan is offline   Reply With Quote

Reply


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
Using createPatch and cyclicAMI in FOAM Extend to create periodicbox manuc OpenFOAM Running, Solving & CFD 1 April 12, 2022 12:36
[foam-extend.org] Installing Foam Extend 4.0 on Linux Mint andysuth OpenFOAM Installation 1 May 11, 2019 09:37
probe Locations error in the dynamicMesh foam extend 4.0 vahidreza lotfi OpenFOAM Post-Processing 2 August 22, 2018 11:30
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 02:27


All times are GMT -4. The time now is 05:51.