Hello, I want to run time-dependent nonlinear problem, therefore I need to assign solution from previous time step. I want to run problem in parallel (MPI). The following code runs correctly on single core, however for more cores fenics outputs following error message
Traceback (most recent call last): File "example.py", line 83, in <module> Traceback (most recent call last): File "example.py", line 83, in <module> assignerVelocity =FunctionAssigner(v0.function_space(),v.function_space( )) File "/home/marek/Libraries/Fenics/lib/python2.7/site-packages/dolfin/cpp/ function.py", line 1758, in __init__ assignerVelocity =FunctionAssigner(v0.function_space(),v.function_space( )) File "/home/marek/Libraries/Fenics/lib/python2.7/site-packages/dolfin/cpp/ function.py", line 1758, in __init__ _function.FunctionAssigner_swiginit(self,_function.new_FunctionAssigner( *args)) RuntimeError: *** ------------------------------------------------------------------------ - *** DOLFIN encountered an error. If you are not able to resolve this issue *** using the information listed below, you can ask for help at *** *** [email protected] *** *** Remember to include the error message listed below and, if possible, *** include a *minimal* running example to reproduce the error. *** *** ------------------------------------------------------------------------ - *** Error: Unable to create function assigner. *** Reason: The receiving and assigning spaces do not have the same number of dofs per space. *** Where: This error was encountered inside FunctionAssigner.cpp. *** Process: 0 *** *** DOLFIN version: 1.3.0 *** Git changeset: the error originates from the following (simplified) code: from dolfin import * from dolfin.cpp.function import FunctionAssigner mesh = RectangleMesh(0, 0, 3, 1, 5, 5, 'left') ffc_options = {"quadrature_degree": 4} V = VectorFunctionSpace(mesh, "CG", 2) Q = FunctionSpace(mesh, "CG", 1) SHEAR_RATE=FunctionSpace(mesh, "CG", 1) HEM = FunctionSpace(mesh, "CG",1) W = MixedFunctionSpace([V,Q,SHEAR_RATE,HEM]) class InitialConditionsV(Expression): def eval(self, values, crossedx): values[0] = .0 values[1] = 0.0 def value_shape(self): return (2,) class InitialConditionsHem(Expression): def eval(self, values, crossedx): values[0] = 0.45 w=Function(W) (v, p,shear_rate,hem) = (as_vector((w[0], w[1])), w[2],w[3],w[4] ) (v_, p_,shear_rate_,hem_) = TestFunctions(W) v_init=InitialConditionsV() v0=Function(V) v0 = interpolate(v_init,V) hem_init=InitialConditionsHem() hem0=Function(HEM) hem0 =interpolate(hem_init,HEM) D = 0.5*(grad(v)+grad(v).T) T_plasma=2*D bcu=[] dt= 0.1 F_ns =(1/dt)*inner((v-v0),v_)*dx + (inner(T_plasma, grad(v_)) - div(v_)*p + p_*div(v))*dx() +inner(grad(v)*v_, v)*dx()\ +\ + shear_rate*shear_rate_*dx() - sqrt(2*inner(D,D)+0.001)*shear_rate_*dx( )\ +\ (1/dt)*(hem-hem0)*hem_*dx + inner(v,grad(hem))*hem_*dx()+inner(grad (hem),grad(hem_))*dx() +inner(grad(shear_rate),grad(hem_))*dx() J_ns=derivative(F_ns,w) NS_problem = NonlinearVariationalProblem(F_ns, w, bcu, J_ns, form_compiler_ parameters=ffc_options) NS_solver = NonlinearVariationalSolver(NS_problem) prm = NS_solver.parameters prm['newton_solver']['absolute_tolerance'] = 1E-9 prm['newton_solver']['relative_tolerance'] = 1E-9 prm['newton_solver']['maximum_iterations'] = 100 prm['newton_solver']['relaxation_parameter'] = .5 # prm['reset_jacobian'] = True ### https://bugs.launchpad.net/dolfin/+bug/ 1055645 # Compute the full NS solution begin("Solving NS ....") NS_solver.solve() end() # Extract solutions: (v, p,shear_rate,hem) = w.split() assignerVelocity =FunctionAssigner(v0.function_space(),v.function_space()) assignerVelocity.assign(v0,v) I use in more elaborated code assignment of values of tensor field between timesteps, therefore I would appreciate advice on this (i.e. for TensorFunctionSpace inside MixedFunctionSpace) issue too. Could you please help me and post some hack for this issue? Thank You Marek C
_______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
