|
[Sponsors] |
Reading a list of scalar data as a constant source term in the governing equation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 8, 2018, 20:37 |
Reading a list of scalar data as a constant source term in the governing equation
|
#1 |
Member
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10 |
Dear Foamers,
I modify the governing equation by adding a source term in a solver, and the source term is a list of scalar which is solved by another solver. But the mesh geometry is kept the same by employing the same blockMeshDict. The source term here call sigma0 as shown below: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.4"; object sigma0; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField nonuniform List<scalar> 1125000 ( 187900 187900 187900 187900 187900 187900 187900 187901 187901 187902 187902 187903 187903 187904 187905 187906 187907 187908 187909 187910 187911 187912 187913 187914 187916 187917 187918 187920 .... ) ; } } Code:
fvScalarMatrix p2Eqn ( fvm::ddt(p2) == fvm::laplacian(Cv, p2) - sigma0 ); Code:
Info<< "Reading sigma0 field\n" << endl; IOdictionary sigmaD0 ( IOobject ( "sigmaD0", // name of the file runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); volScalarField sigma0 ( sigmaD0.lookup("sigma0") ); Cheers! Lewis |
|
August 8, 2018, 22:59 |
|
#2 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
Code:
IOobject sigma0_Header ( "sigma0", runTime.constant(), mesh, IOobject::MUST_READ ); volScalarField sigma0(sigma0_Header, mesh);
__________________
https://openfoam.top |
|
August 9, 2018, 04:24 |
|
#3 |
Member
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10 |
Hi!@zhangyan Thanks for your sharing. The solver is compiled successfully, and the list of data seem to be read in the governing equation so far. For this code:
Code:
volScalarField sigma0(sigma0_Header, mesh); Best regards, Lewis |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 | tlcoons | OpenFOAM Installation | 13 | April 20, 2016 18:34 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 07:42 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |