Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify Equations Jacobian Calculation type due to bug #160

Open
PrasadBabarendaGamage opened this issue Jul 25, 2018 · 1 comment

Comments

@PrasadBabarendaGamage
Copy link
Contributor

PrasadBabarendaGamage commented Jul 25, 2018

Create equations

equations = iron.Equations()
equationsSet.EquationsCreateStart(equations)
#equations.JacobianMatricesTypesSet(iron.EquationsJacobianCalculated.FINITE_DIFFERENCE)
equations.JacobianMatricesTypesSet(iron.EquationsJacobianCalculated.ANALYTIC)
equationsSet.EquationsCreateFinish()

Explicitly specifying either FINITE_DIFFERENCE or ANALYTIC results in

ERROR: 1: Vector matrices is not associated for the vector equations.
EquationsVector_VectorMatricesGet
cmfe_Equations_JacobianMatricesTypesSet

The code in cmfe_Equations_JacobianMatricesTypesSet from Jenny's last commit (jennyhelyanwe@606a887):
equationsMatrices=>equations%equations%EQUATIONS_MATRICES CALL EquationsMatrices_JacobianTypesSet(equationsMatrices,[jacobianTypes],err,error,*999)
and is now the following in latest develop branch:
NULLIFY(vectorEquations) CALL Equations_VectorEquationsGet(equations%equations,vectorEquations,err,error,*999) NULLIFY(vectorMatrices) CALL EquationsVector_VectorMatricesGet(vectorEquations,vectorMatrices,err,error,*999) CALL EquationsMatrices_JacobianTypesSet(vectorMatrices,[jacobianTypes],err,error,*999)

Most likely because vectorMatrices are only associated during equations create finish producing a chicken and egg situation?

@PrasadBabarendaGamage
Copy link
Contributor Author

PrasadBabarendaGamage commented Jul 28, 2018

Ok, so the problem is that VectorMatrices are only created in equations_set create finish for the specific type of equation set being considered (e.g. finite elasticity, poisson etc). (CALL EquationsMatrices_VectorCreateStart(vectorEquations,vectorMatrices,err,error,*999)
).
Once created, cmfe_Equations_JacobianMatricesTypesSet is called.

However, as expected, calling cmfe_Equations_JacobianMatricesTypesSet directly from your python/fortran script raises an error because vectorMatrices are not created yet.

Solution maybe not to directly set the JacobianMatricesType inside the Jacobian vector Matrix type, but set it as a cached variable then, transfer the values to the Jacobian vector Matrix once these have been created during equation_set finish.

There is currently no cache values type for the equations_set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant