15,968,352 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: How to redirect WriteFile func writes to console leon de boer22-Feb-18 14:19 leon de boer 22-Feb-18 14:19
 Re: How to redirect WriteFile func writes to console Łukasz Gęsieniec22-Feb-18 19:50 Łukasz Gęsieniec 22-Feb-18 19:50
 Re: How to redirect WriteFile func writes to console Peter_in_278022-Feb-18 20:21 Peter_in_2780 22-Feb-18 20:21
 Re: How to redirect WriteFile func writes to console leon de boer22-Feb-18 21:06 leon de boer 22-Feb-18 21:06
 problem defining a function inside a structure in c Member 1367832014-Feb-18 5:40 Member 13678320 14-Feb-18 5:40
 Re: problem defining a function inside a structure in c David Crow14-Feb-18 6:09 David Crow 14-Feb-18 6:09
 Re: problem defining a function inside a structure in c CPallini14-Feb-18 10:44 CPallini 14-Feb-18 10:44
 setting Boundary condition X^2-Y^2 for solving Laplace equation for NxN grid. Member 1362564310-Feb-18 17:23 Member 13625643 10-Feb-18 17:23
 i am trying to write a code to solve Laplace equation using Successive Python Over relaxation(SOR)on a NXN matrix boundary condition is X^2-y^2 i dont know how to set this boundary condition on the Mesh created by me here is the code import numpy as np from pylab import * import sys import copy import matplotlib.pyplot as plt import matplotlib.ticker as ticker L =[[]for i in range(2)] N=int(input("Enter a number N for N x N grid: ")) h=1/N def clear_list1(): L[1].clear() L[0].clear() iterat=0 error=0.75 clear_list1() xx=np.arange(0,N,h) yy=np.arange(0,N,h) x,y = np.meshgrid(xx,yy) phi= copy.deepcopy((x**2-y**2)) phi[1:-1,1:-1]=0 phi_new = copy.deepcopy(phi) resid=np.zeros((N,N)) while True: if iterat<21: for w in np.linspace(1,2,11): for i in range(1,N-1): for j in range(1,N-1): phi1=(phi[i+1,j]+phi[i-1,j]+phi[i,j+1]+phi[i,j-1])/4 phi[i,j]=w*phi1+(1-w)*phi1 Sumresidual=0 for i in range(1,N-1): for j in range(1,N-1): resid[i,j]= -4*phi[i,j]+phi[i+1,j]+phi[i-1,j]+phi[i,j+1]+phi[i,j-1] Sumresidual=Sumresidual+(resid[i,j])**2 else: break iterat=iterat+1 p=np.sqrt(Sumresidual) L[0].append(p) L[1].append(w) ax = plt.axes() ax.xaxis.set_major_locator(ticker.MaxNLocator(5)) plt.plot(L[0],L[1]) plt.yscale('log') plt.xlabel('w') plt.ylabel('|| residual ||') plt.title('effect of w on residual') plt.show()
 Re: setting Boundary condition X^2-Y^2 for solving Laplace equation for NxN grid. Victor Nijegorodov10-Feb-18 23:07 Victor Nijegorodov 10-Feb-18 23:07
 Default Stack Size ForNow10-Feb-18 17:02 ForNow 10-Feb-18 17:02
 Re: Default Stack Size Richard MacCutchan10-Feb-18 21:23 Richard MacCutchan 10-Feb-18 21:23
 Re: Default Stack Size ForNow11-Feb-18 3:55 ForNow 11-Feb-18 3:55
 Re: Default Stack Size Richard MacCutchan11-Feb-18 6:32 Richard MacCutchan 11-Feb-18 6:32
 Re: Default Stack Size ForNow11-Feb-18 6:48 ForNow 11-Feb-18 6:48
 Re: Default Stack Size Richard MacCutchan11-Feb-18 7:10 Richard MacCutchan 11-Feb-18 7:10
 Re: Default Stack Size ForNow11-Feb-18 7:13 ForNow 11-Feb-18 7:13
 smoothing issue Member 1367132810-Feb-18 1:59 Member 13671328 10-Feb-18 1:59
 Re: smoothing issue phil.o10-Feb-18 4:57 phil.o 10-Feb-18 4:57
 Re: smoothing issue Member 1367132810-Feb-18 5:04 Member 13671328 10-Feb-18 5:04
 How do we cast void type luplup9-Feb-18 14:46 luplup 9-Feb-18 14:46
 Re: How do we cast void type Richard MacCutchan9-Feb-18 21:49 Richard MacCutchan 9-Feb-18 21:49
 Re: How do we cast void type luplup10-Feb-18 7:15 luplup 10-Feb-18 7:15
 Re: How do we cast void type Richard MacCutchan10-Feb-18 9:54 Richard MacCutchan 10-Feb-18 9:54
 Re: How do we cast void type luplup10-Feb-18 11:35 luplup 10-Feb-18 11:35
 Re: How do we cast void type Richard MacCutchan10-Feb-18 21:18 Richard MacCutchan 10-Feb-18 21:18
 Last Visit: 31-Dec-99 18:00     Last Update: 14-Aug-24 22:40 Refresh ᐊ Prev1...311312313314315316317318319320 Next ᐅ