|
[Sponsors] |
November 5, 2021, 19:16 |
Counterpart representation of fvc::grad ???
|
#1 |
Member
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 9 |
Dear Foamers,
I'm trying to solve a Equation for a volVectorField (H) such that where, Z is another volVectorField and is of less concern. Here, apparently the H field is irrotational and thus should also satisfy . To justify the above condition, the H is represented in terms of gradient of scalar potential (as the curl of gradient of scalar function is always zero ) Now, after substitution, the initial equation can be rewritten as which then can be solved by constructing a scalar matrix as shown below Code:
tmp<fvScalarMatrix> tphiHEqn ( fvm::laplacian(phiH) == -fvc::div(Z) ); Now, it is very easy to represent/reconstruct the H in terms of this scalar potential using Code:
volVectorField H = fvc::grad(phiH); Field dimensions for both field are as mentioned below H = [0 -1 0 0 0 1 0];//A/m phiH = [0 0 0 0 0 1 0];//A I've already tried some workarounds which are mentioned below, but unfortunately they are unable to resolve the issue . 1. Code:
phiH = fvc::surfaceIntegrate(fvc::flux(H)); flux will convert the volVectorField to surfScalar & surfaceIntegrate will convert surfScalarField to volScalarField However, the dimensions of RHS appear to be A.m2 whereas LHS have dim of A. 2. Code:
phiH = fvc::domainIntegrate(Foam::mag(H)); 3. Code:
phiH = (fvc::average((fvc::flux(H)))) All suggestions/comments are welcome. Thanks in advance !!! |
|
November 7, 2021, 14:11 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
My advice is take a step back and think again about what you are trying to do. You effectively want to solve for . Now, this equation is saying that the gradient of at any point is determined by the local value of ... but this means that you cannot calculate the value of at that point just from the local gradient ... you need to find a point where you know the value of (from a boundary condition), and then do a line integral from there to the point you are interested in. So, do you see now why you are struggling to find an analytical solution to this, based on the local values of ?
Or, a TLDR answer is - you can't do it that way; instead, why not just get OpenFOAM to solve the equation with appropriate BCs, as a precursor step? Good luck! |
|
November 8, 2021, 15:01 |
|
#3 |
Member
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 9 |
Hi Tobermory, thanks for your comment. Perhaps I was not able to mention the stuff in better way. As there is some misunderstanding which leads to the following part of your comment
As mentioned earlier, we want to solve the to obtain . Later on using this scalar potential, we compute the H as Can you please elaborate the following statement ? |
|
November 9, 2021, 05:32 |
|
#4 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
No, no - I do understand what you mean ... Apologies if my comment:
was unclear. Recall that you asked earlier: Quote:
For the second part, how to solve , it occurred to me that you could just set this up as an equation for OpenFOAM to solve, eg something like Code:
tmp<fvScalarMatrix> tphiBoundaryEqn ( fvm::grad(phiH) == H ); |
||
Tags |
gradient, volscalarfield, volvectorfield |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mathematical representation of fixedDisplacementZeroShear boundary condition | Sargam05 | OpenFOAM | 14 | January 11, 2022 07:55 |
[General] representation plugin | cplusplus | ParaView | 0 | January 20, 2017 05:19 |
2D Representation of surface values in 3D | mrurq | EnSight | 6 | February 25, 2016 06:01 |
[General] Representation "Surface" is displayed correctly, but Representation "Outline" is not | macfly | ParaView | 4 | March 22, 2014 10:54 |
OpenFOAM representation for a partial equation | jimbean | OpenFOAM Running, Solving & CFD | 0 | October 24, 2013 14:30 |