I’m using the python interface to solve a Helmholtz problem and want to repeat 
the solution for many different values of the Dirichlet boundary conditions.
The question is: Can I use the model framework and only re-assemble the part 
that I want to change without assembling the full problem?
(Or do I have to assemble the parts myself ...)

As I do it today I repeat the following where the “mfWF” variable is updated 
and assembles the full problem for each value of the boundary conditions:

################################################
    import numpy as N

    md = GF.Model('complex')

    # Helmholtz brick
    md.add_fem_variable('psi', mf)
    md.add_initialized_fem_data('sqrtpot', mf, N.sqrt(-mfPot.astype(N.complex)))
    md.add_Helmholtz_brick(mim,'psi','sqrtpot')

    # Zero boundary
    md.add_initialized_data('zerov', 0)
    md.add_Dirichlet_condition_with_multipliers(mim,'psi',mf,[zeroSide],'zerov')

    # Wavefunction boundary
    md.add_initialized_fem_data('WF', mf, mfWF)
    md.add_Dirichlet_condition_with_multipliers(mim, 'psi', mf, [wfSide], 'WF')

    # Periodic boundary conditions
    numPBC = pbcMat.size()[0]
    md.add_variable('mult', numPBC)
    md.add_constraint_with_multipliers('psi', 'mult', pbcMat, 
N.zeros(numPBC,N.complex))

    md.solve()
################################################

What I would like to do is to replace the md.solve() line with:
    for ii in mfWFs:
        md.add_initialized_fem_data('WF', mf, ii)
        md.solve()

Is this possible (from the documentation I kind of guess that the 
enable_bricks, disable_bricks etc are there for this kind of purpose but it’s 
not clear).
Finally, thank you for the GetFEM software. Awesome.

-----------------------------------------------
Magnus Paulsson
Associate Professor
Dept. of Physics and Electrical Engineering
Linnaeus University
Phone: +46-480-446308
Mobile: +46-70-6942987


_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users

Reply via email to