|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 7 ![]() |
The equations are from here
Here is the code: Code:
// Including necessary class definition and libraries ( Header files ) #include "fvCFD.H" #include "simpleControl.H" // handler for printing stuff #define print(X) Info << X << endl // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { // Creating objects from the above defined classes // These .H files are basically code snippets ( "inclusion" files ) #include "setRootCaseLists.H" #include "createTime.H" #include "createMesh.H" simpleControl simple(mesh); #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating scalar transport\n" << endl; // Trigger the objects to store the old value of theirs at each iteration c.oldTime(); p.oldTime(); pSt.oldTime(); // pD.oldTime(); w.oldTime(); q.oldTime(); // Define constant coefficients before the loop to only be calculated once dimensionedScalar coeff1 = (Pmi/Pma); dimensionedScalar coeff2 = 1e-9 * coeff1 * (VT/De); dimensionedScalar coeff3 = -2 * F / CapSt; while (simple.loop(runTime)) { Info<< "Time = " << runTime.timeName() << nl << endl; #include "CourantNo.H" // Potential Equation fvScalarMatrix pEqn ( - fvm::laplacian(c, p) == coeff2 * fvc::ddt(q) ); pEqn.relax(); pEqn.solve(); while (simple.correctNonOrthogonal()) { // Concentration Equation fvScalarMatrix cEqn ( fvm::ddt(c) + coeff_conv * fvm::div(phi, c) - coeff_diff_1 * fvm::laplacian(De, c) // spacer *2 : *0 - coeff_diff_2 * fvm::laplacian(De, c) // electrode *0 : *1 == coeff1 * fvc::ddt(w) ); cEqn.relax(); cEqn.solve(); } q = src_coeff_p * (-c) * exp(Mu) * sinh(pD/VT); pSt = coeff3 * q; pD = max(-1 * src_coeff_p * p + EV * src_coeff_c - pSt); //w = c * exp(Mu) * cosh(pD/VT); w = sqrt(q * q + 4 * src_coeff_c * c * c); runTime.write(); } Info<< endl; Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; Info<< "End\n" << endl; return 0; ![]() |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Sreehari Perumanath
Join Date: Jun 2022
Posts: 28
Rep Power: 4 ![]() |
Hello Ali,
I'm having a similar issue. Did you manage to solve the problem? Please let me know. Thanks, S |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Errors when using different ddt schemes in interFoam | kerim | OpenFOAM Running, Solving & CFD | 2 | August 14, 2020 23:14 |
Explicit ddt scheme | sachinjain | OpenFOAM Running, Solving & CFD | 6 | March 4, 2020 16:08 |
d2dt2 and ddt versus time-varying boundary conditions | bigphil | OpenFOAM CC Toolkits for Fluid-Structure Interaction | 0 | July 3, 2019 05:01 |
ddt scheme: CrankNic(h)olson | Djub | OpenFOAM Running, Solving & CFD | 0 | November 20, 2013 06:22 |
Ddt schemes update | hjasak | OpenFOAM Running, Solving & CFD | 0 | April 11, 2005 07:55 |