overwrite matrix / vector value
Hello,
I would like to overwrite individual matrix values in OpenFoam. I understand in order to get the values you use simply: vectorvalue = vector[cellI] whereas vectorvalue is a scalar and vector a volScalarField in my example. Still I get some trouble to do the opposite operation: vector[cellI] = vectorvalue It does not seem to update, e.g. applied on alpha1 in interFoam: Code:
scalar prec = 1e-10; HTML Code:
PIMPLE: iteration 3 Related question: How do I get values of system of equation, such as fvScalarMatrix. I understand that this is linear equation system such as A x = B, A being a matrix and x and B vector each, whereas x is the unknown to be looked for. I need the values of A and B. Regards, Daniel |
Update
The code actually works as expected limiting alpha1 between 0 and 1. However the min and max values are not printed out correctly :confused:.
For the 2nd matrix problem, I found nn.source as a way to get eg. A * p_rgh = B for B: Code:
pEqn_s = p_rghEqn.source(); HTML Code:
pEqn_m1.H:46:34: Fehler: keine Übereinstimmung für »operator=« in »pEqn_s = p_rghEqn.Foam::fvMatrix<Type>::source [with Type = double]()« Code:
Info<< "Reading field pEqn_s\n" << endl; Daniel |
A and B in FvScalarMatrix
Hello again,
Well there seems nobody out there, though there is time between games in World Cup. I found some solutions of my problem meanwhile, but now I am stuck again. The solution to the type in fvScalaMatrix seems to be the following: Code:
Foam::Field<double> pEqn_s = p_rghEqn.source(); Code:
Foam::Field<int> pEqn_u_addr = p_rghEqn.upperAddr(); HTML Code:
pEqn_m1.H:50:49: Fehler: »Foam::fvScalarMatrix« hat kein Element namens »upperAddr« To get the A matrix, I applied the following: Code:
double A_pEgn [pEqn_d.size()][pEqn_d.size()]; Regards, Daniel |
All times are GMT -4. The time now is 10:16. |