The article "Optimal sample sizes for Welch’s test under various allocation and cost considerations" from Show-Li Jan & Gwowen Shieh published in Behavior Research Methods in December 2011 has the following code in supplementary material A, slightly modified here for my own ergonomy.
ssize.welch = function(alpha=0.05, power=0.90, mu1, mu2, sigma1, sigma2, n2n1r, use_exact=FALSE)
{
mud<-mu1-mu2
sigsq1<-sigma1^2
sigsq2<-sigma2^2
numint<-1000
dd<-0.00001
coevec<-c(1,rep(c(4,2),numint/2-1),4,1)
intl<-(1-2*dd)/numint
bvec<-intl*seq(0,numint)+dd
#Z method
za<-qnorm(1-alpha/2)
zb<-qnorm(power)
n1<-ceiling(((sigsq1+sigsq2/n2n1r)*(za+zb)^2)/(mud^2))
n2<-ceiling(n1*n2n1r)
if(use_exact) #Exact method
{
n1 = n1-1
n2 = n2-1
powere<-0
while(powere<power)
{
n1<-n1+1
n2<-ceiling(n1*n2n1r)
sigsqt<-sigsq1/n1+sigsq2/n2
hsigsqt<-sqrt(sigsqt)
wpdf<-(intl/3)*coevec*dbeta(bvec,(n1-1)/2,(n2-1)/2)
dft<-n1+n2-2
p1<-(n1-1)/dft
p2<-1-p1
s1<-sigsq1/n1
s2<-sigsq2/n2
b12<-(s1/p1)*bvec+(s2/p2)*(1-bvec)
r1<-(s1/p1)*bvec/b12
r2<-1-r1
dfevec<-1/((r1^2)/(n1-1)+(r2^2)/(n2-1))
tdfea<-qt(1-alpha/2,dfevec)
powere<-sum(wpdf*pt(-tdfea*sqrt(b12/sigsqt),dft,mud/hsigsqt))+1-sum(wpdf*pt(tdfea*sqrt(b12/sigsqt),dft,mud/hsigsqt))
}
}
c(n1=n1,n2=n2)
}
ssize.welch(0.05,0.9,85,105,10,20,3)
ssize.welch(0.05,0.9,85,105,10,20,3,TRUE)
The Z method is also the one used in https://clincalc.com/stats/samplesize.aspx which cites Rosner B. Fundamentals of Biostatistics. 7th ed. Boston, MA: Brooks/Cole; 2011. Weirdly, it forces you to input only one variance but the formula it gives can use two (and is the same as the paper above). It is in the spirit of the usual way of computing sample sizes, but I'm not too sure about when the underlying approximations start to be false.
After some fiddling around, both methods give similar results unless you have very unbalanced groups (but in that case, at some point you might want to just approximate the super large group as a known population).
Hope this helps.
Edit : just realized this does not exactly answer your question about power rather than sample size, but you can easily flip the Z method formula to compute power (exact method seems more hairy ; worst case, numeric trial and error should work since the relationship is monotonous).
MKmischas a function calledpower.welch.t.test. – COOLSerdash Jun 19 '19 at 19:19