domain_params['poros'] = porosity #solver parameters solver_params = {} solver_params['collision_model'] = 'trt' solver_params['magic_para'] = 1. / 4. solver_params['cphifact'] = 1. / 3. #solver_params['phrqc_flags']['smart_run']=True #solver_params['phrqc_smart_run_tol']=1e-8 bc_params = { 'top': ['flux', 0.0], 'bottom': ['flux', 0.0], 'left': ['flux', 0.0], 'right': ['flux', 0.0] } rt = yantra.PhrqcReactiveTransport('MultilevelAdvectionDiffusion', domain, domain_params, bc_params, solver_params) #%% run model time = [] AvgCa = [] TotCH = [] iters = 20 while rt.iters < iters: #rt.time<=0.1:# rt.fluid.call('advance') c = copy.deepcopy(rt.fluid.get_attr('c')) #advance phrqc ss = rt.phrqc.modify_solution(c, rt.dt, rt.solid.nodetype) phaseqty = rt.solid.update(rt.phrqc.dphases) if len(phaseqty): rt.phrqc.modify_solid_phases(phaseqty) rt.fluid.set_attr('ss', ss) rt.fluid.set_attr('nodetype', rt.solid.nodetype, component_dict=False)
domain_params['solid_phases'] = { 'portlandite': { 'type': 'non_diffusive', 'mvol': 1, 'c': pqty } } domain_params['voxel_vol'] = 1 #solver parameters solver_params = {} solver_params['collision_model'] = 'srt' solver_params['phrqc_flags'] = {} solver_params['phrqc_flags']['only_interface'] = True #solver_params['phrqc_flags']['smart_run']=True #solver_params['phrqc_smart_run_tol']=1e-8 rt = yantra.PhrqcReactiveTransport('AdvectionDiffusion', domain, domain_params, {}, solver_params) #%%run model time = [] AvgCa = [] while rt.time <= 1: #20 rt.advance() if (rt.iters % 50 == 0): print("+++Time: %s" % rt.time) print("Active Phreeqc Nodes: %s" % rt.phrqc.nactive) print("Solid nodes: %s" % rt.solid.nsolids) AvgCa.append(np.sum(rt.fluid.Ca.c) / np.sum(rt.fluid.Ca.nodetype <= 0)) time.append(rt.time) #%%plot results plt.figure() plt.plot(time, AvgCa)